svn commit: r324478 - in head: sbin/growfs/tests tests/sys/geom/class/eli

2017-10-09 Thread Ngie Cooper
Author: ngie
Date: Tue Oct 10 05:58:33 2017
New Revision: 324478
URL: https://svnweb.freebsd.org/changeset/base/324478

Log:
  Check the exit code from fsck_ffs instead of relying on MODIFIED being in the 
output
  
  ^/head@r323923 changed when MODIFIED is printed at exit. It's better to 
follow the
  documented way of determining whether or not a filesystem is clean per 
fsck_ffs, i.e.,
  ensure that the exit code is either 0 or 7.
  
  The pass/fail determination is brittle prior to this commit, and 
^/head@r323923 made
  the issue apparent -- thus this needs to be fixed independent of 
^/head@r323923.
  
  PR:   222780
  MFC after:1 week
  MFC with: r323923
  Reported by:  Jenkins

Modified:
  head/sbin/growfs/tests/legacy_test.pl
  head/tests/sys/geom/class/eli/resize_test.sh

Modified: head/sbin/growfs/tests/legacy_test.pl
==
--- head/sbin/growfs/tests/legacy_test.pl   Tue Oct 10 05:52:28 2017
(r324477)
+++ head/sbin/growfs/tests/legacy_test.pl   Tue Oct 10 05:58:33 2017
(r324478)
@@ -2,6 +2,7 @@
 
 use strict;
 use warnings;
+use POSIX;
 use Test::More tests => 19;
 use Fcntl qw(:DEFAULT :seek);
 
@@ -11,6 +12,22 @@ use constant BLKS_PER_MB => 2048;
 my $unit;
 END { system "mdconfig -du$unit" if defined $unit };
 
+sub fsck_md {
+my ($is_clean, $md);
+
+$md = shift;
+
+chomp(my @fsck_output = `fsck_ffs -Ffy ${md}a`);
+$is_clean = WIFEXITED($?) &&
+   (WEXITSTATUS($?) == 0 || WEXITSTATUS($?) == 7);
+ok($is_clean, "checking ${md}a's filesystem");
+if ($is_clean) {
+   diag "filesystem reported clean";
+} else {
+   diag "filesystem not reported clean: " . join("\n", @fsck_output);
+}
+}
+
 sub setsize {
 my ($partszMB, $unitszMB) = @_;
 
@@ -46,9 +63,8 @@ SKIP: {
ok(setsize(10, 40), "Sized ${md}a to 10m");
system "newfs -O $type -U ${md}a >/dev/null";
is($?, 0, "Initialised the filesystem on ${md}a as UFS$type");
-   chomp(my @out = `fsck -tufs -y ${md}a`);
-   ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " .
-   scalar(@out) . " lines of output");
+
+   fsck_md($md);
}
 
extend20_zeroed: {
@@ -62,9 +78,7 @@ SKIP: {
fill(30 * BLKS_PER_MB - $unallocated, $unallocated, chr(0))
if $unallocated;
 
-   chomp(my @out = `fsck -tufs -y ${md}a`);
-   ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " .
-   scalar(@out) . " lines of output");
+   fsck_md($md);
}
 
extend30_garbaged: {
@@ -78,9 +92,7 @@ SKIP: {
fill(30 * BLKS_PER_MB - $unallocated, $unallocated, chr(0))
if $unallocated;
 
-   chomp(my @out = `fsck -tufs -y ${md}a`);
-   ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " .
-   scalar(@out) . " lines of output");
+   fsck_md($md);
}
 }
 

Modified: head/tests/sys/geom/class/eli/resize_test.sh
==
--- head/tests/sys/geom/class/eli/resize_test.shTue Oct 10 05:52:28 
2017(r324477)
+++ head/tests/sys/geom/class/eli/resize_test.shTue Oct 10 05:58:33 
2017(r324478)
@@ -12,6 +12,19 @@ md=$(mdconfig -s40m) || exit 1
 unit=${md#md}
 i=1
 
+fsck_md()
+{
+   local is_clean
+
+   out=$(fsck_ffs -Ffy ${md}a.eli)
+   if [ $? -eq 0 -o $? -eq 7 ]; then
+   echo "ok $i - fsck says ${md}a.eli is clean"
+   else
+   echo "not ok $i - fsck says ${md}a.eli is dirty"
+   fi
+   i=$((i + 1))
+}
+
 setsize() {
 partszMB=$1 unitszMB=$2
 
@@ -38,13 +51,8 @@ i=$((i + 1))
 newfs -U ${md}a.eli >/dev/null || echo -n "not "
 echo ok $i - "Initialised the filesystem on ${md}a.eli"
 i=$((i + 1))
-out=$(fsck -tufs -y ${md}a.eli)
-echo "$out" | fgrep -q MODIFIED && echo -n "not "
-echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
-"lines of output"
-i=$((i + 1))
+fsck_md
 
-
 # Doing a backup, resize & restore must be forced (with -f) as geli
 # verifies that the provider size in the metadata matches the consumer.
 
@@ -78,13 +86,8 @@ growfs -y ${md}a.eli >/dev/null || echo -n "not "
 echo ok $i - "Extended the filesystem on ${md}a.eli"
 i=$((i + 1))
 
-out=$(fsck -tufs -y ${md}a.eli)
-echo "$out" | fgrep -q MODIFIED && echo -n "not "
-echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
-"lines of output"
-i=$((i + 1))
+fsck_md
 
-
 # Now do the resize properly
 
 geli detach ${md}a.eli || echo -n "not "
@@ -110,11 +113,7 @@ growfs -y ${md}a.eli >/dev/null || echo -n "not "
 echo ok $i - "Extended the filesystem on ${md}a.eli"
 i=$((i + 1))
 
-out=$(fsck -tufs -y ${md}a.eli)
-echo "$out" | fgrep -q MODIFIED && echo -n "not "
-echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo 

svn commit: r324476 - head/share/misc

2017-10-09 Thread Eitan Adler
Author: eadler
Date: Tue Oct 10 05:47:10 2017
New Revision: 324476
URL: https://svnweb.freebsd.org/changeset/base/324476

Log:
  Add OpenBSD 6.2, reorder macOS 10.13

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Tue Oct 10 05:46:57 2017
(r324475)
+++ head/share/misc/bsd-family-tree Tue Oct 10 05:47:10 2017
(r324476)
@@ -351,12 +351,12 @@ FreeBSD 5.2   |  | |  
  *--FreeBSD   | macOS|OpenBSD 6.0  |
  |   11.0 | 10.12| |   |
  | |  |   |   NetBSD 7.1   |   |
- | |  |   |  | |   DragonFly 4.8.0
- | |  |   |  |OpenBSD 6.1  |
+ | |  | macOS| |   DragonFly 4.8.0
+ | |  | 10.13|OpenBSD 6.1  |
  |  FreeBSD   |   |  | |   |
  |   11.1  FreeBSD|  | |   |
- | |10.4macOS| |   |
- | v10.13| |   |
+ | |10.4  |  |OpenBSD 6.2  |
+ | v  |  | |   |
  ||  | |   |
 FreeBSD 12 -current   |  NetBSD -current  OpenBSD -currentDragonFly 
-current
  ||  | |   |
@@ -719,6 +719,7 @@ OpenBSD 6.1 2017-04-11 [OBD]
 FreeBSD 11.1   2017-07-26 [FBD]
 macOS 10.132017-09-25 [APL]
 FreeBSD 10.4   2017-10-03 [FBD]
+OpenBSD 6.22017-10-09 [OBD]
 
 Bibliography
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324471 - head/sys/boot

2017-10-09 Thread Ngie Cooper (yaneurabeya)

> On Oct 9, 2017, at 21:56, Warner Losh  wrote:
> 
> DO NOT MAKE EDITS TO sys/boot. YOU ARE CREATING CONFLICTS FOR ME.
> 
> DO NOT MAKE ANY COMMITS TO sys/boot.
> 
> BACK OFF.
> 
> Seriously, though, extra changes create extra friction, and these changes 
> aren't worth any friction at all. I'm deleting LIBSAU and this guarantees a 
> conflict when I update.
> 
> So please, do not make any edits to sys/boot whatsoever, no matter how 
> trivial.
> 
> At least until I'm done.

Ok


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r324471 - head/sys/boot

2017-10-09 Thread Warner Losh
DO NOT MAKE EDITS TO sys/boot. YOU ARE CREATING CONFLICTS FOR ME.

DO NOT MAKE ANY COMMITS TO sys/boot.

BACK OFF.

Seriously, though, extra changes create extra friction, and these changes
aren't worth any friction at all. I'm deleting LIBSAU and this guarantees a
conflict when I update.

So please, do not make any edits to sys/boot whatsoever, no matter how
trivial.

At least until I'm done.

Thanks.

Warner

On Mon, Oct 9, 2017 at 10:53 PM, Ngie Cooper  wrote:

> Author: ngie
> Date: Tue Oct 10 04:53:26 2017
> New Revision: 324471
> URL: https://svnweb.freebsd.org/changeset/base/324471
>
> Log:
>   Fix typos: `stand alon{e,g}` should be spelled like `standalone`
>
> Modified:
>   head/sys/boot/Makefile.inc
>
> Modified: head/sys/boot/Makefile.inc
> 
> ==
> --- head/sys/boot/Makefile.inc  Tue Oct 10 04:50:05 2017(r324470)
> +++ head/sys/boot/Makefile.inc  Tue Oct 10 04:53:26 2017(r324471)
> @@ -6,11 +6,11 @@
>  __BOOT_MAKEFILE_INC__=${MFILE}
>
>  SASRC=${SRCTOP}/lib/libstand
> -# Normal stand alone library
> +# Normal standalone library
>  LIBSA=${OBJTOP}/sys/boot/libsa/libstand.a
> -# stand alone library compiled for 32-bit version of the processor
> +# Standalone library compiled for 32-bit version of the processor
>  LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a
> -# stand along library compiled for userboot
> +# Standalone library compiled for userboot
>  LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a
>
>  CFLAGS+=-I${SASRC}
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324471 - head/sys/boot

2017-10-09 Thread Ngie Cooper
Author: ngie
Date: Tue Oct 10 04:53:26 2017
New Revision: 324471
URL: https://svnweb.freebsd.org/changeset/base/324471

Log:
  Fix typos: `stand alon{e,g}` should be spelled like `standalone`

Modified:
  head/sys/boot/Makefile.inc

Modified: head/sys/boot/Makefile.inc
==
--- head/sys/boot/Makefile.inc  Tue Oct 10 04:50:05 2017(r324470)
+++ head/sys/boot/Makefile.inc  Tue Oct 10 04:53:26 2017(r324471)
@@ -6,11 +6,11 @@
 __BOOT_MAKEFILE_INC__=${MFILE}
 
 SASRC=${SRCTOP}/lib/libstand
-# Normal stand alone library
+# Normal standalone library
 LIBSA=${OBJTOP}/sys/boot/libsa/libstand.a
-# stand alone library compiled for 32-bit version of the processor
+# Standalone library compiled for 32-bit version of the processor
 LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a
-# stand along library compiled for userboot
+# Standalone library compiled for userboot
 LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a
 
 CFLAGS+=-I${SASRC}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324470 - head/sys/modules/iwmfw

2017-10-09 Thread Ngie Cooper
Author: ngie
Date: Tue Oct 10 04:50:05 2017
New Revision: 324470
URL: https://svnweb.freebsd.org/changeset/base/324470

Log:
  Add missing SUBDIR needed for iwmfw to load after ^/head@r324434
  
  Submitted by: Pete Wright 
  MFC after:1 month
  MFC with: r324434

Modified:
  head/sys/modules/iwmfw/Makefile

Modified: head/sys/modules/iwmfw/Makefile
==
--- head/sys/modules/iwmfw/Makefile Tue Oct 10 04:47:01 2017
(r324469)
+++ head/sys/modules/iwmfw/Makefile Tue Oct 10 04:50:05 2017
(r324470)
@@ -4,6 +4,7 @@ SUBDIR= iwm3160fw \
iwm7260fw \
iwm7265fw \
iwm7265Dfw \
-   iwm8000Cfw
+   iwm8000Cfw \
+   iwm8265fw
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324469 - head/sys/modules/iwmfw

2017-10-09 Thread Ngie Cooper
Author: ngie
Date: Tue Oct 10 04:47:01 2017
New Revision: 324469
URL: https://svnweb.freebsd.org/changeset/base/324469

Log:
  Sort SUBDIR and put entries on a single list
  
  This is to aid with identifying diffs between commits.
  
  MFC after:3 days

Modified:
  head/sys/modules/iwmfw/Makefile

Modified: head/sys/modules/iwmfw/Makefile
==
--- head/sys/modules/iwmfw/Makefile Tue Oct 10 03:40:38 2017
(r324468)
+++ head/sys/modules/iwmfw/Makefile Tue Oct 10 04:47:01 2017
(r324469)
@@ -1,5 +1,9 @@
 # $FreeBSD$
 
-SUBDIR=iwm3160fw iwm7260fw iwm7265fw iwm8000Cfw iwm7265Dfw
+SUBDIR=iwm3160fw \
+   iwm7260fw \
+   iwm7265fw \
+   iwm7265Dfw \
+   iwm8000Cfw
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324452 - in head/sys/boot: . arm/uboot efi/boot1 efi/loader i386/gptboot i386/gptzfsboot i386/loader i386/zfsboot mips/beri/boot2 mips/beri/loader mips/uboot powerpc/kboot powerpc/ofw

2017-10-09 Thread Ngie Cooper (yaneurabeya)

> On Oct 9, 2017, at 16:23, John Baldwin  wrote:

…

> s/along/alone/.  bde@ probably prefers that the comments start with a capital
> letter as well.

Also: standalone is one word, not 2.
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r324406 - head/sys/modules/em

2017-10-09 Thread Ngie Cooper (yaneurabeya)

> On Oct 9, 2017, at 18:54, Ian Lepore  wrote:

...

> I think the right answer here is just
> 
>   LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_igb.ko

That will definitely work and is probably the best pattern.
Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r324457 - in head/sys/dev: pccbb pci

2017-10-09 Thread Bruce Evans

On Mon, 9 Oct 2017, Alan Somers wrote:


Log:
 Remove embedded newlines from sysctl variable descriptions


This doesn't fix the main bug of writing man pages in sysctl descriptions.


Modified: head/sys/dev/pccbb/pccbb_isa.c
==
--- head/sys/dev/pccbb/pccbb_isa.c  Mon Oct  9 22:19:58 2017
(r324456)
+++ head/sys/dev/pccbb/pccbb_isa.c  Mon Oct  9 22:27:38 2017
(r324457)
@@ -75,11 +75,11 @@ static SYSCTL_NODE(_hw, OID_AUTO, pcic, CTLFLAG_RD, 0,

static int isa_intr_mask = EXCA_INT_MASK_ALLOWED;
SYSCTL_INT(_hw_pcic, OID_AUTO, intr_mask, CTLFLAG_RDTUN, _intr_mask, 0,
-"Mask of allowable interrupts for this laptop.  The default is generally\n\
-correct, but some laptops do not route all the IRQ pins to the bridge to\n\
-save wires.  Sometimes you need a more restrictive mask because some of the\n\
-hardware in your laptop may not have a driver so its IRQ might not be\n\
-allocated.");
+"Mask of allowable interrupts for this laptop.  The default is generally"
+" correct, but some laptops do not route all the IRQ pins to the bridge to"
+" save wires.  Sometimes you need a more restrictive mask because some of"
+" the hardware in your laptop may not have a driver so its IRQ might not 
be"
+" allocated.");


More low quality sysctl messages can be found using

sysctl -da | grep -v ': '  # Sloppy check for embedded newlines
sysctl -da | grep '^[^ ]*: [^A-Z]' # Uncapitalized messages
previous | grep '^dev.*%'' # Auto-generated spam for dev tree
sysctl -da | grep '[^.]*\.$'   # Terminating period
sysctl -da | grep '^[^ ]*: .*\..*\.$' # Multiple sentence, term. period
sysctl -da | grep '^[^ ]*: .*\..*[^.]$' # Period, but not terminating
sysctl -da | grep '\.  '   # Normal sentence break
sysctl -da | grep '\. [^.]'# Misformatted sentence break
sysctl -da | grep '..' # (Really 80 dots).  Long lines

Results on freefall:
- 3294 lines of output
- 7 lines with embedded newlines
- 1041 lines with uncapitalized messages
- 637 lines with previous bug auto-generated for dev tree.  Approx 5 lines
  duplicated for each device
- 109 lines with a terminating period but no other periods
- 5 lines with multiple sentences and a terminating period
- 43 lines with a period but not a terminating period.  This is a sloppy
  check for multiple sentences.  It finds a few correct descriptions with
  periods in sysctl names
- 7 lines with normal sentence breaks.  Half for man pages in sysctls in
  this commit
- 17 lines with single-space sentence breaks
- 359 long lines.  Not counting the sysctl name or ': ', only 30 lines are
  too long.  These lines and ones up to about 10 shorter are also too long
  for source lines.

Another type of search finds inconsistent spellings of booleans.  grep -i
for literal "disable" shows 63 lines with the following inconsistencies
and verboseness:
- often "disable" in the description echoes "disable" in the sysctl name.
  But sometimes the sysctl uses "control", or the sysctl name uses "disable"
  but the description uses "disallow"
- when the description uses "Enable/disable" (10 instances), the name uses
  "allow" (2 instances), "use" (1 instance), "enable "(1 instance) or is
  not clearly boolean (6 instances),
- often (in usb cloned descriptions), "Disable is spelled verbosely as
  "Set to disable".  This is still not verbose enough to say that unset
  means "enable" or even "don't disable".  Disable/enable is never used.

For integer variables, there are lots of inconsistences and verboseness
involving "number/number of/num/n".

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


Re: svn commit: r324446 - in head: share/man/man9 sys/compat/ndis sys/dev/cas sys/dev/cxgbe sys/dev/cxgbe/tom sys/dev/dpaa sys/dev/if_ndis sys/dev/iscsi_initiator sys/dev/lge sys/dev/mwl sys/dev/netma

2017-10-09 Thread Julian Elischer

On 10/10/17 4:35 am, Gleb Smirnoff wrote:

Author: glebius
Date: Mon Oct  9 20:35:31 2017
New Revision: 324446
URL: https://svnweb.freebsd.org/changeset/base/324446

Log:
   Shorten list of arguments to mbuf external storage freeing function.
   
   All of these arguments are stored in m_ext, so there is no reason

   to pass them in the argument list.  Not all functions need the second
   argument, some don't even need the first one.  The second argument
   lives in next cache line, so not dereferencing it is a performance
   gain.  This was discovered in sendfile(2), which will be covered by
   next commits.
   
Originally the external free function was not necessarily freeing 
things that were mbuf related.
In fact in one early use the items being freed were used by both the 
network layer and the disk io layer.

The disk layer had no idea what an m_ext was or an mbuf for that matter.



   The second goal of this commit is to bring even more flexibility
   to m_ext mbufs, allowing to create more fields in m_ext, opaque to
   the generic mbuf code, and potentially set and dereferenced by
   subsystems.
   
   Reviewed by:	gallatin, kbowling

   Differential Revision:   https://reviews.freebsd.org/D12615

Modified:
   head/share/man/man9/mbpool.9
   head/share/man/man9/mbuf.9
   head/sys/compat/ndis/kern_ndis.c
   head/sys/compat/ndis/ndis_var.h
   head/sys/dev/cas/if_cas.c
   head/sys/dev/cas/if_casvar.h
   head/sys/dev/cxgbe/t4_sge.c
   head/sys/dev/cxgbe/tom/t4_cpl_io.c
   head/sys/dev/dpaa/if_dtsec_rm.c
   head/sys/dev/if_ndis/if_ndis.c
   head/sys/dev/iscsi_initiator/isc_soc.c
   head/sys/dev/lge/if_lge.c
   head/sys/dev/mwl/if_mwl.c
   head/sys/dev/netmap/netmap_generic.c
   head/sys/dev/wb/if_wb.c
   head/sys/kern/kern_mbuf.c
   head/sys/kern/subr_mbpool.c
   head/sys/sys/mbpool.h
   head/sys/sys/mbuf.h

Modified: head/share/man/man9/mbpool.9
==
--- head/share/man/man9/mbpool.9Mon Oct  9 18:33:29 2017
(r324445)
+++ head/share/man/man9/mbpool.9Mon Oct  9 20:35:31 2017
(r324446)
@@ -27,7 +27,7 @@
  .\"
  .\" $FreeBSD$
  .\"
-.Dd July 15, 2003
+.Dd September 27, 2017
  .Dt MBPOOL 9
  .Os
  .Sh NAME
@@ -50,7 +50,7 @@
  .Ft void
  .Fn mbp_free "struct mbpool *mbp" "void *p"
  .Ft void
-.Fn mbp_ext_free "void *" "void *"
+.Fn mbp_ext_free "struct mbuf *"
  .Ft void
  .Fn mbp_card_free "struct mbpool *mbp"
  .Ft void
@@ -223,8 +223,6 @@ The function
  can be given to
  .Fn m_extadd
  as the free function.
-The user argument must be the pointer to
-the pool.
  .Pp
  Before using the contents of a buffer returned by the card, the driver
  must call

Modified: head/share/man/man9/mbuf.9
==
--- head/share/man/man9/mbuf.9  Mon Oct  9 18:33:29 2017(r324445)
+++ head/share/man/man9/mbuf.9  Mon Oct  9 20:35:31 2017(r324446)
@@ -24,7 +24,7 @@
  .\"
  .\" $FreeBSD$
  .\"
-.Dd October 10, 2016
+.Dd September 27, 2017
  .Dt MBUF 9
  .Os
  .\"
@@ -44,12 +44,12 @@
  .Fn MCLGET "struct mbuf *mbuf" "int how"
  .Fo MEXTADD
  .Fa "struct mbuf *mbuf"
-.Fa "caddr_t buf"
+.Fa "char *buf"
  .Fa "u_int size"
-.Fa "void (*free)(void *opt_arg1, void *opt_arg2)"
+.Fa "void (*free)(struct mbuf *)"
  .Fa "void *opt_arg1"
  .Fa "void *opt_arg2"
-.Fa "short flags"
+.Fa "int flags"
  .Fa "int type"
  .Fc
  .\"
@@ -416,8 +416,13 @@ The
  .Fa opt_arg1
  and
  .Fa opt_arg2
-arguments will be passed unmodified to
-.Fa free .
+arguments will be saved in
+.Va ext_arg1
+and
+.Va ext_arg2
+fields of the
+.Va struct m_ext
+of the mbuf.
  The
  .Fa flags
  argument specifies additional

Modified: head/sys/compat/ndis/kern_ndis.c
==
--- head/sys/compat/ndis/kern_ndis.cMon Oct  9 18:33:29 2017
(r324445)
+++ head/sys/compat/ndis/kern_ndis.cMon Oct  9 20:35:31 2017
(r324446)
@@ -495,17 +495,21 @@ ndis_return(dobj, arg)
KeReleaseSpinLock(>nmb_returnlock, irql);
  }
  
+static void

+ndis_ext_free(struct mbuf *m)
+{
+
+   return (ndis_return_packet(m->m_ext.ext_arg1));
+}
+
  void
-ndis_return_packet(struct mbuf *m, void *buf, void *arg)
+ndis_return_packet(ndis_packet *p)
  {
-   ndis_packet *p;
ndis_miniport_block *block;
  
-	if (arg == NULL)

+   if (p == NULL)
return;
  
-	p = arg;

-
/* Decrement refcount. */
p->np_refcnt--;
  
@@ -676,9 +680,8 @@ ndis_ptom(m0, p)

return (ENOBUFS);
}
m->m_len = MmGetMdlByteCount(buf);
-   m->m_data = MmGetMdlVirtualAddress(buf);
-   MEXTADD(m, m->m_data, m->m_len, ndis_return_packet,
-   m->m_data, p, 0, EXT_NDIS);
+   m_extadd(m, MmGetMdlVirtualAddress(buf), m->m_len,
+   ndis_ext_free, p, NULL, 0, EXT_NDIS);

Re: svn commit: r324406 - head/sys/modules/em

2017-10-09 Thread Ian Lepore
On Mon, 2017-10-09 at 18:17 -0600, Sean Bruno wrote:
> 
> On 10/09/17 14:33, Brooks Davis wrote:
> > 
> > On Sun, Oct 08, 2017 at 08:42:35AM -0700, Rodney W. Grimes wrote:
> > > 
> > > > 
> > > > 
> > > > > 
> > > > > On Oct 7, 2017, at 16:33, Sean Bruno 
> > > > > wrote:
> > > > > 
> > > > > Author: sbruno
> > > > > Date: Sat Oct  7 23:33:14 2017
> > > > > New Revision: 324406
> > > > > URL: https://svnweb.freebsd.org/changeset/base/324406
> > > > > 
> > > > > Log:
> > > > >  Fix symlink if_igb.ko in -current such that its relative and
> > > > > doesn't
> > > > >  end up with non-standard DESTDIR information in its
> > > > > symlink.  This
> > > > >  can happen very trivially if the release scripts are used.
> > > > > 
> > > > >  Sponsored by:Limelight Networks
> > > > > 
> > > > > Modified:
> > > > >  head/sys/modules/em/Makefile
> > > > > 
> > > > > Modified: head/sys/modules/em/Makefile
> > > > > =
> > > > > =
> > > > > --- head/sys/modules/em/MakefileSat Oct  7 23:30:57
> > > > > 2017(r324405)
> > > > > +++ head/sys/modules/em/MakefileSat Oct  7 23:33:14
> > > > > 2017(r324406)
> > > > > @@ -23,6 +23,6 @@ CFLAGS += -I${SRCTOP}/sys/dev/e1000
> > > > > #CFLAGS  += -DDEVICE_POLLING
> > > > > 
> > > > > afterinstall:
> > > > > -ln -sf ${DESTDIR}${KMODDIR}/${KMOD}.ko
> > > > > ${DESTDIR}${KMODDIR}/if_igb.ko
> > > > > +cd ${DESTDIR}${KMODDIR} && ln -sf if_em.ko if_igb.ko
> > > > While this is definitely better, the same thing could be
> > > > achieved via:
> > > > 
> > > > ln -sf if_em.ko ${DESTDIR}/.../if_igb.ko
> > > Should this be using SYMLINK+= as I thought using ln -sf was a
> > > breakage
> > > for meta mode stuff?
> > At the very least it should use INSTALL_LIBSYMLINK or
> > INSTALL_RLIBSYMLINK.
> > Direct use of ln(1) is always a bug in install targets and ideally
> > we
> > would make it fail.  (It breaks NO_ROOT installs by failing to add
> > an
> > entry to the METALOG file).
> > 
> > -- Brooks
> > 
> 
> I'm more than happy to make changes here.
> 
> The closest example I can see in the tree from a Makefile is some of
> the
> things in etc:
> 
> ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound
> 
> Is that, more or less, something y'all would like to see?
> 
> sean
> 

I think the right answer here is just

  LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_igb.ko

-- Ian

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


Re: svn commit: r324449 - in head/sys/boot: arm/uboot efi/boot1 sparc64/loader

2017-10-09 Thread Warner Losh
Yea, that's my bad. I didn't do a completely clean build with stand.h gone,
so I didn't catch it before the commit. I've just pushed in a fixup so that
we always include the path to stand.h in the include path, since almost
everybody needs it, and it is harmless to the others to include.

Sorry for the bumps...

Warner

On Mon, Oct 9, 2017 at 6:38 PM, Steven Hartland <
steven.hartl...@multiplay.co.uk> wrote:

> Yer even no -j fails :(
>
>
> On 10/10/2017 01:01, Warner Losh wrote:
>
> Oh, killed /usr/include/stand.h and found it. I'll post a fix when I get
> back.
>
> On Mon, Oct 9, 2017 at 6:00 PM, Warner Losh  wrote:
>
>> Can you find out? A clean build works for me. Chances are good that
>> sys/boot/efi/boot1/Makefile needs a line like
>> CFLAGS+=-I${SASRC} or similar. I have to go out for 2 hours, but will
>> look into when I get back if you can't make progress. I don't see one there
>> and I had to add it a couple of other places.
>>
>> Warner
>>
>> On Mon, Oct 9, 2017 at 5:56 PM, Steven Hartland <
>> steven.hartl...@multiplay.co.uk> wrote:
>>
>>> Not sure which of these sets of changes caused the issue but a clean
>>> build from scratch is currently failing here with:
>>>
>>> In file included from /usr/home/smh/freebsd/base/hea
>>> d/sys/boot/efi/boot1/ufs_module.c:41:
>>> In file included from /usr/home/smh/freebsd/base/hea
>>> d/sys/boot/efi/boot1/boot_module.h:35:
>>> /usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/../include/efilib.h:33:10:
>>> fatal error: 'stand.h' file not found
>>> #include 
>>>  ^
>>>
>>> Build was with -j24 in case it matters, going to try without -j but that
>>> will take many hours
>>>
>>>
>>> On 09/10/2017 23:11, Warner Losh wrote:
>>>
>>> Author: imp
>>> Date: Mon Oct  9 22:11:57 2017
>>> New Revision: 324449
>>> URL: https://svnweb.freebsd.org/changeset/base/324449
>>>
>>> Log:
>>>   Prefer ${LIBSTAND} to -lstand
>>>
>>>   Sponsored by: Netflix
>>>
>>> Modified:
>>>   head/sys/boot/arm/uboot/Makefile
>>>   head/sys/boot/efi/boot1/Makefile
>>>   head/sys/boot/sparc64/loader/Makefile
>>>
>>> Modified: head/sys/boot/arm/uboot/Makefile
>>> ==
>>> --- head/sys/boot/arm/uboot/MakefileMon Oct  9 21:06:16 2017
>>> (r324448)
>>> +++ head/sys/boot/arm/uboot/MakefileMon Oct  9 22:11:57 2017
>>> (r324449)
>>> @@ -121,7 +121,7 @@ CFLAGS+=-fPIC
>>>  NO_WERROR.clang=
>>>
>>>  DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} 
>>> ${LIBSTAND}
>>> -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
>>> +LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} 
>>> ${LIBSTAND}
>>>
>>>  OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
>>>
>>>
>>> Modified: head/sys/boot/efi/boot1/Makefile
>>> ==
>>> --- head/sys/boot/efi/boot1/MakefileMon Oct  9 21:06:16 2017
>>> (r324448)
>>> +++ head/sys/boot/efi/boot1/MakefileMon Oct  9 22:11:57 2017
>>> (r324449)
>>> @@ -91,7 +91,7 @@ LIBEFI=   ${.OBJDIR}/../libefi/libefi.a
>>>  # as well as required string and memory functions for all platforms.
>>>  #
>>>  DPADD+=${LIBEFI} ${LIBSTAND}
>>> -LDADD+=${LIBEFI} -lstand
>>> +LDADD+=${LIBEFI} ${LIBSTAND}
>>>
>>>  DPADD+=${LDSCRIPT}
>>>
>>>
>>> Modified: head/sys/boot/sparc64/loader/Makefile
>>> ==
>>> --- head/sys/boot/sparc64/loader/Makefile   Mon Oct  9 21:06:16 2017
>>> (r324448)
>>> +++ head/sys/boot/sparc64/loader/Makefile   Mon Oct  9 22:11:57 2017
>>> (r324449)
>>> @@ -86,7 +86,7 @@ CFLAGS+=  -I${.CURDIR}/../../../../lib/libstand/
>>>  CFLAGS+=   -I${SRCTOP}/sys
>>>
>>>  DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
>>> -LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
>>> +LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
>>>
>>>  loader.help: help.common help.sparc64
>>> cat ${.ALLSRC} | \
>>>
>>>
>>>
>>>
>>
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324460 - in head/sys/boot: . arm/uboot common efi/fdt efi/libefi efi/loader fdt i386/libfirewire i386/libi386 i386/loader mips/beri/boot2 mips/beri/loader mips/uboot ofw/libofw powerpc...

2017-10-09 Thread Warner Losh
Author: imp
Date: Tue Oct 10 01:31:44 2017
New Revision: 324460
URL: https://svnweb.freebsd.org/changeset/base/324460

Log:
  Rather than laying whack-a-mole with including the path to stand.h,
  always include it. Remove places where we explicitly include it. This
  also helps reduce the 'cut-and-paste' factor of these Makefiles.
  
  Sponsored by: Netflix

Modified:
  head/sys/boot/Makefile.ficl
  head/sys/boot/Makefile.inc
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/common/Makefile.inc
  head/sys/boot/efi/fdt/Makefile
  head/sys/boot/efi/libefi/Makefile
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/fdt/Makefile
  head/sys/boot/i386/libfirewire/Makefile
  head/sys/boot/i386/libi386/Makefile
  head/sys/boot/i386/loader/Makefile
  head/sys/boot/mips/beri/boot2/Makefile
  head/sys/boot/mips/beri/loader/Makefile
  head/sys/boot/mips/uboot/Makefile
  head/sys/boot/ofw/libofw/Makefile
  head/sys/boot/powerpc/kboot/Makefile
  head/sys/boot/powerpc/ofw/Makefile
  head/sys/boot/powerpc/ps3/Makefile
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/sparc64/loader/Makefile
  head/sys/boot/uboot/fdt/Makefile
  head/sys/boot/uboot/lib/Makefile
  head/sys/boot/userboot/userboot/Makefile
  head/sys/boot/zfs/Makefile

Modified: head/sys/boot/Makefile.ficl
==
--- head/sys/boot/Makefile.ficl Tue Oct 10 00:32:21 2017(r324459)
+++ head/sys/boot/Makefile.ficl Tue Oct 10 01:31:44 2017(r324460)
@@ -27,7 +27,7 @@ CFLAGS+=  -m32 -mcpu=powerpc -I.
 .endif
 
 CFLAGS+=   -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \
-   -I${FICLDIR}/../common -I${SASRC}
+   -I${FICLDIR}/../common
 
 .if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32)
 .if !exists(machine)

Modified: head/sys/boot/Makefile.inc
==
--- head/sys/boot/Makefile.inc  Tue Oct 10 00:32:21 2017(r324459)
+++ head/sys/boot/Makefile.inc  Tue Oct 10 01:31:44 2017(r324460)
@@ -13,6 +13,8 @@ LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a
 # stand along library compiled for userboot
 LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a
 
+CFLAGS+=-I${SASRC}
+
 SSP_CFLAGS=
 
 .if ${MACHINE_CPUARCH} == "arm"

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileTue Oct 10 00:32:21 2017
(r324459)
+++ head/sys/boot/arm/uboot/MakefileTue Oct 10 01:31:44 2017
(r324460)
@@ -112,8 +112,6 @@ LIBUBOOT=   ${.OBJDIR}/../../uboot/lib/libuboot.a
 CFLAGS+=   -I${.CURDIR}/../../uboot/lib
 CFLAGS+=   -I${.OBJDIR}/../../uboot/lib
 
-CFLAGS+=   -I${SASRC}
-
 CFLAGS+=   -fPIC
 
 # clang doesn't understand %D as a specifier to printf

Modified: head/sys/boot/common/Makefile.inc
==
--- head/sys/boot/common/Makefile.inc   Tue Oct 10 00:32:21 2017
(r324459)
+++ head/sys/boot/common/Makefile.inc   Tue Oct 10 01:31:44 2017
(r324460)
@@ -70,7 +70,6 @@ CFLAGS+=  -DBOOT_PROMPT_123
 
 .if defined(LOADER_INSTALL_SUPPORT)
 SRCS+= install.c
-CFLAGS+=-I${SASRC}
 .endif
 
 CLEANFILES+=   vers.c

Modified: head/sys/boot/efi/fdt/Makefile
==
--- head/sys/boot/efi/fdt/Makefile  Tue Oct 10 00:32:21 2017
(r324459)
+++ head/sys/boot/efi/fdt/Makefile  Tue Oct 10 01:31:44 2017
(r324460)
@@ -17,8 +17,6 @@ CFLAGS+=  -mgeneral-regs-only
 CFLAGS+=   -msoft-float
 .endif
 
-CFLAGS+=   -I${SASRC}
-
 # EFI library headers
 CFLAGS+=   -I${.CURDIR}/../include
 CFLAGS+=   -I${.CURDIR}/../include/${MACHINE}

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Tue Oct 10 00:32:21 2017
(r324459)
+++ head/sys/boot/efi/libefi/Makefile   Tue Oct 10 01:31:44 2017
(r324460)
@@ -37,7 +37,6 @@ CFLAGS+= -fPIC -mno-red-zone
 .endif
 CFLAGS+= -I${.CURDIR}/../include
 CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
-CFLAGS+= -I${SASRC}
 .if ${MK_ZFS} != "no"
 CFLAGS+=   -I${.CURDIR}/../../zfs
 CFLAGS+=   -I${.CURDIR}/../../../cddl/boot/zfs

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Tue Oct 10 00:32:21 2017
(r324459)
+++ head/sys/boot/efi/loader/Makefile   Tue Oct 10 01:31:44 2017
(r324460)
@@ -36,10 +36,6 @@ CWARNFLAGS.zfs.c+=   -Wno-array-bounds
 CWARNFLAGS.zfs.c+= -Wno-missing-prototypes
 .endif
 
-.if defined(LOADER_NET_SUPPORT)
-CFLAGS+=   -I${SASRC}
-.endif
-
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
 CWARNFLAGS.self_reloc.c+=  -Wno-error=maybe-uninitialized
 

Re: svn commit: r324449 - in head/sys/boot: arm/uboot efi/boot1 sparc64/loader

2017-10-09 Thread Steven Hartland

Yer even no -j fails :(

On 10/10/2017 01:01, Warner Losh wrote:
Oh, killed /usr/include/stand.h and found it. I'll post a fix when I 
get back.


On Mon, Oct 9, 2017 at 6:00 PM, Warner Losh > wrote:


Can you find out? A clean build works for me. Chances are good
that sys/boot/efi/boot1/Makefile needs a line like
CFLAGS+=-I${SASRC} or similar. I have to go out for 2 hours, but
will look into when I get back if you can't make progress. I don't
see one there and I had to add it a couple of other places.

Warner

On Mon, Oct 9, 2017 at 5:56 PM, Steven Hartland
> wrote:

Not sure which of these sets of changes caused the issue but a
clean build from scratch is currently failing here with:

In file included from
/usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/ufs_module.c:41:
In file included from
/usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/boot_module.h:35:

/usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/../include/efilib.h:33:10:
fatal error: 'stand.h' file not found
#include 
 ^

Build was with -j24 in case it matters, going to try without
-j but that will take many hours


On 09/10/2017 23:11, Warner Losh wrote:

Author: imp
Date: Mon Oct  9 22:11:57 2017
New Revision: 324449
URL:https://svnweb.freebsd.org/changeset/base/324449


Log:
   Prefer ${LIBSTAND} to -lstand
   
   Sponsored by: Netflix


Modified:
   head/sys/boot/arm/uboot/Makefile
   head/sys/boot/efi/boot1/Makefile
   head/sys/boot/sparc64/loader/Makefile

Modified: head/sys/boot/arm/uboot/Makefile

==
--- head/sys/boot/arm/uboot/MakefileMon Oct  9 21:06:16 2017
(r324448)
+++ head/sys/boot/arm/uboot/MakefileMon Oct  9 22:11:57 2017
(r324449)
@@ -121,7 +121,7 @@ CFLAGS+=-fPIC
  NO_WERROR.clang=
  
  DPADD=		${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}

-LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
+LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} 
${LIBSTAND}
  
  OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
  


Modified: head/sys/boot/efi/boot1/Makefile

==
--- head/sys/boot/efi/boot1/MakefileMon Oct  9 21:06:16 2017
(r324448)
+++ head/sys/boot/efi/boot1/MakefileMon Oct  9 22:11:57 2017
(r324449)
@@ -91,7 +91,7 @@ LIBEFI=   ${.OBJDIR}/../libefi/libefi.a
  # as well as required string and memory functions for all platforms.
  #
  DPADD+=   ${LIBEFI} ${LIBSTAND}
-LDADD+=${LIBEFI} -lstand
+LDADD+=${LIBEFI} ${LIBSTAND}
  
  DPADD+=		${LDSCRIPT}
  


Modified: head/sys/boot/sparc64/loader/Makefile

==
--- head/sys/boot/sparc64/loader/Makefile   Mon Oct  9 21:06:16 
2017(r324448)
+++ head/sys/boot/sparc64/loader/Makefile   Mon Oct  9 22:11:57 
2017(r324449)
@@ -86,7 +86,7 @@ CFLAGS+=  -I${.CURDIR}/../../../../lib/libstand/
  CFLAGS+=  -I${SRCTOP}/sys
  
  DPADD=		${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}

-LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
+LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
  
  loader.help: help.common help.sparc64

cat ${.ALLSRC} | \







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

svn commit: r324459 - head/sys/kern

2017-10-09 Thread Sean Bruno
Author: sbruno
Date: Tue Oct 10 00:32:21 2017
New Revision: 324459
URL: https://svnweb.freebsd.org/changeset/base/324459

Log:
  Revert r324405 at the request of the submitter pending better solution.
  
  Submitted by: Jason Eggleston 
  Sponsored by: Limelight Networks

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Tue Oct 10 00:26:44 2017
(r324458)
+++ head/sys/kern/kern_sendfile.c   Tue Oct 10 00:32:21 2017
(r324459)
@@ -507,11 +507,6 @@ sendfile_getsock(struct thread *td, int s, struct file
*so = (*sock_fp)->f_data;
if ((*so)->so_type != SOCK_STREAM)
return (EINVAL);
-   if ((*so)->so_error) {
-   error = (*so)->so_error;
-   (*so)->so_error = 0;
-   return (error);
-   }
if (((*so)->so_state & SS_ISCONNECTED) == 0)
return (ENOTCONN);
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324458 - head/share/man/man4

2017-10-09 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Tue Oct 10 00:26:44 2017
New Revision: 324458
URL: https://svnweb.freebsd.org/changeset/base/324458

Log:
  Add Asus USB-N13, rev. B1 to the rtwn_usb hardware list
  
  Reported by:  Patrik Horst 

Modified:
  head/share/man/man4/rtwn_usb.4

Modified: head/share/man/man4/rtwn_usb.4
==
--- head/share/man/man4/rtwn_usb.4  Mon Oct  9 22:27:38 2017
(r324457)
+++ head/share/man/man4/rtwn_usb.4  Tue Oct 10 00:26:44 2017
(r324458)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"/
-.Dd January 24, 2017
+.Dd October 9, 2017
 .Dt RTWN_USB 4
 .Os
 .Sh NAME
@@ -64,6 +64,7 @@ based USB wireless network adapters, including:
 .It "Alfa AWUS036NHR v2" Ta USB 2.0
 .It "ASUS USB-AC56" Ta USB 3.0
 .It "ASUS USB-N10 NANO" Ta USB 2.0
+.It "Asus USB-N13, rev. B1" Ta USB 2.0
 .It "Belkin F7D1102 Surf Wireless Micro" Ta USB 2.0
 .It "Buffalo WI-U2-433DM" Ta USB 2.0
 .It "Buffalo WI-U3-866D" Ta USB 3.0
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324406 - head/sys/modules/em

2017-10-09 Thread Sean Bruno


On 10/09/17 14:33, Brooks Davis wrote:
> On Sun, Oct 08, 2017 at 08:42:35AM -0700, Rodney W. Grimes wrote:
>>>
 On Oct 7, 2017, at 16:33, Sean Bruno  wrote:

 Author: sbruno
 Date: Sat Oct  7 23:33:14 2017
 New Revision: 324406
 URL: https://svnweb.freebsd.org/changeset/base/324406

 Log:
  Fix symlink if_igb.ko in -current such that its relative and doesn't
  end up with non-standard DESTDIR information in its symlink.  This
  can happen very trivially if the release scripts are used.

  Sponsored by:Limelight Networks

 Modified:
  head/sys/modules/em/Makefile

 Modified: head/sys/modules/em/Makefile
 ==
 --- head/sys/modules/em/MakefileSat Oct  7 23:30:57 2017(r324405)
 +++ head/sys/modules/em/MakefileSat Oct  7 23:33:14 2017(r324406)
 @@ -23,6 +23,6 @@ CFLAGS += -I${SRCTOP}/sys/dev/e1000
 #CFLAGS  += -DDEVICE_POLLING

 afterinstall:
 -ln -sf ${DESTDIR}${KMODDIR}/${KMOD}.ko ${DESTDIR}${KMODDIR}/if_igb.ko
 +cd ${DESTDIR}${KMODDIR} && ln -sf if_em.ko if_igb.ko
>>>
>>> While this is definitely better, the same thing could be achieved via:
>>>
>>> ln -sf if_em.ko ${DESTDIR}/.../if_igb.ko
>>
>> Should this be using SYMLINK+= as I thought using ln -sf was a breakage
>> for meta mode stuff?
> 
> At the very least it should use INSTALL_LIBSYMLINK or INSTALL_RLIBSYMLINK.
> Direct use of ln(1) is always a bug in install targets and ideally we
> would make it fail.  (It breaks NO_ROOT installs by failing to add an
> entry to the METALOG file).
> 
> -- Brooks
> 


I'm more than happy to make changes here.

The closest example I can see in the tree from a Makefile is some of the
things in etc:

${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound

Is that, more or less, something y'all would like to see?

sean



signature.asc
Description: OpenPGP digital signature


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

2017-10-09 Thread Jason Eggleston
https://reviews.freebsd.org/D12633

On Mon, Oct 9, 2017 at 5:01 PM, Jason Eggleston  wrote:

> In tcp_input.c, this is where a RST is handled. so_error gets ECONNRESET,
> then tcp_close() is called.
>
> case TCPS_ESTABLISHED:
> case TCPS_FIN_WAIT_1:
> case TCPS_FIN_WAIT_2:
> case TCPS_CLOSE_WAIT:
> case TCPS_CLOSING:
> case TCPS_LAST_ACK:
> so->so_error = ECONNRESET;
> close:
> /* FALLTHROUGH */
> default:
> tp = tcp_close(tp);
>
> tcp_close() calls soisdisconnected() which sets this flag:
>
> so->so_state |= SS_ISDISCONNECTED;
>
> Followed by:
>
> ...
> socantrcvmore_locked(so);
> ...
> socantsendmore_locked(so);
> ...
>
> Those two functions set these flags:
>
> so->so_rcv.sb_state |= SBS_CANTRCVMORE;
> so->so_snd.sb_state |= SBS_CANTSENDMORE;
>
> A TCP session cannot survive a RST, and i/o calls will not work afterword,
> no matter how many times you try.
>
> Having said that, there's a race condition between when so_error is set
> and when the socket and socket buffer flags are set, and I agree with your
> strategy of:
>
> - have sendfile() match send()
> - The current send() behavior is probably fine as is
>
> I agree sendfile() should match write() and send(), by checking in this
> order:
>
> SBS_CANTSENDMORE
> so_error
> SS_ISCONNECTED
>
> and will prep a new review with your patch.
>
> On Mon, Oct 9, 2017 at 4:20 PM, Gleb Smirnoff  wrote:
>
>>   Sean & Jason,
>>
>> On Sat, Oct 07, 2017 at 11:30:57PM +, Sean Bruno wrote:
>> S> Author: sbruno
>> S> Date: Sat Oct  7 23:30:57 2017
>> S> New Revision: 324405
>> S> URL: https://svnweb.freebsd.org/changeset/base/324405
>> S>
>> S> Log:
>> S>   Check so_error early in sendfile() call.  Prior to this patch, if a
>> S>   connection was reset by the remote end, sendfile() would just report
>> S>   ENOTCONN instead of ECONNRESET.
>> S>
>> S>   Submitted by:  Jason Eggleston 
>> S>   Reviewed by:   glebius
>> S>   Sponsored by:  Limelight Networks
>> S>   Differential Revision: https://reviews.freebsd.org/D12575
>> S>
>> S> Modified:
>> S>   head/sys/kern/kern_sendfile.c
>> S>
>> S> Modified: head/sys/kern/kern_sendfile.c
>> S> 
>> ==
>> S> --- head/sys/kern/kern_sendfile.cSat Oct  7 23:10:16 2017
>> (r324404)
>> S> +++ head/sys/kern/kern_sendfile.cSat Oct  7 23:30:57 2017
>> (r324405)
>> S> @@ -514,6 +514,11 @@ sendfile_getsock(struct thread *td, int s, struct
>> file
>> S>  *so = (*sock_fp)->f_data;
>> S>  if ((*so)->so_type != SOCK_STREAM)
>> S>  return (EINVAL);
>> S> +if ((*so)->so_error) {
>> S> +error = (*so)->so_error;
>> S> +(*so)->so_error = 0;
>> S> +return (error);
>> S> +}
>> S>  if (((*so)->so_state & SS_ISCONNECTED) == 0)
>> S>  return (ENOTCONN);
>> S>  return (0);
>>
>> Despite my initial positive review, now I am quite unsure on that.
>>
>> Problem is that sendfile(2) isn't defined by SUS, so there is no
>> distinctive final answer on that. Should we match other OSes?
>> Should we match our historic behaviour? Or should we match
>> write(2)/send(2) to socket, which are closest analogy. I probably
>> believe in the latter: sendfile(2) belongs to write(2)/send(2)
>> family.
>>
>> SUS specifies that write may return ECONNRESET. It also documents
>> EPIPE. However, our manual page documents only EPIPE for both
>> send(2) and write(2). For write we have:
>>
>> SOCKBUF_LOCK(>so_snd);
>> if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
>> SOCKBUF_UNLOCK(>so_snd);
>> error = EPIPE;
>> goto out;
>> }
>> if (so->so_error) {
>> error = so->so_error;
>> so->so_error = 0;
>> SOCKBUF_UNLOCK(>so_snd);
>> goto out;
>> }
>>
>> Indeed, EPIPE will be returned prior to return/clear of so_error,
>> which supposedly is ECONNRESET.
>>
>> In the sendfile(2) implementation we see exactly same code:
>>
>> if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
>> error = EPIPE;
>> SOCKBUF_UNLOCK(>so_snd);
>> goto done;
>> } else if (so->so_error) {
>> error = so->so_error;
>> so->so_error = 0;
>> SOCKBUF_UNLOCK(>so_snd);
>> goto done;
>>

Re: svn commit: r324449 - in head/sys/boot: arm/uboot efi/boot1 sparc64/loader

2017-10-09 Thread Warner Losh
Oh, killed /usr/include/stand.h and found it. I'll post a fix when I get
back.

On Mon, Oct 9, 2017 at 6:00 PM, Warner Losh  wrote:

> Can you find out? A clean build works for me. Chances are good that
> sys/boot/efi/boot1/Makefile needs a line like
> CFLAGS+=-I${SASRC} or similar. I have to go out for 2 hours, but will look
> into when I get back if you can't make progress. I don't see one there and
> I had to add it a couple of other places.
>
> Warner
>
> On Mon, Oct 9, 2017 at 5:56 PM, Steven Hartland <
> steven.hartl...@multiplay.co.uk> wrote:
>
>> Not sure which of these sets of changes caused the issue but a clean
>> build from scratch is currently failing here with:
>>
>> In file included from /usr/home/smh/freebsd/base/hea
>> d/sys/boot/efi/boot1/ufs_module.c:41:
>> In file included from /usr/home/smh/freebsd/base/hea
>> d/sys/boot/efi/boot1/boot_module.h:35:
>> /usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/../include/efilib.h:33:10:
>> fatal error: 'stand.h' file not found
>> #include 
>>  ^
>>
>> Build was with -j24 in case it matters, going to try without -j but that
>> will take many hours
>>
>>
>> On 09/10/2017 23:11, Warner Losh wrote:
>>
>> Author: imp
>> Date: Mon Oct  9 22:11:57 2017
>> New Revision: 324449
>> URL: https://svnweb.freebsd.org/changeset/base/324449
>>
>> Log:
>>   Prefer ${LIBSTAND} to -lstand
>>
>>   Sponsored by: Netflix
>>
>> Modified:
>>   head/sys/boot/arm/uboot/Makefile
>>   head/sys/boot/efi/boot1/Makefile
>>   head/sys/boot/sparc64/loader/Makefile
>>
>> Modified: head/sys/boot/arm/uboot/Makefile
>> ==
>> --- head/sys/boot/arm/uboot/Makefile Mon Oct  9 21:06:16 2017
>> (r324448)
>> +++ head/sys/boot/arm/uboot/Makefile Mon Oct  9 22:11:57 2017
>> (r324449)
>> @@ -121,7 +121,7 @@ CFLAGS+= -fPIC
>>  NO_WERROR.clang=
>>
>>  DPADD=  ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} 
>> ${LIBSTAND}
>> -LDADD=  ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
>> +LDADD=  ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} 
>> ${LIBSTAND}
>>
>>  OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
>>
>>
>> Modified: head/sys/boot/efi/boot1/Makefile
>> ==
>> --- head/sys/boot/efi/boot1/Makefile Mon Oct  9 21:06:16 2017
>> (r324448)
>> +++ head/sys/boot/efi/boot1/Makefile Mon Oct  9 22:11:57 2017
>> (r324449)
>> @@ -91,7 +91,7 @@ LIBEFI=${.OBJDIR}/../libefi/libefi.a
>>  # as well as required string and memory functions for all platforms.
>>  #
>>  DPADD+= ${LIBEFI} ${LIBSTAND}
>> -LDADD+= ${LIBEFI} -lstand
>> +LDADD+= ${LIBEFI} ${LIBSTAND}
>>
>>  DPADD+= ${LDSCRIPT}
>>
>>
>> Modified: head/sys/boot/sparc64/loader/Makefile
>> ==
>> --- head/sys/boot/sparc64/loader/MakefileMon Oct  9 21:06:16 2017
>> (r324448)
>> +++ head/sys/boot/sparc64/loader/MakefileMon Oct  9 22:11:57 2017
>> (r324449)
>> @@ -86,7 +86,7 @@ CFLAGS+=   -I${.CURDIR}/../../../../lib/libstand/
>>  CFLAGS+=-I${SRCTOP}/sys
>>
>>  DPADD=  ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
>> -LDADD=  ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
>> +LDADD=  ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
>>
>>  loader.help: help.common help.sparc64
>>  cat ${.ALLSRC} | \
>>
>>
>>
>>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-10-09 Thread Jason Eggleston
In tcp_input.c, this is where a RST is handled. so_error gets ECONNRESET,
then tcp_close() is called.

case TCPS_ESTABLISHED:
case TCPS_FIN_WAIT_1:
case TCPS_FIN_WAIT_2:
case TCPS_CLOSE_WAIT:
case TCPS_CLOSING:
case TCPS_LAST_ACK:
so->so_error = ECONNRESET;
close:
/* FALLTHROUGH */
default:
tp = tcp_close(tp);

tcp_close() calls soisdisconnected() which sets this flag:

so->so_state |= SS_ISDISCONNECTED;

Followed by:

...
socantrcvmore_locked(so);
...
socantsendmore_locked(so);
...

Those two functions set these flags:

so->so_rcv.sb_state |= SBS_CANTRCVMORE;
so->so_snd.sb_state |= SBS_CANTSENDMORE;

A TCP session cannot survive a RST, and i/o calls will not work afterword,
no matter how many times you try.

Having said that, there's a race condition between when so_error is set and
when the socket and socket buffer flags are set, and I agree with your
strategy of:

- have sendfile() match send()
- The current send() behavior is probably fine as is

I agree sendfile() should match write() and send(), by checking in this
order:

SBS_CANTSENDMORE
so_error
SS_ISCONNECTED

and will prep a new review with your patch.

On Mon, Oct 9, 2017 at 4:20 PM, Gleb Smirnoff  wrote:

>   Sean & Jason,
>
> On Sat, Oct 07, 2017 at 11:30:57PM +, Sean Bruno wrote:
> S> Author: sbruno
> S> Date: Sat Oct  7 23:30:57 2017
> S> New Revision: 324405
> S> URL: https://svnweb.freebsd.org/changeset/base/324405
> S>
> S> Log:
> S>   Check so_error early in sendfile() call.  Prior to this patch, if a
> S>   connection was reset by the remote end, sendfile() would just report
> S>   ENOTCONN instead of ECONNRESET.
> S>
> S>   Submitted by:  Jason Eggleston 
> S>   Reviewed by:   glebius
> S>   Sponsored by:  Limelight Networks
> S>   Differential Revision: https://reviews.freebsd.org/D12575
> S>
> S> Modified:
> S>   head/sys/kern/kern_sendfile.c
> S>
> S> Modified: head/sys/kern/kern_sendfile.c
> S> 
> ==
> S> --- head/sys/kern/kern_sendfile.cSat Oct  7 23:10:16 2017
> (r324404)
> S> +++ head/sys/kern/kern_sendfile.cSat Oct  7 23:30:57 2017
> (r324405)
> S> @@ -514,6 +514,11 @@ sendfile_getsock(struct thread *td, int s, struct
> file
> S>  *so = (*sock_fp)->f_data;
> S>  if ((*so)->so_type != SOCK_STREAM)
> S>  return (EINVAL);
> S> +if ((*so)->so_error) {
> S> +error = (*so)->so_error;
> S> +(*so)->so_error = 0;
> S> +return (error);
> S> +}
> S>  if (((*so)->so_state & SS_ISCONNECTED) == 0)
> S>  return (ENOTCONN);
> S>  return (0);
>
> Despite my initial positive review, now I am quite unsure on that.
>
> Problem is that sendfile(2) isn't defined by SUS, so there is no
> distinctive final answer on that. Should we match other OSes?
> Should we match our historic behaviour? Or should we match
> write(2)/send(2) to socket, which are closest analogy. I probably
> believe in the latter: sendfile(2) belongs to write(2)/send(2)
> family.
>
> SUS specifies that write may return ECONNRESET. It also documents
> EPIPE. However, our manual page documents only EPIPE for both
> send(2) and write(2). For write we have:
>
> SOCKBUF_LOCK(>so_snd);
> if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
> SOCKBUF_UNLOCK(>so_snd);
> error = EPIPE;
> goto out;
> }
> if (so->so_error) {
> error = so->so_error;
> so->so_error = 0;
> SOCKBUF_UNLOCK(>so_snd);
> goto out;
> }
>
> Indeed, EPIPE will be returned prior to return/clear of so_error,
> which supposedly is ECONNRESET.
>
> In the sendfile(2) implementation we see exactly same code:
>
> if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
> error = EPIPE;
> SOCKBUF_UNLOCK(>so_snd);
> goto done;
> } else if (so->so_error) {
> error = so->so_error;
> so->so_error = 0;
> SOCKBUF_UNLOCK(>so_snd);
> goto done;
> }
>
> But it isn't reached. Before due to SS_ISCONNECTED check, now
> due to your change. Now we got two spots where so_error is
> returned/cleared.
>
> For the receive family (read(2) and recv(2)), SUS specifies
> ECONNRESET and our code does that. It also clears so_error.
>
> 

Re: svn commit: r324449 - in head/sys/boot: arm/uboot efi/boot1 sparc64/loader

2017-10-09 Thread Warner Losh
Can you find out? A clean build works for me. Chances are good that
sys/boot/efi/boot1/Makefile needs a line like
CFLAGS+=-I${SASRC} or similar. I have to go out for 2 hours, but will look
into when I get back if you can't make progress. I don't see one there and
I had to add it a couple of other places.

Warner

On Mon, Oct 9, 2017 at 5:56 PM, Steven Hartland <
steven.hartl...@multiplay.co.uk> wrote:

> Not sure which of these sets of changes caused the issue but a clean build
> from scratch is currently failing here with:
>
> In file included from /usr/home/smh/freebsd/base/
> head/sys/boot/efi/boot1/ufs_module.c:41:
> In file included from /usr/home/smh/freebsd/base/
> head/sys/boot/efi/boot1/boot_module.h:35:
> /usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/../include/efilib.h:33:10:
> fatal error: 'stand.h' file not found
> #include 
>  ^
>
> Build was with -j24 in case it matters, going to try without -j but that
> will take many hours
>
>
> On 09/10/2017 23:11, Warner Losh wrote:
>
> Author: imp
> Date: Mon Oct  9 22:11:57 2017
> New Revision: 324449
> URL: https://svnweb.freebsd.org/changeset/base/324449
>
> Log:
>   Prefer ${LIBSTAND} to -lstand
>
>   Sponsored by: Netflix
>
> Modified:
>   head/sys/boot/arm/uboot/Makefile
>   head/sys/boot/efi/boot1/Makefile
>   head/sys/boot/sparc64/loader/Makefile
>
> Modified: head/sys/boot/arm/uboot/Makefile
> ==
> --- head/sys/boot/arm/uboot/Makefile  Mon Oct  9 21:06:16 2017
> (r324448)
> +++ head/sys/boot/arm/uboot/Makefile  Mon Oct  9 22:11:57 2017
> (r324449)
> @@ -121,7 +121,7 @@ CFLAGS+=  -fPIC
>  NO_WERROR.clang=
>
>  DPADD=   ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} 
> ${LIBSTAND}
> -LDADD=   ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
> +LDADD=   ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} 
> ${LIBSTAND}
>
>  OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
>
>
> Modified: head/sys/boot/efi/boot1/Makefile
> ==
> --- head/sys/boot/efi/boot1/Makefile  Mon Oct  9 21:06:16 2017
> (r324448)
> +++ head/sys/boot/efi/boot1/Makefile  Mon Oct  9 22:11:57 2017
> (r324449)
> @@ -91,7 +91,7 @@ LIBEFI= ${.OBJDIR}/../libefi/libefi.a
>  # as well as required string and memory functions for all platforms.
>  #
>  DPADD+=  ${LIBEFI} ${LIBSTAND}
> -LDADD+=  ${LIBEFI} -lstand
> +LDADD+=  ${LIBEFI} ${LIBSTAND}
>
>  DPADD+=  ${LDSCRIPT}
>
>
> Modified: head/sys/boot/sparc64/loader/Makefile
> ==
> --- head/sys/boot/sparc64/loader/Makefile Mon Oct  9 21:06:16 2017
> (r324448)
> +++ head/sys/boot/sparc64/loader/Makefile Mon Oct  9 22:11:57 2017
> (r324449)
> @@ -86,7 +86,7 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/libstand/
>  CFLAGS+= -I${SRCTOP}/sys
>
>  DPADD=   ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
> -LDADD=   ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
> +LDADD=   ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
>
>  loader.help: help.common help.sparc64
>   cat ${.ALLSRC} | \
>
>
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324449 - in head/sys/boot: arm/uboot efi/boot1 sparc64/loader

2017-10-09 Thread Steven Hartland
Not sure which of these sets of changes caused the issue but a clean 
build from scratch is currently failing here with:


In file included from 
/usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/ufs_module.c:41:
In file included from 
/usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/boot_module.h:35:
/usr/home/smh/freebsd/base/head/sys/boot/efi/boot1/../include/efilib.h:33:10: 
fatal error: 'stand.h' file not found

#include 
 ^

Build was with -j24 in case it matters, going to try without -j but that 
will take many hours


On 09/10/2017 23:11, Warner Losh wrote:

Author: imp
Date: Mon Oct  9 22:11:57 2017
New Revision: 324449
URL: https://svnweb.freebsd.org/changeset/base/324449

Log:
   Prefer ${LIBSTAND} to -lstand
   
   Sponsored by: Netflix


Modified:
   head/sys/boot/arm/uboot/Makefile
   head/sys/boot/efi/boot1/Makefile
   head/sys/boot/sparc64/loader/Makefile

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileMon Oct  9 21:06:16 2017
(r324448)
+++ head/sys/boot/arm/uboot/MakefileMon Oct  9 22:11:57 2017
(r324449)
@@ -121,7 +121,7 @@ CFLAGS+=-fPIC
  NO_WERROR.clang=
  
  DPADD=		${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}

-LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
+LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
  
  OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
  


Modified: head/sys/boot/efi/boot1/Makefile
==
--- head/sys/boot/efi/boot1/MakefileMon Oct  9 21:06:16 2017
(r324448)
+++ head/sys/boot/efi/boot1/MakefileMon Oct  9 22:11:57 2017
(r324449)
@@ -91,7 +91,7 @@ LIBEFI=   ${.OBJDIR}/../libefi/libefi.a
  # as well as required string and memory functions for all platforms.
  #
  DPADD+=   ${LIBEFI} ${LIBSTAND}
-LDADD+=${LIBEFI} -lstand
+LDADD+=${LIBEFI} ${LIBSTAND}
  
  DPADD+=		${LDSCRIPT}
  


Modified: head/sys/boot/sparc64/loader/Makefile
==
--- head/sys/boot/sparc64/loader/Makefile   Mon Oct  9 21:06:16 2017
(r324448)
+++ head/sys/boot/sparc64/loader/Makefile   Mon Oct  9 22:11:57 2017
(r324449)
@@ -86,7 +86,7 @@ CFLAGS+=  -I${.CURDIR}/../../../../lib/libstand/
  CFLAGS+=  -I${SRCTOP}/sys
  
  DPADD=		${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}

-LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
+LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
  
  loader.help: help.common help.sparc64

cat ${.ALLSRC} | \



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

Re: svn commit: r324452 - in head/sys/boot: . arm/uboot efi/boot1 efi/loader i386/gptboot i386/gptzfsboot i386/loader i386/zfsboot mips/beri/boot2 mips/beri/loader mips/uboot powerpc/kboot powerpc/ofw

2017-10-09 Thread John Baldwin
On Monday, October 09, 2017 10:12:47 PM Warner Losh wrote:
> Author: imp
> Date: Mon Oct  9 22:12:46 2017
> New Revision: 324452
> URL: https://svnweb.freebsd.org/changeset/base/324452
> 
> Log:
>   Define LIBSA* and use them instead of overloaded LIBSTAND
>   
>   LIBSA is the current stand alone library. LIBSA32 is the 32-bit
>   version of the library. LIBSAU is the userboot version of libsa. Use
>   the proper define instead of the more generic define.
>   
>   Sponsored by: Netflix
> 
> Modified:
>   head/sys/boot/Makefile.inc
>   head/sys/boot/arm/uboot/Makefile
>   head/sys/boot/efi/boot1/Makefile
>   head/sys/boot/efi/loader/Makefile
>   head/sys/boot/i386/gptboot/Makefile
>   head/sys/boot/i386/gptzfsboot/Makefile
>   head/sys/boot/i386/loader/Makefile
>   head/sys/boot/i386/zfsboot/Makefile
>   head/sys/boot/mips/beri/boot2/Makefile
>   head/sys/boot/mips/beri/loader/Makefile
>   head/sys/boot/mips/uboot/Makefile
>   head/sys/boot/powerpc/kboot/Makefile
>   head/sys/boot/powerpc/ofw/Makefile
>   head/sys/boot/powerpc/ps3/Makefile
>   head/sys/boot/powerpc/uboot/Makefile
>   head/sys/boot/sparc64/loader/Makefile
>   head/sys/boot/userboot/userboot/Makefile
> 
> Modified: head/sys/boot/Makefile.inc
> ==
> --- head/sys/boot/Makefile.incMon Oct  9 22:12:39 2017
> (r324451)
> +++ head/sys/boot/Makefile.incMon Oct  9 22:12:46 2017
> (r324452)
> @@ -6,6 +6,12 @@
>  __BOOT_MAKEFILE_INC__=${MFILE}
>  
>  SASRC=${SRCTOP}/lib/libstand
> +# Normal stand alone library
> +LIBSA=${OBJTOP}/lib/libstand/libstand.a
> +# stand alone library compiled for 32-bit version of the processor
> +LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a
> +# stand along library compiled for userboot
> +LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a

s/along/alone/.  bde@ probably prefers that the comments start with a capital
letter as well.

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


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

2017-10-09 Thread Gleb Smirnoff
  Sean & Jason,

On Sat, Oct 07, 2017 at 11:30:57PM +, Sean Bruno wrote:
S> Author: sbruno
S> Date: Sat Oct  7 23:30:57 2017
S> New Revision: 324405
S> URL: https://svnweb.freebsd.org/changeset/base/324405
S> 
S> Log:
S>   Check so_error early in sendfile() call.  Prior to this patch, if a
S>   connection was reset by the remote end, sendfile() would just report
S>   ENOTCONN instead of ECONNRESET.
S>   
S>   Submitted by:  Jason Eggleston 
S>   Reviewed by:   glebius
S>   Sponsored by:  Limelight Networks
S>   Differential Revision: https://reviews.freebsd.org/D12575
S> 
S> Modified:
S>   head/sys/kern/kern_sendfile.c
S> 
S> Modified: head/sys/kern/kern_sendfile.c
S> 
==
S> --- head/sys/kern/kern_sendfile.cSat Oct  7 23:10:16 2017
(r324404)
S> +++ head/sys/kern/kern_sendfile.cSat Oct  7 23:30:57 2017
(r324405)
S> @@ -514,6 +514,11 @@ sendfile_getsock(struct thread *td, int s, struct file
S>  *so = (*sock_fp)->f_data;
S>  if ((*so)->so_type != SOCK_STREAM)
S>  return (EINVAL);
S> +if ((*so)->so_error) {
S> +error = (*so)->so_error;
S> +(*so)->so_error = 0;
S> +return (error);
S> +}
S>  if (((*so)->so_state & SS_ISCONNECTED) == 0)
S>  return (ENOTCONN);
S>  return (0);

Despite my initial positive review, now I am quite unsure on that.

Problem is that sendfile(2) isn't defined by SUS, so there is no
distinctive final answer on that. Should we match other OSes?
Should we match our historic behaviour? Or should we match
write(2)/send(2) to socket, which are closest analogy. I probably
believe in the latter: sendfile(2) belongs to write(2)/send(2)
family.

SUS specifies that write may return ECONNRESET. It also documents
EPIPE. However, our manual page documents only EPIPE for both
send(2) and write(2). For write we have:

SOCKBUF_LOCK(>so_snd);
if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
SOCKBUF_UNLOCK(>so_snd);
error = EPIPE;
goto out;
}
if (so->so_error) {
error = so->so_error;
so->so_error = 0;
SOCKBUF_UNLOCK(>so_snd);
goto out;
}

Indeed, EPIPE will be returned prior to return/clear of so_error,
which supposedly is ECONNRESET.

In the sendfile(2) implementation we see exactly same code:

if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
error = EPIPE;
SOCKBUF_UNLOCK(>so_snd);
goto done;
} else if (so->so_error) {
error = so->so_error;
so->so_error = 0;
SOCKBUF_UNLOCK(>so_snd);
goto done;
}

But it isn't reached. Before due to SS_ISCONNECTED check, now
due to your change. Now we got two spots where so_error is
returned/cleared.

For the receive family (read(2) and recv(2)), SUS specifies
ECONNRESET and our code does that. It also clears so_error.

So, after your change at least one standard case is broken: an
application that polls/selects for both readability and
writeability of a socket. It discovers that socket is available
for writing, does sendfile(2), receives ECONNRESET. Then it does
read on the socket, and blocks(?) or returns a bogus error(?),
not sure. But definitely not ECONNRESET, since it is now cleared.

Now, where does this ENOTCONN come from? These two lines:

if (((*so)->so_state & SS_ISCONNECTED) == 0)
return (ENOTCONN);

can be traced back all the way to original 1998 commit of sendfile.

Here comes difference between sendfile(2) and send(2). In send(2),
this check is done _after_ so_error check, so your change is correct
in placing of so_error check wrt so_state check, but is incorrect
in placing wrt socket buffer state check.

After all this considerations, I would suggest to revert your change,
and apply this patch. It would make behavior of sendfile(2) to match
send(2). I would appreciate more reviews around it.

-- 
Gleb Smirnoff
Index: kern_sendfile.c
===
--- kern_sendfile.c	(revision 324457)
+++ kern_sendfile.c	(working copy)
@@ -507,13 +507,6 @@ sendfile_getsock(struct thread *td, int s, struct
 	*so = (*sock_fp)->f_data;
 	if ((*so)->so_type != SOCK_STREAM)
 		return (EINVAL);
-	if ((*so)->so_error) {
-		error = (*so)->so_error;
-		(*so)->so_error = 0;
-		return (error);
-	}
-	if (((*so)->so_state & SS_ISCONNECTED) == 0)
-		return (ENOTCONN);
 	return (0);
 }
 
@@ -622,6 +615,12 @@ retry_space:
 			SOCKBUF_UNLOCK(>so_snd);
 			goto done;
 		}
+		if ((so->so_state & SS_ISCONNECTED) == 0) {
+			SOCKBUF_UNLOCK(>so_snd);
+			error = ENOTCONN;
+			goto done;
+		}
+
 		space = sbspace(>so_snd);
 		if (space < rem &&
 		 

svn commit: r324457 - in head/sys/dev: pccbb pci

2017-10-09 Thread Alan Somers
Author: asomers
Date: Mon Oct  9 22:27:38 2017
New Revision: 324457
URL: https://svnweb.freebsd.org/changeset/base/324457

Log:
  Remove embedded newlines from sysctl variable descriptions
  
  PR:   112556
  Submitted by: Willem Jan Withagen  (earlier version)
  Reported by:  Willem Jan Withagen, ighi...@gmail.com
  MFC after:3 weeks
  Sponsored by: Spectra Logic Corp

Modified:
  head/sys/dev/pccbb/pccbb_isa.c
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/pccbb/pccbb_isa.c
==
--- head/sys/dev/pccbb/pccbb_isa.c  Mon Oct  9 22:19:58 2017
(r324456)
+++ head/sys/dev/pccbb/pccbb_isa.c  Mon Oct  9 22:27:38 2017
(r324457)
@@ -75,11 +75,11 @@ static SYSCTL_NODE(_hw, OID_AUTO, pcic, CTLFLAG_RD, 0,
 
 static int isa_intr_mask = EXCA_INT_MASK_ALLOWED;
 SYSCTL_INT(_hw_pcic, OID_AUTO, intr_mask, CTLFLAG_RDTUN, _intr_mask, 0,
-"Mask of allowable interrupts for this laptop.  The default is generally\n\
-correct, but some laptops do not route all the IRQ pins to the bridge to\n\
-save wires.  Sometimes you need a more restrictive mask because some of the\n\
-hardware in your laptop may not have a driver so its IRQ might not be\n\
-allocated.");
+"Mask of allowable interrupts for this laptop.  The default is generally"
+" correct, but some laptops do not route all the IRQ pins to the bridge to"
+" save wires.  Sometimes you need a more restrictive mask because some of"
+" the hardware in your laptop may not have a driver so its IRQ might not 
be"
+" allocated.");
 
 /*
  * CL-PD6722's VSENSE method
@@ -90,13 +90,13 @@ allocated.");
 int pcic_pd6722_vsense = 1;
 SYSCTL_INT(_hw_pcic, OID_AUTO, pd6722_vsense, CTLFLAG_RDTUN,
 _pd6722_vsense, 1,
-"Select CL-PD6722's VSENSE method.  VSENSE is used to determine the\n\
-volatage of inserted cards.  The CL-PD6722 has two methods to determine the\n\
-voltage of the card.  0 means assume a 5.0V card and do not check.  1 means\n\
-use the same method that the CL-PD6710 uses (default).  2 means use the\n\
-same method as the CL-PD6729.  2 is documented in the datasheet as being\n\
-the correct way, but 1 seems to give better results on more laptops.");
-
+"Select CL-PD6722's VSENSE method.  VSENSE is used to determine the"
+" voltage of inserted cards.  The CL-PD6722 has two methods to determine"
+" the voltage of the card.  0 means assume a 5.0V card and do not check.  
1"
+" means use the same method that the CL-PD6710 uses (default).  2 means 
use"
+" the same method as the CL-PD6729.  2 is documented in the datasheet as"
+" being the correct way, but 1 seems to give better results on more"
+" laptops."); 
 /*
  * End of configurable parameters.
  */

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Mon Oct  9 22:19:58 2017(r324456)
+++ head/sys/dev/pci/pci.c  Mon Oct  9 22:27:38 2017(r324457)
@@ -321,9 +321,9 @@ SYSCTL_NODE(_hw, OID_AUTO, pci, CTLFLAG_RD, 0, "PCI bu
 static int pci_enable_io_modes = 1;
 SYSCTL_INT(_hw_pci, OID_AUTO, enable_io_modes, CTLFLAG_RWTUN,
 _enable_io_modes, 1,
-"Enable I/O and memory bits in the config register.  Some BIOSes do not\n\
-enable these bits correctly.  We'd like to do this all the time, but there\n\
-are some peripherals that this causes problems with.");
+"Enable I/O and memory bits in the config register.  Some BIOSes do not"
+" enable these bits correctly.  We'd like to do this all the time, but"
+" there are some peripherals that this causes problems with.");
 
 static int pci_do_realloc_bars = 0;
 SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RWTUN,
@@ -334,10 +334,10 @@ SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RW
 static int pci_do_power_nodriver = 0;
 SYSCTL_INT(_hw_pci, OID_AUTO, do_power_nodriver, CTLFLAG_RWTUN,
 _do_power_nodriver, 0,
-  "Place a function into D3 state when no driver attaches to it.  0 means\n\
-disable.  1 means conservatively place devices into D3 state.  2 means\n\
-aggressively place devices into D3 state.  3 means put absolutely everything\n\
-in D3 state.");
+"Place a function into D3 state when no driver attaches to it.  0 means"
+" disable.  1 means conservatively place devices into D3 state.  2 means"
+" aggressively place devices into D3 state.  3 means put absolutely"
+" everything in D3 state.");
 
 int pci_do_power_resume = 1;
 SYSCTL_INT(_hw_pci, OID_AUTO, do_power_resume, CTLFLAG_RWTUN,
@@ -372,9 +372,10 @@ static int pci_usb_takeover = 1;
 static int pci_usb_takeover = 0;
 #endif
 SYSCTL_INT(_hw_pci, OID_AUTO, usb_early_takeover, CTLFLAG_RDTUN,
-_usb_takeover, 1, "Enable early takeover 

svn commit: r324456 - head/sbin/fsck_ffs

2017-10-09 Thread Kirk McKusick
Author: mckusick
Date: Mon Oct  9 22:19:58 2017
New Revision: 324456
URL: https://svnweb.freebsd.org/changeset/base/324456

Log:
  Do not report the filesystem as modified when the only change is to
  update the timestamp in the superblock.
  
  Reported by:  Peter Holm
  MFC after:1 week

Modified:
  head/sbin/fsck_ffs/main.c

Modified: head/sbin/fsck_ffs/main.c
==
--- head/sbin/fsck_ffs/main.c   Mon Oct  9 22:17:18 2017(r324455)
+++ head/sbin/fsck_ffs/main.c   Mon Oct  9 22:19:58 2017(r324456)
@@ -231,6 +231,7 @@ checkfilesys(char *filesys)
struct group *grp;
struct iovec *iov;
char errmsg[255];
+   int ofsmodified;
int iovlen;
int cylno;
intmax_t blks, files;
@@ -425,10 +426,15 @@ checkfilesys(char *filesys)
}
/*
 * Write the superblock so we don't try to recover the
-* journal on another pass.
+* journal on another pass. If this is the only change
+* to the filesystem, we do not want it to be called
+* out as modified.
 */
sblock.fs_mtime = time(NULL);
sbdirty();
+   ofsmodified = fsmodified;
+   flush(fswritefd, );
+   fsmodified = ofsmodified;
}
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324455 - in head: . sys/sys

2017-10-09 Thread Warner Losh
Author: imp
Date: Mon Oct  9 22:17:18 2017
New Revision: 324455
URL: https://svnweb.freebsd.org/changeset/base/324455

Log:
  Note libstand is no longer a public interface in UPDATING. Bump
  FreeBSD_version to 1200051 on the off chance that something cares.
  
  Sponsored by: Netflix

Modified:
  head/UPDATING
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Mon Oct  9 22:12:57 2017(r324454)
+++ head/UPDATING   Mon Oct  9 22:17:18 2017(r324455)
@@ -51,6 +51,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
 
 ** SPECIAL WARNING: **
 
+20171010:
+   libstand has turned into a private library for sys/boot use only.
+   It is no longer supported as a public interface outside of sys/boot.
+
 20171005:
The arm port has split armv6 into armv6 and armv7. armv7 is now
a valid TARGET_ARCH/MACHINE_ARCH setting. If you have an armv7 system

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hMon Oct  9 22:12:57 2017(r324454)
+++ head/sys/sys/param.hMon Oct  9 22:17:18 2017(r324455)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1200050  /* Master, propagated to newvers */
+#define __FreeBSD_version 1200051  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324453 - in head/sys/boot: . libsa

2017-10-09 Thread Warner Losh
Author: imp
Date: Mon Oct  9 22:12:53 2017
New Revision: 324453
URL: https://svnweb.freebsd.org/changeset/base/324453

Log:
  Create sys/boot/libsa and build libstand.a there
  
  Build libstand from inside the sys/boot build. Redirect all users in
  sys/boot to grab it from there. We still build it as libstand.a for
  the moment. When lib/libstand is moved here, we'll change the name.
  
  Sponsored by: Netflix

Added:
  head/sys/boot/libsa/
  head/sys/boot/libsa/Makefile   (contents, props changed)
Modified:
  head/sys/boot/Makefile
  head/sys/boot/Makefile.inc

Modified: head/sys/boot/Makefile
==
--- head/sys/boot/Makefile  Mon Oct  9 22:12:46 2017(r324452)
+++ head/sys/boot/Makefile  Mon Oct  9 22:12:53 2017(r324453)
@@ -2,6 +2,7 @@
 
 .include 
 
+SUBDIR+=   libsa
 .if ${MK_FORTH} != "no"
 # Build the add-in FORTH interpreter.
 SUBDIR+=   ficl

Modified: head/sys/boot/Makefile.inc
==
--- head/sys/boot/Makefile.inc  Mon Oct  9 22:12:46 2017(r324452)
+++ head/sys/boot/Makefile.inc  Mon Oct  9 22:12:53 2017(r324453)
@@ -7,7 +7,7 @@ __BOOT_MAKEFILE_INC__=${MFILE}
 
 SASRC=${SRCTOP}/lib/libstand
 # Normal stand alone library
-LIBSA=${OBJTOP}/lib/libstand/libstand.a
+LIBSA=${OBJTOP}/sys/boot/libsa/libstand.a
 # stand alone library compiled for 32-bit version of the processor
 LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a
 # stand along library compiled for userboot

Added: head/sys/boot/libsa/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/libsa/MakefileMon Oct  9 22:12:53 2017
(r324453)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+.include 
+
+.include "../Makefile.inc"
+
+LIBSTAND_SRC=  ${SASRC}
+LIBC_SRC=  ${SRCTOP}/lib/libc
+INTERNALLIB=
+INCS=
+MAN=
+.PATH: ${SASRC}
+
+.include "${SASRC}/Makefile"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324454 - in head: . lib share/mk

2017-10-09 Thread Warner Losh
Author: imp
Date: Mon Oct  9 22:12:57 2017
New Revision: 324454
URL: https://svnweb.freebsd.org/changeset/base/324454

Log:
  Disconnect libstand from the build.
  
  Remove libstand from the src/lib build. Remove LIBSTAND from
  bsd.libnames.mk. Add affected files to the obsolete files list.
  
  Sponsored by: Netflix

Modified:
  head/ObsoleteFiles.inc
  head/lib/Makefile
  head/share/mk/bsd.libnames.mk

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Mon Oct  9 22:12:53 2017(r324453)
+++ head/ObsoleteFiles.inc  Mon Oct  9 22:12:57 2017(r324454)
@@ -38,6 +38,11 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20161010: Remove libstand
+OLD_FILES+=usr/lib/libstand.a
+OLD_FILES+=usr/lib/libstand_p.a
+OLD_FILES+=usr/include/stand.h
+OLD_FILES+=usr/share/man/man3/libstand.3
 # 20171003: remove RCMDS
 OLD_FILES+=bin/rcp
 OLD_FILES+=rescue/rcp

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Mon Oct  9 22:12:53 2017(r324453)
+++ head/lib/Makefile   Mon Oct  9 22:12:57 2017(r324454)
@@ -75,7 +75,6 @@ SUBDIR=   ${SUBDIR_BOOTSTRAP} \
libsbuf \
libsmb \
libsqlite3 \
-   libstand \
libstdbuf \
libstdthreads \
libsysdecode \

Modified: head/share/mk/bsd.libnames.mk
==
--- head/share/mk/bsd.libnames.mk   Mon Oct  9 22:12:53 2017
(r324453)
+++ head/share/mk/bsd.libnames.mk   Mon Oct  9 22:12:57 2017
(r324454)
@@ -142,7 +142,6 @@ LIBSDP?=${LIBDESTDIR}${LIBDIR_BASE}/libsdp.a
 LIBSMB?=   ${LIBDESTDIR}${LIBDIR_BASE}/libsmb.a
 LIBSSL?=   ${LIBDESTDIR}${LIBDIR_BASE}/libssl.a
 LIBSSP_NONSHARED?= ${LIBDESTDIR}${LIBDIR_BASE}/libssp_nonshared.a
-LIBSTAND?= ${LIBDESTDIR}${LIBDIR_BASE}/libstand.a
 LIBSTDCPLUSPLUS?= ${LIBDESTDIR}${LIBDIR_BASE}/libstdc++.a
 LIBSTDTHREADS?=${LIBDESTDIR}${LIBDIR_BASE}/libstdthreads.a
 LIBSYSDECODE?= ${LIBDESTDIR}${LIBDIR_BASE}/libsysdecode.a
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324452 - in head/sys/boot: . arm/uboot efi/boot1 efi/loader i386/gptboot i386/gptzfsboot i386/loader i386/zfsboot mips/beri/boot2 mips/beri/loader mips/uboot powerpc/kboot powerpc/ofw ...

2017-10-09 Thread Warner Losh
Author: imp
Date: Mon Oct  9 22:12:46 2017
New Revision: 324452
URL: https://svnweb.freebsd.org/changeset/base/324452

Log:
  Define LIBSA* and use them instead of overloaded LIBSTAND
  
  LIBSA is the current stand alone library. LIBSA32 is the 32-bit
  version of the library. LIBSAU is the userboot version of libsa. Use
  the proper define instead of the more generic define.
  
  Sponsored by: Netflix

Modified:
  head/sys/boot/Makefile.inc
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/efi/boot1/Makefile
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/i386/gptboot/Makefile
  head/sys/boot/i386/gptzfsboot/Makefile
  head/sys/boot/i386/loader/Makefile
  head/sys/boot/i386/zfsboot/Makefile
  head/sys/boot/mips/beri/boot2/Makefile
  head/sys/boot/mips/beri/loader/Makefile
  head/sys/boot/mips/uboot/Makefile
  head/sys/boot/powerpc/kboot/Makefile
  head/sys/boot/powerpc/ofw/Makefile
  head/sys/boot/powerpc/ps3/Makefile
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/sparc64/loader/Makefile
  head/sys/boot/userboot/userboot/Makefile

Modified: head/sys/boot/Makefile.inc
==
--- head/sys/boot/Makefile.inc  Mon Oct  9 22:12:39 2017(r324451)
+++ head/sys/boot/Makefile.inc  Mon Oct  9 22:12:46 2017(r324452)
@@ -6,6 +6,12 @@
 __BOOT_MAKEFILE_INC__=${MFILE}
 
 SASRC=${SRCTOP}/lib/libstand
+# Normal stand alone library
+LIBSA=${OBJTOP}/lib/libstand/libstand.a
+# stand alone library compiled for 32-bit version of the processor
+LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a
+# stand along library compiled for userboot
+LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a
 
 SSP_CFLAGS=
 

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileMon Oct  9 22:12:39 2017
(r324451)
+++ head/sys/boot/arm/uboot/MakefileMon Oct  9 22:12:46 2017
(r324452)
@@ -112,7 +112,6 @@ LIBUBOOT=   ${.OBJDIR}/../../uboot/lib/libuboot.a
 CFLAGS+=   -I${.CURDIR}/../../uboot/lib
 CFLAGS+=   -I${.OBJDIR}/../../uboot/lib
 
-# where to get libstand from
 CFLAGS+=   -I${SASRC}
 
 CFLAGS+=   -fPIC
@@ -120,8 +119,8 @@ CFLAGS+=-fPIC
 # clang doesn't understand %D as a specifier to printf
 NO_WERROR.clang=
 
-DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
-LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
+DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
+LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
 
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 

Modified: head/sys/boot/efi/boot1/Makefile
==
--- head/sys/boot/efi/boot1/MakefileMon Oct  9 22:12:39 2017
(r324451)
+++ head/sys/boot/efi/boot1/MakefileMon Oct  9 22:12:46 2017
(r324452)
@@ -90,8 +90,8 @@ LIBEFI=   ${.OBJDIR}/../libefi/libefi.a
 # __aeabi_* (arm) or __divdi3 (i386).
 # as well as required string and memory functions for all platforms.
 #
-DPADD+=${LIBEFI} ${LIBSTAND}
-LDADD+=${LIBEFI} ${LIBSTAND}
+DPADD+=${LIBEFI} ${LIBSA}
+LDADD+=${LIBEFI} ${LIBSA}
 
 DPADD+=${LDSCRIPT}
 

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Mon Oct  9 22:12:39 2017
(r324451)
+++ head/sys/boot/efi/loader/Makefile   Mon Oct  9 22:12:46 2017
(r324452)
@@ -150,9 +150,9 @@ loader.efi: ${PROG}
 
 LIBEFI=${.OBJDIR}/../libefi/libefi.a
 
-DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSTAND} \
+DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} \
${LDSCRIPT}
-LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSTAND}
+LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA}
 
 .include 
 

Modified: head/sys/boot/i386/gptboot/Makefile
==
--- head/sys/boot/i386/gptboot/Makefile Mon Oct  9 22:12:39 2017
(r324451)
+++ head/sys/boot/i386/gptboot/Makefile Mon Oct  9 22:12:46 2017
(r324452)
@@ -50,8 +50,6 @@ OPENCRYPTO_XTS=   xform_aes_xts.o
 
 LD_FLAGS=${LD_FLAGS_BIN}
 
-LIBSTAND=  ${.OBJDIR}/../../libstand32/libstand.a
-
 # Pick up ../Makefile.inc early.
 .include 
 
@@ -76,7 +74,7 @@ gptboot.bin: gptboot.out
${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
 
 gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o 
${OPENCRYPTO_XTS}
-   ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBSTAND}
+   ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBSA32}
 
 gptboot.o: 

svn commit: r324451 - in head/sys/boot: . fdt

2017-10-09 Thread Warner Losh
Author: imp
Date: Mon Oct  9 22:12:39 2017
New Revision: 324451
URL: https://svnweb.freebsd.org/changeset/base/324451

Log:
  Add missing -I${SASRC} in a couple of places so that stand.h doesn't
  accidentally come in via host pollution.
  
  Sponsored by: Netflix

Modified:
  head/sys/boot/Makefile.ficl
  head/sys/boot/fdt/Makefile

Modified: head/sys/boot/Makefile.ficl
==
--- head/sys/boot/Makefile.ficl Mon Oct  9 22:12:32 2017(r324450)
+++ head/sys/boot/Makefile.ficl Mon Oct  9 22:12:39 2017(r324451)
@@ -27,7 +27,7 @@ CFLAGS+=  -m32 -mcpu=powerpc -I.
 .endif
 
 CFLAGS+=   -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \
-   -I${FICLDIR}/../common
+   -I${FICLDIR}/../common -I${SASRC}
 
 .if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32)
 .if !exists(machine)

Modified: head/sys/boot/fdt/Makefile
==
--- head/sys/boot/fdt/Makefile  Mon Oct  9 22:12:32 2017(r324450)
+++ head/sys/boot/fdt/Makefile  Mon Oct  9 22:12:39 2017(r324451)
@@ -12,6 +12,7 @@ SRCS+=fdt.c fdt_ro.c fdt_wip.c fdt_sw.c 
fdt_rw.c fdt
 # Loader's fdt commands extension sources.
 SRCS+= fdt_loader_cmd.c fdt_overlay.c
 
+CFLAGS+=   -I${SASRC}
 CFLAGS+=   -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/
 
 CFLAGS+=   -ffreestanding
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324450 - in head/sys/boot: . arm/uboot common efi/fdt efi/libefi efi/loader i386/libfirewire i386/libi386 i386/loader libstand32 mips/beri/boot2 mips/beri/loader mips/uboot ofw/libofw ...

2017-10-09 Thread Warner Losh
Author: imp
Date: Mon Oct  9 22:12:32 2017
New Revision: 324450
URL: https://svnweb.freebsd.org/changeset/base/324450

Log:
  Define SASRC and use it
  
  Define SASRC to point to the current libstand sources. Include
  ../Makefile.inc early enough in a few places so we can .include
  "${SASRC}/Makefile" and have it work. Create a new pass-up
  Makefile.inc in sys/boot/userboot to allow this pattern to work.
  
  Sponsored by: Netflix

Added:
  head/sys/boot/userboot/Makefile.inc   (contents, props changed)
Modified:
  head/sys/boot/Makefile.inc
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/common/Makefile.inc
  head/sys/boot/efi/fdt/Makefile
  head/sys/boot/efi/libefi/Makefile
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/i386/libfirewire/Makefile
  head/sys/boot/i386/libi386/Makefile
  head/sys/boot/i386/loader/Makefile
  head/sys/boot/libstand32/Makefile
  head/sys/boot/mips/beri/boot2/Makefile
  head/sys/boot/mips/beri/loader/Makefile
  head/sys/boot/mips/uboot/Makefile
  head/sys/boot/ofw/libofw/Makefile
  head/sys/boot/powerpc/kboot/Makefile
  head/sys/boot/powerpc/ofw/Makefile
  head/sys/boot/powerpc/ps3/Makefile
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/sparc64/loader/Makefile
  head/sys/boot/uboot/fdt/Makefile
  head/sys/boot/uboot/lib/Makefile
  head/sys/boot/userboot/libstand/Makefile
  head/sys/boot/userboot/userboot/Makefile
  head/sys/boot/userboot/zfs/Makefile
  head/sys/boot/zfs/Makefile

Modified: head/sys/boot/Makefile.inc
==
--- head/sys/boot/Makefile.inc  Mon Oct  9 22:11:57 2017(r324449)
+++ head/sys/boot/Makefile.inc  Mon Oct  9 22:12:32 2017(r324450)
@@ -2,6 +2,11 @@
 
 .include 
 
+.if !defined(__BOOT_MAKEFILE_INC__)
+__BOOT_MAKEFILE_INC__=${MFILE}
+
+SASRC=${SRCTOP}/lib/libstand
+
 SSP_CFLAGS=
 
 .if ${MACHINE_CPUARCH} == "arm"
@@ -24,9 +29,9 @@ DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && e
 DD=dd ${DD_NOSTATUS}
 
 .if ${MK_LOADER_FORCE_LE} != "no"
-
 .if ${MACHINE_ARCH} == "powerpc64"
 CFLAGS+=   -mlittle-endian
+.endif
 .endif
 
 .endif

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileMon Oct  9 22:11:57 2017
(r324449)
+++ head/sys/boot/arm/uboot/MakefileMon Oct  9 22:12:32 2017
(r324450)
@@ -113,7 +113,7 @@ CFLAGS+=-I${.CURDIR}/../../uboot/lib
 CFLAGS+=   -I${.OBJDIR}/../../uboot/lib
 
 # where to get libstand from
-CFLAGS+=   -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=   -I${SASRC}
 
 CFLAGS+=   -fPIC
 

Modified: head/sys/boot/common/Makefile.inc
==
--- head/sys/boot/common/Makefile.inc   Mon Oct  9 22:11:57 2017
(r324449)
+++ head/sys/boot/common/Makefile.inc   Mon Oct  9 22:12:32 2017
(r324450)
@@ -70,7 +70,7 @@ CFLAGS+=  -DBOOT_PROMPT_123
 
 .if defined(LOADER_INSTALL_SUPPORT)
 SRCS+= install.c
-CFLAGS+=-I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=-I${SASRC}
 .endif
 
 CLEANFILES+=   vers.c

Modified: head/sys/boot/efi/fdt/Makefile
==
--- head/sys/boot/efi/fdt/Makefile  Mon Oct  9 22:11:57 2017
(r324449)
+++ head/sys/boot/efi/fdt/Makefile  Mon Oct  9 22:12:32 2017
(r324450)
@@ -17,7 +17,7 @@ CFLAGS+=  -mgeneral-regs-only
 CFLAGS+=   -msoft-float
 .endif
 
-CFLAGS+=   -I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=   -I${SASRC}
 
 # EFI library headers
 CFLAGS+=   -I${.CURDIR}/../include

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Mon Oct  9 22:11:57 2017
(r324449)
+++ head/sys/boot/efi/libefi/Makefile   Mon Oct  9 22:12:32 2017
(r324450)
@@ -37,7 +37,7 @@ CFLAGS+= -fPIC -mno-red-zone
 .endif
 CFLAGS+= -I${.CURDIR}/../include
 CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${SASRC}
 .if ${MK_ZFS} != "no"
 CFLAGS+=   -I${.CURDIR}/../../zfs
 CFLAGS+=   -I${.CURDIR}/../../../cddl/boot/zfs

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Mon Oct  9 22:11:57 2017
(r324449)
+++ head/sys/boot/efi/loader/Makefile   Mon Oct  9 22:12:32 2017
(r324450)
@@ -37,7 +37,7 @@ CWARNFLAGS.zfs.c+=-Wno-missing-prototypes
 .endif
 
 .if defined(LOADER_NET_SUPPORT)
-CFLAGS+=   -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+=   -I${SASRC}
 .endif
 
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201

Modified: head/sys/boot/i386/libfirewire/Makefile
==
--- 

svn commit: r324449 - in head/sys/boot: arm/uboot efi/boot1 sparc64/loader

2017-10-09 Thread Warner Losh
Author: imp
Date: Mon Oct  9 22:11:57 2017
New Revision: 324449
URL: https://svnweb.freebsd.org/changeset/base/324449

Log:
  Prefer ${LIBSTAND} to -lstand
  
  Sponsored by: Netflix

Modified:
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/efi/boot1/Makefile
  head/sys/boot/sparc64/loader/Makefile

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileMon Oct  9 21:06:16 2017
(r324448)
+++ head/sys/boot/arm/uboot/MakefileMon Oct  9 22:11:57 2017
(r324449)
@@ -121,7 +121,7 @@ CFLAGS+=-fPIC
 NO_WERROR.clang=
 
 DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
-LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
+LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
 
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 

Modified: head/sys/boot/efi/boot1/Makefile
==
--- head/sys/boot/efi/boot1/MakefileMon Oct  9 21:06:16 2017
(r324448)
+++ head/sys/boot/efi/boot1/MakefileMon Oct  9 22:11:57 2017
(r324449)
@@ -91,7 +91,7 @@ LIBEFI=   ${.OBJDIR}/../libefi/libefi.a
 # as well as required string and memory functions for all platforms.
 #
 DPADD+=${LIBEFI} ${LIBSTAND}
-LDADD+=${LIBEFI} -lstand
+LDADD+=${LIBEFI} ${LIBSTAND}
 
 DPADD+=${LDSCRIPT}
 

Modified: head/sys/boot/sparc64/loader/Makefile
==
--- head/sys/boot/sparc64/loader/Makefile   Mon Oct  9 21:06:16 2017
(r324448)
+++ head/sys/boot/sparc64/loader/Makefile   Mon Oct  9 22:11:57 2017
(r324449)
@@ -86,7 +86,7 @@ CFLAGS+=  -I${.CURDIR}/../../../../lib/libstand/
 CFLAGS+=   -I${SRCTOP}/sys
 
 DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
-LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
+LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
 
 loader.help: help.common help.sparc64
cat ${.ALLSRC} | \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324448 - in head/sys: kern sys

2017-10-09 Thread Gleb Smirnoff
Author: glebius
Date: Mon Oct  9 21:06:16 2017
New Revision: 324448
URL: https://svnweb.freebsd.org/changeset/base/324448

Log:
  Improvements to sendfile(2) mbuf free routine.
  
  o Fall back to default m_ext free mech, using function pointer in
m_ext_free, and remove sf_ext_free() called directly from mbuf code.
Testing on modern CPUs showed no regression.
  o Provide internally used flag EXT_FLAG_SYNC, to mark that I/O uses
SF_SYNC flag.  Lack of the flag allows us not to dereference
ext_arg2, saving from a cache line miss.
  o Create function sendfile_free_page() that later will be used, for
multi-page mbufs.  For now compiler will inline it into
sendfile_free_mext().
  
  In collaboration with:gallatin
  Differential Revision:https://reviews.freebsd.org/D12615

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/kern/kern_sendfile.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Mon Oct  9 20:51:58 2017(r324447)
+++ head/sys/kern/kern_mbuf.c   Mon Oct  9 21:06:16 2017(r324448)
@@ -675,14 +675,6 @@ mb_free_ext(struct mbuf *m)
uma_zfree(zone_mbuf, mref);
break;
case EXT_SFBUF:
-   sf_ext_free(mref->m_ext.ext_arg1, mref->m_ext.ext_arg2);
-   uma_zfree(zone_mbuf, mref);
-   break;
-   case EXT_SFBUF_NOCACHE:
-   sf_ext_free_nocache(mref->m_ext.ext_arg1,
-   mref->m_ext.ext_arg2);
-   uma_zfree(zone_mbuf, mref);
-   break;
case EXT_NET_DRV:
case EXT_MOD_TYPE:
case EXT_DISPOSABLE:

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Mon Oct  9 20:51:58 2017
(r324447)
+++ head/sys/kern/kern_sendfile.c   Mon Oct  9 21:06:16 2017
(r324448)
@@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#defineEXT_FLAG_SYNC   EXT_FLAG_VENDOR1
+#defineEXT_FLAG_NOCACHEEXT_FLAG_VENDOR2
+
 /*
  * Structure describing a single sendfile(2) I/O, which may consist of
  * several underlying pager I/Os.
@@ -122,63 +125,53 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQU
  * Detach mapped page and release resources back to the system.  Called
  * by mbuf(9) code when last reference to a page is freed.
  */
-void
-sf_ext_free(void *arg1, void *arg2)
+static void
+sendfile_free_page(vm_page_t pg, bool nocache)
 {
-   struct sf_buf *sf = arg1;
-   struct sendfile_sync *sfs = arg2;
-   vm_page_t pg = sf_buf_page(sf);
 
-   sf_buf_free(sf);
-
vm_page_lock(pg);
/*
-* Check for the object going away on us. This can
-* happen since we don't hold a reference to it.
-* If so, we're responsible for freeing the page.
+* In either case check for the object going away on us.  This can
+* happen since we don't hold a reference to it.  If so, we're
+* responsible for freeing the page.  In 'noncache' case try to free
+* the page, but only if it is cheap to.
 */
-   if (vm_page_unwire(pg, PQ_INACTIVE) && pg->object == NULL)
-   vm_page_free(pg);
-   vm_page_unlock(pg);
+   if (vm_page_unwire(pg, nocache ? PQ_NONE : PQ_INACTIVE)) {
+   vm_object_t obj;
 
-   if (sfs != NULL) {
-   mtx_lock(>mtx);
-   KASSERT(sfs->count > 0, ("Sendfile sync botchup count == 0"));
-   if (--sfs->count == 0)
-   cv_signal(>cv);
-   mtx_unlock(>mtx);
+   if ((obj = pg->object) == NULL)
+   vm_page_free(pg);
+   else if (nocache) {
+   if (!vm_page_xbusied(pg) && VM_OBJECT_TRYWLOCK(obj)) {
+   vm_page_free(pg);
+   VM_OBJECT_WUNLOCK(obj);
+   } else
+   vm_page_deactivate(pg);
+   }
}
+   vm_page_unlock(pg);
 }
 
-/*
- * Same as above, but forces the page to be detached from the object
- * and go into free pool.
- */
-void
-sf_ext_free_nocache(void *arg1, void *arg2)
+static void
+sendfile_free_mext(struct mbuf *m)
 {
-   struct sf_buf *sf = arg1;
-   struct sendfile_sync *sfs = arg2;
-   vm_page_t pg = sf_buf_page(sf);
+   struct sf_buf *sf;
+   vm_page_t pg;
+   bool nocache;
 
-   sf_buf_free(sf);
+   KASSERT(m->m_flags & M_EXT && m->m_ext.ext_type == EXT_SFBUF,
+   ("%s: m %p !M_EXT or !EXT_SFBUF", __func__, m));
 
-   vm_page_lock(pg);
-   if (vm_page_unwire(pg, PQ_NONE)) {
-   vm_object_t obj;
+   sf 

svn commit: r324447 - in head/sys: kern sys

2017-10-09 Thread Gleb Smirnoff
Author: glebius
Date: Mon Oct  9 20:51:58 2017
New Revision: 324447
URL: https://svnweb.freebsd.org/changeset/base/324447

Log:
  In mb_dupcl() don't copy full m_ext, to avoid cache miss.  Respectively,
  in mb_free_ext() always use fields from the original refcount holding
  mbuf (see. r296242) mbuf.  Cuts another cache miss from mb_free_ext().
  
  However, treat EXT_EXTREF mbufs differently, since they are different -
  they don't have a refcount holding mbuf.
  
  Provide longer comments in m_ext declaration to explain this change
  and change from r296242.
  
  In collaboration with:gallatin
  Differential Revision:https://reviews.freebsd.org/D12615

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Mon Oct  9 20:35:31 2017(r324446)
+++ head/sys/kern/kern_mbuf.c   Mon Oct  9 20:51:58 2017(r324447)
@@ -675,20 +675,20 @@ mb_free_ext(struct mbuf *m)
uma_zfree(zone_mbuf, mref);
break;
case EXT_SFBUF:
-   sf_ext_free(m->m_ext.ext_arg1, m->m_ext.ext_arg2);
+   sf_ext_free(mref->m_ext.ext_arg1, mref->m_ext.ext_arg2);
uma_zfree(zone_mbuf, mref);
break;
case EXT_SFBUF_NOCACHE:
-   sf_ext_free_nocache(m->m_ext.ext_arg1,
-   m->m_ext.ext_arg2);
+   sf_ext_free_nocache(mref->m_ext.ext_arg1,
+   mref->m_ext.ext_arg2);
uma_zfree(zone_mbuf, mref);
break;
case EXT_NET_DRV:
case EXT_MOD_TYPE:
case EXT_DISPOSABLE:
-   KASSERT(m->m_ext.ext_free != NULL,
+   KASSERT(mref->m_ext.ext_free != NULL,
("%s: ext_free not set", __func__));
-   m->m_ext.ext_free(m);
+   mref->m_ext.ext_free(mref);
uma_zfree(zone_mbuf, mref);
break;
case EXT_EXTREF:

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Mon Oct  9 20:35:31 2017(r324446)
+++ head/sys/kern/uipc_mbuf.c   Mon Oct  9 20:51:58 2017(r324447)
@@ -188,7 +188,17 @@ mb_dupcl(struct mbuf *n, struct mbuf *m)
KASSERT(m->m_flags & M_EXT, ("%s: M_EXT not set on %p", __func__, m));
KASSERT(!(n->m_flags & M_EXT), ("%s: M_EXT set on %p", __func__, n));
 
-   n->m_ext = m->m_ext;
+   /*
+* Cache access optimization.  For most kinds of external
+* storage we don't need full copy of m_ext, since the
+* holder of the 'ext_count' is responsible to carry the
+* free routine and its arguments.  Exclusion is EXT_EXTREF,
+* where 'ext_cnt' doesn't point into mbuf at all.
+*/
+   if (m->m_ext.ext_type == EXT_EXTREF)
+   bcopy(>m_ext, >m_ext, sizeof(struct m_ext));
+   else
+   bcopy(>m_ext, >m_ext, m_ext_copylen);
n->m_flags |= M_EXT;
n->m_flags |= m->m_flags & M_RDONLY;
 

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Mon Oct  9 20:35:31 2017(r324446)
+++ head/sys/sys/mbuf.h Mon Oct  9 20:51:58 2017(r324447)
@@ -200,13 +200,29 @@ struct pkthdr {
 typedefvoid m_ext_free_t(struct mbuf *);
 struct m_ext {
union {
-   volatile u_int   ext_count; /* value of ref count info */
-   volatile u_int  *ext_cnt;   /* pointer to ref count info */
+   /*
+* If EXT_FLAG_EMBREF is set, then we use refcount in the
+* mbuf, the 'ext_count' member.  Otherwise, we have a
+* shadow copy and we use pointer 'ext_cnt'.  The original
+* mbuf is responsible to carry the pointer to free routine
+* and its arguments.  They aren't copied into shadows in
+* mb_dupcl() to avoid dereferencing next cachelines.
+*/
+   volatile u_int   ext_count;
+   volatile u_int  *ext_cnt;
};
char*ext_buf;   /* start of buffer */
uint32_t ext_size;  /* size of buffer, for ext_free */
uint32_t ext_type:8,/* type of external storage */
 ext_flags:24;  /* external storage mbuf flags */
+   /*
+* Fields below store the free context for the external storage.
+* They are valid only in the refcount carrying mbuf, the one with
+* EXT_FLAG_EMBREF flag, with exclusion for 

Re: svn commit: r324406 - head/sys/modules/em

2017-10-09 Thread Brooks Davis
On Sun, Oct 08, 2017 at 08:42:35AM -0700, Rodney W. Grimes wrote:
> > 
> > > On Oct 7, 2017, at 16:33, Sean Bruno  wrote:
> > > 
> > > Author: sbruno
> > > Date: Sat Oct  7 23:33:14 2017
> > > New Revision: 324406
> > > URL: https://svnweb.freebsd.org/changeset/base/324406
> > > 
> > > Log:
> > >  Fix symlink if_igb.ko in -current such that its relative and doesn't
> > >  end up with non-standard DESTDIR information in its symlink.  This
> > >  can happen very trivially if the release scripts are used.
> > > 
> > >  Sponsored by:Limelight Networks
> > > 
> > > Modified:
> > >  head/sys/modules/em/Makefile
> > > 
> > > Modified: head/sys/modules/em/Makefile
> > > ==
> > > --- head/sys/modules/em/MakefileSat Oct  7 23:30:57 2017(r324405)
> > > +++ head/sys/modules/em/MakefileSat Oct  7 23:33:14 2017(r324406)
> > > @@ -23,6 +23,6 @@ CFLAGS += -I${SRCTOP}/sys/dev/e1000
> > > #CFLAGS  += -DDEVICE_POLLING
> > > 
> > > afterinstall:
> > > -ln -sf ${DESTDIR}${KMODDIR}/${KMOD}.ko ${DESTDIR}${KMODDIR}/if_igb.ko
> > > +cd ${DESTDIR}${KMODDIR} && ln -sf if_em.ko if_igb.ko
> > 
> > While this is definitely better, the same thing could be achieved via:
> > 
> > ln -sf if_em.ko ${DESTDIR}/.../if_igb.ko
> 
> Should this be using SYMLINK+= as I thought using ln -sf was a breakage
> for meta mode stuff?

At the very least it should use INSTALL_LIBSYMLINK or INSTALL_RLIBSYMLINK.
Direct use of ln(1) is always a bug in install targets and ideally we
would make it fail.  (It breaks NO_ROOT installs by failing to add an
entry to the METALOG file).

-- Brooks


signature.asc
Description: PGP signature


svn commit: r324446 - in head: share/man/man9 sys/compat/ndis sys/dev/cas sys/dev/cxgbe sys/dev/cxgbe/tom sys/dev/dpaa sys/dev/if_ndis sys/dev/iscsi_initiator sys/dev/lge sys/dev/mwl sys/dev/netmap...

2017-10-09 Thread Gleb Smirnoff
Author: glebius
Date: Mon Oct  9 20:35:31 2017
New Revision: 324446
URL: https://svnweb.freebsd.org/changeset/base/324446

Log:
  Shorten list of arguments to mbuf external storage freeing function.
  
  All of these arguments are stored in m_ext, so there is no reason
  to pass them in the argument list.  Not all functions need the second
  argument, some don't even need the first one.  The second argument
  lives in next cache line, so not dereferencing it is a performance
  gain.  This was discovered in sendfile(2), which will be covered by
  next commits.
  
  The second goal of this commit is to bring even more flexibility
  to m_ext mbufs, allowing to create more fields in m_ext, opaque to
  the generic mbuf code, and potentially set and dereferenced by
  subsystems.
  
  Reviewed by:  gallatin, kbowling
  Differential Revision:https://reviews.freebsd.org/D12615

Modified:
  head/share/man/man9/mbpool.9
  head/share/man/man9/mbuf.9
  head/sys/compat/ndis/kern_ndis.c
  head/sys/compat/ndis/ndis_var.h
  head/sys/dev/cas/if_cas.c
  head/sys/dev/cas/if_casvar.h
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/dpaa/if_dtsec_rm.c
  head/sys/dev/if_ndis/if_ndis.c
  head/sys/dev/iscsi_initiator/isc_soc.c
  head/sys/dev/lge/if_lge.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/netmap/netmap_generic.c
  head/sys/dev/wb/if_wb.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/subr_mbpool.c
  head/sys/sys/mbpool.h
  head/sys/sys/mbuf.h

Modified: head/share/man/man9/mbpool.9
==
--- head/share/man/man9/mbpool.9Mon Oct  9 18:33:29 2017
(r324445)
+++ head/share/man/man9/mbpool.9Mon Oct  9 20:35:31 2017
(r324446)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 15, 2003
+.Dd September 27, 2017
 .Dt MBPOOL 9
 .Os
 .Sh NAME
@@ -50,7 +50,7 @@
 .Ft void
 .Fn mbp_free "struct mbpool *mbp" "void *p"
 .Ft void
-.Fn mbp_ext_free "void *" "void *"
+.Fn mbp_ext_free "struct mbuf *"
 .Ft void
 .Fn mbp_card_free "struct mbpool *mbp"
 .Ft void
@@ -223,8 +223,6 @@ The function
 can be given to
 .Fn m_extadd
 as the free function.
-The user argument must be the pointer to
-the pool.
 .Pp
 Before using the contents of a buffer returned by the card, the driver
 must call

Modified: head/share/man/man9/mbuf.9
==
--- head/share/man/man9/mbuf.9  Mon Oct  9 18:33:29 2017(r324445)
+++ head/share/man/man9/mbuf.9  Mon Oct  9 20:35:31 2017(r324446)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 10, 2016
+.Dd September 27, 2017
 .Dt MBUF 9
 .Os
 .\"
@@ -44,12 +44,12 @@
 .Fn MCLGET "struct mbuf *mbuf" "int how"
 .Fo MEXTADD
 .Fa "struct mbuf *mbuf"
-.Fa "caddr_t buf"
+.Fa "char *buf"
 .Fa "u_int size"
-.Fa "void (*free)(void *opt_arg1, void *opt_arg2)"
+.Fa "void (*free)(struct mbuf *)"
 .Fa "void *opt_arg1"
 .Fa "void *opt_arg2"
-.Fa "short flags"
+.Fa "int flags"
 .Fa "int type"
 .Fc
 .\"
@@ -416,8 +416,13 @@ The
 .Fa opt_arg1
 and
 .Fa opt_arg2
-arguments will be passed unmodified to
-.Fa free .
+arguments will be saved in
+.Va ext_arg1
+and
+.Va ext_arg2
+fields of the
+.Va struct m_ext
+of the mbuf.
 The
 .Fa flags
 argument specifies additional

Modified: head/sys/compat/ndis/kern_ndis.c
==
--- head/sys/compat/ndis/kern_ndis.cMon Oct  9 18:33:29 2017
(r324445)
+++ head/sys/compat/ndis/kern_ndis.cMon Oct  9 20:35:31 2017
(r324446)
@@ -495,17 +495,21 @@ ndis_return(dobj, arg)
KeReleaseSpinLock(>nmb_returnlock, irql);
 }
 
+static void
+ndis_ext_free(struct mbuf *m)
+{
+
+   return (ndis_return_packet(m->m_ext.ext_arg1));
+}
+
 void
-ndis_return_packet(struct mbuf *m, void *buf, void *arg)
+ndis_return_packet(ndis_packet *p)
 {
-   ndis_packet *p;
ndis_miniport_block *block;
 
-   if (arg == NULL)
+   if (p == NULL)
return;
 
-   p = arg;
-
/* Decrement refcount. */
p->np_refcnt--;
 
@@ -676,9 +680,8 @@ ndis_ptom(m0, p)
return (ENOBUFS);
}
m->m_len = MmGetMdlByteCount(buf);
-   m->m_data = MmGetMdlVirtualAddress(buf);
-   MEXTADD(m, m->m_data, m->m_len, ndis_return_packet,
-   m->m_data, p, 0, EXT_NDIS);
+   m_extadd(m, MmGetMdlVirtualAddress(buf), m->m_len,
+   ndis_ext_free, p, NULL, 0, EXT_NDIS);
p->np_refcnt++;
 
totlen += m->m_len;

Modified: head/sys/compat/ndis/ndis_var.h
==
--- head/sys/compat/ndis/ndis_var.h Mon Oct  9 18:33:29 2017
(r324445)
+++ head/sys/compat/ndis/ndis_var.h Mon Oct  9 20:35:31 2017
(r324446)
@@ -1743,7 +1743,7 @@ extern int 

svn commit: r324445 - head/sys/kern

2017-10-09 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct  9 18:33:29 2017
New Revision: 324445
URL: https://svnweb.freebsd.org/changeset/base/324445

Log:
  When showing the sleepqueues from the in-kernel debugger,
  properly dump all the sendqueues and not just the first one
  
  History:
  It appears that in the commit which introduced the code,
  r165272, the array indexes of "sq_blocked[0]" and "td_name[i]"
  were interchanged. In r180927 "td_name[i]" was corrected to
  "td_name[0]", but "sq_blocked[0]" was left unchanged.
  
  PR:   222624
  Discussed with:   kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/kern/subr_sleepqueue.c

Modified: head/sys/kern/subr_sleepqueue.c
==
--- head/sys/kern/subr_sleepqueue.c Mon Oct  9 18:19:06 2017
(r32)
+++ head/sys/kern/subr_sleepqueue.c Mon Oct  9 18:33:29 2017
(r324445)
@@ -1435,7 +1435,7 @@ found:
if (TAILQ_EMPTY(>sq_blocked[i]))
db_printf("\tempty\n");
else
-   TAILQ_FOREACH(td, >sq_blocked[0],
+   TAILQ_FOREACH(td, >sq_blocked[i],
  td_slpq) {
db_printf("\t%p (tid %d, pid %d, \"%s\")\n", td,
  td->td_tid, td->td_proc->p_pid,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-10-09 Thread Cy Schubert
In message <201710091819.v99ij6ob009...@repo.freebsd.org>, Alan Cox writes:
> Author: alc
> Date: Mon Oct  9 18:19:06 2017
> New Revision: 32
> URL: https://svnweb.freebsd.org/changeset/base/32
> 
> Log:
>   The recent change to initialization of blists (r324420) relied on '-1'
>   appearing only where the code explicitly set it, but since much of the
>   data was not initialized, '-1' appeared other places too, and led to
>   panics.  Clear the allocated data before initializing nonzero values by
>   allocating with M_ZERO.
>   
>   Submitted by:   Doug Moore 
>   Reported by:Oleg V. Nauman , cy
>   Tested by:  Oleg V. Nauman 
>   MFC after:  1 week
>   X-MFC with: r324420
>   Differential Revision:  https://reviews.freebsd.org/D12627

Thanks. This fixes the recurring panic on one of my machines.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.




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


Re: svn commit: r324420 - in head/sys: kern sys

2017-10-09 Thread Alan Cox
On 10/09/2017 10:54, Cy Schubert wrote:
> In message <201710082217.v98mhdni012...@repo.freebsd.org>, Alan Cox writes:
>> Author: alc
>> Date: Sun Oct  8 22:17:39 2017
>> New Revision: 324420
>> URL: https://svnweb.freebsd.org/changeset/base/324420
>>
>> Log:
>>   The blst_radix_init function has two purposes - to compute the number of
>>   nodes to allocate for the blist, and to initialize them.  The computation
>>   can be done much more quickly by identifying the terminating node, if any,
>>   at every level of the tree and then summing the number of nodes at each
>>   level that precedes the topmost terminator.  The initialization can also be
>>   done quickly, since settings at the root mark the tree as all-allocated, an
>> d
>>   only a few terminator nodes need to be marked in the rest of the tree.
>>   Eliminate blst_radix_init, and perform its two functions more simply in
>>   blist_create.
>>   
>>   The allocation of the blist takes places in two pieces, but there's no good
>>   reason to do so, when a single allocation is sufficient, and simpler.
>>   Allocate the blist struct, and the array of nodes associated with it, with 
>> a
>>   single allocation.
>>   
>>   Submitted by:  Doug Moore 
>>   Reviewed by:   markj (an earlier version)
>>   MFC after: 1 week
>>   Differential Revision: https://reviews.freebsd.org/D11968
>>
>> Modified:
>>   head/sys/kern/subr_blist.c
>>   head/sys/sys/blist.h
>>
>> Modified: head/sys/kern/subr_blist.c
>> =
>> =
>> --- head/sys/kern/subr_blist.c   Sun Oct  8 21:20:25 2017(r32441
>> 9)
>> +++ head/sys/kern/subr_blist.c   Sun Oct  8 22:17:39 2017(r32442
>> 0)
>> @@ -108,6 +108,7 @@ __FBSDID("$FreeBSD$");
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -137,7 +138,6 @@ static void blst_copy(blmeta_t *scan, daddr_t blk, dad
>>  static daddr_t blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count);
>>  static daddr_t blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t coun
>> t,
>>  u_daddr_t radix);
>> -static daddr_t  blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t 
>> count);
>>  #ifndef _KERNEL
>>  static void blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix,
>>  int tab);
>> @@ -218,30 +218,69 @@ blist_t
>>  blist_create(daddr_t blocks, int flags)
>>  {
>>  blist_t bl;
>> -daddr_t nodes, radix;
>> +daddr_t i, last_block;
>> +u_daddr_t nodes, radix, skip;
>> +int digit;
>>  
>>  /*
>> - * Calculate the radix field used for scanning.
>> + * Calculate the radix and node count used for scanning.  Find the last
>> + * block that is followed by a terminator.
>>   */
>> +last_block = blocks - 1;
>>  radix = BLIST_BMAP_RADIX;
>>  while (radix < blocks) {
>> +if (((last_block / radix + 1) & BLIST_META_MASK) != 0)
>> +/*
>> + * A terminator will be added.  Update last_block to th
>> e
>> + * position just before that terminator.
>> + */
>> +last_block |= radix - 1;
>>  radix *= BLIST_META_RADIX;
>>  }
>> -nodes = 1 + blst_radix_init(NULL, radix, blocks);
>>  
>> -bl = malloc(sizeof(struct blist), M_SWAP, flags);
>> +/*
>> + * Count the meta-nodes in the expanded tree, including the final
>> + * terminator, from the bottom level up to the root.
>> + */
>> +nodes = (last_block >= blocks) ? 2 : 1;
>> +last_block /= BLIST_BMAP_RADIX;
>> +while (last_block > 0) {
>> +nodes += last_block + 1;
>> +last_block /= BLIST_META_RADIX;
>> +}
>> +bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags);
>>  if (bl == NULL)
>>  return (NULL);
>>  
>>  bl->bl_blocks = blocks;
>>  bl->bl_radix = radix;
>>  bl->bl_cursor = 0;
>> -bl->bl_root = malloc(nodes * sizeof(blmeta_t), M_SWAP, flags);
>> -if (bl->bl_root == NULL) {
>> -free(bl, M_SWAP);
>> -return (NULL);
>> +
>> +/*
>> + * Initialize the empty tree by filling in root values, then initialize
>> + * just the terminators in the rest of the tree.
>> + */
>> +bl->bl_root[0].bm_bighint = 0;
>> +if (radix == BLIST_BMAP_RADIX)
>> +bl->bl_root[0].u.bmu_bitmap = 0;
>> +else
>> +bl->bl_root[0].u.bmu_avail = 0;
>> +last_block = blocks - 1;
>> +i = 0;
>> +while (radix > BLIST_BMAP_RADIX) {
>> +radix /= BLIST_META_RADIX;
>> +skip = radix_to_skip(radix);
>> +digit = last_block / radix;
>> +i += 1 + digit * skip;
>> +if (digit != BLIST_META_MASK) {
>> +/*
>> + * Add a terminator.
>> + */
>> +

svn commit: r324444 - head/sys/kern

2017-10-09 Thread Alan Cox
Author: alc
Date: Mon Oct  9 18:19:06 2017
New Revision: 32
URL: https://svnweb.freebsd.org/changeset/base/32

Log:
  The recent change to initialization of blists (r324420) relied on '-1'
  appearing only where the code explicitly set it, but since much of the
  data was not initialized, '-1' appeared other places too, and led to
  panics.  Clear the allocated data before initializing nonzero values by
  allocating with M_ZERO.
  
  Submitted by: Doug Moore 
  Reported by:  Oleg V. Nauman , cy
  Tested by:Oleg V. Nauman 
  MFC after:1 week
  X-MFC with:   r324420
  Differential Revision:https://reviews.freebsd.org/D12627

Modified:
  head/sys/kern/subr_blist.c

Modified: head/sys/kern/subr_blist.c
==
--- head/sys/kern/subr_blist.c  Mon Oct  9 18:00:40 2017(r324443)
+++ head/sys/kern/subr_blist.c  Mon Oct  9 18:19:06 2017(r32)
@@ -248,7 +248,8 @@ blist_create(daddr_t blocks, int flags)
nodes += last_block + 1;
last_block /= BLIST_META_RADIX;
}
-   bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags);
+   bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags |
+   M_ZERO);
if (bl == NULL)
return (NULL);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324443 - head/usr.sbin/cxgbetool

2017-10-09 Thread Navdeep Parhar
Author: np
Date: Mon Oct  9 18:00:40 2017
New Revision: 324443
URL: https://svnweb.freebsd.org/changeset/base/324443

Log:
  cxgbetool(8): Do not close uninitialized fd on malloc failure.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/usr.sbin/cxgbetool/cxgbetool.c

Modified: head/usr.sbin/cxgbetool/cxgbetool.c
==
--- head/usr.sbin/cxgbetool/cxgbetool.c Mon Oct  9 17:12:02 2017
(r324442)
+++ head/usr.sbin/cxgbetool/cxgbetool.c Mon Oct  9 18:00:40 2017
(r324443)
@@ -1901,7 +1901,6 @@ dumpstate(int argc, const char *argv[])
dump.len = 8 * 1024 * 1024;
dump.data = malloc(dump.len);
if (dump.data == NULL) {
-   close(fd);
return (ENOMEM);
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324415 - in head/sys: kern sys

2017-10-09 Thread John Baldwin
On Sunday, October 08, 2017 11:56:30 AM Ian Lepore wrote:
> On Sun, 2017-10-08 at 17:33 +, Ian Lepore wrote:
> > Author: ian
> > Date: Sun Oct  8 17:33:49 2017
> > New Revision: 324415
> > URL: https://svnweb.freebsd.org/changeset/base/324415
> > 
> > Log:
> >   Add eventhandler notifications for newbus device attach/detach.
> >   
> > [...]
> >   
> >   A couple salient comments from the review, they amount to some helpful
> >   documentation about these events, but there's currently no good place for
> >   such documentation...
> 
> About this last point... sys/eventhandler.h is now an ever-growing list
> of EVENTHANDLER_DECLARE() statements for events that are unrelated to
> each other.  I think we are at the point where it's no longer a few
> well-known "standard system event queues", it's turning into a mess.
> 
> My first thought was to add these to bus.h because they're bus events.
>  But you have to include eventhandler.h to use EVENTHANDLER_DECLARE,
> and I didn't want to pull it (and its dependencies) into bus.h.

I think we should fix the headers so that we can declare these in bus.h.
It might consist of moving some bits of eventhandler.h into _eventhandler.h.
All you would need for _eventhandler.h is struct eventhandler_entry and
EVENTHANDLER_DECLARE() I think.

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


svn commit: r324442 - head/release/arm

2017-10-09 Thread Glen Barber
Author: gjb
Date: Mon Oct  9 17:12:02 2017
New Revision: 324442
URL: https://svnweb.freebsd.org/changeset/base/324442

Log:
  Switch BEAGLEBONE, CUBIEBOARD, and PANDABOARD to use the GENERIC
  kernel configuration.
  
  Submitted by: andrew
  Differential Revision:https://reviews.freebsd.org/D12484
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/arm/BEAGLEBONE.conf
  head/release/arm/CUBIEBOARD.conf
  head/release/arm/PANDABOARD.conf

Modified: head/release/arm/BEAGLEBONE.conf
==
--- head/release/arm/BEAGLEBONE.confMon Oct  9 16:33:37 2017
(r324441)
+++ head/release/arm/BEAGLEBONE.confMon Oct  9 17:12:02 2017
(r324442)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-beaglebone"
-KERNEL="BEAGLEBONE"
+KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x8800"
 IMAGE_SIZE="2560M"
 PART_SCHEME="MBR"
@@ -15,6 +15,7 @@ FAT_SIZE="2m"
 FAT_TYPE="12"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
+export BOARDNAME="BEAGLEBONE"
 
 arm_install_uboot() {
UBOOT_DIR="/usr/local/share/u-boot/u-boot-beaglebone"

Modified: head/release/arm/CUBIEBOARD.conf
==
--- head/release/arm/CUBIEBOARD.confMon Oct  9 16:33:37 2017
(r324441)
+++ head/release/arm/CUBIEBOARD.confMon Oct  9 17:12:02 2017
(r324442)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-cubieboard"
-KERNEL="ALLWINNER_UP"
+KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"
 IMAGE_SIZE="2560M"
 PART_SCHEME="MBR"
@@ -15,6 +15,7 @@ FAT_SIZE="32m -b 1m"
 FAT_TYPE="16"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
+export BOARDNAME="CUBIEBOARD"
 
 arm_install_uboot() {
UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard"

Modified: head/release/arm/PANDABOARD.conf
==
--- head/release/arm/PANDABOARD.confMon Oct  9 16:33:37 2017
(r324441)
+++ head/release/arm/PANDABOARD.confMon Oct  9 17:12:02 2017
(r324442)
@@ -7,7 +7,7 @@ EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
 EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-pandaboard"
-KERNEL="PANDABOARD"
+KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x8800"
 IMAGE_SIZE="2560M"
 PART_SCHEME="MBR"
@@ -15,6 +15,7 @@ FAT_SIZE="2m"
 FAT_TYPE="12"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
+export BOARDNAME="PANDABOARD"
 
 arm_install_uboot() {
UBOOT_DIR="/usr/local/share/u-boot/u-boot-pandaboard"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324441 - head/usr.sbin/freebsd-update

2017-10-09 Thread Guangyuan Yang
Author: ygy (doc committer)
Date: Mon Oct  9 16:33:37 2017
New Revision: 324441
URL: https://svnweb.freebsd.org/changeset/base/324441

Log:
  Fix freebsd-update(8) erroneous message and exit status when "fetch install" 
used.
  
  PR:   190660
  Reviewed by:  allanjude
  Approved by:  emaste
  Differential Revision:https://reviews.freebsd.org/D12037

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Mon Oct  9 16:27:31 
2017(r324440)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Mon Oct  9 16:33:37 
2017(r324441)
@@ -418,6 +418,9 @@ init_params () {
 
# Run without a TTY
NOTTYOK=0
+
+   # Fetched first in a chain of commands
+   ISFETCHED=0
 }
 
 # Parse the command line
@@ -783,8 +786,10 @@ install_check_params () {
# Check that we have updates ready to install
if ! [ -L ${BDHASH}-install ]; then
echo "No updates are available to install."
-   echo "Run '$0 fetch' first."
-   exit 1
+   if [ $ISFETCHED -eq 0 ]; then
+   echo "Run '$0 fetch' first."
+   fi
+   exit 0
fi
if ! [ -f ${BDHASH}-install/INDEX-OLD ] ||
! [ -f ${BDHASH}-install/INDEX-NEW ]; then
@@ -3241,6 +3246,7 @@ cmd_fetch () {
fi
fetch_check_params
fetch_run || exit 1
+   ISFETCHED=1
 }
 
 # Cron command.  Make sure the parameters are sensible; wait
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324439 - head/sys/amd64/amd64

2017-10-09 Thread Konstantin Belousov
Author: kib
Date: Mon Oct  9 16:20:39 2017
New Revision: 324439
URL: https://svnweb.freebsd.org/changeset/base/324439

Log:
  Change amd64_get_ldt() to return 'EOF' when the LDT is not yet
  allocated, when requested range of descriptors does not fit into
  currently allocated LDT, or trim the return if the range fits
  partially.  Before, the function returned EINVAL.
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/sys_machdep.c

Modified: head/sys/amd64/amd64/sys_machdep.c
==
--- head/sys/amd64/amd64/sys_machdep.c  Mon Oct  9 16:19:26 2017
(r324438)
+++ head/sys/amd64/amd64/sys_machdep.c  Mon Oct  9 16:20:39 2017
(r324439)
@@ -556,12 +556,12 @@ amd64_get_ldt(struct thread *td, struct i386_ldt_args 
uap->start, uap->num, (void *)uap->descs);
 #endif
 
-   if (uap->start >= max_ldt_segment)
-   return (EINVAL);
-   num = min(uap->num, max_ldt_segment - uap->start);
pldt = td->td_proc->p_md.md_ldt;
-   if (pldt == NULL)
-   return (EINVAL);
+   if (pldt == NULL || uap->start >= max_ldt_segment || uap->num == 0) {
+   td->td_retval[0] = 0;
+   return (0);
+   }
+   num = min(uap->num, max_ldt_segment - uap->start);
lp = &((struct user_segment_descriptor *)(pldt->ldt_base))[uap->start];
data = malloc(num * sizeof(struct user_segment_descriptor), M_TEMP,
M_WAITOK);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324438 - head/sys/i386/i386

2017-10-09 Thread Konstantin Belousov
Author: kib
Date: Mon Oct  9 16:19:26 2017
New Revision: 324438
URL: https://svnweb.freebsd.org/changeset/base/324438

Log:
  Change i386_get_ldt() to return 'EOF' when the requested range of
  descriptors does not fit into currently allocated LDT, or trim the
  return if the range fits partially.  Before, the function returned
  EINVAL.
  
  Fix two bugs in r324366: use capped num counter for malloc size, and
  do not leak allocated buffer on EINVAL (by handling EINVAL case as
  normal, see above).
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cMon Oct  9 16:07:27 2017
(r324437)
+++ head/sys/i386/i386/sys_machdep.cMon Oct  9 16:19:26 2017
(r324438)
@@ -534,23 +534,20 @@ i386_get_ldt(struct thread *td, struct i386_ldt_args *
uap->start, uap->num, (void *)uap->descs);
 #endif
 
-   if (uap->start >= MAX_LD)
-   return (EINVAL);
-   num = min(uap->num, MAX_LD - uap->start);
-   data = malloc(uap->num * sizeof(union descriptor), M_TEMP, M_WAITOK);
+   num = min(uap->num, MAX_LD);
+   data = malloc(num * sizeof(union descriptor), M_TEMP, M_WAITOK);
mtx_lock_spin(_lock);
pldt = td->td_proc->p_md.md_ldt;
nldt = pldt != NULL ? pldt->ldt_len : nitems(ldt);
-   num = min(num, nldt);
-   if (uap->start > nldt || uap->start + num > nldt) {
-   mtx_unlock_spin(_lock);
-   return (EINVAL);
+   if (uap->start >= nldt) {
+   num = 0;
+   } else {
+   num = min(num, nldt - uap->start);
+   bcopy(pldt != NULL ?
+   &((union descriptor *)(pldt->ldt_base))[uap->start] :
+   [uap->start], data, num * sizeof(union descriptor));
}
-   bcopy(pldt != NULL ?
-   &((union descriptor *)(pldt->ldt_base))[uap->start] :
-   [uap->start], data, num * sizeof(union descriptor));
mtx_unlock_spin(_lock);
-
error = copyout(data, uap->descs, num * sizeof(union descriptor));
if (error == 0)
td->td_retval[0] = num;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324437 - head/sys/i386/i386

2017-10-09 Thread Konstantin Belousov
Author: kib
Date: Mon Oct  9 16:07:27 2017
New Revision: 324437
URL: https://svnweb.freebsd.org/changeset/base/324437

Log:
  Improvements to set_user_ldt().
  
  Remove mtx_owned() checks from set_user_ldt().  Split the function
  into _locked() version which requires the dt_lock spinlock owned, and
  make set_user_ldt() a wrapper.  Add a comment in swtch.s noting that
  the call to the new set_user_ldt() cannot recurse on dt_lock.
  
  Remove #ifdef SMP block, the addend is always zero on UP.
  
  Fix type of set_user_ldt_rv(), making it match the type used for
  smb_rendezvous() callback, and remove the cast.  Use curproc.
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/swtch.s
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/swtch.s
==
--- head/sys/i386/i386/swtch.s  Mon Oct  9 16:02:15 2017(r324436)
+++ head/sys/i386/i386/swtch.s  Mon Oct  9 16:07:27 2017(r324437)
@@ -279,6 +279,10 @@ sw1:
pushl   %edx/* Preserve pointer to pcb. */
addl$P_MD,%eax  /* Pointer to mdproc is arg. */
pushl   %eax
+   /*
+* Holding dt_lock prevents context switches, so dt_lock cannot
+* be held now and set_user_ldt() will not deadlock acquiring it.
+*/
callset_user_ldt
addl$4,%esp
popl%edx

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cMon Oct  9 16:02:15 2017
(r324436)
+++ head/sys/i386/i386/sys_machdep.cMon Oct  9 16:07:27 2017
(r324437)
@@ -69,10 +69,10 @@ __FBSDID("$FreeBSD$");
 #defineNULL_LDT_BASE   ((caddr_t)NULL)
 
 #ifdef SMP
-static void set_user_ldt_rv(struct vmspace *vmsp);
+static void set_user_ldt_rv(void *arg);
 #endif
 static int i386_set_ldt_data(struct thread *, int start, int num,
-   union descriptor *descs);
+union descriptor *descs);
 static int i386_ldt_grow(struct thread *td, int len);
 
 void
@@ -405,41 +405,40 @@ done:
  * Update the GDT entry pointing to the LDT to point to the LDT of the
  * current process. Manage dt_lock holding/unholding autonomously.
  */   
-void
-set_user_ldt(struct mdproc *mdp)
+static void
+set_user_ldt_locked(struct mdproc *mdp)
 {
struct proc_ldt *pldt;
-   int dtlocked;
+   int gdt_idx;
 
-   dtlocked = 0;
-   if (!mtx_owned(_lock)) {
-   mtx_lock_spin(_lock);
-   dtlocked = 1;
-   }
+   mtx_assert(_lock, MA_OWNED);
 
pldt = mdp->md_ldt;
-#ifdef SMP
-   gdt[PCPU_GET(cpuid) * NGDT + GUSERLDT_SEL].sd = pldt->ldt_sd;
-#else
-   gdt[GUSERLDT_SEL].sd = pldt->ldt_sd;
-#endif
+   gdt_idx = GUSERLDT_SEL;
+   gdt_idx += PCPU_GET(cpuid) * NGDT;  /* always 0 on UP */
+   gdt[gdt_idx].sd = pldt->ldt_sd;
lldt(GSEL(GUSERLDT_SEL, SEL_KPL));
PCPU_SET(currentldt, GSEL(GUSERLDT_SEL, SEL_KPL));
-   if (dtlocked)
-   mtx_unlock_spin(_lock);
 }
 
+void
+set_user_ldt(struct mdproc *mdp)
+{
+
+   mtx_lock_spin(_lock);
+   set_user_ldt_locked(mdp);
+   mtx_unlock_spin(_lock);
+}
+
 #ifdef SMP
 static void
-set_user_ldt_rv(struct vmspace *vmsp)
+set_user_ldt_rv(void *arg)
 {
-   struct thread *td;
+   struct proc *p;
 
-   td = curthread;
-   if (vmsp != td->td_proc->p_vmspace)
-   return;
-
-   set_user_ldt(>td_proc->p_md);
+   p = curproc;
+   if (arg == p->p_vmspace)
+   set_user_ldt(>p_md);
 }
 #endif
 
@@ -796,10 +795,10 @@ i386_ldt_grow(struct thread *td, int len) 
 * to acquire it.
 */
mtx_unlock_spin(_lock);
-   smp_rendezvous(NULL, (void (*)(void *))set_user_ldt_rv,
-   NULL, td->td_proc->p_vmspace);
+   smp_rendezvous(NULL, set_user_ldt_rv, NULL,
+   td->td_proc->p_vmspace);
 #else
-   set_user_ldt(>td_proc->p_md);
+   set_user_ldt_locked(>td_proc->p_md);
mtx_unlock_spin(_lock);
 #endif
if (old_ldt_base != NULL_LDT_BASE) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324423 - head/share/misc

2017-10-09 Thread Eitan Adler
On 9 October 2017 at 07:47, Li-Wen Hsu  wrote:

> Hi Eitan,
>
> Plase revert this line, "Taiwan" is how we call ourself.
Done in r324436.


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324436 - head/share/misc

2017-10-09 Thread Eitan Adler
Author: eadler
Date: Mon Oct  9 16:02:15 2017
New Revision: 324436
URL: https://svnweb.freebsd.org/changeset/base/324436

Log:
  See r198948

Modified:
  head/share/misc/iso3166

Modified: head/share/misc/iso3166
==
--- head/share/misc/iso3166 Mon Oct  9 15:54:57 2017(r324435)
+++ head/share/misc/iso3166 Mon Oct  9 16:02:15 2017(r324436)
@@ -236,7 +236,7 @@ SZ  SWZ 748 Swaziland
 SE SWE 752 Sweden
 CH CHE 756 Switzerland
 SY SYR 760 Syrian Arab Republic
-TW TWN 158 Taiwan, Province of China
+TW TWN 158 Taiwan
 TJ TJK 762 Tajikistan
 TZ TZA 834 Tanzania United Republic of
 TH THA 764 Thailand
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324435 - head/sys/contrib/dev/iwm

2017-10-09 Thread George V. Neville-Neil
Author: gnn
Date: Mon Oct  9 15:54:57 2017
New Revision: 324435
URL: https://svnweb.freebsd.org/changeset/base/324435

Log:
  Add the firmware for the Intel 8265 WiFi device.
  
  MFC after:1 month

Added:
  head/sys/contrib/dev/iwm/iwm-8265-22.fw.uu

Added: head/sys/contrib/dev/iwm/iwm-8265-22.fw.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/iwm/iwm-8265-22.fw.uu  Mon Oct  9 15:54:57 2017
(r324435)
@@ -0,0 +1,40270 @@
+begin 644 iwm-8265-22.fw
+M`$E73`IS=')E86TZ0V]R94-Y8VQE,3E?"`$`'@@"
+MCWX#`!P0`!L$`@```#,,
+M@```@`$`,PP!``"(``"S#`(`
+M`$```(`&`!,```"\`@```$!```8```"A```!``"&@P<6
+M(`#/`0!`0`$$A`4`
+M
+MU7?1O$KMC1P!%L)AM`1@'DT[FA#1
+MOWMZR()DJ-L;GQEBIN9H[A^ZS%KH6MG.(:=CV\&$V<0:'I[5@L7;]O#+S6])Q;OTUZ`
+M@Q9O#\ZQZUROU1XL3>@GIX0A'ZLQS3.]EM]`#)-:.@LH#44.K^C\7[\`!P3D
+MY4F9W;8[]70ZRI8T>H?6RDCG3OM
+M8]KY^9H/)$3]O$5[

Re: svn commit: r324420 - in head/sys: kern sys

2017-10-09 Thread Cy Schubert
In message <201710082217.v98mhdni012...@repo.freebsd.org>, Alan Cox writes:
> Author: alc
> Date: Sun Oct  8 22:17:39 2017
> New Revision: 324420
> URL: https://svnweb.freebsd.org/changeset/base/324420
> 
> Log:
>   The blst_radix_init function has two purposes - to compute the number of
>   nodes to allocate for the blist, and to initialize them.  The computation
>   can be done much more quickly by identifying the terminating node, if any,
>   at every level of the tree and then summing the number of nodes at each
>   level that precedes the topmost terminator.  The initialization can also be
>   done quickly, since settings at the root mark the tree as all-allocated, an
> d
>   only a few terminator nodes need to be marked in the rest of the tree.
>   Eliminate blst_radix_init, and perform its two functions more simply in
>   blist_create.
>   
>   The allocation of the blist takes places in two pieces, but there's no good
>   reason to do so, when a single allocation is sufficient, and simpler.
>   Allocate the blist struct, and the array of nodes associated with it, with 
> a
>   single allocation.
>   
>   Submitted by:   Doug Moore 
>   Reviewed by:markj (an earlier version)
>   MFC after:  1 week
>   Differential Revision:  https://reviews.freebsd.org/D11968
> 
> Modified:
>   head/sys/kern/subr_blist.c
>   head/sys/sys/blist.h
> 
> Modified: head/sys/kern/subr_blist.c
> =
> =
> --- head/sys/kern/subr_blist.cSun Oct  8 21:20:25 2017(r32441
> 9)
> +++ head/sys/kern/subr_blist.cSun Oct  8 22:17:39 2017(r32442
> 0)
> @@ -108,6 +108,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -137,7 +138,6 @@ static void blst_copy(blmeta_t *scan, daddr_t blk, dad
>  static daddr_t blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count);
>  static daddr_t blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t coun
> t,
>   u_daddr_t radix);
> -static daddr_t   blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t 
> count);
>  #ifndef _KERNEL
>  static void  blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix,
>   int tab);
> @@ -218,30 +218,69 @@ blist_t
>  blist_create(daddr_t blocks, int flags)
>  {
>   blist_t bl;
> - daddr_t nodes, radix;
> + daddr_t i, last_block;
> + u_daddr_t nodes, radix, skip;
> + int digit;
>  
>   /*
> -  * Calculate the radix field used for scanning.
> +  * Calculate the radix and node count used for scanning.  Find the last
> +  * block that is followed by a terminator.
>*/
> + last_block = blocks - 1;
>   radix = BLIST_BMAP_RADIX;
>   while (radix < blocks) {
> + if (((last_block / radix + 1) & BLIST_META_MASK) != 0)
> + /*
> +  * A terminator will be added.  Update last_block to th
> e
> +  * position just before that terminator.
> +  */
> + last_block |= radix - 1;
>   radix *= BLIST_META_RADIX;
>   }
> - nodes = 1 + blst_radix_init(NULL, radix, blocks);
>  
> - bl = malloc(sizeof(struct blist), M_SWAP, flags);
> + /*
> +  * Count the meta-nodes in the expanded tree, including the final
> +  * terminator, from the bottom level up to the root.
> +  */
> + nodes = (last_block >= blocks) ? 2 : 1;
> + last_block /= BLIST_BMAP_RADIX;
> + while (last_block > 0) {
> + nodes += last_block + 1;
> + last_block /= BLIST_META_RADIX;
> + }
> + bl = malloc(offsetof(struct blist, bl_root[nodes]), M_SWAP, flags);
>   if (bl == NULL)
>   return (NULL);
>  
>   bl->bl_blocks = blocks;
>   bl->bl_radix = radix;
>   bl->bl_cursor = 0;
> - bl->bl_root = malloc(nodes * sizeof(blmeta_t), M_SWAP, flags);
> - if (bl->bl_root == NULL) {
> - free(bl, M_SWAP);
> - return (NULL);
> +
> + /*
> +  * Initialize the empty tree by filling in root values, then initialize
> +  * just the terminators in the rest of the tree.
> +  */
> + bl->bl_root[0].bm_bighint = 0;
> + if (radix == BLIST_BMAP_RADIX)
> + bl->bl_root[0].u.bmu_bitmap = 0;
> + else
> + bl->bl_root[0].u.bmu_avail = 0;
> + last_block = blocks - 1;
> + i = 0;
> + while (radix > BLIST_BMAP_RADIX) {
> + radix /= BLIST_META_RADIX;
> + skip = radix_to_skip(radix);
> + digit = last_block / radix;
> + i += 1 + digit * skip;
> + if (digit != BLIST_META_MASK) {
> + /*
> +  * Add a terminator.
> +  */
> + bl->bl_root[i + skip].bm_bighint = (daddr_t)-1;
> + bl->bl_root[i + 

svn commit: r324434 - in head/sys: dev/iwm modules/iwmfw/iwm8265fw

2017-10-09 Thread George V. Neville-Neil
Author: gnn
Date: Mon Oct  9 15:48:56 2017
New Revision: 324434
URL: https://svnweb.freebsd.org/changeset/base/324434

Log:
  Add support for Intel 8265 WiFi
  
  Obtained from:OpenBSD
  MFC after:1 month

Added:
  head/sys/modules/iwmfw/iwm8265fw/
  head/sys/modules/iwmfw/iwm8265fw/Makefile   (contents, props changed)
Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_8000.c
  head/sys/dev/iwm/if_iwm_config.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Mon Oct  9 15:39:43 2017(r324433)
+++ head/sys/dev/iwm/if_iwm.c   Mon Oct  9 15:48:56 2017(r324434)
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.42 2015/05/30 02:49:23 deraadt Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.167 2017/04/04 00:40:52 claudio Exp $*/
 
 /*
  * Copyright (c) 2014 genua mbh 
@@ -5690,6 +5690,7 @@ iwm_intr(void *arg)
 #definePCI_PRODUCT_INTEL_WL_7265_2 0x095b
 #definePCI_PRODUCT_INTEL_WL_8260_1 0x24f3
 #definePCI_PRODUCT_INTEL_WL_8260_2 0x24f4
+#definePCI_PRODUCT_INTEL_WL_8265_1 0x24fd
 
 static const struct iwm_devices {
uint16_tdevice;
@@ -5705,6 +5706,7 @@ static const struct iwm_devices {
{ PCI_PRODUCT_INTEL_WL_7265_2, _cfg },
{ PCI_PRODUCT_INTEL_WL_8260_1, _cfg },
{ PCI_PRODUCT_INTEL_WL_8260_2, _cfg },
+   { PCI_PRODUCT_INTEL_WL_8265_1, _cfg },
 };
 
 static int

Modified: head/sys/dev/iwm/if_iwm_8000.c
==
--- head/sys/dev/iwm/if_iwm_8000.c  Mon Oct  9 15:39:43 2017
(r324433)
+++ head/sys/dev/iwm/if_iwm_8000.c  Mon Oct  9 15:48:56 2017
(r324434)
@@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$");
 #include "if_iwm_config.h"
 
 #define IWM8000_FW "iwm8000Cfw"
+#define IWM8265_FW "iwm8265fw"
 
 #define IWM_NVM_HW_SECTION_NUM_FAMILY_8000 10
 
@@ -90,6 +91,13 @@ __FBSDID("$FreeBSD$");
 const struct iwm_cfg iwm8260_cfg = {
.name = "Intel(R) Dual Band Wireless AC 8260",
.fw_name = IWM8000_FW,
+   IWM_DEVICE_8000_COMMON,
+   .host_interrupt_operation_mode = 0,
+};
+
+const struct iwm_cfg iwm8265_cfg = {
+   .name = "Intel(R) Dual Band Wireless AC 8265",
+   .fw_name = IWM8265_FW,
IWM_DEVICE_8000_COMMON,
.host_interrupt_operation_mode = 0,
 };

Modified: head/sys/dev/iwm/if_iwm_config.h
==
--- head/sys/dev/iwm/if_iwm_config.hMon Oct  9 15:39:43 2017
(r324433)
+++ head/sys/dev/iwm/if_iwm_config.hMon Oct  9 15:48:56 2017
(r324434)
@@ -131,5 +131,6 @@ extern const struct iwm_cfg iwm3165_cfg;
 extern const struct iwm_cfg iwm7265_cfg;
 extern const struct iwm_cfg iwm7265d_cfg;
 extern const struct iwm_cfg iwm8260_cfg;
+extern const struct iwm_cfg iwm8265_cfg;
 
 #endif /* __IWM_CONFIG_H__ */

Added: head/sys/modules/iwmfw/iwm8265fw/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/iwmfw/iwm8265fw/Makefile   Mon Oct  9 15:48:56 2017
(r324434)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+KMOD=  iwm8265fw
+IMG=   iwm-8265-22
+
+.include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324433 - in head/sys/i386: i386 include

2017-10-09 Thread Konstantin Belousov
Author: kib
Date: Mon Oct  9 15:39:43 2017
New Revision: 324433
URL: https://svnweb.freebsd.org/changeset/base/324433

Log:
  Reset the fs and gs bases on exec(2).
  
  The values from the old address space do not make sense for the new
  program.  In particular, gsbase might be the TLS base for the old
  program but the new program has no TLS now.
  
  amd64 already handles this correctly.
  
  Reported and reviewed by: bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/sys_machdep.c
  head/sys/i386/include/md_var.h

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cMon Oct  9 15:24:18 2017
(r324432)
+++ head/sys/i386/i386/machdep.cMon Oct  9 15:39:43 2017
(r324433)
@@ -1132,6 +1132,15 @@ exec_setregs(struct thread *td, struct image_params *i
else
mtx_unlock_spin(_lock);
   
+   /*
+* Reset the fs and gs bases.  The values from the old address
+* space do not make sense for the new program.  In particular,
+* gsbase might be the TLS base for the old program but the new
+* program has no TLS now.
+*/
+   set_fsbase(td, 0);
+   set_gsbase(td, 0);
+
bzero((char *)regs, sizeof(struct trapframe));
regs->tf_eip = imgp->entry_addr;
regs->tf_esp = stack;

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cMon Oct  9 15:24:18 2017
(r324432)
+++ head/sys/i386/i386/sys_machdep.cMon Oct  9 15:39:43 2017
(r324433)
@@ -91,6 +91,37 @@ fill_based_sd(struct segment_descriptor *sdp, uint32_t
sdp->sd_gran = 1;
 }
 
+/*
+ * Construct special descriptors for "base" selectors.  Store them in
+ * the PCB for later use by cpu_switch().  Store them in the GDT for
+ * more immediate use.  The GDT entries are part of the current
+ * context.  Callers must load related segment registers to complete
+ * setting up the current context.
+ */
+void
+set_fsbase(struct thread *td, uint32_t base)
+{
+   struct segment_descriptor sd;
+
+   fill_based_sd(, base);
+   critical_enter();
+   td->td_pcb->pcb_fsd = sd;
+   PCPU_GET(fsgs_gdt)[0] = sd;
+   critical_exit();
+}
+
+void
+set_gsbase(struct thread *td, uint32_t base)
+{
+   struct segment_descriptor sd;
+
+   fill_based_sd(, base);
+   critical_enter();
+   td->td_pcb->pcb_gsd = sd;
+   PCPU_GET(fsgs_gdt)[1] = sd;
+   critical_exit();
+}
+
 #ifndef _SYS_SYSPROTO_H_
 struct sysarch_args {
int op;
@@ -109,7 +140,7 @@ sysarch(struct thread *td, struct sysarch_args *uap)
struct i386_get_xfpustate xfpu;
} kargs;
uint32_t base;
-   struct segment_descriptor sd, *sdp;
+   struct segment_descriptor *sdp;
 
AUDIT_ARG_CMD(uap->op);
 
@@ -204,16 +235,11 @@ sysarch(struct thread *td, struct sysarch_args *uap)
error = copyin(uap->parms, , sizeof(base));
if (error == 0) {
/*
-* Construct a descriptor and store it in the pcb for
-* the next context switch.  Also store it in the gdt
-* so that the load of tf_fs into %fs will activate it
-* at return to userland.
+* Construct the special descriptor for fsbase
+* and arrange for doreti to load its selector
+* soon enough.
 */
-   fill_based_sd(, base);
-   critical_enter();
-   td->td_pcb->pcb_fsd = sd;
-   PCPU_GET(fsgs_gdt)[0] = sd;
-   critical_exit();
+   set_fsbase(td, base);
td->td_frame->tf_fs = GSEL(GUFS_SEL, SEL_UPL);
}
break;
@@ -226,15 +252,11 @@ sysarch(struct thread *td, struct sysarch_args *uap)
error = copyin(uap->parms, , sizeof(base));
if (error == 0) {
/*
-* Construct a descriptor and store it in the pcb for
-* the next context switch.  Also store it in the gdt
-* because we have to do a load_gs() right now.
+* Construct the special descriptor for gsbase.
+* The selector is loaded immediately, since we
+* normally only reload %gs on context switches.
 */
-   fill_based_sd(, base);
-   critical_enter();
-   td->td_pcb->pcb_gsd = sd;
-   PCPU_GET(fsgs_gdt)[1] = sd;
-

svn commit: r324432 - head/sys/i386/i386

2017-10-09 Thread Konstantin Belousov
Author: kib
Date: Mon Oct  9 15:24:18 2017
New Revision: 324432
URL: https://svnweb.freebsd.org/changeset/base/324432

Log:
  More style.
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cMon Oct  9 14:50:02 2017
(r324431)
+++ head/sys/i386/i386/sys_machdep.cMon Oct  9 15:24:18 2017
(r324432)
@@ -717,10 +717,10 @@ i386_set_ldt_data(struct thread *td, int start, int nu
 static int
 i386_ldt_grow(struct thread *td, int len) 
 {
-   struct mdproc *mdp = >td_proc->p_md;
+   struct mdproc *mdp;
struct proc_ldt *new_ldt, *pldt;
-   caddr_t old_ldt_base = NULL_LDT_BASE;
-   int old_ldt_len = 0;
+   caddr_t old_ldt_base;
+   int old_ldt_len;
 
mtx_assert(_lock, MA_OWNED);
 
@@ -728,6 +728,10 @@ i386_ldt_grow(struct thread *td, int len) 
return (ENOMEM);
if (len < NLDT + 1)
len = NLDT + 1;
+
+   mdp = >td_proc->p_md;
+   old_ldt_base = NULL_LDT_BASE;
+   old_ldt_len = 0;
 
/* Allocate a user ldt. */
if ((pldt = mdp->md_ldt) == NULL || len > pldt->ldt_len) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324431 - head/usr.bin/patch

2017-10-09 Thread Kyle Evans
Author: kevans
Date: Mon Oct  9 14:50:02 2017
New Revision: 324431
URL: https://svnweb.freebsd.org/changeset/base/324431

Log:
  patch(1): Don't overrun line buffer in some cases
  
  Patches like file.txt attached to PR 190195 with a final line formed
  like ">(EOL)" could cause a copy past the end of the current line buffer. In 
the
  case of PR 191641, this caused a duplicate line to be copied into the 
resulting
  file.
  
  Instead of running past the end, treat it as if it were a blank line.
  
  PR:   191641
  Reviewed by:  cem, emaste, pfg
  Approved by:  emaste (mentor)
  Differential Revision:https://reviews.freebsd.org/D12609

Modified:
  head/usr.bin/patch/pch.c

Modified: head/usr.bin/patch/pch.c
==
--- head/usr.bin/patch/pch.cMon Oct  9 13:53:41 2017(r324430)
+++ head/usr.bin/patch/pch.cMon Oct  9 14:50:02 2017(r324431)
@@ -1135,7 +1135,12 @@ hunk_done:
if (*buf != '>')
fatal("> expected at line %ld of patch\n",
p_input_line);
-   p_line[i] = savestr(buf + 2);
+   /* Don't overrun if we don't have enough line */
+   if (len > 2)
+   p_line[i] = savestr(buf + 2);
+   else
+   p_line[i] = savestr("");
+
if (out_of_mem) {
p_end = i - 1;
return false;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324423 - head/share/misc

2017-10-09 Thread Li-Wen Hsu
On Mon, Oct 09, 2017 at 05:01:52 +, Eitan Adler wrote:
> Author: eadler
> Date: Mon Oct  9 05:01:51 2017
> New Revision: 324423
> URL: https://svnweb.freebsd.org/changeset/base/324423
> 
> Log:
>   Update iso3166 codes
>   
>   Based on 
> https://raw.githubusercontent.com/lukes/ISO-3166-Countries-with-Regional-Codes/master/all/all.csv
>   and hand massaged.
> 
> Modified:
>   head/share/misc/iso3166
> 
> Modified: head/share/misc/iso3166
> ==
> --- head/share/misc/iso3166   Mon Oct  9 04:43:05 2017(r324422)
> +++ head/share/misc/iso3166   Mon Oct  9 05:01:51 2017(r324423)
> @@ -236,10 +236,11 @@ SZ  SWZ 748 Swaziland
>  SE   SWE 752 Sweden
>  CH   CHE 756 Switzerland
>  SY   SYR 760 Syrian Arab Republic
> -TW   TWN 158 Taiwan
> +TW   TWN 158 Taiwan, Province of China

Hi Eitan,

Plase revert this line, "Taiwan" is how we call ourself.

Also please refer to previous commit:
https://svnweb.freebsd.org/changeset/base/198948

Thanks,
Li-Wen


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


svn commit: r324430 - head/bin/ps

2017-10-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Oct  9 13:53:41 2017
New Revision: 324430
URL: https://svnweb.freebsd.org/changeset/base/324430

Log:
  Undocument "tdnam" (leaving it as an alias), and rename the column
  to TDNAME.
  
  Suggested by: bde
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/bin/ps/keyword.c
  head/bin/ps/ps.1

Modified: head/bin/ps/keyword.c
==
--- head/bin/ps/keyword.c   Mon Oct  9 13:48:10 2017(r324429)
+++ head/bin/ps/keyword.c   Mon Oct  9 13:53:41 2017(r324430)
@@ -199,9 +199,9 @@ static VAR var[] = {
{"tdaddr", "TDADDR", NULL, "thread-address", 0, kvar, KOFF(ki_tdaddr),
KPTR, "lx", 0},
{"tdev", "TDEV", NULL, "terminal-device", 0, tdev, 0, CHAR, NULL, 0},
-   {"tdnam", "TDNAM", NULL, "thread-name", LJUST, tdnam, 0, CHAR,
+   {"tdnam", "", "tdname", NULL, 0, NULL, 0, CHAR, NULL, 0},
+   {"tdname", "TDNAME", NULL, "thread-name", LJUST, tdnam, 0, CHAR,
NULL, 0},
-   {"tdname", "", "tdnam", NULL, 0, NULL, 0, CHAR, NULL, 0},
{"time", "TIME", NULL, "cpu-time", USER, cputime, 0, CHAR, NULL, 0},
{"tpgid", "TPGID", NULL, "terminal-process-gid", 0, kvar,
KOFF(ki_tpgid), UINT, PIDFMT, 0},

Modified: head/bin/ps/ps.1
==
--- head/bin/ps/ps.1Mon Oct  9 13:48:10 2017(r324429)
+++ head/bin/ps/ps.1Mon Oct  9 13:53:41 2017(r324430)
@@ -675,9 +675,8 @@ saved UID from a setuid executable
 accumulated system CPU time
 .It Cm tdaddr
 thread address
-.It Cm tdnam
-thread name (alias
-.Cm tdname )
+.It Cm tdname
+thread name
 .It Cm tdev
 control terminal device number
 .It Cm time
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324429 - head/bin/ps

2017-10-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Oct  9 13:48:10 2017
New Revision: 324429
URL: https://svnweb.freebsd.org/changeset/base/324429

Log:
  Fix long name (used by libxo) for the "tdnam" ps(1) keyword.
  
  Reported by:  pluknet
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/bin/ps/keyword.c

Modified: head/bin/ps/keyword.c
==
--- head/bin/ps/keyword.c   Mon Oct  9 13:28:08 2017(r324428)
+++ head/bin/ps/keyword.c   Mon Oct  9 13:48:10 2017(r324429)
@@ -199,7 +199,7 @@ static VAR var[] = {
{"tdaddr", "TDADDR", NULL, "thread-address", 0, kvar, KOFF(ki_tdaddr),
KPTR, "lx", 0},
{"tdev", "TDEV", NULL, "terminal-device", 0, tdev, 0, CHAR, NULL, 0},
-   {"tdnam", "TDNAM", NULL, "terminal-device-name", LJUST, tdnam, 0, CHAR,
+   {"tdnam", "TDNAM", NULL, "thread-name", LJUST, tdnam, 0, CHAR,
NULL, 0},
{"tdname", "", "tdnam", NULL, 0, NULL, 0, CHAR, NULL, 0},
{"time", "TIME", NULL, "cpu-time", USER, cputime, 0, CHAR, NULL, 0},
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324427 - head/bin/ps

2017-10-09 Thread Bruce Evans

{Please ignore my previous null reply]

On Mon, 9 Oct 2017, Sergey Kandaurov wrote:


On 9 October 2017 at 13:24, Edward Tomasz Napierala 
wrote:


Author: trasz
Date: Mon Oct  9 10:24:06 2017
New Revision: 324427
URL: https://svnweb.freebsd.org/changeset/base/324427

Log:
  Document "tdnam" keyword to ps(1), and add "tdname" alias.
Modified: head/bin/ps/keyword.c

==
--- head/bin/ps/keyword.c   Mon Oct  9 08:50:03 2017(r324426)
+++ head/bin/ps/keyword.c   Mon Oct  9 10:24:06 2017(r324427)
@@ -201,6 +201,7 @@ static VAR var[] = {
{"tdev", "TDEV", NULL, "terminal-device", 0, tdev, 0, CHAR, NULL,
0},
{"tdnam", "TDNAM", NULL, "terminal-device-name", LJUST, tdnam, 0,
CHAR,
NULL, 0},


Hello,
could you please fix this ^^ "tdnam" description as well?
fwiw, looks like it's only used in libxo as a field name.


Since it is badly designed and implemented, 2 names for it are worse than
for any other keyword.  Perhaps since it was undocumented in the man page
and misdocumented in the screen, nothing uses it and you can rename it
without anything noticing it.

(Design errors start with splitting thread and proc names in a way that
is difficult for applications to untangle.  Implementation errors start
with abusing the space reserved for the old command name (ki_ocomm) for
ki_tdname.  This helps break old applications that only understand
ki_ocomm.  TDNAMLEN = OCOMMLEN = 16 is also too small, and its name is
spelled without an E, unlike all other *NAMELEN names in .
This is too short.  It is only 3 shorter than COMMLEN, but should probably
be longer, depending on how thread and proc names are split.

The last bug has been partly fixed.  There is now ki_moretdname[].  This
has length just 3 (plus 1 for a NUL) to make allow expansion of thread
names to the same length as proc names (19).  ps and top actually
understand this (except the update to use it is missing in ps/ps.c; it
is only in ps/print.c).

Thread names are also printed for the comm and command keywords in ps.
They are essentially appended to ki_comm.  This is too simple of ki_comm
already contains some thread info.  A negative amount of space is
available for expansion.  if the user uses tdnam then it is even more
difficult to get a good combination of proc and thread info.

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


Re: svn commit: r324427 - head/bin/ps

2017-10-09 Thread Bruce Evans



On Mon, 9 Oct 2017, Sergey Kandaurov wrote:


On 9 October 2017 at 13:24, Edward Tomasz Napierala 
wrote:


Author: trasz
Date: Mon Oct  9 10:24:06 2017
New Revision: 324427
URL: https://svnweb.freebsd.org/changeset/base/324427

Log:
  Document "tdnam" keyword to ps(1), and add "tdname" alias.

  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/bin/ps/keyword.c
  head/bin/ps/ps.1

Modified: head/bin/ps/keyword.c

==
--- head/bin/ps/keyword.c   Mon Oct  9 08:50:03 2017(r324426)
+++ head/bin/ps/keyword.c   Mon Oct  9 10:24:06 2017(r324427)
@@ -201,6 +201,7 @@ static VAR var[] = {
{"tdev", "TDEV", NULL, "terminal-device", 0, tdev, 0, CHAR, NULL,
0},
{"tdnam", "TDNAM", NULL, "terminal-device-name", LJUST, tdnam, 0,
CHAR,
NULL, 0},




Hello,
could you please fix this ^^ "tdnam" description as well?
fwiw, looks like it's only used in libxo as a field name.

[..]

--
wbr,
pluknet


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


Re: svn commit: r324415 - in head/sys: kern sys

2017-10-09 Thread Mateusz Guzik
On Sun, Oct 08, 2017 at 11:56:30AM -0600, Ian Lepore wrote:
> On Sun, 2017-10-08 at 17:33 +, Ian Lepore wrote:
> > Author: ian
> > Date: Sun Oct  8 17:33:49 2017
> > New Revision: 324415
> > URL: https://svnweb.freebsd.org/changeset/base/324415
> >
> > Log:
> >   Add eventhandler notifications for newbus device attach/detach.
> >
> > [...]
> >
> >   A couple salient comments from the review, they amount to some helpful
> >   documentation about these events, but there's currently no good place
for
> >   such documentation...
>
> About this last point... sys/eventhandler.h is now an ever-growing list
> of EVENTHANDLER_DECLARE() statements for events that are unrelated to
> each other.  I think we are at the point where it's no longer a few
> well-known "standard system event queues", it's turning into a mess.
>
> My first thought was to add these to bus.h because they're bus events.
>  But you have to include eventhandler.h to use EVENTHANDLER_DECLARE,
> and I didn't want to pull it (and its dependencies) into bus.h.
>

The current implementation has to be retired and significant tinkering
with it is imho a waste of time.

It is weirdly inefficient both single and multithreaded.

Vast majority (if not all) lists are statically defined. And yet
invocing the handlers starts with following a linked list and strcmping
to find the instance. All this under a global eventhanadler lock which
starts showing up.

Most registered handlers for any paritcular event are never going to
get unregistered. The current code locks the list do the traversal,
which again is slow and starts showing up in lock profiles.

So the proposal is to partially unscrew the current code so that it
largely gets out of the way and then implement something new and
migrate evertyhing on head to use it.

A new set of eventhnadler declarations can be added (_STATIC?) which
provides a known at compilation time symbol. Then a paired invocation
macro to just lock the handler list without the need to look it up.

As for the new mechanism, I don't have anything fleshed out, but in
general it would do away with excessive macro use.

handlers which once registered never get removed get a lockless
treatment for traveral. say they also get implemented as a linked list.
Invocations would do a lockless traversal of the list. If there is an
entry, it is fully installed and never goes away.
Registrations would lock the list and add an entry in traversal-friendly
manner updating the '->next' pointer at the lsat step.

Later this can be made even nicer with a table, but that will require
a little bit of trickery to make it freeable.

With this in place there will be no central "here are the handlers"
header.

That said, I have no immediate plans working on this, but I'll
eventually get around to it unless someone beats me or has a better
idea.

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


Re: svn commit: r324427 - head/bin/ps

2017-10-09 Thread Sergey Kandaurov
On 9 October 2017 at 13:24, Edward Tomasz Napierala 
wrote:

> Author: trasz
> Date: Mon Oct  9 10:24:06 2017
> New Revision: 324427
> URL: https://svnweb.freebsd.org/changeset/base/324427
>
> Log:
>   Document "tdnam" keyword to ps(1), and add "tdname" alias.
>
>   MFC after:2 weeks
>   Sponsored by: DARPA, AFRL
>
> Modified:
>   head/bin/ps/keyword.c
>   head/bin/ps/ps.1
>
> Modified: head/bin/ps/keyword.c
> 
> ==
> --- head/bin/ps/keyword.c   Mon Oct  9 08:50:03 2017(r324426)
> +++ head/bin/ps/keyword.c   Mon Oct  9 10:24:06 2017(r324427)
> @@ -201,6 +201,7 @@ static VAR var[] = {
> {"tdev", "TDEV", NULL, "terminal-device", 0, tdev, 0, CHAR, NULL,
> 0},
> {"tdnam", "TDNAM", NULL, "terminal-device-name", LJUST, tdnam, 0,
> CHAR,
> NULL, 0},
>


Hello,
could you please fix this ^^ "tdnam" description as well?
fwiw, looks like it's only used in libxo as a field name.

[..]

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


svn commit: r324427 - head/bin/ps

2017-10-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Oct  9 10:24:06 2017
New Revision: 324427
URL: https://svnweb.freebsd.org/changeset/base/324427

Log:
  Document "tdnam" keyword to ps(1), and add "tdname" alias.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/bin/ps/keyword.c
  head/bin/ps/ps.1

Modified: head/bin/ps/keyword.c
==
--- head/bin/ps/keyword.c   Mon Oct  9 08:50:03 2017(r324426)
+++ head/bin/ps/keyword.c   Mon Oct  9 10:24:06 2017(r324427)
@@ -201,6 +201,7 @@ static VAR var[] = {
{"tdev", "TDEV", NULL, "terminal-device", 0, tdev, 0, CHAR, NULL, 0},
{"tdnam", "TDNAM", NULL, "terminal-device-name", LJUST, tdnam, 0, CHAR,
NULL, 0},
+   {"tdname", "", "tdnam", NULL, 0, NULL, 0, CHAR, NULL, 0},
{"time", "TIME", NULL, "cpu-time", USER, cputime, 0, CHAR, NULL, 0},
{"tpgid", "TPGID", NULL, "terminal-process-gid", 0, kvar,
KOFF(ki_tpgid), UINT, PIDFMT, 0},

Modified: head/bin/ps/ps.1
==
--- head/bin/ps/ps.1Mon Oct  9 08:50:03 2017(r324426)
+++ head/bin/ps/ps.1Mon Oct  9 10:24:06 2017(r324427)
@@ -29,7 +29,7 @@
 .\" @(#)ps.1   8.3 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd September 7, 2017
+.Dd October 9, 2017
 .Dt PS 1
 .Os
 .Sh NAME
@@ -675,6 +675,9 @@ saved UID from a setuid executable
 accumulated system CPU time
 .It Cm tdaddr
 thread address
+.It Cm tdnam
+thread name (alias
+.Cm tdname )
 .It Cm tdev
 control terminal device number
 .It Cm time
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324425 - head/sys/cddl/compat/opensolaris/sys

2017-10-09 Thread Andriy Gapon
Author: avg
Date: Mon Oct  9 07:44:09 2017
New Revision: 324425
URL: https://svnweb.freebsd.org/changeset/base/324425

Log:
  illumos mutex_init: use SX_NEW instead of bzero
  
  There should be no functional change, but SX_NEW seems to be more
  idiomatic to the use-case.
  
  MFC after:2 weeks
  X-MFC note:   stable/11 only

Modified:
  head/sys/cddl/compat/opensolaris/sys/mutex.h

Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h
==
--- head/sys/cddl/compat/opensolaris/sys/mutex.hMon Oct  9 05:16:34 
2017(r324424)
+++ head/sys/cddl/compat/opensolaris/sys/mutex.hMon Oct  9 07:44:09 
2017(r324425)
@@ -47,9 +47,9 @@ typedef enum {
 typedef struct sx  kmutex_t;
 
 #ifndef OPENSOLARIS_WITNESS
-#defineMUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS)
+#defineMUTEX_FLAGS (SX_DUPOK | SX_NEW | SX_NOWITNESS)
 #else
-#defineMUTEX_FLAGS (SX_DUPOK)
+#defineMUTEX_FLAGS (SX_DUPOK | SX_NEW)
 #endif
 
 #definemutex_init(lock, desc, type, arg)   do {
\
@@ -57,7 +57,6 @@ typedef struct sx kmutex_t;
ASSERT((type) == 0 || (type) == MUTEX_DEFAULT); \
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) !=  \
LO_EXPECTED, ("lock %s already initialized", #lock));   \
-   bzero((lock), sizeof(struct sx));   \
for (_name = #lock; *_name != '\0'; _name++) {  \
if (*_name >= 'a' && *_name <= 'z') \
break;  \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"