Re: svn commit: r304803 - in head/sys: netinet netinet/cc sys

2016-08-26 Thread Lawrence Stewart
On 08/26/16 04:39, hiren panchasara wrote:
> On 08/25/16 at 01:33P, Lawrence Stewart wrote:
>> Author: lstewart
>> Date: Thu Aug 25 13:33:32 2016
>> New Revision: 304803
>> URL: https://svnweb.freebsd.org/changeset/base/304803
>>
>> Log:
>>   Pass the number of segments coalesced by LRO up the stack by repurposing 
>> the
>>   tso_segsz pkthdr field during RX processing, and use the information in 
>> TCP for
>>   more correct accounting and as a congestion control input. This is only a 
>> start,
>>   and an audit of other uses for the data is left as future work.
>>   
>>   Reviewed by:   gallatin, rrs
>>   Sponsored by:  Netflix, Inc.
>>   Differential Revision: https://reviews.freebsd.org/D7564

[snip]

> Also, can this be brought back to stable/11?

I believe so, but need to make a sanity check pass to convince myself
it's ok.

Cheers,
Lawrence
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304857 - head/sys/netinet/tcp_stacks

2016-08-26 Thread Lawrence Stewart
Pointy hat to: lstewart@

Apologies all for the breakage, thanks Hiren for fixing and apologies
also for missing your email. For some reason your reply to my commit did
not make it to my inbox and was filtered straight to my mailing list
folder which is annoying - I must have introduced a bug in my
.procmailrc at some point.

I don't understand why my buildkernel prior to commit succeeded though.
Is fastpath not build by default?

Cheers,
Lawrence

On 08/27/16 05:23, Hiren Panchasara wrote:
> Author: hiren
> Date: Fri Aug 26 19:23:17 2016
> New Revision: 304857
> URL: https://svnweb.freebsd.org/changeset/base/304857
> 
> Log:
>   Adjust TCP module fastpath after r304803's cc_ack_received() changes.
>   
>   Reported by:hiren, bz, np
>   Reviewed by:rrs
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D7664
> 
> Modified:
>   head/sys/netinet/tcp_stacks/fastpath.c
> 
> Modified: head/sys/netinet/tcp_stacks/fastpath.c
> ==
> --- head/sys/netinet/tcp_stacks/fastpath.cFri Aug 26 19:08:58 2016
> (r304856)
> +++ head/sys/netinet/tcp_stacks/fastpath.cFri Aug 26 19:23:17 2016
> (r304857)
> @@ -172,7 +172,10 @@ tcp_do_fastack(struct mbuf *m, struct tc
>  int ti_locked, u_long tiwin)
>  {
>   int acked;
> + uint16_t nsegs;
>   int winup_only=0;
> +
> + nsegs = max(1, m->m_pkthdr.lro_nsegs);
>  #ifdef TCPDEBUG
>   /*
>* The size of tcp_saveipgen must be the size of the max ip header,
> @@ -278,7 +281,7 @@ tcp_do_fastack(struct mbuf *m, struct tc
>* typically means increasing the congestion
>* window.
>*/
> - cc_ack_received(tp, th, CC_ACK);
> + cc_ack_received(tp, th, nsegs, CC_ACK);
>  
>   tp->snd_una = th->th_ack;
>   /*
> @@ -502,9 +505,12 @@ tcp_do_slowpath(struct mbuf *m, struct t
>  {
>   int  acked, ourfinisacked, needoutput = 0;
>   int rstreason, todrop, win;
> + uint16_t nsegs;
>   char *s;
>   struct in_conninfo *inc;
>   struct mbuf *mfree = NULL;
> +
> + nsegs = max(1, m->m_pkthdr.lro_nsegs);
>  #ifdef TCPDEBUG
>   /*
>* The size of tcp_saveipgen must be the size of the max ip header,
> @@ -1085,7 +1091,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>   tp->t_dupacks = 0;
>   else if (++tp->t_dupacks > tcprexmtthresh ||
>IN_FASTRECOVERY(tp->t_flags)) {
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   if ((tp->t_flags & TF_SACK_PERMIT) &&
>   IN_FASTRECOVERY(tp->t_flags)) {
>   int awnd;
> @@ -1135,7 +1142,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>   }
>   /* Congestion signal before ack. */
>   cc_cong_signal(tp, th, CC_NDUPACK);
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   tcp_timer_activate(tp, TT_REXMT, 0);
>   tp->t_rtttime = 0;
>   if (tp->t_flags & TF_SACK_PERMIT) {
> @@ -1169,7 +1177,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>* segment. Restore the original
>* snd_cwnd after packet transmission.
>*/
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   u_long oldcwnd = tp->snd_cwnd;
>   tcp_seq oldsndmax = tp->snd_max;
>   u_int sent;
> @@ -1323,7 +1332,7 @@ process_ACK:
>* control related information. This typically means increasing
>* the congestion window.
>*/
> - cc_ack_received(tp, th, CC_ACK);
> + cc_ack_received(tp, th, nsegs, CC_ACK);
>  
>   SOCKBUF_LOCK(>so_snd);
>   if (acked > sbavail(>so_snd)) {
> @@ -1758,6 +1767,7 @@ tcp_do_segment_fastslow(struct mbuf *m, 
>   int thflags;
>   u_long tiwin;
>   char *s;
> + uint16_t nsegs;
>   int can_enter;
>   struct in_conninfo *inc;
>  

Re: svn commit: r304857 - head/sys/netinet/tcp_stacks

2016-08-26 Thread Lawrence Stewart
Pointy hat to: lstewart@

Apologies all for the breakage, thanks Hiren for fixing and apologies
also for missing your email. For some reason your reply to my commit did
not make it to my inbox and was filtered straight to my mailing list
folder which is annoying - I must have introduced a bug in my
.procmailrc at some point.

I don't understand why my buildkernel prior to commit succeeded though.
Is fastpath not build by default?

Cheers,
Lawrence

On 08/27/16 05:23, Hiren Panchasara wrote:
> Author: hiren
> Date: Fri Aug 26 19:23:17 2016
> New Revision: 304857
> URL: https://svnweb.freebsd.org/changeset/base/304857
> 
> Log:
>   Adjust TCP module fastpath after r304803's cc_ack_received() changes.
>   
>   Reported by:hiren, bz, np
>   Reviewed by:rrs
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D7664
> 
> Modified:
>   head/sys/netinet/tcp_stacks/fastpath.c
> 
> Modified: head/sys/netinet/tcp_stacks/fastpath.c
> ==
> --- head/sys/netinet/tcp_stacks/fastpath.cFri Aug 26 19:08:58 2016
> (r304856)
> +++ head/sys/netinet/tcp_stacks/fastpath.cFri Aug 26 19:23:17 2016
> (r304857)
> @@ -172,7 +172,10 @@ tcp_do_fastack(struct mbuf *m, struct tc
>  int ti_locked, u_long tiwin)
>  {
>   int acked;
> + uint16_t nsegs;
>   int winup_only=0;
> +
> + nsegs = max(1, m->m_pkthdr.lro_nsegs);
>  #ifdef TCPDEBUG
>   /*
>* The size of tcp_saveipgen must be the size of the max ip header,
> @@ -278,7 +281,7 @@ tcp_do_fastack(struct mbuf *m, struct tc
>* typically means increasing the congestion
>* window.
>*/
> - cc_ack_received(tp, th, CC_ACK);
> + cc_ack_received(tp, th, nsegs, CC_ACK);
>  
>   tp->snd_una = th->th_ack;
>   /*
> @@ -502,9 +505,12 @@ tcp_do_slowpath(struct mbuf *m, struct t
>  {
>   int  acked, ourfinisacked, needoutput = 0;
>   int rstreason, todrop, win;
> + uint16_t nsegs;
>   char *s;
>   struct in_conninfo *inc;
>   struct mbuf *mfree = NULL;
> +
> + nsegs = max(1, m->m_pkthdr.lro_nsegs);
>  #ifdef TCPDEBUG
>   /*
>* The size of tcp_saveipgen must be the size of the max ip header,
> @@ -1085,7 +1091,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>   tp->t_dupacks = 0;
>   else if (++tp->t_dupacks > tcprexmtthresh ||
>IN_FASTRECOVERY(tp->t_flags)) {
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   if ((tp->t_flags & TF_SACK_PERMIT) &&
>   IN_FASTRECOVERY(tp->t_flags)) {
>   int awnd;
> @@ -1135,7 +1142,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>   }
>   /* Congestion signal before ack. */
>   cc_cong_signal(tp, th, CC_NDUPACK);
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   tcp_timer_activate(tp, TT_REXMT, 0);
>   tp->t_rtttime = 0;
>   if (tp->t_flags & TF_SACK_PERMIT) {
> @@ -1169,7 +1177,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
>* segment. Restore the original
>* snd_cwnd after packet transmission.
>*/
> - cc_ack_received(tp, th, CC_DUPACK);
> + cc_ack_received(tp, th, nsegs,
> + CC_DUPACK);
>   u_long oldcwnd = tp->snd_cwnd;
>   tcp_seq oldsndmax = tp->snd_max;
>   u_int sent;
> @@ -1323,7 +1332,7 @@ process_ACK:
>* control related information. This typically means increasing
>* the congestion window.
>*/
> - cc_ack_received(tp, th, CC_ACK);
> + cc_ack_received(tp, th, nsegs, CC_ACK);
>  
>   SOCKBUF_LOCK(>so_snd);
>   if (acked > sbavail(>so_snd)) {
> @@ -1758,6 +1767,7 @@ tcp_do_segment_fastslow(struct mbuf *m, 
>   int thflags;
>   u_long tiwin;
>   char *s;
> + uint16_t nsegs;
>   int can_enter;
>   struct in_conninfo *inc;
>  

svn commit: r304879 - in stable: 10/etc/ntp 10/etc/rc.d 11/etc/ntp 11/etc/rc.d 9/etc/ntp 9/etc/rc.d

2016-08-26 Thread Cy Schubert
Author: cy
Date: Sat Aug 27 02:53:21 2016
New Revision: 304879
URL: https://svnweb.freebsd.org/changeset/base/304879

Log:
  MFC r304779, r304780, r304781, r304782, r304802
  
  r304779:
  
Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes
to leap-seconds invaldidates validation hash at the end of the file.
  
Remove svn:keywords and replace with fbsd:nokeywords=yes to
support this change.
  
  r304780:
  
Change the algorithm by which /var/db/leap-seconds is updated.
  
1. Use the leap-seconds version number (update time) to determine
   whether to update the file or not.
  
2. If the version numbers of the files is the same, use the later
   expiry date to determine which file to use.
  
Suggested by:   ian@
  
  r304781:
  
Add logic to replace the working ntp leap-seconds file in /var/db
if it contains a $FreeBSD$ header. The header will cause the file
to fail checksum of the hash causing ntpd to ignore the file.
  
  r304782:
  
Make validation of the leap-seconds file unconditional.
  
  r304802:
  
Remove the gratuitous check for $FreeBSD$ and rename the function
to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy
isn't already there.
  
Reported by:ache@

Modified:
  stable/11/etc/ntp/leap-seconds   (contents, props changed)
  stable/11/etc/rc.d/ntpd
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/etc/ntp/leap-seconds   (contents, props changed)
  stable/10/etc/rc.d/ntpd
  stable/9/etc/ntp/leap-seconds   (contents, props changed)
  stable/9/etc/rc.d/ntpd
Directory Properties:
  stable/10/   (props changed)
  stable/9/etc/   (props changed)
  stable/9/etc/rc.d/   (props changed)

Modified: stable/11/etc/ntp/leap-seconds
==
--- stable/11/etc/ntp/leap-seconds  Sat Aug 27 02:27:29 2016
(r304878)
+++ stable/11/etc/ntp/leap-seconds  Sat Aug 27 02:53:21 2016
(r304879)
@@ -1,6 +1,4 @@
 #
-# $FreeBSD$
-#
 #  In the following text, the symbol '#' introduces
 #  a comment, which continues from that symbol until 
 #  the end of the line. A plain comment line has a
@@ -46,7 +44,7 @@
 #  by the International Bureau of Weights and Measures
 #  (BIPM). See www.bipm.fr for more information.
 #
-#  3. The current definition of the relationship between UTC 
+#  3. The current defintion of the relationship between UTC 
 #  and TAI dates from 1 January 1972. A number of different 
 #  time scales were in use before than epoch, and it can be 
 #  quite difficult to compute precise timestamps and time 

Modified: stable/11/etc/rc.d/ntpd
==
--- stable/11/etc/rc.d/ntpd Sat Aug 27 02:27:29 2016(r304878)
+++ stable/11/etc/rc.d/ntpd Sat Aug 27 02:53:21 2016(r304879)
@@ -29,6 +29,8 @@ ntpd_precmd()
rc_flags="-g $rc_flags"
fi
 
+   ntpd_init_leapfile
+
if [ ! -f $ntp_db_leapfile ]; then
ntpd_fetch_leapfile
fi
@@ -67,15 +69,27 @@ current_ntp_ts() {
 }

 get_ntp_leapfile_ver() {
+   # Leapfile update date (version number).
expr "$(awk '$1 == "#$" { print $2 }' "$1" 2>/dev/null)" : \
'^\([1-9][0-9]*\)$' \| 0
 }
 
 get_ntp_leapfile_expiry() {
+   # Leapfile expiry date.
expr "$(awk '$1 == "#@" { print $2 }' "$1" 2>/dev/null)" : \
'^\([1-9][0-9]*\)$' \| 0
 }
 
+ntpd_init_leapfile() {
+   # Refresh working leapfile with an invalid hash due to
+   # FreeBSD id header. Ntpd will ignore leapfiles with a
+   # mismatch hash. The file must be the virgin file from
+   # the source.
+   if [ ! -f $ntp_db_leapfile ]; then
+   cp -p $ntp_src_leapfile $ntp_db_leapfile
+   fi
+}
+
 ntpd_fetch_leapfile() {
local ntp_tmp_leapfile rc verbose

@@ -88,19 +102,23 @@ ntpd_fetch_leapfile() {
ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
 
ntp_ver_no_src=$(get_ntp_leapfile_ver $ntp_src_leapfile)
+   ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile)
ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile)
+   ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile)
$verbose ntp_src_leapfile version is $ntp_ver_no_src
$verbose ntp_db_leapfile version is $ntp_ver_no_db
 
-   if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" ]; then
+   if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \
+"$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \
+"$ntp_expiry_src" -gt "$ntp_expiry_db" ]; then
$verbose replacing $ntp_db_leapfile with $ntp_src_leapfile 
cp -p $ntp_src_leapfile $ntp_db_leapfile
ntp_ver_no_db=$ntp_ver_no_src
else
  

svn commit: r304879 - in stable: 10/etc/ntp 10/etc/rc.d 11/etc/ntp 11/etc/rc.d 9/etc/ntp 9/etc/rc.d

2016-08-26 Thread Cy Schubert
Author: cy
Date: Sat Aug 27 02:53:21 2016
New Revision: 304879
URL: https://svnweb.freebsd.org/changeset/base/304879

Log:
  MFC r304779, r304780, r304781, r304782, r304802
  
  r304779:
  
Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes
to leap-seconds invaldidates validation hash at the end of the file.
  
Remove svn:keywords and replace with fbsd:nokeywords=yes to
support this change.
  
  r304780:
  
Change the algorithm by which /var/db/leap-seconds is updated.
  
1. Use the leap-seconds version number (update time) to determine
   whether to update the file or not.
  
2. If the version numbers of the files is the same, use the later
   expiry date to determine which file to use.
  
Suggested by:   ian@
  
  r304781:
  
Add logic to replace the working ntp leap-seconds file in /var/db
if it contains a $FreeBSD$ header. The header will cause the file
to fail checksum of the hash causing ntpd to ignore the file.
  
  r304782:
  
Make validation of the leap-seconds file unconditional.
  
  r304802:
  
Remove the gratuitous check for $FreeBSD$ and rename the function
to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy
isn't already there.
  
Reported by:ache@

Modified:
  stable/10/etc/ntp/leap-seconds   (contents, props changed)
  stable/10/etc/rc.d/ntpd
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/etc/ntp/leap-seconds   (contents, props changed)
  stable/11/etc/rc.d/ntpd
  stable/9/etc/ntp/leap-seconds   (contents, props changed)
  stable/9/etc/rc.d/ntpd
Directory Properties:
  stable/11/   (props changed)
  stable/9/etc/   (props changed)
  stable/9/etc/rc.d/   (props changed)

Modified: stable/10/etc/ntp/leap-seconds
==
--- stable/10/etc/ntp/leap-seconds  Sat Aug 27 02:27:29 2016
(r304878)
+++ stable/10/etc/ntp/leap-seconds  Sat Aug 27 02:53:21 2016
(r304879)
@@ -1,6 +1,4 @@
 #
-# $FreeBSD$
-#
 #  In the following text, the symbol '#' introduces
 #  a comment, which continues from that symbol until 
 #  the end of the line. A plain comment line has a
@@ -46,7 +44,7 @@
 #  by the International Bureau of Weights and Measures
 #  (BIPM). See www.bipm.fr for more information.
 #
-#  3. The current definition of the relationship between UTC 
+#  3. The current defintion of the relationship between UTC 
 #  and TAI dates from 1 January 1972. A number of different 
 #  time scales were in use before than epoch, and it can be 
 #  quite difficult to compute precise timestamps and time 

Modified: stable/10/etc/rc.d/ntpd
==
--- stable/10/etc/rc.d/ntpd Sat Aug 27 02:27:29 2016(r304878)
+++ stable/10/etc/rc.d/ntpd Sat Aug 27 02:53:21 2016(r304879)
@@ -28,6 +28,8 @@ ntpd_precmd()
rc_flags="-g $rc_flags"
fi
 
+   ntpd_init_leapfile
+
if [ ! -f $ntp_db_leapfile ]; then
ntpd_fetch_leapfile
fi
@@ -66,15 +68,27 @@ current_ntp_ts() {
 }

 get_ntp_leapfile_ver() {
+   # Leapfile update date (version number).
expr "$(awk '$1 == "#$" { print $2 }' "$1" 2>/dev/null)" : \
'^\([1-9][0-9]*\)$' \| 0
 }
 
 get_ntp_leapfile_expiry() {
+   # Leapfile expiry date.
expr "$(awk '$1 == "#@" { print $2 }' "$1" 2>/dev/null)" : \
'^\([1-9][0-9]*\)$' \| 0
 }
 
+ntpd_init_leapfile() {
+   # Refresh working leapfile with an invalid hash due to
+   # FreeBSD id header. Ntpd will ignore leapfiles with a
+   # mismatch hash. The file must be the virgin file from
+   # the source.
+   if [ ! -f $ntp_db_leapfile ]; then
+   cp -p $ntp_src_leapfile $ntp_db_leapfile
+   fi
+}
+
 ntpd_fetch_leapfile() {
local ntp_tmp_leapfile rc verbose

@@ -87,19 +101,23 @@ ntpd_fetch_leapfile() {
ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
 
ntp_ver_no_src=$(get_ntp_leapfile_ver $ntp_src_leapfile)
+   ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile)
ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile)
+   ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile)
$verbose ntp_src_leapfile version is $ntp_ver_no_src
$verbose ntp_db_leapfile version is $ntp_ver_no_db
 
-   if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" ]; then
+   if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \
+"$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \
+"$ntp_expiry_src" -gt "$ntp_expiry_db" ]; then
$verbose replacing $ntp_db_leapfile with $ntp_src_leapfile 
cp -p $ntp_src_leapfile $ntp_db_leapfile
ntp_ver_no_db=$ntp_ver_no_src
else
  

svn commit: r304879 - in stable: 10/etc/ntp 10/etc/rc.d 11/etc/ntp 11/etc/rc.d 9/etc/ntp 9/etc/rc.d

2016-08-26 Thread Cy Schubert
Author: cy
Date: Sat Aug 27 02:53:21 2016
New Revision: 304879
URL: https://svnweb.freebsd.org/changeset/base/304879

Log:
  MFC r304779, r304780, r304781, r304782, r304802
  
  r304779:
  
Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes
to leap-seconds invaldidates validation hash at the end of the file.
  
Remove svn:keywords and replace with fbsd:nokeywords=yes to
support this change.
  
  r304780:
  
Change the algorithm by which /var/db/leap-seconds is updated.
  
1. Use the leap-seconds version number (update time) to determine
   whether to update the file or not.
  
2. If the version numbers of the files is the same, use the later
   expiry date to determine which file to use.
  
Suggested by:   ian@
  
  r304781:
  
Add logic to replace the working ntp leap-seconds file in /var/db
if it contains a $FreeBSD$ header. The header will cause the file
to fail checksum of the hash causing ntpd to ignore the file.
  
  r304782:
  
Make validation of the leap-seconds file unconditional.
  
  r304802:
  
Remove the gratuitous check for $FreeBSD$ and rename the function
to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy
isn't already there.
  
Reported by:ache@

Modified:
  stable/9/etc/ntp/leap-seconds   (contents, props changed)
  stable/9/etc/rc.d/ntpd
Directory Properties:
  stable/9/etc/   (props changed)
  stable/9/etc/rc.d/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/etc/ntp/leap-seconds   (contents, props changed)
  stable/10/etc/rc.d/ntpd
  stable/11/etc/ntp/leap-seconds   (contents, props changed)
  stable/11/etc/rc.d/ntpd
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/9/etc/ntp/leap-seconds
==
--- stable/9/etc/ntp/leap-seconds   Sat Aug 27 02:27:29 2016
(r304878)
+++ stable/9/etc/ntp/leap-seconds   Sat Aug 27 02:53:21 2016
(r304879)
@@ -1,6 +1,4 @@
 #
-# $FreeBSD$
-#
 #  In the following text, the symbol '#' introduces
 #  a comment, which continues from that symbol until 
 #  the end of the line. A plain comment line has a

Modified: stable/9/etc/rc.d/ntpd
==
--- stable/9/etc/rc.d/ntpd  Sat Aug 27 02:27:29 2016(r304878)
+++ stable/9/etc/rc.d/ntpd  Sat Aug 27 02:53:21 2016(r304879)
@@ -28,6 +28,8 @@ ntpd_precmd()
rc_flags="-g $rc_flags"
fi
 
+   ntpd_init_leapfile
+
if [ ! -f $ntp_db_leapfile ]; then
ntpd_fetch_leapfile
fi
@@ -66,15 +68,27 @@ current_ntp_ts() {
 }

 get_ntp_leapfile_ver() {
+   # Leapfile update date (version number).
expr "$(awk '$1 == "#$" { print $2 }' "$1" 2>/dev/null)" : \
'^\([1-9][0-9]*\)$' \| 0
 }
 
 get_ntp_leapfile_expiry() {
+   # Leapfile expiry date.
expr "$(awk '$1 == "#@" { print $2 }' "$1" 2>/dev/null)" : \
'^\([1-9][0-9]*\)$' \| 0
 }
 
+ntpd_init_leapfile() {
+   # Refresh working leapfile with an invalid hash due to
+   # FreeBSD id header. Ntpd will ignore leapfiles with a
+   # mismatch hash. The file must be the virgin file from
+   # the source.
+   if [ ! -f $ntp_db_leapfile ]; then
+   cp -p $ntp_src_leapfile $ntp_db_leapfile
+   fi
+}
+
 ntpd_fetch_leapfile() {
local ntp_tmp_leapfile rc verbose

@@ -87,19 +101,23 @@ ntpd_fetch_leapfile() {
ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
 
ntp_ver_no_src=$(get_ntp_leapfile_ver $ntp_src_leapfile)
+   ntp_expiry_src=$(get_ntp_leapfile_expiry $ntp_src_leapfile)
ntp_ver_no_db=$(get_ntp_leapfile_ver $ntp_db_leapfile)
+   ntp_expiry_db=$(get_ntp_leapfile_expiry $ntp_db_leapfile)
$verbose ntp_src_leapfile version is $ntp_ver_no_src
$verbose ntp_db_leapfile version is $ntp_ver_no_db
 
-   if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" ]; then
+   if [ "$ntp_ver_no_src" -gt "$ntp_ver_no_db" -o \
+"$ntp_ver_no_src" -eq "$ntp_ver_no_db" -a \
+"$ntp_expiry_src" -gt "$ntp_expiry_db" ]; then
$verbose replacing $ntp_db_leapfile with $ntp_src_leapfile 
cp -p $ntp_src_leapfile $ntp_db_leapfile
ntp_ver_no_db=$ntp_ver_no_src
else
$verbose not replacing $ntp_db_leapfile with $ntp_src_leapfile 
fi
-   ntp_leap_expiry=$(get_ntp_leapfile_expiry $ntp_db_leapfile)
ntp_leapfile_expiry_seconds=$((ntp_leapfile_expiry_days*86400))
+   ntp_leap_expiry=$(get_ntp_leapfile_expiry $ntp_db_leapfile)
ntp_leap_fetch_date=$((ntp_leap_expiry-ntp_leapfile_expiry_seconds))
if [ $(current_ntp_ts) -ge $ntp_leap_fetch_date ]; then
$verbose Within 

svn commit: r304878 - in stable: 10/usr.sbin/ntp/doc 11/usr.sbin/ntp/doc 9/usr.sbin/ntp/doc

2016-08-26 Thread Cy Schubert
Author: cy
Date: Sat Aug 27 02:27:29 2016
New Revision: 304878
URL: https://svnweb.freebsd.org/changeset/base/304878

Log:
  MFC r304721:
  
  Fixup man page formatting.
  
  Submitted by: Steve Kargl 
  Discussed with:   bjk@

Modified:
  stable/9/usr.sbin/ntp/doc/sntp.8
Directory Properties:
  stable/9/usr.sbin/   (props changed)
  stable/9/usr.sbin/ntp/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/usr.sbin/ntp/doc/sntp.8
  stable/11/usr.sbin/ntp/doc/sntp.8
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/9/usr.sbin/ntp/doc/sntp.8
==
--- stable/9/usr.sbin/ntp/doc/sntp.8Sat Aug 27 01:28:00 2016
(r304877)
+++ stable/9/usr.sbin/ntp/doc/sntp.8Sat Aug 27 02:27:29 2016
(r304878)
@@ -213,7 +213,7 @@ of seconds specified before giving up.  
 more than enough for a unicast response.  If \fBsntp\fP is
 only waiting for a broadcast response a longer timeout is
 likely needed.
-.It  Fl \-wait , " Fl \-no\-wait"
+.It  Fl \-wait , Fl \-no\-wait
 Wait for pending replies (if not setting the time).
 The \fIno\-wait\fP form will disable the option.
 This option is enabled by default.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304878 - in stable: 10/usr.sbin/ntp/doc 11/usr.sbin/ntp/doc 9/usr.sbin/ntp/doc

2016-08-26 Thread Cy Schubert
Author: cy
Date: Sat Aug 27 02:27:29 2016
New Revision: 304878
URL: https://svnweb.freebsd.org/changeset/base/304878

Log:
  MFC r304721:
  
  Fixup man page formatting.
  
  Submitted by: Steve Kargl 
  Discussed with:   bjk@

Modified:
  stable/10/usr.sbin/ntp/doc/sntp.8
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.sbin/ntp/doc/sntp.8
  stable/9/usr.sbin/ntp/doc/sntp.8
Directory Properties:
  stable/11/   (props changed)
  stable/9/usr.sbin/   (props changed)
  stable/9/usr.sbin/ntp/   (props changed)

Modified: stable/10/usr.sbin/ntp/doc/sntp.8
==
--- stable/10/usr.sbin/ntp/doc/sntp.8   Sat Aug 27 01:28:00 2016
(r304877)
+++ stable/10/usr.sbin/ntp/doc/sntp.8   Sat Aug 27 02:27:29 2016
(r304878)
@@ -213,7 +213,7 @@ of seconds specified before giving up.  
 more than enough for a unicast response.  If \fBsntp\fP is
 only waiting for a broadcast response a longer timeout is
 likely needed.
-.It  Fl \-wait , " Fl \-no\-wait"
+.It  Fl \-wait , Fl \-no\-wait
 Wait for pending replies (if not setting the time).
 The \fIno\-wait\fP form will disable the option.
 This option is enabled by default.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304878 - in stable: 10/usr.sbin/ntp/doc 11/usr.sbin/ntp/doc 9/usr.sbin/ntp/doc

2016-08-26 Thread Cy Schubert
Author: cy
Date: Sat Aug 27 02:27:29 2016
New Revision: 304878
URL: https://svnweb.freebsd.org/changeset/base/304878

Log:
  MFC r304721:
  
  Fixup man page formatting.
  
  Submitted by: Steve Kargl 
  Discussed with:   bjk@

Modified:
  stable/11/usr.sbin/ntp/doc/sntp.8
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/usr.sbin/ntp/doc/sntp.8
  stable/9/usr.sbin/ntp/doc/sntp.8
Directory Properties:
  stable/10/   (props changed)
  stable/9/usr.sbin/   (props changed)
  stable/9/usr.sbin/ntp/   (props changed)

Modified: stable/11/usr.sbin/ntp/doc/sntp.8
==
--- stable/11/usr.sbin/ntp/doc/sntp.8   Sat Aug 27 01:28:00 2016
(r304877)
+++ stable/11/usr.sbin/ntp/doc/sntp.8   Sat Aug 27 02:27:29 2016
(r304878)
@@ -213,7 +213,7 @@ of seconds specified before giving up.  
 more than enough for a unicast response.  If \fBsntp\fP is
 only waiting for a broadcast response a longer timeout is
 likely needed.
-.It  Fl \-wait , " Fl \-no\-wait"
+.It  Fl \-wait , Fl \-no\-wait
 Wait for pending replies (if not setting the time).
 The \fIno\-wait\fP form will disable the option.
 This option is enabled by default.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304877 - head/share/mk

2016-08-26 Thread Baptiste Daroussin
Author: bapt
Date: Sat Aug 27 01:28:00 2016
New Revision: 304877
URL: https://svnweb.freebsd.org/changeset/base/304877

Log:
  Remove warning on struct-overflow on gcc 5.3.0 as zic(8) dies on it

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkSat Aug 27 00:58:21 2016(r304876)
+++ head/share/mk/bsd.sys.mkSat Aug 27 01:28:00 2016(r304877)
@@ -128,6 +128,11 @@ CWARNFLAGS+=   -Wno-error=address  
\
-Wno-error=unused-value
 .endif
 
+# GCC 5.3.0
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 50300
+CWARNFLAGS+=   -Wno-error=strict-overflow
+.endif
+
 # GCC 6.1.0
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100
 CWARNFLAGS+=   -Wno-error=misleading-indentation   \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304876 - in head/sys/dev/bhnd: . siba

2016-08-26 Thread Landon J. Fuller
Author: landonf
Date: Sat Aug 27 00:58:21 2016
New Revision: 304876
URL: https://svnweb.freebsd.org/changeset/base/304876

Log:
  Implement siba(4) support for bhnd_(read|write)_config.
  
  This provides access to the siba(4) bus-mapped per-core cfg0 register
  block.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/siba/siba.c

Modified: head/sys/dev/bhnd/bhnd_bus_if.m
==
--- head/sys/dev/bhnd/bhnd_bus_if.m Sat Aug 27 00:56:37 2016
(r304875)
+++ head/sys/dev/bhnd/bhnd_bus_if.m Sat Aug 27 00:58:21 2016
(r304876)
@@ -565,8 +565,9 @@ METHOD int release_ext_rsrc {
  * @param offset The offset to be read.
  * @param width The size of the access. Must be 1, 2 or 4 bytes.
  *
- * The exact behavior of this method is bus-specific. In the case of
- * bcma(4), this method provides access to the first agent port of @p child.
+ * The exact behavior of this method is bus-specific. On a bcma(4) bus, this
+ * method provides access to the first agent port of @p child; on a siba(4) 
bus,
+ * this method provides access to the core's CFG0 register block.
  *
  * @note Device drivers should only use this API for functionality
  * that is not available via another bhnd(4) function.

Modified: head/sys/dev/bhnd/siba/siba.c
==
--- head/sys/dev/bhnd/siba/siba.c   Sat Aug 27 00:56:37 2016
(r304875)
+++ head/sys/dev/bhnd/siba/siba.c   Sat Aug 27 00:58:21 2016
(r304876)
@@ -263,6 +263,32 @@ siba_suspend_core(device_t dev, device_t
 static uint32_t
 siba_read_config(device_t dev, device_t child, bus_size_t offset, u_int width)
 {
+   struct siba_devinfo *dinfo;
+   rman_res_t   r_size;
+
+   /* Must be directly attached */
+   if (device_get_parent(child) != dev)
+   return (UINT32_MAX);
+
+   /* CFG0 registers must be available */
+   dinfo = device_get_ivars(child);
+   if (dinfo->cfg[0] == NULL)
+   return (UINT32_MAX);
+
+   /* Offset must fall within CFG0 */
+   r_size = rman_get_size(dinfo->cfg[0]->res);
+   if (r_size < offset || r_size - offset < width)
+   return (UINT32_MAX);
+
+   switch (width) {
+   case 1:
+   return (bhnd_bus_read_1(dinfo->cfg[0], offset));
+   case 2:
+   return (bhnd_bus_read_2(dinfo->cfg[0], offset));
+   case 4:
+   return (bhnd_bus_read_4(dinfo->cfg[0], offset));
+   }
+   
/* Unsuported */
return (UINT32_MAX);
 }
@@ -271,8 +297,31 @@ static void
 siba_write_config(device_t dev, device_t child, bus_size_t offset, uint32_t 
val,
 u_int width)
 {
-   /* Unsuported */
-   return;
+   struct siba_devinfo *dinfo;
+   rman_res_t   r_size;
+
+   /* Must be directly attached */
+   if (device_get_parent(child) != dev)
+   return;
+
+   /* CFG0 registers must be available */
+   dinfo = device_get_ivars(child);
+   if (dinfo->cfg[0] == NULL)
+   return;
+
+   /* Offset must fall within CFG0 */
+   r_size = rman_get_size(dinfo->cfg[0]->res);
+   if (r_size < offset || r_size - offset < width)
+   return;
+
+   switch (width) {
+   case 1:
+   bhnd_bus_write_1(dinfo->cfg[0], offset, val);
+   case 2:
+   bhnd_bus_write_2(dinfo->cfg[0], offset, val);
+   case 4:
+   bhnd_bus_write_4(dinfo->cfg[0], offset, val);
+   }
 }
 
 static u_int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304875 - head/usr.bin/gzip

2016-08-26 Thread Xin LI
Author: delphij
Date: Sat Aug 27 00:56:37 2016
New Revision: 304875
URL: https://svnweb.freebsd.org/changeset/base/304875

Log:
  Use printable ASCII instead of octal representation.
  
  MFC after:2 weeks

Modified:
  head/usr.bin/gzip/gzip.c

Modified: head/usr.bin/gzip/gzip.c
==
--- head/usr.bin/gzip/gzip.cSat Aug 27 00:47:47 2016(r304874)
+++ head/usr.bin/gzip/gzip.cSat Aug 27 00:56:37 2016(r304875)
@@ -88,7 +88,7 @@ enum filetype {
 #include 
 
 #define BZ2_SUFFIX ".bz2"
-#define BZIP2_MAGIC"\102\132\150"
+#define BZIP2_MAGIC"BZh"
 #endif
 
 #ifndef NO_COMPRESS_SUPPORT
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304874 - head/lib/libarchive/tests

2016-08-26 Thread Martin Matuska
Author: mm
Date: Sat Aug 27 00:47:47 2016
New Revision: 304874
URL: https://svnweb.freebsd.org/changeset/base/304874

Log:
  Temporarily disable two libarchive tests that have not yet been fixed by
  vendor. Tests will be re-enabled after a fix has been merged.
  
  MFC after:3 days

Modified:
  head/lib/libarchive/tests/Makefile

Modified: head/lib/libarchive/tests/Makefile
==
--- head/lib/libarchive/tests/Makefile  Sat Aug 27 00:13:41 2016
(r304873)
+++ head/lib/libarchive/tests/Makefile  Sat Aug 27 00:47:47 2016
(r304874)
@@ -211,8 +211,6 @@ TESTS_SRCS= \
test_write_disk_perms.c \
test_write_disk_secure.c\
test_write_disk_secure744.c \
-   test_write_disk_secure745.c \
-   test_write_disk_secure746.c \
test_write_disk_sparse.c\
test_write_disk_symlink.c   \
test_write_disk_times.c \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Slawa Olhovchenkov
On Fri, Aug 26, 2016 at 04:55:34PM -0700, Adrian Chadd wrote:

> Hi,
> 
> I use the kernel lock profiling debugging,

I am already have 100% utilise all CPU cores, I think this is drop
performance?

> but you can use dtrace to
> get an idea:
> 
> dtrace -n 'lockstat:::adaptive-block { @[stack()] = sum(arg1); }'

How to interpret results (how to distinct lock contention from lock
cost/overhead (LOCK CMPXCGQ is very expensive))?

> (https://wiki.freebsd.org/DTrace/One-Liners)
> 
> 
> 
> -adrian
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304873 - in head/sys/dev/cxgbe: . common firmware

2016-08-26 Thread Navdeep Parhar
Author: np
Date: Sat Aug 27 00:13:41 2016
New Revision: 304873
URL: https://svnweb.freebsd.org/changeset/base/304873

Log:
  cxgbe(4): Provide more details about the card in the sysctl MIB.
  
  dev.t5nex.0.%desc: Chelsio T580-CR
  dev.t5nex.0.hw_revision: 1
  dev.t5nex.0.sn: PT13140042
  dev.t5nex.0.pn: 110117150A0
  dev.t5nex.0.ec: 
  dev.t5nex.0.na: 0007432AF490
  dev.t5nex.0.vpd_version: 3
  dev.t5nex.0.scfg_version: 53255
  dev.t5nex.0.bs_version: 1.1.0.0
  dev.t5nex.0.er_version: 1.0.0.68
  dev.t5nex.0.tp_version: 0.1.4.9
  dev.t5nex.0.firmware_version: 1.16.2.0
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/firmware/t4fw_interface.h
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hSat Aug 27 00:07:48 2016
(r304872)
+++ head/sys/dev/cxgbe/adapter.hSat Aug 27 00:13:41 2016
(r304873)
@@ -821,7 +821,8 @@ struct adapter {
 
char fw_version[16];
char tp_version[16];
-   char exprom_version[16];
+   char er_version[16];
+   char bs_version[16];
char cfg_file[32];
u_int cfcsum;
struct adapter_params params;

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Sat Aug 27 00:07:48 2016
(r304872)
+++ head/sys/dev/cxgbe/common/common.h  Sat Aug 27 00:13:41 2016
(r304873)
@@ -330,9 +330,12 @@ struct adapter_params {
unsigned int sf_size; /* serial flash size in bytes */
unsigned int sf_nsec; /* # of flash sectors */
 
-   unsigned int fw_vers;
-   unsigned int tp_vers;
-   unsigned int exprom_vers;
+   unsigned int fw_vers;   /* firmware version */
+   unsigned int bs_vers;   /* bootstrap version */
+   unsigned int tp_vers;   /* TP microcode version */
+   unsigned int er_vers;   /* expansion ROM version */
+   unsigned int scfg_vers; /* Serial Configuration version */
+   unsigned int vpd_vers;  /* VPD version */
 
unsigned short mtus[NMTUS];
unsigned short a_wnd[NCCTRL_WIN];
@@ -548,8 +551,12 @@ int t4_flash_erase_sectors(struct adapte
 int t4_flash_cfg_addr(struct adapter *adapter);
 int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int 
size);
 int t4_get_fw_version(struct adapter *adapter, u32 *vers);
+int t4_get_bs_version(struct adapter *adapter, u32 *vers);
 int t4_get_tp_version(struct adapter *adapter, u32 *vers);
 int t4_get_exprom_version(struct adapter *adapter, u32 *vers);
+int t4_get_scfg_version(struct adapter *adapter, u32 *vers);
+int t4_get_vpd_version(struct adapter *adapter, u32 *vers);
+int t4_get_version_info(struct adapter *adapter);
 int t4_init_hw(struct adapter *adapter, u32 fw_params);
 int t4_prep_adapter(struct adapter *adapter, u8 *buf);
 int t4_shutdown_adapter(struct adapter *adapter);

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Sat Aug 27 00:07:48 2016
(r304872)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Sat Aug 27 00:13:41 2016
(r304873)
@@ -3234,6 +3234,20 @@ int t4_get_fw_version(struct adapter *ad
 }
 
 /**
+ * t4_get_bs_version - read the firmware bootstrap version
+ * @adapter: the adapter
+ * @vers: where to place the version
+ *
+ * Reads the FW Bootstrap version from flash.
+ */
+int t4_get_bs_version(struct adapter *adapter, u32 *vers)
+{
+   return t4_read_flash(adapter, FLASH_FWBOOTSTRAP_START +
+offsetof(struct fw_hdr, fw_ver), 1,
+vers, 0);
+}
+
+/**
  * t4_get_tp_version - read the TP microcode version
  * @adapter: the adapter
  * @vers: where to place the version
@@ -3285,6 +3299,110 @@ int t4_get_exprom_version(struct adapter
 }
 
 /**
+ * t4_get_scfg_version - return the Serial Configuration version
+ * @adapter: the adapter
+ * @vers: where to place the version
+ *
+ * Reads the Serial Configuration Version via the Firmware interface
+ * (thus this can only be called once we're ready to issue Firmware
+ * commands).  The format of the Serial Configuration version is
+ * adapter specific.  Returns 0 on success, an error on failure.
+ *
+ * Note that early versions of the Firmware didn't include the ability
+ * to retrieve the Serial Configuration version, so we zero-out the
+ * return-value parameter in that case to avoid leaving it with
+ * garbage in it.
+ *
+ * Also note that the Firmware will return its cached copy of the Serial
+ * Initialization 

svn commit: r304872 - in head/sys/dev/bhnd: . bcma siba

2016-08-26 Thread Landon J. Fuller
Author: landonf
Date: Sat Aug 27 00:07:48 2016
New Revision: 304872
URL: https://svnweb.freebsd.org/changeset/base/304872

Log:
  bhnd(4): Include the chip model (e.g. BCM4xxx) in bhnd(4) bus's device
  descriptions.
  
  Reviewed by:  mizhka
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7570

Modified:
  head/sys/dev/bhnd/bcma/bcma_bhndb.c
  head/sys/dev/bhnd/bcma/bcma_nexus.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/siba/siba_bhndb.c
  head/sys/dev/bhnd/siba/siba_nexus.c

Modified: head/sys/dev/bhnd/bcma/bcma_bhndb.c
==
--- head/sys/dev/bhnd/bcma/bcma_bhndb.c Sat Aug 27 00:06:20 2016
(r304871)
+++ head/sys/dev/bhnd/bcma/bcma_bhndb.c Sat Aug 27 00:07:48 2016
(r304872)
@@ -51,15 +51,22 @@ __FBSDID("$FreeBSD$");
 static int
 bcma_bhndb_probe(device_t dev)
 {
-   const struct bhnd_chipid *cid;
+   const struct bhnd_chipid*cid;
+   int  error;
+
+   /* Defer to default probe implementation */
+   if ((error = bcma_probe(dev)) > 0)
+   return (error);
 
/* Check bus type */
cid = BHNDB_GET_CHIPID(device_get_parent(dev), dev);
if (cid->chip_type != BHND_CHIPTYPE_BCMA)
return (ENXIO);
 
-   /* Delegate to default probe implementation */
-   return (bcma_probe(dev));
+   /* Set device description */
+   bhnd_set_default_bus_desc(dev, cid);
+
+   return (error);
 }
 
 static int

Modified: head/sys/dev/bhnd/bcma/bcma_nexus.c
==
--- head/sys/dev/bhnd/bcma/bcma_nexus.c Sat Aug 27 00:06:20 2016
(r304871)
+++ head/sys/dev/bhnd/bcma/bcma_nexus.c Sat Aug 27 00:07:48 2016
(r304872)
@@ -82,6 +82,9 @@ bcma_nexus_probe(device_t dev)
return (error);
}
 
+   /* Set device description */
+   bhnd_set_default_bus_desc(dev, >bcma_cid);
+
return (0);
 }
 

Modified: head/sys/dev/bhnd/bhnd.h
==
--- head/sys/dev/bhnd/bhnd.hSat Aug 27 00:06:20 2016(r304871)
+++ head/sys/dev/bhnd/bhnd.hSat Aug 27 00:07:48 2016(r304872)
@@ -49,6 +49,9 @@ extern devclass_t bhnd_devclass;
 extern devclass_t bhnd_hostb_devclass;
 extern devclass_t bhnd_nvram_devclass;
 
+#defineBHND_CHIPID_MAX_NAMELEN 32  /**< maximum buffer required 
for a
+bhnd_format_chip_id() */
+
 /**
  * bhnd child instance variables
  */
@@ -254,6 +257,8 @@ bhnd_devclass_t  bhnd_find_core_class(
 const char *bhnd_core_name(const struct bhnd_core_info 
*ci);
 bhnd_devclass_t bhnd_core_class(const struct 
bhnd_core_info *ci);
 
+int bhnd_format_chip_id(char *buffer, size_t size,
+uint16_t chip_id);
 
 device_tbhnd_match_child(device_t dev,
 const struct bhnd_core_match *desc);
@@ -321,6 +326,9 @@ void 
bhnd_set_custom_core_desc(devic
 const char *name);
 voidbhnd_set_default_core_desc(device_t dev);
 
+voidbhnd_set_default_bus_desc(device_t dev,
+const struct bhnd_chipid *chip_id);
+
 int bhnd_nvram_getvar_str(device_t dev,
 const char *name, char *buf, size_t len,
 size_t *rlen);

Modified: head/sys/dev/bhnd/bhnd_subr.c
==
--- head/sys/dev/bhnd/bhnd_subr.c   Sat Aug 27 00:06:20 2016
(r304871)
+++ head/sys/dev/bhnd/bhnd_subr.c   Sat Aug 27 00:07:48 2016
(r304872)
@@ -288,6 +288,30 @@ bhnd_core_class(const struct bhnd_core_i
 }
 
 /**
+ * Write a human readable name representation of the given
+ * BHND_CHIPID_* constant to @p buffer.
+ * 
+ * @param buffer Output buffer, or NULL to compute the required size.
+ * @param size Capacity of @p buffer, in bytes.
+ * @param chip_id Chip ID to be formatted.
+ * 
+ * @return Returns the required number of bytes on success, or a negative
+ * integer on failure. No more than @p size-1 characters be written, with
+ * the @p size'th set to '\0'.
+ * 
+ * @sa BHND_CHIPID_MAX_NAMELEN
+ */
+int
+bhnd_format_chip_id(char *buffer, size_t size, uint16_t chip_id)
+{
+   /* All hex formatted IDs are within the range of 0x4000-0x9C3F 
(4-1) */
+   if (chip_id >= 0x4000 && chip_id <= 0x9C3F)
+   return (snprintf(buffer, size, "BCM%hX", chip_id));
+   else
+   return (snprintf(buffer, size, 

svn commit: r304871 - in head/sys: dev/bhnd/cores/chipc dev/bhnd/cores/chipc/pwrctl dev/bhnd/cores/pmu mips/broadcom

2016-08-26 Thread Landon J. Fuller
Author: landonf
Date: Sat Aug 27 00:06:20 2016
New Revision: 304871
URL: https://svnweb.freebsd.org/changeset/base/304871

Log:
  [mips/broadcom]: Replace static frequency table with generic PMU clock
  handling.
  
  
  - Extended PWRCTL/PMU APIs to support querying clock frequency during very
early boot, prior to bus attach.
  - Implement generic PMU-based calculation of UART rclk values.
  - Replaced use of static frequency tables (bcm_socinfo) with
runtime-determined values.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7552

Added:
  head/sys/mips/broadcom/bcm_pmu.c   (contents, props changed)
Deleted:
  head/sys/mips/broadcom/bcm_socinfo.c
  head/sys/mips/broadcom/bcm_socinfo.h
Modified:
  head/sys/dev/bhnd/cores/chipc/chipcreg.h
  head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c
  head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctlvar.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_private.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c
  head/sys/dev/bhnd/cores/pmu/bhnd_pmuvar.h
  head/sys/mips/broadcom/bcm_machdep.c
  head/sys/mips/broadcom/bcm_machdep.h
  head/sys/mips/broadcom/files.broadcom
  head/sys/mips/broadcom/uart_bus_chipc.c
  head/sys/mips/broadcom/uart_cpu_chipc.c

Modified: head/sys/dev/bhnd/cores/chipc/chipcreg.h
==
--- head/sys/dev/bhnd/cores/chipc/chipcreg.hSat Aug 27 00:03:02 2016
(r304870)
+++ head/sys/dev/bhnd/cores/chipc/chipcreg.hSat Aug 27 00:06:20 2016
(r304871)
@@ -31,6 +31,10 @@
 required during bus
 enumeration */
 
+/** Evaluates to true if the given ChipCommon core revision supports
+ *  the CHIPC_CORECTRL register */
+#defineCHIPC_HWREV_HAS_CORECTRL(hwrev) ((hwrev) >= 1)
+
 /** Evaluates to true if the given ChipCommon core revision provides
  *  the core count via the chip identification register. */
 #defineCHIPC_NCORES_MIN_HWREV(hwrev)   ((hwrev) == 4 || (hwrev) >= 6)
@@ -278,14 +282,14 @@ enum {
 #defineCHIPC_CST_SPROM_OTP_SEL_R23_SHIFT   6
 
 /* PLL type */
-#defineCHIPC_PLL_NONE  0x00
-#defineCHIPC_PLL_TYPE1 0x10/* 48MHz base, 3 dividers */
-#defineCHIPC_PLL_TYPE2 0x20/* 48MHz, 4 dividers */
-#defineCHIPC_PLL_TYPE3 0x30/* 25MHz, 2 dividers */
-#defineCHIPC_PLL_TYPE4 0x08/* 48MHz, 4 dividers */
-#defineCHIPC_PLL_TYPE5 0x18/* 25MHz, 4 dividers */
-#defineCHIPC_PLL_TYPE6 0x28/* 100/200 or 120/240 only */
-#defineCHIPC_PLL_TYPE7 0x38/* 25MHz, 4 dividers */
+#defineCHIPC_PLL_NONE  0x0
+#defineCHIPC_PLL_TYPE1 0x2 /* 48MHz base, 3 dividers */
+#defineCHIPC_PLL_TYPE2 0x4 /* 48MHz, 4 dividers */
+#defineCHIPC_PLL_TYPE3 0x6 /* 25MHz, 2 dividers */
+#defineCHIPC_PLL_TYPE4 0x8 /* 48MHz, 4 dividers */
+#defineCHIPC_PLL_TYPE5 0x3 /* 25MHz, 4 dividers */
+#defineCHIPC_PLL_TYPE6 0x5 /* 100/200 or 120/240 only */
+#defineCHIPC_PLL_TYPE7 0x7 /* 25MHz, 4 dividers */
 
 /* dynamic clock control defines */
 #defineCHIPC_LPOMINFREQ25000   /* low power oscillator 
min */

Modified: head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c
==
--- head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c Sat Aug 27 
00:03:02 2016(r304870)
+++ head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c Sat Aug 27 
00:06:20 2016(r304871)
@@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$");
 #include "bhnd_pwrctl_private.h"
 
 static uint32_tbhnd_pwrctl_factor6(uint32_t x);
-static uint32_tbhnd_pwrctl_clock_rate(uint32_t pll_type, uint32_t n,
-   uint32_t m);
 
 /**
  * Return the factor value corresponding to a given N3M clock control magic
@@ -75,14 +73,122 @@ bhnd_pwrctl_factor6(uint32_t x)
 }
 
 /**
+ * Return the backplane clock's chipc 'M' register offset for a given PLL type,
+ * or 0 if a fixed clock speed should be used.
+ *
+ * @param cid Chip identification.
+ * @param pll_type PLL type (CHIPC_PLL_TYPE*)
+ * @param[out] fixed_hz If 0 is returned, will be set to the fixed clock
+ * speed for this device.
+ */
+bus_size_t
+bhnd_pwrctl_si_clkreg_m(const struct bhnd_chipid *cid,
+uint8_t pll_type, uint32_t *fixed_hz)
+{
+   switch (pll_type) {
+   case CHIPC_PLL_TYPE6:
+   return (CHIPC_CLKC_M3);
+   case CHIPC_PLL_TYPE3:
+   return (CHIPC_CLKC_M2);
+   default:
+   return (CHIPC_CLKC_SB);
+   }
+}
+
+/**
+ * Calculate the backplane clock speed (in Hz) for a 

svn commit: r304870 - in head/sys: conf dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/cores/chipc/pwrctl dev/bhnd/cores/pmu dev/bhnd/nvram dev/bhnd/pmu dev/bhnd/siba mips/broa...

2016-08-26 Thread Landon J. Fuller
Author: landonf
Date: Sat Aug 27 00:03:02 2016
New Revision: 304870
URL: https://svnweb.freebsd.org/changeset/base/304870

Log:
  bhnd(4): Initial PMU/PWRCTL power and clock management support.
  
  
  - Added bhnd_pmu driver implementations for PMU and PWRCTL chipsets,
derived from Broadcom's ISC-licensed HND code.
  - Added bhnd bus-level support for routing per-core clock and resource
power requests to the PMU device.
  - Lift ChipCommon support out into the bhnd module, dropping
bhnd_chipc.
  
  Reviewed by:  mizhka
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7492

Added:
  head/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c   (contents, props changed)
  head/sys/dev/bhnd/cores/chipc/pwrctl/
  head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c   (contents, props changed)
  head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_private.h   (contents, props 
changed)
  head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c   (contents, props 
changed)
  head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctlvar.h   (contents, props 
changed)
  head/sys/dev/bhnd/cores/pmu/
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c   (contents, props changed)
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu.h   (contents, props changed)
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_core.c   (contents, props changed)
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_if.m   (contents, props changed)
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_private.h   (contents, props changed)
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c   (contents, props changed)
  head/sys/dev/bhnd/cores/pmu/bhnd_pmureg.h   (contents, props changed)
  head/sys/dev/bhnd/cores/pmu/bhnd_pmuvar.h   (contents, props changed)
  head/sys/dev/bhnd/pmu/
Deleted:
  head/sys/modules/bhnd/cores/bhnd_chipc/
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/bcma/bcma.c
  head/sys/dev/bhnd/bcma/bcma_dmp.h
  head/sys/dev/bhnd/bhnd.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhnd_core.h
  head/sys/dev/bhnd/bhnd_ids.h
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhnd_types.h
  head/sys/dev/bhnd/bhndb/bhnd_bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb_pci.c
  head/sys/dev/bhnd/bhndvar.h
  head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m
  head/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c
  head/sys/dev/bhnd/cores/chipc/chipc.c
  head/sys/dev/bhnd/cores/chipc/chipc.h
  head/sys/dev/bhnd/cores/chipc/chipc_subr.c
  head/sys/dev/bhnd/cores/chipc/chipcreg.h
  head/sys/dev/bhnd/cores/chipc/chipcvar.h
  head/sys/dev/bhnd/nvram/nvram_map
  head/sys/dev/bhnd/siba/siba.c
  head/sys/mips/broadcom/bcm_machdep.c
  head/sys/modules/bhnd/Makefile
  head/sys/modules/bhnd/cores/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Aug 26 23:50:44 2016(r304869)
+++ head/sys/conf/files Sat Aug 27 00:03:02 2016(r304870)
@@ -1157,19 +1157,26 @@ dev/bhnd/bcma/bcma_bhndb.c  optional bcm
 dev/bhnd/bcma/bcma_erom.c  optional bcma bhnd
 dev/bhnd/bcma/bcma_nexus.c optional bcma_nexus bcma bhnd
 dev/bhnd/bcma/bcma_subr.c  optional bcma bhnd
+dev/bhnd/cores/chipc/bhnd_chipc_if.m   optional bhnd
+dev/bhnd/cores/chipc/bhnd_sprom_chipc.coptional bhnd
+dev/bhnd/cores/chipc/bhnd_pmu_chipc.c  optional bhnd
 dev/bhnd/cores/chipc/chipc.c   optional bhnd
 dev/bhnd/cores/chipc/chipc_cfi.c   optional bhnd cfi 
 dev/bhnd/cores/chipc/chipc_slicer.coptional bhnd cfi | bhnd spibus
 dev/bhnd/cores/chipc/chipc_spi.c   optional bhnd spibus
 dev/bhnd/cores/chipc/chipc_subr.c  optional bhnd
-dev/bhnd/cores/chipc/bhnd_chipc_if.m   optional bhnd
-dev/bhnd/cores/chipc/bhnd_sprom_chipc.coptional bhnd
+dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c  optional bhnd
+dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c optional bhnd
 dev/bhnd/cores/pci/bhnd_pci.c  optional bhnd pci
 dev/bhnd/cores/pci/bhnd_pci_hostb.coptional bhndb bhnd pci
 dev/bhnd/cores/pci/bhnd_pcib.c optional bhnd_pcib bhnd pci
 dev/bhnd/cores/pcie2/bhnd_pcie2.c  optional bhnd pci
 dev/bhnd/cores/pcie2/bhnd_pcie2_hostb.coptional bhndb bhnd pci
 dev/bhnd/cores/pcie2/bhnd_pcie2b.c optional bhnd_pcie2b bhnd pci
+dev/bhnd/cores/pmu/bhnd_pmu.c  optional bhnd
+dev/bhnd/cores/pmu/bhnd_pmu_core.c optional bhnd
+dev/bhnd/cores/pmu/bhnd_pmu_if.m   optional bhnd
+dev/bhnd/cores/pmu/bhnd_pmu_subr.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram.coptional bhnd
 dev/bhnd/nvram/bhnd_nvram_common.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_cfe.coptional bhnd siba_nexus cfe | \

Modified: head/sys/dev/bhnd/bcma/bcma.c
==
--- head/sys/dev/bhnd/bcma/bcma.c   Fri Aug 26 23:50:44 2016
(r304869)
+++ head/sys/dev/bhnd/bcma/bcma.c   Sat Aug 

Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Adrian Chadd
Hi,

I use the kernel lock profiling debugging, but you can use dtrace to
get an idea:

dtrace -n 'lockstat:::adaptive-block { @[stack()] = sum(arg1); }'

(https://wiki.freebsd.org/DTrace/One-Liners)



-adrian
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304869 - in head/contrib/libarchive: libarchive tar

2016-08-26 Thread Martin Matuska
Author: mm
Date: Fri Aug 26 23:50:44 2016
New Revision: 304869
URL: https://svnweb.freebsd.org/changeset/base/304869

Log:
  MFV r304866:
  Sync libarchive with vendor including security fixes
  
  Vendor issues fixed:
  Issue #731: Reject tar entries >= INT64_MAX
  Issue #744 (part of Issue #743): Enforce sandbox with very long pathnames
  Issue #748: Zip decompression failure with highly-compressed data
  Issue #767: Buffer overflow printing a filename
  Issue #770: Zip read: be more careful about extra_length
  
  MFC after:3 days

Modified:
  head/contrib/libarchive/libarchive/archive_acl.c
  head/contrib/libarchive/libarchive/archive_entry.h
  head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
  head/contrib/libarchive/libarchive/archive_read_support_format_tar.c
  head/contrib/libarchive/libarchive/archive_read_support_format_zip.c
  head/contrib/libarchive/libarchive/archive_write_disk_acl.c
  head/contrib/libarchive/libarchive/archive_write_disk_posix.c
  head/contrib/libarchive/libarchive/archive_write_set_format_pax.c
  head/contrib/libarchive/tar/util.c
Directory Properties:
  head/contrib/libarchive/   (props changed)
  head/contrib/libarchive/libarchive/   (props changed)
  head/contrib/libarchive/tar/   (props changed)

Modified: head/contrib/libarchive/libarchive/archive_acl.c
==
--- head/contrib/libarchive/libarchive/archive_acl.cFri Aug 26 22:56:23 
2016(r304868)
+++ head/contrib/libarchive/libarchive/archive_acl.cFri Aug 26 23:50:44 
2016(r304869)
@@ -57,21 +57,27 @@ static int  archive_acl_add_entry_len_l(s
size_t len, struct archive_string_conv *sc);
 static int isint_w(const wchar_t *start, const wchar_t *end, int *result);
 static int ismode_w(const wchar_t *start, const wchar_t *end, int *result);
+static int parse_nfs4_flags_w(const wchar_t *start, const wchar_t *end,
+   int *result);
+static int parse_nfs4_perms_w(const wchar_t *start, const wchar_t *end,
+   int *result);
 static voidnext_field_w(const wchar_t **wp, const wchar_t **start,
const wchar_t **end, wchar_t *sep);
 static int prefix_w(const wchar_t *start, const wchar_t *end,
const wchar_t *test);
-static voidappend_entry_w(wchar_t **wp, const wchar_t *prefix, int tag,
-   const wchar_t *wname, int perm, int id);
+static voidappend_entry_w(wchar_t **wp, const wchar_t *prefix, int type,
+   int tag, const wchar_t *wname, int perm, int id);
 static voidappend_id_w(wchar_t **wp, int id);
 static int isint(const char *start, const char *end, int *result);
 static int ismode(const char *start, const char *end, int *result);
+static int parse_nfs4_flags(const char *start, const char *end, int 
*result);
+static int parse_nfs4_perms(const char *start, const char *end, int 
*result);
 static voidnext_field(const char **p, const char **start,
const char **end, char *sep);
 static int prefix_c(const char *start, const char *end,
const char *test);
-static voidappend_entry(char **p, const char *prefix, int tag,
-   const char *name, int perm, int id);
+static voidappend_entry(char **p, const char *prefix, int type,
+   int tag, const char *name, int perm, int id);
 static voidappend_id(char **p, int id);
 
 void
@@ -447,6 +453,16 @@ archive_acl_text_w(struct archive *a, st
int id, r;
wchar_t *wp;
 
+   if ((flags & ARCHIVE_ENTRY_ACL_TYPE_NFS4) &&
+   (flags & (ARCHIVE_ENTRY_ACL_TYPE_ACCESS | 
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT))) {
+   /* cannot convert NFSv4 ACLs and POSIX1e ACLs at the same time 
*/   
+   return (NULL);
+   }
+   if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) && (flags & 
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)) {
+   /* cannot have access and default at the same time */
+   return (NULL);
+   }
+
if (acl->acl_text_w != NULL) {
free (acl->acl_text_w);
acl->acl_text_w = NULL;
@@ -462,17 +478,57 @@ archive_acl_text_w(struct archive *a, st
if ((flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) &&
(ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT))
length += 8; /* "default:" */
-   length += 5; /* tag name */
+   switch (ap->tag) {
+   case ARCHIVE_ENTRY_ACL_USER_OBJ:
+   if ((flags & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) 
{
+   length += 6; /* "owner@" */
+   break;
+   }
+   /* FALLTHROUGH */
+   case 

Re: svn commit: r304858 - in head/sys/amd64/vmm: . io

2016-08-26 Thread John Baldwin
On Friday, August 26, 2016 08:15:23 PM John Baldwin wrote:
> Author: jhb
> Date: Fri Aug 26 20:15:22 2016
> New Revision: 304858
> URL: https://svnweb.freebsd.org/changeset/base/304858
> 
> Log:
>   Enable I/O MMU when PCI pass through is first used.
>   
>   Rather than enabling the I/O MMU when the vmm module is loaded,
>   defer initialization until the first attempt to pass a PCI device
>   through to a guest.  If the I/O MMU fails to initialize or is not
>   present, than fail the attempt to pass a PCI device through to a
>   guest.
>   
>   The hw.vmm.force_iommu tunable has been removed since the I/O MMU is
>   no longer enabled during boot.  However, the I/O MMU support can be
>   disabled by setting the hw.vmm.iommu.enable tunable to 0 to prevent
>   use of the I/O MMU on any systems where it is buggy.
>   
>   Reviewed by:grehan
>   MFC after:  1 week
>   Differential Revision:  https://reviews.freebsd.org/D7448

Forgot 'Sponsored by: Chelsio Communications'

Previously if you did the following:

# kldload vmm
# devctl set driver  ppt

And then started a virtual machine that used ppt0 as a PCI
pass through device, the I/O MMU was never enabled.  The result
was that DMA requests for the PCI device weren't translated.  This
would cause the driver to not work in the guest and possibly trash
memory in either the guest or host.  Now the I/O MMU is always
enabled before passing a device to a guest, and if the I/O MMU
doesn't work for some reason, bhyve will fail to start the
guest.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304244 - head/sys/kern

2016-08-26 Thread Gleb Smirnoff
On Sat, Aug 20, 2016 at 10:18:14AM -0700, Bryan Drewery wrote:
B> On 8/16/2016 2:55 PM, Gleb Smirnoff wrote:
B> > Author: glebius
B> > Date: Tue Aug 16 21:55:34 2016
B> > New Revision: 304244
B> > URL: https://svnweb.freebsd.org/changeset/base/304244
B> > 
B> > Log:
B> >   We should not be allowing a timeout to reset when a drain is in progress 
on
B> >   it (either async or sync drain).
B> >   
B> >   At this moment the only user of drain is TCP, but TCP wouldn't 
reschedule a
B> >   callout after it has drained it, since it drains only when a tcpcb is 
closed.
B> >   This for now the problem isn't observed.
B> >   
B> >   Submitted by:rrs
B> 
B> Should this be MFC'd into 11.0?

I'm bit on fence on this. As said this is commit for a problem not observed. I
prefer not to touch stable branches for no good reason.

-- 
Totus tuus, Glebius.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Slawa Olhovchenkov
On Fri, Aug 26, 2016 at 02:42:27PM -0700, Adrian Chadd wrote:

> On 26 August 2016 at 14:36, Slawa Olhovchenkov  wrote:
> > On Fri, Aug 26, 2016 at 02:32:00PM -0700, Adrian Chadd wrote:
> >
> >> Hi,
> >>
> >> It's pcb lock contention.
> >
> > Not sure: only 5% of all time.
> > And same 5% for tcbhashsize = 65K and 256K.
> > Or you talk about some more thin effect?
> 
> You're in the inpcb lock from multiple places.

For tcp case I am found only 3 places: in_pcbdrop in_pcbremlists 
in_pcblookup_hash

> the tcbhashsize doesnt influence the pcb lock contention - it just
> affects how long you take doing lookups. iF your hash table is too
> small then you end up doing lots of O(n) walks of a hash bucket to
> find a pcb entry. :)

Hmm. I am not clearly understund you.
How originate pcb lock contention?
How I can see this (in pmc profile, in dtarce probese)?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304866 - in vendor/libarchive/dist: libarchive tar

2016-08-26 Thread Martin Matuska
Author: mm
Date: Fri Aug 26 22:02:37 2016
New Revision: 304866
URL: https://svnweb.freebsd.org/changeset/base/304866

Log:
  Update vendor/libarchive to git 299c6bf136b9bc328b498505f24f87e732b73ff6
  
  Vendor issues fixed:
  Issue #731: Reject tar entries >= INT64_MAX
  Issue #744 (part of Issue #743): Enforce sandbox with very long pathnames
  Issue #748: Zip decompression failure with highly-compressed data
  Issue #767: Buffer overflow printing a filename
  Issue #770: Be more careful about extra_length

Modified:
  vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c
  vendor/libarchive/dist/libarchive/archive_write_disk_acl.c
  vendor/libarchive/dist/libarchive/archive_write_disk_posix.c
  vendor/libarchive/dist/tar/util.c

Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c
==
--- vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c Fri Aug 
26 21:28:24 2016(r304865)
+++ vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c Fri Aug 
26 22:02:37 2016(r304866)
@@ -1128,8 +1128,15 @@ header_common(struct archive_read *a, st
if (tar->entry_bytes_remaining < 0) {
tar->entry_bytes_remaining = 0;
archive_set_error(>archive, ARCHIVE_ERRNO_MISC,
-   "Tar entry has negative size?");
-   err = ARCHIVE_WARN;
+   "Tar entry has negative size");
+   return (ARCHIVE_FATAL);
+   }
+   if (tar->entry_bytes_remaining == INT64_MAX) {
+   /* Note: tar_atol returns INT64_MAX on overflow */
+   tar->entry_bytes_remaining = 0;
+   archive_set_error(>archive, ARCHIVE_ERRNO_MISC,
+   "Tar entry size overflow");
+   return (ARCHIVE_FATAL);
}
tar->realsize = tar->entry_bytes_remaining;
archive_entry_set_size(entry, tar->entry_bytes_remaining);

Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c
==
--- vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c Fri Aug 
26 21:28:24 2016(r304865)
+++ vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c Fri Aug 
26 22:02:37 2016(r304866)
@@ -418,18 +418,30 @@ zip_time(const char *p)
  * id1+size1+data1 + id2+size2+data2 ...
  *  triplets.  id and size are 2 bytes each.
  */
-static void
-process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry)
+static int
+process_extra(struct archive_read *a, const char *p, size_t extra_length, 
struct zip_entry* zip_entry)
 {
unsigned offset = 0;
 
-   while (offset < extra_length - 4) {
+   if (extra_length == 0) {
+   return ARCHIVE_OK;
+   }
+
+   if (extra_length < 4) {
+   archive_set_error(>archive, ARCHIVE_ERRNO_FILE_FORMAT,
+   "Too-small extra data: Need at least 4 bytes, but only 
found %d bytes", (int)extra_length);
+   return ARCHIVE_FAILED;
+   }
+   while (offset <= extra_length - 4) {
unsigned short headerid = archive_le16dec(p + offset);
unsigned short datasize = archive_le16dec(p + offset + 2);
 
offset += 4;
if (offset + datasize > extra_length) {
-   break;
+   archive_set_error(>archive, 
ARCHIVE_ERRNO_FILE_FORMAT,
+   "Extra data overflow: Need %d bytes but only found 
%d bytes",
+   (int)datasize, (int)(extra_length - offset));
+   return ARCHIVE_FAILED;
}
 #ifdef DEBUG
fprintf(stderr, "Header id 0x%04x, length %d\n",
@@ -715,13 +727,13 @@ process_extra(const char *p, size_t extr
}
offset += datasize;
}
-#ifdef DEBUG
-   if (offset != extra_length)
-   {
-   fprintf(stderr,
-   "Extra data field contents do not match reported size!\n");
+   if (offset != extra_length) {
+   archive_set_error(>archive, ARCHIVE_ERRNO_FILE_FORMAT,
+   "Malformed extra data: Consumed %d bytes of %d bytes",
+   (int)offset, (int)extra_length);
+   return ARCHIVE_FAILED;
}
-#endif
+   return ARCHIVE_OK;
 }
 
 /*
@@ -840,7 +852,9 @@ zip_read_local_file_header(struct archiv
return (ARCHIVE_FATAL);
}
 
-   process_extra(h, extra_length, zip_entry);
+   if (ARCHIVE_OK != process_extra(a, h, extra_length, zip_entry)) {
+   return ARCHIVE_FATAL;
+   }
__archive_read_consume(a, extra_length);
 
/* Work around a bug in Info-Zip: When reading from a pipe, it
@@ -1293,7 +1307,7 @@ 

Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Adrian Chadd
On 26 August 2016 at 14:36, Slawa Olhovchenkov  wrote:
> On Fri, Aug 26, 2016 at 02:32:00PM -0700, Adrian Chadd wrote:
>
>> Hi,
>>
>> It's pcb lock contention.
>
> Not sure: only 5% of all time.
> And same 5% for tcbhashsize = 65K and 256K.
> Or you talk about some more thin effect?

You're in the inpcb lock from multiple places.

the tcbhashsize doesnt influence the pcb lock contention - it just
affects how long you take doing lookups. iF your hash table is too
small then you end up doing lots of O(n) walks of a hash bucket to
find a pcb entry. :)



-adrian

>>
>> On 26 August 2016 at 08:13, Slawa Olhovchenkov  wrote:
>> > On Fri, Aug 26, 2016 at 04:01:14PM +0100, Bruce Simpson wrote:
>> >
>> >> Slawa,
>> >>
>> >> I'm afraid this may be a bit of a non-sequitur. Sorry.. I seem to be
>> >> missing something. As I understand it this thread is about Ryan's change
>> >> to netinet for broadcast.
>> >>
>> >> On 26/08/16 15:49, Slawa Olhovchenkov wrote:
>> >> > On Sun, Aug 21, 2016 at 03:04:00AM +0300, Slawa Olhovchenkov wrote:
>> >> >> On Sun, Aug 21, 2016 at 12:25:46AM +0100, Bruce Simpson wrote:
>> >> >>> Whilst I agree with your concerns about multipoint, I support the
>> >> >>> motivation behind Ryan's original change: optimize the common case.
>> >> >>
>> >> >> Oh, common case...
>> >> >> I am have pmc profiling for TCP output and see on this SVG picture and
>> >> >> don't find any simple way.
>> >> >> You want to watch too?
>> >> >
>> >> > At time peak network traffic (more then 25K connections, about 20Gbit
>> >> > total traffic) half of cores fully utilised by network stack.
>> >> >
>> >> > This is flamegraph from one core: http://zxy.spb.ru/cpu10.svg
>> >> > This is same, but stack cut of at ixgbe_rxeof for more unified
>> >> > tcp/ip stack view http://zxy.spb.ru/cpu10u.svg
>> >> ...
>> >>
>> >> I appreciate that you've taken the time to post a flamegraph (a
>> >> fashionable visualization) of relative performance in the FreeBSD
>> >> networking stack.
>> >>
>> >> Sadly, I am mostly out of my depth for looking at stack wide performance
>> >> for the moment; for the things I look at involving FreeBSD at work just
>> >> at the moment, I would not generally go down there except for specific
>> >> performance issues (e.g. with IEEE 1588).
>> >>
>> >> It sounds as though perhaps you should raise a wider discussion about
>> >> your results on -net. I would caution you however that the Function
>> >> Boundary Trace (FBT) provider for DTrace can introduce a fair amount of
>> >> noise to the raw performance data because of the trap mechanism it uses.
>> >> This ruled it out for one of my own studies requiring packet-level 
>> >> accuracy.
>> >>
>> >> Whilst raw pmc(4) profiles may require more post-processing, they will
>> >> provide less equivocal data (and a better fix) on the hot path, due also
>> >> to being sampled effectively on a PMC interrupt (a gather stage- poll
>> >> core+uncore MSRs), not purely a software timer interrupt.
>> >
>> > Thanks for answer, I am now try to start discussion on -net.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Slawa Olhovchenkov
On Fri, Aug 26, 2016 at 02:32:00PM -0700, Adrian Chadd wrote:

> Hi,
> 
> It's pcb lock contention.

Not sure: only 5% of all time.
And same 5% for tcbhashsize = 65K and 256K.
Or you talk about some more thin effect?

> 
> On 26 August 2016 at 08:13, Slawa Olhovchenkov  wrote:
> > On Fri, Aug 26, 2016 at 04:01:14PM +0100, Bruce Simpson wrote:
> >
> >> Slawa,
> >>
> >> I'm afraid this may be a bit of a non-sequitur. Sorry.. I seem to be
> >> missing something. As I understand it this thread is about Ryan's change
> >> to netinet for broadcast.
> >>
> >> On 26/08/16 15:49, Slawa Olhovchenkov wrote:
> >> > On Sun, Aug 21, 2016 at 03:04:00AM +0300, Slawa Olhovchenkov wrote:
> >> >> On Sun, Aug 21, 2016 at 12:25:46AM +0100, Bruce Simpson wrote:
> >> >>> Whilst I agree with your concerns about multipoint, I support the
> >> >>> motivation behind Ryan's original change: optimize the common case.
> >> >>
> >> >> Oh, common case...
> >> >> I am have pmc profiling for TCP output and see on this SVG picture and
> >> >> don't find any simple way.
> >> >> You want to watch too?
> >> >
> >> > At time peak network traffic (more then 25K connections, about 20Gbit
> >> > total traffic) half of cores fully utilised by network stack.
> >> >
> >> > This is flamegraph from one core: http://zxy.spb.ru/cpu10.svg
> >> > This is same, but stack cut of at ixgbe_rxeof for more unified
> >> > tcp/ip stack view http://zxy.spb.ru/cpu10u.svg
> >> ...
> >>
> >> I appreciate that you've taken the time to post a flamegraph (a
> >> fashionable visualization) of relative performance in the FreeBSD
> >> networking stack.
> >>
> >> Sadly, I am mostly out of my depth for looking at stack wide performance
> >> for the moment; for the things I look at involving FreeBSD at work just
> >> at the moment, I would not generally go down there except for specific
> >> performance issues (e.g. with IEEE 1588).
> >>
> >> It sounds as though perhaps you should raise a wider discussion about
> >> your results on -net. I would caution you however that the Function
> >> Boundary Trace (FBT) provider for DTrace can introduce a fair amount of
> >> noise to the raw performance data because of the trap mechanism it uses.
> >> This ruled it out for one of my own studies requiring packet-level 
> >> accuracy.
> >>
> >> Whilst raw pmc(4) profiles may require more post-processing, they will
> >> provide less equivocal data (and a better fix) on the hot path, due also
> >> to being sampled effectively on a PMC interrupt (a gather stage- poll
> >> core+uncore MSRs), not purely a software timer interrupt.
> >
> > Thanks for answer, I am now try to start discussion on -net.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Adrian Chadd
Hi,

It's pcb lock contention.



-adrian


On 26 August 2016 at 08:13, Slawa Olhovchenkov  wrote:
> On Fri, Aug 26, 2016 at 04:01:14PM +0100, Bruce Simpson wrote:
>
>> Slawa,
>>
>> I'm afraid this may be a bit of a non-sequitur. Sorry.. I seem to be
>> missing something. As I understand it this thread is about Ryan's change
>> to netinet for broadcast.
>>
>> On 26/08/16 15:49, Slawa Olhovchenkov wrote:
>> > On Sun, Aug 21, 2016 at 03:04:00AM +0300, Slawa Olhovchenkov wrote:
>> >> On Sun, Aug 21, 2016 at 12:25:46AM +0100, Bruce Simpson wrote:
>> >>> Whilst I agree with your concerns about multipoint, I support the
>> >>> motivation behind Ryan's original change: optimize the common case.
>> >>
>> >> Oh, common case...
>> >> I am have pmc profiling for TCP output and see on this SVG picture and
>> >> don't find any simple way.
>> >> You want to watch too?
>> >
>> > At time peak network traffic (more then 25K connections, about 20Gbit
>> > total traffic) half of cores fully utilised by network stack.
>> >
>> > This is flamegraph from one core: http://zxy.spb.ru/cpu10.svg
>> > This is same, but stack cut of at ixgbe_rxeof for more unified
>> > tcp/ip stack view http://zxy.spb.ru/cpu10u.svg
>> ...
>>
>> I appreciate that you've taken the time to post a flamegraph (a
>> fashionable visualization) of relative performance in the FreeBSD
>> networking stack.
>>
>> Sadly, I am mostly out of my depth for looking at stack wide performance
>> for the moment; for the things I look at involving FreeBSD at work just
>> at the moment, I would not generally go down there except for specific
>> performance issues (e.g. with IEEE 1588).
>>
>> It sounds as though perhaps you should raise a wider discussion about
>> your results on -net. I would caution you however that the Function
>> Boundary Trace (FBT) provider for DTrace can introduce a fair amount of
>> noise to the raw performance data because of the trap mechanism it uses.
>> This ruled it out for one of my own studies requiring packet-level accuracy.
>>
>> Whilst raw pmc(4) profiles may require more post-processing, they will
>> provide less equivocal data (and a better fix) on the hot path, due also
>> to being sampled effectively on a PMC interrupt (a gather stage- poll
>> core+uncore MSRs), not purely a software timer interrupt.
>
> Thanks for answer, I am now try to start discussion on -net.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304865 - stable/11/sys/sys

2016-08-26 Thread Andrey A. Chernov
Author: ache
Date: Fri Aug 26 21:28:24 2016
New Revision: 304865
URL: https://svnweb.freebsd.org/changeset/base/304865

Log:
  Bump __FreeBSD_version after LC_*_MASK fix

Modified:
  stable/11/sys/sys/param.h

Modified: stable/11/sys/sys/param.h
==
--- stable/11/sys/sys/param.h   Fri Aug 26 21:26:33 2016(r304864)
+++ stable/11/sys/sys/param.h   Fri Aug 26 21:28:24 2016(r304865)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1100501  /* Master, propagated to newvers */
+#define __FreeBSD_version 1100502  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304864 - stable/10/sys/sys

2016-08-26 Thread Andrey A. Chernov
Author: ache
Date: Fri Aug 26 21:26:33 2016
New Revision: 304864
URL: https://svnweb.freebsd.org/changeset/base/304864

Log:
  Bump __FreeBSD_version after LC_*_MASK fix

Modified:
  stable/10/sys/sys/param.h

Modified: stable/10/sys/sys/param.h
==
--- stable/10/sys/sys/param.h   Fri Aug 26 21:23:38 2016(r304863)
+++ stable/10/sys/sys/param.h   Fri Aug 26 21:26:33 2016(r304864)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1003506  /* Master, propagated to newvers */
+#define __FreeBSD_version 1003507  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304863 - in stable/11: include/xlocale lib/libc/nls

2016-08-26 Thread Andrey A. Chernov
Author: ache
Date: Fri Aug 26 21:23:38 2016
New Revision: 304863
URL: https://svnweb.freebsd.org/changeset/base/304863

Log:
  MFC r304703, r304755
  
  1) _locale.h
  LC_*_MASK bit shifting order was partially broken from the initial commit
  time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the
  right order.
  
  The order here should match XLC_* from "xlocale_private.h" which, in turn,
  match LC_* publicly visible order from  which determines how
  locale components are stored in the structure.
  LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale()
  and equivalent shift loop in the newlocale(), so mapped to some wrong
  components (excluding two mentioned above).
  
  Formally the fix is ABI breakage, but old code using those masks
  never works properly in any case.
  Only newlocale() and querylocale() are affected.
  
  2) msgcat.c
  Use current locale (f.e. set by thread). It was global locale always
  previously.
  
  PR: 211743

Modified:
  stable/11/include/xlocale/_locale.h
  stable/11/lib/libc/nls/msgcat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/include/xlocale/_locale.h
==
--- stable/11/include/xlocale/_locale.h Fri Aug 26 21:19:23 2016
(r304862)
+++ stable/11/include/xlocale/_locale.h Fri Aug 26 21:23:38 2016
(r304863)
@@ -32,12 +32,13 @@
 #ifndef _XLOCALE_LOCALE_H
 #define _XLOCALE_LOCALE_H
 
+/* Bit shifting order of LC_*_MASK should match XLC_* and LC_* order. */
 #define LC_COLLATE_MASK  (1<<0)
 #define LC_CTYPE_MASK(1<<1)
-#define LC_MESSAGES_MASK (1<<2)
-#define LC_MONETARY_MASK (1<<3)
-#define LC_NUMERIC_MASK  (1<<4)
-#define LC_TIME_MASK (1<<5)
+#define LC_MONETARY_MASK (1<<2)
+#define LC_NUMERIC_MASK  (1<<3)
+#define LC_TIME_MASK (1<<4)
+#define LC_MESSAGES_MASK (1<<5)
 #define LC_ALL_MASK  (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | 
\
  LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
 #define LC_GLOBAL_LOCALE ((locale_t)-1)

Modified: stable/11/lib/libc/nls/msgcat.c
==
--- stable/11/lib/libc/nls/msgcat.c Fri Aug 26 21:19:23 2016
(r304862)
+++ stable/11/lib/libc/nls/msgcat.c Fri Aug 26 21:23:38 2016
(r304863)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -56,7 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "un-namespace.h"
 
-#include "../locale/setlocale.h"/* for ENCODING_LEN */
+#include "../locale/xlocale_private.h"
 
 #define _DEFAULT_NLS_PATH 
"/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L"
 
@@ -115,9 +114,10 @@ catopen(const char *name, int type)
 {
struct stat sbuf;
struct catentry *np;
-   char *base, *cptr, *cptr1, *lang, *nlspath, *pathP, *pcode;
-   char *plang, *pter, *tmpptr;
+   char *base, *cptr, *cptr1, *nlspath, *pathP, *pcode;
+   char *plang, *pter;
int saverr, spcleft;
+   const char *lang, *tmpptr;
char path[PATH_MAX];
 
/* sanity checking */
@@ -129,7 +129,7 @@ catopen(const char *name, int type)
lang = NULL;
else {
if (type == NL_CAT_LOCALE)
-   lang = setlocale(LC_MESSAGES, NULL);
+   lang = querylocale(LC_MESSAGES_MASK, __get_locale());
else
lang = getenv("LANG");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304862 - in stable/10: include/xlocale lib/libc/nls

2016-08-26 Thread Andrey A. Chernov
Author: ache
Date: Fri Aug 26 21:19:23 2016
New Revision: 304862
URL: https://svnweb.freebsd.org/changeset/base/304862

Log:
  MFC r304703, r304755
  
  1) _locale.h
  LC_*_MASK bit shifting order was partially broken from the initial commit
  time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the
  right order.
  
  The order here should match XLC_* from "xlocale_private.h" which, in turn,
  match LC_* publicly visible order from  which determines how
  locale components are stored in the structure.
  LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale()
  and equivalent shift loop in the newlocale(), so mapped to some wrong
  components (excluding two mentioned above).
  
  Formally the fix is ABI breakage, but old code using those masks
  never works properly in any case.
  Only newlocale() and querylocale() are affected.
  
  2) msgcat.c
  Use current locale (f.e. set by thread). It was global locale always
  previously.
  
  PR: 211743

Modified:
  stable/10/include/xlocale/_locale.h
  stable/10/lib/libc/nls/msgcat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/include/xlocale/_locale.h
==
--- stable/10/include/xlocale/_locale.h Fri Aug 26 20:51:09 2016
(r304861)
+++ stable/10/include/xlocale/_locale.h Fri Aug 26 21:19:23 2016
(r304862)
@@ -32,12 +32,13 @@
 #ifndef _XLOCALE_LOCALE_H
 #define _XLOCALE_LOCALE_H
 
+/* Bit shifting order of LC_*_MASK should match XLC_* and LC_* order. */
 #define LC_COLLATE_MASK  (1<<0)
 #define LC_CTYPE_MASK(1<<1)
-#define LC_MESSAGES_MASK (1<<2)
-#define LC_MONETARY_MASK (1<<3)
-#define LC_NUMERIC_MASK  (1<<4)
-#define LC_TIME_MASK (1<<5)
+#define LC_MONETARY_MASK (1<<2)
+#define LC_NUMERIC_MASK  (1<<3)
+#define LC_TIME_MASK (1<<4)
+#define LC_MESSAGES_MASK (1<<5)
 #define LC_ALL_MASK  (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | 
\
  LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
 #define LC_GLOBAL_LOCALE ((locale_t)-1)

Modified: stable/10/lib/libc/nls/msgcat.c
==
--- stable/10/lib/libc/nls/msgcat.c Fri Aug 26 20:51:09 2016
(r304861)
+++ stable/10/lib/libc/nls/msgcat.c Fri Aug 26 21:19:23 2016
(r304862)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -56,7 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "un-namespace.h"
 
-#include "../locale/setlocale.h"/* for ENCODING_LEN */
+#include "../locale/xlocale_private.h"
 
 #define _DEFAULT_NLS_PATH 
"/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L"
 
@@ -115,9 +114,10 @@ catopen(const char *name, int type)
 {
struct stat sbuf;
struct catentry *np;
-   char *base, *cptr, *cptr1, *lang, *nlspath, *pathP, *pcode;
-   char *plang, *pter, *tmpptr;
+   char *base, *cptr, *cptr1, *nlspath, *pathP, *pcode;
+   char *plang, *pter;
int saverr, spcleft;
+   const char *lang, *tmpptr;
char path[PATH_MAX];
 
/* sanity checking */
@@ -129,7 +129,7 @@ catopen(const char *name, int type)
lang = NULL;
else {
if (type == NL_CAT_LOCALE)
-   lang = setlocale(LC_MESSAGES, NULL);
+   lang = querylocale(LC_MESSAGES_MASK, __get_locale());
else
lang = getenv("LANG");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304861 - in vendor/illumos/dist: cmd/dtrace/test/tst/common/llquantize lib/libdtrace/common

2016-08-26 Thread Mark Johnston
Author: markj
Date: Fri Aug 26 20:51:09 2016
New Revision: 304861
URL: https://svnweb.freebsd.org/changeset/base/304861

Log:
  7297 clear() on llquantize aggregation causes dtrace to exit
  7298 printa() of multiple aggregations can fail for llquantize()
  
  illumos/illumos-gate@0ddc0ebb74cedb0ac394818c6e166c47eb8e62e5
  
  Reviewed by: Patrick Mooney 
  Reviewed by: Robert Mustacchi 
  Reviewed by: Dan McDonald 
  Reviewed by: Adam Leventhal 
  Approved by: Richard Lowe 
  Author: Bryan Cantrill 

Added:
  vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d
  vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d.out
  vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d
  vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d.out
Modified:
  vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d   
Fri Aug 26 20:51:09 2016(r304861)
@@ -0,0 +1,23 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+   @ = llquantize(0, 10, 0, 6, 20);
+   clear(@);
+   exit(0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d.out   
Fri Aug 26 20:51:09 2016(r304861)
@@ -0,0 +1,6 @@
+
+
+   value  - Distribution - count
+ < 1 | 0
+   1 | 0
+

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d   
Fri Aug 26 20:51:09 2016(r304861)
@@ -0,0 +1,24 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+   @sfo["tabs"] = llquantize(1, 10, 0, 6, 20);
+   @yvr["spaces"] = count();
+   printa(@sfo, @yvr);
+   exit(0);
+}

Added: 
vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d.out   
Fri Aug 26 20:51:09 2016(r304861)
@@ -0,0 +1,13 @@
+
+  spaces
+   value  - Distribution - count
+ < 1 | 0
+   1 | 0
+1
+  tabs  
+   value  - Distribution - count
+9500 | 0
+   1 | 1
+   15000 | 0
+0
+

Modified: vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c
==
--- vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c Fri Aug 26 
20:23:10 2016(r304860)
+++ vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c Fri Aug 26 
20:51:09 2016(r304861)

svn commit: r304860 - in head: include lib/libc/gen

2016-08-26 Thread Ed Schouten
Author: ed
Date: Fri Aug 26 20:23:10 2016
New Revision: 304860
URL: https://svnweb.freebsd.org/changeset/base/304860

Log:
  Improve compatibility of calls to dirname() on constant strings.
  
  As the xinstall(8) utility had to be patched up to work with the POSIXly
  correct basename()/dirname() prototypes, we make it pretty hard to build
  previous versions of FreeBSD on HEAD. xinstall(8) is part of the
  bootstrap tools.
  
  Add some logic to  to automatically detect bad calls to
  dirname() based on the type of the argument. If the argument is of type
  'const char *', we simply fall back to calling into dirname@FBSD_1.0
  directly.
  
  I'll also give basename() similar treatment when importing the
  thread-safe version of that function.
  
  Tested by:bdrewery, madpilot (thanks!)

Modified:
  head/include/libgen.h
  head/lib/libc/gen/dirname.c

Modified: head/include/libgen.h
==
--- head/include/libgen.h   Fri Aug 26 20:16:02 2016(r304859)
+++ head/include/libgen.h   Fri Aug 26 20:23:10 2016(r304860)
@@ -39,4 +39,23 @@ char *basename_r(const char *, char *);
 char   *dirname(char *);
 __END_DECLS
 
+/*
+ * In FreeBSD 12, the prototype of dirname() was modified to comply to
+ * POSIX. This function may now modify its input. Unfortunately, our
+ * copy of xinstall(8) shipped with previous versions of FreeBSD is
+ * built using the host headers and libc during the bootstrapping phase
+ * and depends on the old behavior.
+ *
+ * Apply a workaround where we explicitly link against dirname@FBSD_1.0
+ * in case this function is called on constant strings, instead of
+ * making the build fail.
+ */
+#if defined(__generic) && !defined(__cplusplus)
+__BEGIN_DECLS
+char   *__old_dirname(const char *);
+__END_DECLS
+__sym_compat(dirname, __old_dirname, FBSD_1.0);
+#definedirname(x)  __generic(x, const char *, __old_dirname, 
dirname)(x)
+#endif
+
 #endif /* !_LIBGEN_H_ */

Modified: head/lib/libc/gen/dirname.c
==
--- head/lib/libc/gen/dirname.c Fri Aug 26 20:16:02 2016(r304859)
+++ head/lib/libc/gen/dirname.c Fri Aug 26 20:23:10 2016(r304860)
@@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 char *
-dirname(char *path)
+(dirname)(char *path)
 {
const char *in, *prev, *begin, *end;
char *out;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303988 - head/lib/libc/gen

2016-08-26 Thread Ed Schouten
Hey,

2016-08-26 22:04 GMT+02:00 Bryan Drewery :
> On 8/26/2016 12:57 PM, John Baldwin wrote:
>> Alternatively, couldn't you just leave basename out of the libgen patch
>> for now and only add it once you do the real symver bump for the
>> different version?  (That is, just use __generic() for dirname() for
>> now since that is the only one that has really changed.)
>
> Doing this also works.
>
> I think it was done since the prototype did change as well which
> disallows building the old xinstall directly, but in the bootstrap build
> it is built with MK_WARNS=no so the error is ignored.

That's good to know. I'll land this change in a couple of minutes from
now, reverting any of the changes related to basename().

Guido, Bryan, thanks for testing!

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304859 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/cores/chipc mips/broadcom

2016-08-26 Thread Landon J. Fuller
Author: landonf
Date: Fri Aug 26 20:16:02 2016
New Revision: 304859
URL: https://svnweb.freebsd.org/changeset/base/304859

Log:
  [mips/broadcom] Generic platform_reset() support.
  
  This adds support for performing platform_reset() on all supported
  devices, using early boot enumeration of chipc capabilities and
  available cores.
  
  
  - Added Broadcom-specific MIPS CP0 register definitions used by
BCM4785-specific reset handling.
  - Added a bcm_platform structure for tracking chipc/pmu/cfe platform
data.
  - Extended the BCMA EROM API to support early boot lookup of core info
(including port/region mappings).
  - Extended platform_reset() to support PMU, PMU+AOB, and non-PMU
devices.
  
  Reviewed by:  mizhka
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7539

Added:
  head/sys/mips/broadcom/bcm_bcma.c   (contents, props changed)
  head/sys/mips/broadcom/bcm_machdep.h   (contents, props changed)
  head/sys/mips/broadcom/bcm_mips_exts.h   (contents, props changed)
  head/sys/mips/broadcom/bcm_siba.c   (contents, props changed)
Modified:
  head/sys/dev/bhnd/bcma/bcma_erom.c
  head/sys/dev/bhnd/bcma/bcma_eromvar.h
  head/sys/dev/bhnd/bhnd_ids.h
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/cores/chipc/chipcreg.h
  head/sys/mips/broadcom/bcm_machdep.c
  head/sys/mips/broadcom/bcm_socinfo.c
  head/sys/mips/broadcom/bcm_socinfo.h
  head/sys/mips/broadcom/files.broadcom
  head/sys/mips/broadcom/uart_cpu_chipc.c

Modified: head/sys/dev/bhnd/bcma/bcma_erom.c
==
--- head/sys/dev/bhnd/bcma/bcma_erom.c  Fri Aug 26 20:15:22 2016
(r304858)
+++ head/sys/dev/bhnd/bcma/bcma_erom.c  Fri Aug 26 20:16:02 2016
(r304859)
@@ -65,10 +65,18 @@ static int   erom_skip_mport(struct bcma
 static int  erom_skip_sport_region(struct bcma_erom *erom);
 
 static int  erom_seek_next(struct bcma_erom *erom, uint8_t etype);
+static int  erom_region_to_port_type(struct bcma_erom *erom,
+   uint8_t region_type, bhnd_port_type *port_type);
 
-#defineEROM_LOG(erom, fmt, ...)\
-   device_printf(erom->dev, "erom[0x%llx]: " fmt, \
-   (unsigned long long) (erom->offset), ##__VA_ARGS__);
+#defineEROM_LOG(erom, fmt, ...)do {
\
+   if (erom->dev != NULL) {\
+   device_printf(erom->dev, "erom[0x%llx]: " fmt,  \
+   (unsigned long long) (erom->offset), ##__VA_ARGS__);\
+   } else {\
+   printf("erom[0x%llx]: " fmt,\
+   (unsigned long long) (erom->offset), ##__VA_ARGS__);\
+   }   \
+} while(0)
 
 /**
  * Open an EROM table for reading.
@@ -82,11 +90,37 @@ static int   erom_seek_next(struct bcma_
  * @retval non-zero if the erom table could not be opened.
  */
 int
-bcma_erom_open(struct bcma_erom *erom, struct resource *r, bus_size_t offset)
+bcma_erom_open(struct bcma_erom *erom, struct resource *r,
+bus_size_t offset)
+{
+   return (bhnd_erom_bus_space_open(erom, rman_get_device(r),
+   rman_get_bustag(r), rman_get_bushandle(r), offset));
+
+   return (0);
+}
+
+/**
+ * Open an EROM table for reading using the provided bus space tag and
+ * handle.
+ * 
+ * @param[out] erom On success, will be populated with a valid EROM
+ * read state.
+ * @param dev The owning device, or NULL if none.
+ * @param bst EROM table bus space tag.
+ * @param bsh EROM table bus space handle.
+ * @param offset Offset of the EROM core from @p resource.
+ *
+ * @retval 0 success
+ * @retval non-zero if the erom table could not be opened.
+ */
+int
+bhnd_erom_bus_space_open(struct bcma_erom *erom, device_t dev,
+bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t offset)
 {
/* Initialize the EROM reader */
-   erom->dev = rman_get_device(r);
-   erom->r = r;
+   erom->dev = dev;
+   erom->bst = bst;
+   erom->bsh = bsh;
erom->start = offset + BCMA_EROM_TABLE_START;
erom->offset = 0;
 
@@ -145,7 +179,8 @@ bcma_erom_peek32(struct bcma_erom *erom,
return (EINVAL);
}
 
-   *entry = bus_read_4(erom->r, erom->start + erom->offset);
+   *entry = bus_space_read_4(erom->bst, erom->bsh,
+   erom->start + erom->offset);
return (0);
 }
 
@@ -300,6 +335,20 @@ bcma_erom_reset(struct bcma_erom *erom)
 }
 
 /**
+ * Seek to the next core entry.
+ * 
+ * @param erom EROM read state.
+ * @retval 0 success
+ * @retval ENOENT The end of the EROM table was reached.
+ * @retval non-zero Reading or parsing failed.
+ */
+int
+bcma_erom_seek_next_core(struct bcma_erom *erom)
+{
+   return (erom_seek_next(erom, 

svn commit: r304858 - in head/sys/amd64/vmm: . io

2016-08-26 Thread John Baldwin
Author: jhb
Date: Fri Aug 26 20:15:22 2016
New Revision: 304858
URL: https://svnweb.freebsd.org/changeset/base/304858

Log:
  Enable I/O MMU when PCI pass through is first used.
  
  Rather than enabling the I/O MMU when the vmm module is loaded,
  defer initialization until the first attempt to pass a PCI device
  through to a guest.  If the I/O MMU fails to initialize or is not
  present, than fail the attempt to pass a PCI device through to a
  guest.
  
  The hw.vmm.force_iommu tunable has been removed since the I/O MMU is
  no longer enabled during boot.  However, the I/O MMU support can be
  disabled by setting the hw.vmm.iommu.enable tunable to 0 to prevent
  use of the I/O MMU on any systems where it is buggy.
  
  Reviewed by:  grehan
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D7448

Modified:
  head/sys/amd64/vmm/io/iommu.c
  head/sys/amd64/vmm/io/iommu.h
  head/sys/amd64/vmm/vmm.c

Modified: head/sys/amd64/vmm/io/iommu.c
==
--- head/sys/amd64/vmm/io/iommu.c   Fri Aug 26 19:23:17 2016
(r304857)
+++ head/sys/amd64/vmm/io/iommu.c   Fri Aug 26 20:15:22 2016
(r304858)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include "vmm_util.h"
@@ -51,6 +52,10 @@ static int iommu_avail;
 SYSCTL_INT(_hw_vmm_iommu, OID_AUTO, initialized, CTLFLAG_RD, _avail,
 0, "bhyve iommu initialized?");
 
+static int iommu_enable = 1;
+SYSCTL_INT(_hw_vmm_iommu, OID_AUTO, enable, CTLFLAG_RDTUN, _enable, 0,
+"Enable use of I/O MMU (required for PCI passthrough).");
+
 static struct iommu_ops *ops;
 static void *host_domain;
 
@@ -148,7 +153,7 @@ IOMMU_DISABLE(void)
(*ops->disable)();
 }
 
-void
+static void
 iommu_init(void)
 {
int error, bus, slot, func;
@@ -156,6 +161,9 @@ iommu_init(void)
const char *name;
device_t dev;
 
+   if (!iommu_enable)
+   return;
+
if (vmm_is_intel())
ops = _ops_intel;
else if (vmm_is_amd())
@@ -174,8 +182,13 @@ iommu_init(void)
 */
maxaddr = vmm_mem_maxaddr();
host_domain = IOMMU_CREATE_DOMAIN(maxaddr);
-   if (host_domain == NULL)
-   panic("iommu_init: unable to create a host domain");
+   if (host_domain == NULL) {
+   printf("iommu_init: unable to create a host domain");
+   IOMMU_CLEANUP();
+   ops = NULL;
+   iommu_avail = 0;
+   return;
+   }
 
/*
 * Create 1:1 mappings from '0' to 'maxaddr' for devices assigned to
@@ -216,7 +229,16 @@ iommu_cleanup(void)
 void *
 iommu_create_domain(vm_paddr_t maxaddr)
 {
+   static volatile int iommu_initted;
 
+   if (iommu_initted < 2) {
+   if (atomic_cmpset_int(_initted, 0, 1)) {
+   iommu_init();
+   atomic_store_rel_int(_initted, 2);
+   } else
+   while (iommu_initted == 1)
+   cpu_spinwait();
+   }
return (IOMMU_CREATE_DOMAIN(maxaddr));
 }
 

Modified: head/sys/amd64/vmm/io/iommu.h
==
--- head/sys/amd64/vmm/io/iommu.h   Fri Aug 26 19:23:17 2016
(r304857)
+++ head/sys/amd64/vmm/io/iommu.h   Fri Aug 26 20:15:22 2016
(r304858)
@@ -61,7 +61,6 @@ struct iommu_ops {
 extern struct iommu_ops iommu_ops_intel;
 extern struct iommu_ops iommu_ops_amd;
 
-void   iommu_init(void);
 void   iommu_cleanup(void);
 void   *iommu_host_domain(void);
 void   *iommu_create_domain(vm_paddr_t maxaddr);

Modified: head/sys/amd64/vmm/vmm.c
==
--- head/sys/amd64/vmm/vmm.cFri Aug 26 19:23:17 2016(r304857)
+++ head/sys/amd64/vmm/vmm.cFri Aug 26 20:15:22 2016(r304858)
@@ -224,11 +224,6 @@ SYSCTL_INT(_hw_vmm, OID_AUTO, trace_gues
 _guest_exceptions, 0,
 "Trap into hypervisor on all guest exceptions and reflect them back");
 
-static int vmm_force_iommu = 0;
-TUNABLE_INT("hw.vmm.force_iommu", _force_iommu);
-SYSCTL_INT(_hw_vmm, OID_AUTO, force_iommu, CTLFLAG_RDTUN, _force_iommu, 0,
-"Force use of I/O MMU even if no passthrough devices were found.");
-
 static void vm_free_memmap(struct vm *vm, int ident);
 static bool sysmem_mapping(struct vm *vm, struct mem_map *mm);
 static void vcpu_notify_event_locked(struct vcpu *vcpu, bool lapic_intr);
@@ -358,8 +353,6 @@ vmm_handler(module_t mod, int what, void
switch (what) {
case MOD_LOAD:
vmmdev_init();
-   if (vmm_force_iommu || ppt_avail_devices() > 0)
-   iommu_init();
error = vmm_init();
if (error == 0)
vmm_initialized = 1;
@@ -396,9 +389,6 @@ static moduledata_t vmm_kmod = {
 /*

Re: svn commit: r303988 - head/lib/libc/gen

2016-08-26 Thread Bryan Drewery
On 8/26/2016 12:57 PM, John Baldwin wrote:
> On Friday, August 26, 2016 09:37:10 AM Ed Schouten wrote:
>> Hi,
>>
>> 2016-08-26 1:52 GMT+02:00 Bryan Drewery :
>>> Libc wouldn't build, it complained quite loudly with a lot of these:
>>
>> Got it. Thinking ahead, if it's just basename() giving the problems,
>> maybe it's easier to just go ahead and bump the symver of basename()
>> as well? I'm planning on replacing it anyway to be in sync with the
>> new basename() anyway. Attached is a new patch. Be sure to let me know
>> whether that works for you.
> 
> Alternatively, couldn't you just leave basename out of the libgen patch
> for now and only add it once you do the real symver bump for the
> different version?  (That is, just use __generic() for dirname() for
> now since that is the only one that has really changed.)
> 

Doing this also works.

I think it was done since the prototype did change as well which
disallows building the old xinstall directly, but in the bootstrap build
it is built with MK_WARNS=no so the error is ignored.

> /usr/local/bin/ccache cc -O2 -pipe   
> -I/root/svn/releng/11.0/usr.bin/xinstall/../../contrib/mtree 
> -I/root/svn/releng/11.0/usr.bin/xinstall/../../lib/libnetbsd -g -std=gnu99 
> -fstack-protector-strong -Qunused-arguments  -c 
> /root/svn/releng/11.0/usr.bin/xinstall/xinstall.c -o xinstall.o
> /root/svn/releng/11.0/usr.bin/xinstall/xinstall.c:696:17: warning: passing 
> 'const char *' to parameter of type 'char *' discards qualifiers 
> [-Wincompatible-pointer-types-discards-qualifiers]
> cp = basename(to_name);
>   ^~~
> /usr/include/libgen.h:37:22: note: passing argument to parameter here
> char*basename(char *);
> ^
> 1 warning generated.
> Building /usr/obj/root/svn/releng/11.0/usr.bin/xinstall/getid.o


Let's just not forget to add the _generic in if/when needed too.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r303988 - head/lib/libc/gen

2016-08-26 Thread John Baldwin
On Friday, August 26, 2016 09:37:10 AM Ed Schouten wrote:
> Hi,
> 
> 2016-08-26 1:52 GMT+02:00 Bryan Drewery :
> > Libc wouldn't build, it complained quite loudly with a lot of these:
> 
> Got it. Thinking ahead, if it's just basename() giving the problems,
> maybe it's easier to just go ahead and bump the symver of basename()
> as well? I'm planning on replacing it anyway to be in sync with the
> new basename() anyway. Attached is a new patch. Be sure to let me know
> whether that works for you.

Alternatively, couldn't you just leave basename out of the libgen patch
for now and only add it once you do the real symver bump for the
different version?  (That is, just use __generic() for dirname() for
now since that is the only one that has really changed.)

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304857 - head/sys/netinet/tcp_stacks

2016-08-26 Thread Hiren Panchasara
Author: hiren
Date: Fri Aug 26 19:23:17 2016
New Revision: 304857
URL: https://svnweb.freebsd.org/changeset/base/304857

Log:
  Adjust TCP module fastpath after r304803's cc_ack_received() changes.
  
  Reported by:  hiren, bz, np
  Reviewed by:  rrs
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D7664

Modified:
  head/sys/netinet/tcp_stacks/fastpath.c

Modified: head/sys/netinet/tcp_stacks/fastpath.c
==
--- head/sys/netinet/tcp_stacks/fastpath.c  Fri Aug 26 19:08:58 2016
(r304856)
+++ head/sys/netinet/tcp_stacks/fastpath.c  Fri Aug 26 19:23:17 2016
(r304857)
@@ -172,7 +172,10 @@ tcp_do_fastack(struct mbuf *m, struct tc
   int ti_locked, u_long tiwin)
 {
int acked;
+   uint16_t nsegs;
int winup_only=0;
+
+   nsegs = max(1, m->m_pkthdr.lro_nsegs);
 #ifdef TCPDEBUG
/*
 * The size of tcp_saveipgen must be the size of the max ip header,
@@ -278,7 +281,7 @@ tcp_do_fastack(struct mbuf *m, struct tc
 * typically means increasing the congestion
 * window.
 */
-   cc_ack_received(tp, th, CC_ACK);
+   cc_ack_received(tp, th, nsegs, CC_ACK);
 
tp->snd_una = th->th_ack;
/*
@@ -502,9 +505,12 @@ tcp_do_slowpath(struct mbuf *m, struct t
 {
int  acked, ourfinisacked, needoutput = 0;
int rstreason, todrop, win;
+   uint16_t nsegs;
char *s;
struct in_conninfo *inc;
struct mbuf *mfree = NULL;
+
+   nsegs = max(1, m->m_pkthdr.lro_nsegs);
 #ifdef TCPDEBUG
/*
 * The size of tcp_saveipgen must be the size of the max ip header,
@@ -1085,7 +1091,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
tp->t_dupacks = 0;
else if (++tp->t_dupacks > tcprexmtthresh ||
 IN_FASTRECOVERY(tp->t_flags)) {
-   cc_ack_received(tp, th, CC_DUPACK);
+   cc_ack_received(tp, th, nsegs,
+   CC_DUPACK);
if ((tp->t_flags & TF_SACK_PERMIT) &&
IN_FASTRECOVERY(tp->t_flags)) {
int awnd;
@@ -1135,7 +1142,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
}
/* Congestion signal before ack. */
cc_cong_signal(tp, th, CC_NDUPACK);
-   cc_ack_received(tp, th, CC_DUPACK);
+   cc_ack_received(tp, th, nsegs,
+   CC_DUPACK);
tcp_timer_activate(tp, TT_REXMT, 0);
tp->t_rtttime = 0;
if (tp->t_flags & TF_SACK_PERMIT) {
@@ -1169,7 +1177,8 @@ tcp_do_slowpath(struct mbuf *m, struct t
 * segment. Restore the original
 * snd_cwnd after packet transmission.
 */
-   cc_ack_received(tp, th, CC_DUPACK);
+   cc_ack_received(tp, th, nsegs,
+   CC_DUPACK);
u_long oldcwnd = tp->snd_cwnd;
tcp_seq oldsndmax = tp->snd_max;
u_int sent;
@@ -1323,7 +1332,7 @@ process_ACK:
 * control related information. This typically means increasing
 * the congestion window.
 */
-   cc_ack_received(tp, th, CC_ACK);
+   cc_ack_received(tp, th, nsegs, CC_ACK);
 
SOCKBUF_LOCK(>so_snd);
if (acked > sbavail(>so_snd)) {
@@ -1758,6 +1767,7 @@ tcp_do_segment_fastslow(struct mbuf *m, 
int thflags;
u_long tiwin;
char *s;
+   uint16_t nsegs;
int can_enter;
struct in_conninfo *inc;
struct tcpopt to;
@@ -1765,6 +1775,7 @@ tcp_do_segment_fastslow(struct mbuf *m, 
thflags = th->th_flags;
tp->sackhint.last_sack_ack = 0;
inc = >t_inpcb->inp_inc;
+   nsegs = max(1, m->m_pkthdr.lro_nsegs);
/*
 * If this is either a state-changing packet or current state isn't
 * established, we require a write lock on tcbinfo.  Otherwise, we
@@ -1983,7 +1994,10 @@ tcp_fastack(struct mbuf *m, struct tcphd
   int ti_locked, u_long tiwin)
 {
int acked;
+   uint16_t nsegs;
int winup_only=0;
+
+ 

Re: svn commit: r303988 - head/lib/libc/gen

2016-08-26 Thread Guido Falsi
On 08/26/16 18:31, Bryan Drewery wrote:
> On 8/26/2016 12:37 AM, Ed Schouten wrote:
>> Hi,
>>
>> 2016-08-26 1:52 GMT+02:00 Bryan Drewery :
>>> Libc wouldn't build, it complained quite loudly with a lot of these:
>> Got it. Thinking ahead, if it's just basename() giving the problems,
>> maybe it's easier to just go ahead and bump the symver of basename()
>> as well? I'm planning on replacing it anyway to be in sync with the
>> new basename() anyway. Attached is a new patch. Be sure to let me know
>> whether that works for you.
> 
> This passes my tests.
> 

Everything works fine here too. Thanks!

-- 
Guido Falsi 



signature.asc
Description: OpenPGP digital signature


svn commit: r304855 - head/sys/netinet

2016-08-26 Thread Hiren Panchasara
Author: hiren
Date: Fri Aug 26 17:48:54 2016
New Revision: 304855
URL: https://svnweb.freebsd.org/changeset/base/304855

Log:
  Update TCPS_HAVERCVDFIN() macro to correctly include all states a connection
  can be in after receiving a FIN.
  
  FWIW, NetBSD has this change for quite some time.
  
  This has been tested at Netflix and Limelight in production traffic.
  
  Reported by:  Sam Kumar  on transport@
  Reviewed by:  rrs
  MFC after:4 weeks
  Sponsored by: Limelight Networks
  Differential Revision: https://reviews.freebsd.org/D7475

Modified:
  head/sys/netinet/tcp_fsm.h

Modified: head/sys/netinet/tcp_fsm.h
==
--- head/sys/netinet/tcp_fsm.h  Fri Aug 26 17:38:13 2016(r304854)
+++ head/sys/netinet/tcp_fsm.h  Fri Aug 26 17:48:54 2016(r304855)
@@ -73,7 +73,8 @@
 
 #defineTCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED)
 #defineTCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED)
-#defineTCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
+#defineTCPS_HAVERCVDFIN(s) \
+((s) == TCPS_CLOSE_WAIT || ((s) >= TCPS_CLOSING && (s) != TCPS_FIN_WAIT_2))
 
 #ifdef TCPOUTFLAGS
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304854 - in head: contrib/ofed/libcxgb4/src sys/dev/cxgbe/iw_cxgbe

2016-08-26 Thread Navdeep Parhar
Author: np
Date: Fri Aug 26 17:38:13 2016
New Revision: 304854
URL: https://svnweb.freebsd.org/changeset/base/304854

Log:
  cxgbe/iw_cxgbe: Various fixes to the iWARP driver.
  
  - Return appropriate error code instead of ENOMEM when sosend() fails in
send_mpa_req.
  - Fix for problematic race during destroy_qp.
  - Abortive close in the failure of send_mpa_reject() instead of normal close.
  - Remove the unnecessary doorbell flowcontrol logic.
  
  Submitted by: Krishnamraju Eraparaju at Chelsio
  MFC after:1 month
  Sponsored by: Chelsio communications

Modified:
  head/contrib/ofed/libcxgb4/src/qp.c
  head/sys/dev/cxgbe/iw_cxgbe/cm.c
  head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
  head/sys/dev/cxgbe/iw_cxgbe/qp.c
  head/sys/dev/cxgbe/iw_cxgbe/t4.h

Modified: head/contrib/ofed/libcxgb4/src/qp.c
==
--- head/contrib/ofed/libcxgb4/src/qp.c Fri Aug 26 17:32:51 2016
(r304853)
+++ head/contrib/ofed/libcxgb4/src/qp.c Fri Aug 26 17:38:13 2016
(r304854)
@@ -392,11 +392,9 @@ int c4iw_post_send(struct ibv_qp *ibqp, 
t4_sq_produce(>wq, len16);
idx += DIV_ROUND_UP(len16*16, T4_EQ_ENTRY_SIZE);
}
-   if (t4_wq_db_enabled(>wq)) {
-   t4_ring_sq_db(>wq, idx, dev_is_t5(qhp->rhp),
- len16, wqe);
-   } else
-   ring_kernel_db(qhp, qhp->wq.sq.qid, idx);
+
+   t4_ring_sq_db(>wq, idx, dev_is_t5(qhp->rhp),
+   len16, wqe);
qhp->wq.sq.queue[qhp->wq.sq.size].status.host_wq_pidx = \
(qhp->wq.sq.wq_pidx);
pthread_spin_unlock(>lock);
@@ -458,11 +456,9 @@ int c4iw_post_receive(struct ibv_qp *ibq
wr = wr->next;
num_wrs--;
}
-   if (t4_wq_db_enabled(>wq))
-   t4_ring_rq_db(>wq, idx, dev_is_t5(qhp->rhp),
- len16, wqe);
-   else
-   ring_kernel_db(qhp, qhp->wq.rq.qid, idx);
+
+   t4_ring_rq_db(>wq, idx, dev_is_t5(qhp->rhp),
+   len16, wqe);
qhp->wq.rq.queue[qhp->wq.rq.size].status.host_wq_pidx = \
(qhp->wq.rq.wq_pidx);
pthread_spin_unlock(>lock);

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cFri Aug 26 17:32:51 2016
(r304853)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cFri Aug 26 17:38:13 2016
(r304854)
@@ -83,6 +83,8 @@ static void process_req(struct work_stru
 static void start_ep_timer(struct c4iw_ep *ep);
 static int stop_ep_timer(struct c4iw_ep *ep);
 static int set_tcpinfo(struct c4iw_ep *ep);
+static void process_timeout(struct c4iw_ep *ep);
+static void process_timedout_eps(void);
 static enum c4iw_ep_state state_read(struct c4iw_ep_common *epc);
 static void __state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state 
tostate);
 static void state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state tostate);
@@ -93,7 +95,7 @@ static int find_route(__be32 local_ip, _
 static int close_socket(struct c4iw_ep_common *epc, int close);
 static int shutdown_socket(struct c4iw_ep_common *epc);
 static void abort_socket(struct c4iw_ep *ep);
-static void send_mpa_req(struct c4iw_ep *ep);
+static int send_mpa_req(struct c4iw_ep *ep);
 static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen);
 static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen);
 static void close_complete_upcall(struct c4iw_ep *ep, int status);
@@ -176,20 +178,91 @@ static void ref_qp(struct c4iw_ep *ep)
c4iw_qp_add_ref(>com.qp->ibqp);
 }
 
+static void process_timeout(struct c4iw_ep *ep)
+{
+   struct c4iw_qp_attributes attrs;
+   int abort = 1;
+
+   mutex_lock(>com.mutex);
+   CTR4(KTR_IW_CXGBE, "%s ep :%p, tid:%u, state %d", __func__,
+   ep, ep->hwtid, ep->com.state);
+   set_bit(TIMEDOUT, >com.history);
+   switch (ep->com.state) {
+   case MPA_REQ_SENT:
+   connect_reply_upcall(ep, -ETIMEDOUT);
+   break;
+   case MPA_REQ_WAIT:
+   case MPA_REQ_RCVD:
+   case MPA_REP_SENT:
+   case FPDU_MODE:
+   break;
+   case CLOSING:
+   case MORIBUND:
+   if (ep->com.cm_id && ep->com.qp) {
+   attrs.next_state = C4IW_QP_STATE_ERROR;
+   c4iw_modify_qp(ep->com.dev, ep->com.qp,
+   C4IW_QP_ATTR_NEXT_STATE, , 1);
+   }
+   close_complete_upcall(ep, -ETIMEDOUT);
+   break;
+   case ABORTING:
+   case DEAD:
+   /*
+* These states are expected if the ep timed out at the same
+* time as another thread was calling stop_ep_timer().
+* So we silently do nothing for these states.
+*/
+  

Re: svn commit: r303988 - head/lib/libc/gen

2016-08-26 Thread Bryan Drewery
On 8/26/2016 12:37 AM, Ed Schouten wrote:
> Hi,
> 
> 2016-08-26 1:52 GMT+02:00 Bryan Drewery :
>> Libc wouldn't build, it complained quite loudly with a lot of these:
> Got it. Thinking ahead, if it's just basename() giving the problems,
> maybe it's easier to just go ahead and bump the symver of basename()
> as well? I'm planning on replacing it anyway to be in sync with the
> new basename() anyway. Attached is a new patch. Be sure to let me know
> whether that works for you.

This passes my tests.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Slawa Olhovchenkov
On Fri, Aug 26, 2016 at 04:01:14PM +0100, Bruce Simpson wrote:

> Slawa,
> 
> I'm afraid this may be a bit of a non-sequitur. Sorry.. I seem to be 
> missing something. As I understand it this thread is about Ryan's change 
> to netinet for broadcast.
> 
> On 26/08/16 15:49, Slawa Olhovchenkov wrote:
> > On Sun, Aug 21, 2016 at 03:04:00AM +0300, Slawa Olhovchenkov wrote:
> >> On Sun, Aug 21, 2016 at 12:25:46AM +0100, Bruce Simpson wrote:
> >>> Whilst I agree with your concerns about multipoint, I support the
> >>> motivation behind Ryan's original change: optimize the common case.
> >>
> >> Oh, common case...
> >> I am have pmc profiling for TCP output and see on this SVG picture and
> >> don't find any simple way.
> >> You want to watch too?
> >
> > At time peak network traffic (more then 25K connections, about 20Gbit
> > total traffic) half of cores fully utilised by network stack.
> >
> > This is flamegraph from one core: http://zxy.spb.ru/cpu10.svg
> > This is same, but stack cut of at ixgbe_rxeof for more unified
> > tcp/ip stack view http://zxy.spb.ru/cpu10u.svg
> ...
> 
> I appreciate that you've taken the time to post a flamegraph (a 
> fashionable visualization) of relative performance in the FreeBSD 
> networking stack.
> 
> Sadly, I am mostly out of my depth for looking at stack wide performance 
> for the moment; for the things I look at involving FreeBSD at work just 
> at the moment, I would not generally go down there except for specific 
> performance issues (e.g. with IEEE 1588).
> 
> It sounds as though perhaps you should raise a wider discussion about 
> your results on -net. I would caution you however that the Function 
> Boundary Trace (FBT) provider for DTrace can introduce a fair amount of 
> noise to the raw performance data because of the trap mechanism it uses. 
> This ruled it out for one of my own studies requiring packet-level accuracy.
> 
> Whilst raw pmc(4) profiles may require more post-processing, they will 
> provide less equivocal data (and a better fix) on the hot path, due also 
> to being sampled effectively on a PMC interrupt (a gather stage- poll 
> core+uncore MSRs), not purely a software timer interrupt.

Thanks for answer, I am now try to start discussion on -net.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Bruce Simpson

Slawa,

I'm afraid this may be a bit of a non-sequitur. Sorry.. I seem to be 
missing something. As I understand it this thread is about Ryan's change 
to netinet for broadcast.


On 26/08/16 15:49, Slawa Olhovchenkov wrote:

On Sun, Aug 21, 2016 at 03:04:00AM +0300, Slawa Olhovchenkov wrote:

On Sun, Aug 21, 2016 at 12:25:46AM +0100, Bruce Simpson wrote:

Whilst I agree with your concerns about multipoint, I support the
motivation behind Ryan's original change: optimize the common case.


Oh, common case...
I am have pmc profiling for TCP output and see on this SVG picture and
don't find any simple way.
You want to watch too?


At time peak network traffic (more then 25K connections, about 20Gbit
total traffic) half of cores fully utilised by network stack.

This is flamegraph from one core: http://zxy.spb.ru/cpu10.svg
This is same, but stack cut of at ixgbe_rxeof for more unified
tcp/ip stack view http://zxy.spb.ru/cpu10u.svg

...

I appreciate that you've taken the time to post a flamegraph (a 
fashionable visualization) of relative performance in the FreeBSD 
networking stack.


Sadly, I am mostly out of my depth for looking at stack wide performance 
for the moment; for the things I look at involving FreeBSD at work just 
at the moment, I would not generally go down there except for specific 
performance issues (e.g. with IEEE 1588).


It sounds as though perhaps you should raise a wider discussion about 
your results on -net. I would caution you however that the Function 
Boundary Trace (FBT) provider for DTrace can introduce a fair amount of 
noise to the raw performance data because of the trap mechanism it uses. 
This ruled it out for one of my own studies requiring packet-level accuracy.


Whilst raw pmc(4) profiles may require more post-processing, they will 
provide less equivocal data (and a better fix) on the hot path, due also 
to being sampled effectively on a PMC interrupt (a gather stage- poll 
core+uncore MSRs), not purely a software timer interrupt.


thanks
Bruce

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304850 - head/lib/libstand

2016-08-26 Thread Toomas Soome
Author: tsoome
Date: Fri Aug 26 14:58:57 2016
New Revision: 304850
URL: https://svnweb.freebsd.org/changeset/base/304850

Log:
  Unused variables and cstyle fix for loader dosfs
  
  Reviewed by:  imp, allanjude
  Approved by:  imp (mentor), allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D7659

Modified:
  head/lib/libstand/dosfs.c

Modified: head/lib/libstand/dosfs.c
==
--- head/lib/libstand/dosfs.c   Fri Aug 26 13:59:21 2016(r304849)
+++ head/lib/libstand/dosfs.c   Fri Aug 26 14:58:57 2016(r304850)
@@ -439,7 +439,7 @@ dos_readdir(struct open_file *fd, struct
 u_char fn[261];
 DOS_DIR dd;
 size_t res;
-u_int chk, i, x, xdn;
+u_int chk, x, xdn;
 int err;
 
 x = chk = 0;
@@ -598,7 +598,7 @@ lookup(DOS_FS *fs, u_int clus, const cha
 u_char lfn[261];
 u_char sfn[13];
 u_int nsec, lsec, xdn, chk, sec, ent, x;
-int err, ok, i;
+int err, ok;
 
 if (!clus)
 for (ent = 0; ent < 2; ent++)
@@ -774,11 +774,11 @@ fatget(DOS_FS *fs, u_int *c)
 int err = 0;
 
 if (fat.unit != dd->d_unit) {
-   /* fat cache was changed to another device, dont use it */
+   /* fat cache was changed to another device, don't use it */
err = ioread(fs, secbyt(fs->lsnfat) + fatoff(fs->fatsz, *c), buf,
fs->fatsz != 32 ? 2 : 4);
if (err)
-   return err;
+   return (err);
 } else {
offset = fatoff(fs->fatsz, *c);
nbyte = fs->fatsz != 32 ? 2 : 4;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304436 - in head: . sys/netinet

2016-08-26 Thread Slawa Olhovchenkov
On Sun, Aug 21, 2016 at 03:04:00AM +0300, Slawa Olhovchenkov wrote:

> On Sun, Aug 21, 2016 at 12:25:46AM +0100, Bruce Simpson wrote:
> 
> > On 20/08/16 23:05, Slawa Olhovchenkov wrote:
> > > I am think this substitution is very bad idea (by design).
> > > Also, on transmit side this is must be irrelevant on received L2
> > > header (and this in many cases this is will be L2 unicast packet). For
> > > other cases packet will be created on host and don't have any received
> > > information.
> > >
> > 
> > Whilst I agree with your concerns about multipoint, I support the 
> > motivation behind Ryan's original change: optimize the common case.
> 
> Oh, common case...
> I am have pmc profiling for TCP output and see on this SVG picture and
> don't find any simple way.
> You want to watch too?

At time peak network traffic (more then 25K connections, about 20Gbit
total traffic) half of cores fully utilised by network stack.

This is flamegraph from one core: http://zxy.spb.ru/cpu10.svg
This is same, but stack cut of at ixgbe_rxeof for more unified
tcp/ip stack view http://zxy.spb.ru/cpu10u.svg

Top 3 used lines is:

7036 0x804bf02d atomic_cmpset_long 
/usr/obj/usr/src/sys/VSTREAM/./machine/atomic.h:163

static __inline int
atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src)
{
u_char res;
 
__asm __volatile(
"   " MPLOCKED ""
>   "   cmpxchgq %3,%1 ;"
"   sete%0 ;"
"# atomic_cmpset_long"
: "=q" (res),   /* 0 */
  "+m" (*dst),  /* 1 */
  "+a" (expect) /* 2 */
: "r" (src) /* 3 */
: "memory", "cc");
return (res);
}
 
6099 0x81171963 ?? ??:0

0x81171940 :  mov0x10(%r15),%rax
0x81171944 :  add$0x8,%rax
0x81171948 :  mov-0x4c(%rbp),%ecx
0x8117194b :  test   %cx,%cx
0x8117194e :  mov%rax,0x10(%r15)
0x81171952 :  je 0x8117198d 

0x81171954 :  mov0x10(%rdi),%rcx
0x81171958 :  mov-0x4c(%rbp),%edx
0x8117195b :  nopl   0x0(%rax,%rax,1)
0x81171960 :  mov(%rcx),%rsi
0x81171963 :  mov%rsi,(%rax)
0x81171966 :  mov0x8(%rcx),%rsi
0x8117196a :  mov%rsi,0x8(%rax)
0x8117196e :  mov0x10(%rcx),%rsi
0x81171972 :  mov%rsi,0x10(%rax)
0x81171976 :  mov0x18(%rcx),%rsi
0x8117197a :  mov%rsi,0x18(%rax)
0x8117197e :  add$0xffe0,%edx
0x81171981 :  add$0x20,%rcx
0x81171985 :  add$0x20,%rax
0x81171989 :  test   %edx,%edx

5594 0x8053395a mb_free_ext /usr/src/sys/kern/uipc_mbuf.c:301

if (*(m->m_ext.ref_cnt) == 1 ||


I am able collect and process more measure for help
to improve FreeBSD network stack.

Do you have some idea about this?
I am don't see evident and simple points of optimisation :(

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304847 - stable/9/sys/ofed/drivers/infiniband/core

2016-08-26 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Aug 26 12:08:27 2016
New Revision: 304847
URL: https://svnweb.freebsd.org/changeset/base/304847

Log:
  MFC r304342:
  Add support for setting blocking and non-blocking mode on /dev/rdma_cm
  by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags
  handling is done by the kern_ioctl() function.
  
  Reported by:  Alex Bowden 
  Sponsored by: Mellanox Technologies

Modified:
  stable/9/sys/ofed/drivers/infiniband/core/ucma.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ofed/drivers/infiniband/core/ucma.c
==
--- stable/9/sys/ofed/drivers/infiniband/core/ucma.cFri Aug 26 12:06:43 
2016(r304846)
+++ stable/9/sys/ofed/drivers/infiniband/core/ucma.cFri Aug 26 12:08:27 
2016(r304847)
@@ -39,6 +39,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -1285,11 +1287,25 @@ static int ucma_close(struct inode *inod
return 0;
 }
 
+static long
+ucma_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+
+   switch (cmd) {
+   case FIONBIO:
+   case FIOASYNC:
+   return (0);
+   default:
+   return (-ENOTTY);
+   }
+}
+
 static const struct file_operations ucma_fops = {
.owner   = THIS_MODULE,
.open= ucma_open,
.release = ucma_close,
.write   = ucma_write,
+   .unlocked_ioctl = ucma_ioctl,
.poll= ucma_poll,
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304846 - stable/10/sys/ofed/drivers/infiniband/core

2016-08-26 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Aug 26 12:06:43 2016
New Revision: 304846
URL: https://svnweb.freebsd.org/changeset/base/304846

Log:
  MFC r304342:
  Add support for setting blocking and non-blocking mode on /dev/rdma_cm
  by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags
  handling is done by the kern_ioctl() function.
  
  Reported by:  Alex Bowden 
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/drivers/infiniband/core/ucma.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/drivers/infiniband/core/ucma.c
==
--- stable/10/sys/ofed/drivers/infiniband/core/ucma.c   Fri Aug 26 12:04:31 
2016(r304845)
+++ stable/10/sys/ofed/drivers/infiniband/core/ucma.c   Fri Aug 26 12:06:43 
2016(r304846)
@@ -39,6 +39,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -1285,11 +1287,25 @@ static int ucma_close(struct inode *inod
return 0;
 }
 
+static long
+ucma_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+
+   switch (cmd) {
+   case FIONBIO:
+   case FIOASYNC:
+   return (0);
+   default:
+   return (-ENOTTY);
+   }
+}
+
 static const struct file_operations ucma_fops = {
.owner   = THIS_MODULE,
.open= ucma_open,
.release = ucma_close,
.write   = ucma_write,
+   .unlocked_ioctl = ucma_ioctl,
.poll= ucma_poll,
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304845 - stable/11/sys/ofed/drivers/infiniband/core

2016-08-26 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Aug 26 12:04:31 2016
New Revision: 304845
URL: https://svnweb.freebsd.org/changeset/base/304845

Log:
  MFC r304342:
  Add support for setting blocking and non-blocking mode on /dev/rdma_cm
  by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags
  handling is done by the kern_ioctl() function.
  
  Reported by:  Alex Bowden 
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/ofed/drivers/infiniband/core/ucma.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ofed/drivers/infiniband/core/ucma.c
==
--- stable/11/sys/ofed/drivers/infiniband/core/ucma.c   Fri Aug 26 10:06:24 
2016(r304844)
+++ stable/11/sys/ofed/drivers/infiniband/core/ucma.c   Fri Aug 26 12:04:31 
2016(r304845)
@@ -42,6 +42,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -1345,11 +1347,25 @@ static int ucma_close(struct inode *inod
return 0;
 }
 
+static long
+ucma_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+
+   switch (cmd) {
+   case FIONBIO:
+   case FIOASYNC:
+   return (0);
+   default:
+   return (-ENOTTY);
+   }
+}
+
 static const struct file_operations ucma_fops = {
.owner   = THIS_MODULE,
.open= ucma_open,
.release = ucma_close,
.write   = ucma_write,
+   .unlocked_ioctl = ucma_ioctl,
.poll= ucma_poll,
.llseek  = no_llseek,
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304844 - stable/11/sys/kern

2016-08-26 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 26 10:06:24 2016
New Revision: 304844
URL: https://svnweb.freebsd.org/changeset/base/304844

Log:
  MFC r303388:
  Remove Giant from settime().

Modified:
  stable/11/sys/kern/kern_time.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_time.c
==
--- stable/11/sys/kern/kern_time.c  Fri Aug 26 10:04:10 2016
(r304843)
+++ stable/11/sys/kern/kern_time.c  Fri Aug 26 10:06:24 2016
(r304844)
@@ -120,9 +120,7 @@ settime(struct thread *td, struct timeva
struct timeval delta, tv1, tv2;
static struct timeval maxtime, laststep;
struct timespec ts;
-   int s;
 
-   s = splclock();
microtime();
delta = *tv;
timevalsub(, );
@@ -152,10 +150,8 @@ settime(struct thread *td, struct timeva
printf("Time adjustment clamped to -1 
second\n");
}
} else {
-   if (tv1.tv_sec == laststep.tv_sec) {
-   splx(s);
+   if (tv1.tv_sec == laststep.tv_sec)
return (EPERM);
-   }
if (delta.tv_sec > 1) {
tv->tv_sec = tv1.tv_sec + 1;
printf("Time adjustment clamped to +1 
second\n");
@@ -166,10 +162,8 @@ settime(struct thread *td, struct timeva
 
ts.tv_sec = tv->tv_sec;
ts.tv_nsec = tv->tv_usec * 1000;
-   mtx_lock();
tc_setclock();
resettodr();
-   mtx_unlock();
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304843 - in stable/11/sys: compat/linprocfs fs/devfs fs/fdescfs fs/nfs fs/procfs kern net net/altq netpfil/ipfw nfs rpc/rpcsec_gss sys

2016-08-26 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 26 10:04:10 2016
New Revision: 304843
URL: https://svnweb.freebsd.org/changeset/base/304843

Log:
  MFC r303382:
  Provide the getboottime(9) and getboottimebin(9) KPI.
  
  MFC r303387:
  Prevent parallel tc_windup() calls.  Keep boottime in timehands,
  and adjust it from tc_windup().
  
  MFC notes:
  
  The boottime and boottimebin globals are still exported from
  the kernel dyn symbol table in stable/11, but their declarations are
  removed from sys/time.h.  This preserves KBI but not KPI, while all
  in-tree consumers are converted to getboottime().
  
  The variables are updated after tc_setclock_mtx is dropped, which gives
  approximately same unlocked bugs as before.
  
  The boottime and boottimebin locals in several sys/kern_tc.c functions
  were renamed by adding the '_x' suffix to avoid name conficts.

Modified:
  stable/11/sys/compat/linprocfs/linprocfs.c
  stable/11/sys/fs/devfs/devfs_vnops.c
  stable/11/sys/fs/fdescfs/fdesc_vnops.c
  stable/11/sys/fs/nfs/nfsport.h
  stable/11/sys/fs/procfs/procfs_status.c
  stable/11/sys/kern/kern_acct.c
  stable/11/sys/kern/kern_clock.c
  stable/11/sys/kern/kern_proc.c
  stable/11/sys/kern/kern_tc.c
  stable/11/sys/kern/sys_procdesc.c
  stable/11/sys/net/altq/altq_subr.c
  stable/11/sys/net/bpf.c
  stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c
  stable/11/sys/nfs/nfs_lock.c
  stable/11/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
  stable/11/sys/sys/time.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linprocfs/linprocfs.c
==
--- stable/11/sys/compat/linprocfs/linprocfs.c  Fri Aug 26 09:42:51 2016
(r304842)
+++ stable/11/sys/compat/linprocfs/linprocfs.c  Fri Aug 26 10:04:10 2016
(r304843)
@@ -447,9 +447,11 @@ linprocfs_dostat(PFS_FILL_ARGS)
struct pcpu *pcpu;
long cp_time[CPUSTATES];
long *cp;
+   struct timeval boottime;
int i;
 
read_cpu_time(cp_time);
+   getboottime();
sbuf_printf(sb, "cpu %ld %ld %ld %ld\n",
T2J(cp_time[CP_USER]),
T2J(cp_time[CP_NICE]),
@@ -624,10 +626,12 @@ static int
 linprocfs_doprocstat(PFS_FILL_ARGS)
 {
struct kinfo_proc kp;
+   struct timeval boottime;
char state;
static int ratelimit = 0;
vm_offset_t startcode, startdata;
 
+   getboottime();
sx_slock(_lock);
PROC_LOCK(p);
fill_kinfo_proc(p, );

Modified: stable/11/sys/fs/devfs/devfs_vnops.c
==
--- stable/11/sys/fs/devfs/devfs_vnops.cFri Aug 26 09:42:51 2016
(r304842)
+++ stable/11/sys/fs/devfs/devfs_vnops.cFri Aug 26 10:04:10 2016
(r304843)
@@ -707,10 +707,11 @@ devfs_getattr(struct vop_getattr_args *a
 {
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
-   int error;
struct devfs_dirent *de;
struct devfs_mount *dmp;
struct cdev *dev;
+   struct timeval boottime;
+   int error;
 
error = devfs_populate_vp(vp);
if (error != 0)
@@ -740,6 +741,7 @@ devfs_getattr(struct vop_getattr_args *a
vap->va_blocksize = DEV_BSIZE;
vap->va_type = vp->v_type;
 
+   getboottime();
 #define fix(aa)\
do {\
if ((aa).tv_sec <= 3600) {  \

Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c
==
--- stable/11/sys/fs/fdescfs/fdesc_vnops.c  Fri Aug 26 09:42:51 2016
(r304842)
+++ stable/11/sys/fs/fdescfs/fdesc_vnops.c  Fri Aug 26 10:04:10 2016
(r304843)
@@ -394,7 +394,9 @@ fdesc_getattr(struct vop_getattr_args *a
 {
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
+   struct timeval boottime;
 
+   getboottime();
vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
vap->va_fileid = VTOFDESC(vp)->fd_ix;
vap->va_uid = 0;

Modified: stable/11/sys/fs/nfs/nfsport.h
==
--- stable/11/sys/fs/nfs/nfsport.h  Fri Aug 26 09:42:51 2016
(r304842)
+++ stable/11/sys/fs/nfs/nfsport.h  Fri Aug 26 10:04:10 2016
(r304843)
@@ -872,7 +872,7 @@ int newnfs_realign(struct mbuf **, int);
 /*
  * Set boottime.
  */
-#defineNFSSETBOOTTIME(b)   ((b) = boottime)
+#defineNFSSETBOOTTIME(b)   (getboottime())
 
 /*
  * The size of directory blocks in the buffer cache.

Modified: stable/11/sys/fs/procfs/procfs_status.c
==
--- stable/11/sys/fs/procfs/procfs_status.c Fri Aug 26 09:42:51 2016
(r304842)
+++ 

svn commit: r304842 - stable/11/sys/kern

2016-08-26 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 26 09:42:51 2016
New Revision: 304842
URL: https://svnweb.freebsd.org/changeset/base/304842

Log:
  MFC r303386:
  Change ntpadj_lock to spinlock always.
  Add missed lock to ntp_update_second().

Modified:
  stable/11/sys/kern/kern_ntptime.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_ntptime.c
==
--- stable/11/sys/kern/kern_ntptime.c   Fri Aug 26 09:40:34 2016
(r304841)
+++ stable/11/sys/kern/kern_ntptime.c   Fri Aug 26 09:42:51 2016
(r304842)
@@ -162,29 +162,12 @@ static l_fp time_adj; /* tick adjust (
 
 static int64_t time_adjtime;   /* correction from adjtime(2) (usec) */
 
-static struct mtx ntpadj_lock;
-MTX_SYSINIT(ntpadj, _lock, "ntpadj",
-#ifdef PPS_SYNC
-MTX_SPIN
-#else
-MTX_DEF
-#endif
-);
+static struct mtx ntp_lock;
+MTX_SYSINIT(ntp, _lock, "ntp", MTX_SPIN);
 
-/*
- * When PPS_SYNC is defined, hardpps() function is provided which can
- * be legitimately called from interrupt filters.  Due to this, use
- * spinlock for ntptime state protection, otherwise sleepable mutex is
- * adequate.
- */
-#ifdef PPS_SYNC
-#defineNTPADJ_LOCK()   mtx_lock_spin(_lock)
-#defineNTPADJ_UNLOCK() mtx_unlock_spin(_lock)
-#else
-#defineNTPADJ_LOCK()   mtx_lock(_lock)
-#defineNTPADJ_UNLOCK() mtx_unlock(_lock)
-#endif
-#defineNTPADJ_ASSERT_LOCKED()  mtx_assert(_lock, MA_OWNED)
+#defineNTP_LOCK()  mtx_lock_spin(_lock)
+#defineNTP_UNLOCK()mtx_unlock_spin(_lock)
+#defineNTP_ASSERT_LOCKED() mtx_assert(_lock, MA_OWNED)
 
 #ifdef PPS_SYNC
 /*
@@ -271,7 +254,7 @@ ntp_gettime1(struct ntptimeval *ntvp)
 {
struct timespec atv;/* nanosecond time */
 
-   NTPADJ_ASSERT_LOCKED();
+   NTP_ASSERT_LOCKED();
 
nanotime();
ntvp->time.tv_sec = atv.tv_sec;
@@ -302,9 +285,9 @@ sys_ntp_gettime(struct thread *td, struc
 {  
struct ntptimeval ntv;
 
-   NTPADJ_LOCK();
+   NTP_LOCK();
ntp_gettime1();
-   NTPADJ_UNLOCK();
+   NTP_UNLOCK();
 
td->td_retval[0] = ntv.time_state;
return (copyout(, uap->ntvp, sizeof(ntv)));
@@ -315,9 +298,9 @@ ntp_sysctl(SYSCTL_HANDLER_ARGS)
 {
struct ntptimeval ntv;  /* temporary structure */
 
-   NTPADJ_LOCK();
+   NTP_LOCK();
ntp_gettime1();
-   NTPADJ_UNLOCK();
+   NTP_UNLOCK();
 
return (sysctl_handle_opaque(oidp, , sizeof(ntv), req));
 }
@@ -382,7 +365,7 @@ sys_ntp_adjtime(struct thread *td, struc
error = priv_check(td, PRIV_NTP_ADJTIME);
if (error != 0)
return (error);
-   NTPADJ_LOCK();
+   NTP_LOCK();
if (modes & MOD_MAXERROR)
time_maxerror = ntv.maxerror;
if (modes & MOD_ESTERROR)
@@ -484,7 +467,7 @@ sys_ntp_adjtime(struct thread *td, struc
ntv.stbcnt = pps_stbcnt;
 #endif /* PPS_SYNC */
retval = ntp_is_time_error(time_status) ? TIME_ERROR : time_state;
-   NTPADJ_UNLOCK();
+   NTP_UNLOCK();
 
error = copyout((caddr_t), (caddr_t)uap->tp, sizeof(ntv));
if (error == 0)
@@ -506,6 +489,8 @@ ntp_update_second(int64_t *adjustment, t
int tickrate;
l_fp ftemp; /* 32/64-bit temporary */
 
+   NTP_LOCK();
+
/*
 * On rollover of the second both the nanosecond and microsecond
 * clocks are updated and the state machine cranked as
@@ -627,6 +612,8 @@ ntp_update_second(int64_t *adjustment, t
else
time_status &= ~STA_PPSSIGNAL;
 #endif /* PPS_SYNC */
+
+   NTP_UNLOCK();
 }
 
 /*
@@ -690,7 +677,7 @@ hardupdate(offset)
long mtemp;
l_fp ftemp;
 
-   NTPADJ_ASSERT_LOCKED();
+   NTP_ASSERT_LOCKED();
 
/*
 * Select how the phase is to be controlled and from which
@@ -772,7 +759,7 @@ hardpps(tsp, nsec)
long u_sec, u_nsec, v_nsec; /* temps */
l_fp ftemp;
 
-   NTPADJ_LOCK();
+   NTP_LOCK();
 
/*
 * The signal is first processed by a range gate and frequency
@@ -956,7 +943,7 @@ hardpps(tsp, nsec)
time_freq = pps_freq;
 
 out:
-   NTPADJ_UNLOCK();
+   NTP_UNLOCK();
 }
 #endif /* PPS_SYNC */
 
@@ -999,11 +986,11 @@ kern_adjtime(struct thread *td, struct t
return (error);
ltw = (int64_t)delta->tv_sec * 100 + delta->tv_usec;
}
-   NTPADJ_LOCK();
+   NTP_LOCK();
ltr = time_adjtime;
if (delta != NULL)
time_adjtime = ltw;
-   NTPADJ_UNLOCK();
+   NTP_UNLOCK();
if (olddelta != NULL) {
atv.tv_sec = ltr / 100;
atv.tv_usec = ltr % 100;
___
svn-src-all@freebsd.org mailing list

svn commit: r304841 - stable/11/sys/kern

2016-08-26 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 26 09:40:34 2016
New Revision: 304841
URL: https://svnweb.freebsd.org/changeset/base/304841

Log:
  MFC r303385:
  Reduce the resettodr_lock scope to only CLOCK_SETTIME() call.

Modified:
  stable/11/sys/kern/subr_rtc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/subr_rtc.c
==
--- stable/11/sys/kern/subr_rtc.c   Fri Aug 26 09:38:25 2016
(r304840)
+++ stable/11/sys/kern/subr_rtc.c   Fri Aug 26 09:40:34 2016
(r304841)
@@ -172,11 +172,11 @@ resettodr(void)
if (disable_rtc_set || clock_dev == NULL)
return;
 
-   mtx_lock(_lock);
getnanotime();
timespecadd(, _adj);
ts.tv_sec -= utc_offset();
/* XXX: We should really set all registered RTCs */
+   mtx_lock(_lock);
error = CLOCK_SETTIME(clock_dev, );
mtx_unlock(_lock);
if (error != 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304840 - stable/11/sys/kern

2016-08-26 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 26 09:38:25 2016
New Revision: 304840
URL: https://svnweb.freebsd.org/changeset/base/304840

Log:
  MFC r303384:
  Style.

Modified:
  stable/11/sys/kern/kern_tc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_tc.c
==
--- stable/11/sys/kern/kern_tc.cFri Aug 26 09:36:45 2016
(r304839)
+++ stable/11/sys/kern/kern_tc.cFri Aug 26 09:38:25 2016
(r304840)
@@ -154,7 +154,7 @@ sysctl_kern_timecounter_get(SYSCTL_HANDL
struct timecounter *tc = arg1;
 
ncount = tc->tc_get_timecount(tc);
-   return sysctl_handle_int(oidp, , 0, req);
+   return (sysctl_handle_int(oidp, , 0, req));
 }
 
 static int
@@ -164,7 +164,7 @@ sysctl_kern_timecounter_freq(SYSCTL_HAND
struct timecounter *tc = arg1;
 
freq = tc->tc_frequency;
-   return sysctl_handle_64(oidp, , 0, req);
+   return (sysctl_handle_64(oidp, , 0, req));
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304839 - stable/11/sys/kern

2016-08-26 Thread Konstantin Belousov
Author: kib
Date: Fri Aug 26 09:36:45 2016
New Revision: 304839
URL: https://svnweb.freebsd.org/changeset/base/304839

Log:
  MFC r303383:
  Reduce number of timehands to just two.

Modified:
  stable/11/sys/kern/kern_tc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_tc.c
==
--- stable/11/sys/kern/kern_tc.cFri Aug 26 08:25:28 2016
(r304838)
+++ stable/11/sys/kern/kern_tc.cFri Aug 26 09:36:45 2016
(r304839)
@@ -76,25 +76,15 @@ struct timehands {
 };
 
 static struct timehands th0;
-static struct timehands th9 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
-static struct timehands th8 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
-static struct timehands th7 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
-static struct timehands th6 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
-static struct timehands th5 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
-static struct timehands th4 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
-static struct timehands th3 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
-static struct timehands th2 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
-static struct timehands th1 = { NULL, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0, 
};
+static struct timehands th1 = {
+   .th_next = 
+};
 static struct timehands th0 = {
-   _timecounter,
-   0,
-   (uint64_t)-1 / 100,
-   0,
-   {1, 0},
-   {0, 0},
-   {0, 0},
-   1,
-   
+   .th_counter = _timecounter,
+   .th_scale = (uint64_t)-1 / 100,
+   .th_offset = { .sec = 1 },
+   .th_generation = 1,
+   .th_next = 
 };
 
 static struct timehands *volatile timehands = 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304838 - head/sys/ofed/drivers/infiniband/core

2016-08-26 Thread Navdeep Parhar
Author: np
Date: Fri Aug 26 08:25:28 2016
New Revision: 304838
URL: https://svnweb.freebsd.org/changeset/base/304838

Log:
  Do not free an uninitialized pointer on soaccept failure in the iWARP
  connection manager.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/ofed/drivers/infiniband/core/iwcm.c

Modified: head/sys/ofed/drivers/infiniband/core/iwcm.c
==
--- head/sys/ofed/drivers/infiniband/core/iwcm.cFri Aug 26 07:49:23 
2016(r304837)
+++ head/sys/ofed/drivers/infiniband/core/iwcm.cFri Aug 26 08:25:28 
2016(r304838)
@@ -438,6 +438,7 @@ dequeue_socket(struct socket *head)
so->so_state |= SS_NBIO;
SOCK_UNLOCK(so);
ACCEPT_UNLOCK();
+   remote = NULL;
soaccept(so, (struct sockaddr **));
 
free(remote, M_SONAME);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304837 - head/sys/netinet

2016-08-26 Thread Michael Tuexen
Author: tuexen
Date: Fri Aug 26 07:49:23 2016
New Revision: 304837
URL: https://svnweb.freebsd.org/changeset/base/304837

Log:
  Fix a bug, where no SACK is sent when receiving a FORWARD-TSN or
  I-FORWARD-TSN chunk before any DATA or I-DATA chunk.
  
  Thanks to Julian Cordes for finding this problem and prividing
  packetdrill scripts to reporduce the issue.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Fri Aug 26 06:19:12 2016
(r304836)
+++ head/sys/netinet/sctp_input.c   Fri Aug 26 07:49:23 2016
(r304837)
@@ -5515,6 +5515,11 @@ process_control_chunks:
*offset = length;
return (NULL);
}
+   /*
+* For sending a SACK this looks like DATA
+* chunks.
+*/
+   stcb->asoc.last_data_chunk_from = 
stcb->asoc.last_control_chunk_from;
sctp_handle_forward_tsn(stcb,
(struct sctp_forward_tsn_chunk *)ch, 
_flag, m, *offset);
if (abort_flag) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r303988 - head/lib/libc/gen

2016-08-26 Thread Ed Schouten
Hi,

2016-08-26 1:52 GMT+02:00 Bryan Drewery :
> Libc wouldn't build, it complained quite loudly with a lot of these:

Got it. Thinking ahead, if it's just basename() giving the problems,
maybe it's easier to just go ahead and bump the symver of basename()
as well? I'm planning on replacing it anyway to be in sync with the
new basename() anyway. Attached is a new patch. Be sure to let me know
whether that works for you.

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
Index: include/libgen.h
===
--- include/libgen.h(revision 304750)
+++ include/libgen.h(working copy)
@@ -39,4 +39,26 @@
 char   *dirname(char *);
 __END_DECLS
 
+/*
+ * In FreeBSD 12, the prototype of basename() and dirname() was modified
+ * to comply to POSIX. These functions may now modify their input.
+ * Unfortunately, our copy of xinstall(8) shipped with previous versions
+ * of FreeBSD is built using the host headers and libc during the
+ * bootstrapping phase and depends on the old behavior.
+ *
+ * Apply a workaround where we explicitly link against basename@FBSD_1.0
+ * and dirname@FBSD_1.0 in case these functions are called on constant
+ * strings, instead of making the build fail.
+ */
+#if defined(__generic) && !defined(__cplusplus)
+__BEGIN_DECLS
+char   *__old_basename(const char *);
+char   *__old_dirname(const char *);
+__END_DECLS
+__sym_compat(basename, __old_basename, FBSD_1.0);
+__sym_compat(dirname, __old_dirname, FBSD_1.0);
+#definebasename(x) __generic(x, const char *, __old_basename, 
basename)(x)
+#definedirname(x)  __generic(x, const char *, __old_dirname, 
dirname)(x)
+#endif
+
 #endif /* !_LIBGEN_H_ */
Index: lib/libc/gen/Symbol.map
===
--- lib/libc/gen/Symbol.map (revision 304750)
+++ lib/libc/gen/Symbol.map (working copy)
@@ -68,7 +68,6 @@
arc4random_addrandom;
arc4random_stir;
__assert;
-   basename;
check_utility_compat;
clock;
closedir;
@@ -418,6 +417,7 @@
 };
 
 FBSD_1.5 {
+   basename;
dirname;
 };
 
Index: lib/libc/gen/basename.c
===
--- lib/libc/gen/basename.c (revision 304750)
+++ lib/libc/gen/basename.c (working copy)
@@ -66,7 +66,7 @@
 }
 
 char *
-basename(char *path)
+__freebsd11_basename(char *path)
 {
static char *bname = NULL;
 
@@ -77,3 +77,13 @@
}
return (basename_r(path, bname));
 }
+
+__sym_compat(basename, __freebsd11_basename, FBSD_1.0);
+
+char *
+(basename)(char *path)
+{
+
+   /* TODO(ed): Replace this by a thread-safe version, like dirname(3). */
+   return (__freebsd11_basename(path));
+}
Index: lib/libc/gen/dirname.c
===
--- lib/libc/gen/dirname.c  (revision 304750)
+++ lib/libc/gen/dirname.c  (working copy)
@@ -31,7 +31,7 @@
 #include 
 
 char *
-dirname(char *path)
+(dirname)(char *path)
 {
const char *in, *prev, *begin, *end;
char *out;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r304836 - stable/10/sys/netinet

2016-08-26 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Aug 26 06:19:12 2016
New Revision: 304836
URL: https://svnweb.freebsd.org/changeset/base/304836

Log:
  MFC 303766
  tcp/lro: If timestamps mismatch or it's a FIN, force flush.
  
  This keeps the segments/ACK/FIN delivery order.
  
  Before this patch, it was observed: if A sent FIN immediately after
  an ACK, B would deliver FIN first to the TCP stack, then the ACK.
  This out-of-order delivery causes one unnecessary ACK sent from B.
  
  Reviewed by:gallatin, hps
  Obtained from:  rrs, gallatin
  Sponsored by:   Netflix (rrs, gallatin), Microsoft (sephe)
  Differential Revision:  https://reviews.freebsd.org/D7415

Modified:
  stable/10/sys/netinet/tcp_lro.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_lro.c
==
--- stable/10/sys/netinet/tcp_lro.c Fri Aug 26 05:37:44 2016
(r304835)
+++ stable/10/sys/netinet/tcp_lro.c Fri Aug 26 06:19:12 2016
(r304836)
@@ -382,6 +382,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
tcp_seq seq;
int error, ip_len, l;
uint16_t eh_type, tcp_data_len;
+   int force_flush = 0;
 
/* We expect a contiguous header [eh, ip, tcp]. */
 
@@ -448,8 +449,15 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 * Check TCP header constraints.
 */
/* Ensure no bits set besides ACK or PSH. */
-   if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0)
-   return (TCP_LRO_CANNOT);
+   if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) {
+   if (th->th_flags & TH_SYN)
+   return (TCP_LRO_CANNOT);
+   /*
+* Make sure that previously seen segements/ACKs are delivered
+* before this segement, e.g. FIN.
+*/
+   force_flush = 1;
+   }
 
/* XXX-BZ We lose a ACK|PUSH flag concatenating multiple segments. */
/* XXX-BZ Ideally we'd flush on PUSH? */
@@ -465,8 +473,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
ts_ptr = (uint32_t *)(th + 1);
if (l != 0 && (__predict_false(l != TCPOLEN_TSTAMP_APPA) ||
(*ts_ptr != ntohl(TCPOPT_NOP<<24|TCPOPT_NOP<<16|
-   TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP
-   return (TCP_LRO_CANNOT);
+   TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP {
+   /*
+* Make sure that previously seen segements/ACKs are delivered
+* before this segement.
+*/
+   force_flush = 1;
+   }
 
/* If the driver did not pass in the checksum, set it now. */
if (csum == 0x)
@@ -500,6 +513,13 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 #endif
}
 
+   if (force_flush) {
+   /* Timestamps mismatch; this is a FIN, etc */
+   SLIST_REMOVE(>lro_active, le, lro_entry, next);
+   tcp_lro_flush(lc, le);
+   return (TCP_LRO_CANNOT);
+   }
+
/* Flush now if appending will result in overflow. */
if (le->p_len > (65535 - tcp_data_len)) {
SLIST_REMOVE(>lro_active, le, lro_entry, next);
@@ -568,6 +588,14 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
return (0);
}
 
+   if (force_flush) {
+   /*
+* Nothing to flush, but this segment can not be further
+* aggregated/delayed.
+*/
+   return (TCP_LRO_CANNOT);
+   }
+
/* Try to find an empty slot. */
if (SLIST_EMPTY(>lro_free))
return (TCP_LRO_NO_ENTRIES);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304835 - stable/11/sys/netinet

2016-08-26 Thread hiren panchasara
On 08/26/16 at 05:37P, Sepherosa Ziehau wrote:
> Author: sephe
> Date: Fri Aug 26 05:37:44 2016
> New Revision: 304835
> URL: https://svnweb.freebsd.org/changeset/base/304835
> 
> Log:
>   MFC 303766

Thanks!

Cheers,
Hiren


pgpTQwTTkL1ou.pgp
Description: PGP signature


Re: svn commit: r303656 - head/sys/netinet

2016-08-26 Thread hiren panchasara
On 08/26/16 at 09:23P, Sepherosa Ziehau wrote:
> On Fri, Aug 26, 2016 at 1:54 AM, hiren panchasara
>  wrote:
> > On 08/02/16 at 06:36P, Sepherosa Ziehau wrote:
> >> Author: sephe
> >> Date: Tue Aug  2 06:36:47 2016
> >> New Revision: 303656
> >> URL: https://svnweb.freebsd.org/changeset/base/303656
> >>
> >> Log:
> >>   tcp/lro: Implement hash table for LRO entries.
> >>
> >>   This significantly improves HTTP workload performance and reduces
> >>   HTTP workload latency.
> >>
> >>   Reviewed by:rrs, gallatin, hps
> >>   Obtained from:  rrs, gallatin
> >>   Sponsored by:   Netflix (rrs, gallatin) , Microsoft (sephe)
> >>   Differential Revision:  https://reviews.freebsd.org/D6689
> >
> > Hi Sephe,
> >
> > Can you please MFC this to stable/11?
> 
> I don't think this one can be MFC'ed, since it changes the size of LRO
> control struct, which is usually embedded in the driver's softc/RX
> ring struct.

Ah, okay. Thanks for checking.
Cheers,
Hiren


pgp8SKbngNbbp.pgp
Description: PGP signature