svn commit: r363468 - head/share/man/man9

2020-07-23 Thread John-Mark Gurney
Author: jmg
Date: Fri Jul 24 00:47:14 2020
New Revision: 363468
URL: https://svnweb.freebsd.org/changeset/base/363468

Log:
  fix up docs for m_getjcl as well..

Modified:
  head/share/man/man9/mbuf.9

Modified: head/share/man/man9/mbuf.9
==
--- head/share/man/man9/mbuf.9  Fri Jul 24 00:35:21 2020(r363467)
+++ head/share/man/man9/mbuf.9  Fri Jul 24 00:47:14 2020(r363468)
@@ -635,9 +635,12 @@ on failure.
 .It Fn m_getjcl how type flags size
 This is like
 .Fn m_getcl
-but it the size of the cluster allocated will be large enough for
+but the specified
 .Fa size
-bytes.
+of the cluster to be allocated must be one of
+.Dv MCLBYTES , MJUMPAGESIZE , MJUM9BYTES ,
+or
+.Dv MJUM16BYTES.
 .It Fn m_free mbuf
 Frees
 .Vt mbuf .
___
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: r363467 - head/share/man/man9

2020-07-23 Thread John-Mark Gurney
Author: jmg
Date: Fri Jul 24 00:35:21 2020
New Revision: 363467
URL: https://svnweb.freebsd.org/changeset/base/363467

Log:
  document that m_get2 only accepts up to MJUMPAGESIZE..

Modified:
  head/share/man/man9/mbuf.9

Modified: head/share/man/man9/mbuf.9
==
--- head/share/man/man9/mbuf.9  Fri Jul 24 00:23:26 2020(r363466)
+++ head/share/man/man9/mbuf.9  Fri Jul 24 00:35:21 2020(r363467)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 28, 2019
+.Dd July 23, 2020
 .Dt MBUF 9
 .Os
 .\"
@@ -574,6 +574,9 @@ for non-critical paths.
 Allocate an
 .Vt mbuf
 with enough space to hold specified amount of data.
+If the size is is larger than 
+.Dv MJUMPAGESIZE , NULL
+will be returned.
 .It Fn m_getm orig len how type
 Allocate
 .Fa 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"


Re: svn commit: r363188 - in head: lib/libpmc sys/dev/hwpmc

2020-07-23 Thread John Baldwin
On 7/23/20 4:44 PM, Alexander Motin wrote:
> On 23.07.2020 19:15, John Baldwin wrote:
>> On 7/14/20 11:11 AM, Alexander Motin wrote:
>>> Author: mav
>>> Date: Tue Jul 14 18:11:05 2020
>>> New Revision: 363188
>>> URL: https://svnweb.freebsd.org/changeset/base/363188
>>>
>>> Log:
>>>   Add stepping to the kern.hwpmc.cpuid string on x86.
>>>   
>>>   It follows the equivalent Linux change to be able to differentiate
>>>   skylakex and cascadelakex, sharing the same model but not stepping.
>>>   
>>>   This fixes skylakex handling broken by r363144.
>>
>> Unfortunately this breaks compatibility meaning you can't use an older
>> libpmc with a newer kernel module after this change.  Perhaps we don't
>> consider libpmc stable, but this was really annoying as I booted a test
>> kernel today on an older Haswell box whose world is from before this
>> change and pmc doesn't work at all.  (pmccontrol -L doesn't list any
>> valid counters as the older libpmc presumably chokes on the additional
>> suffix and doesn't match anything)
> 
> Unfortunately so.  I've added other way compatibility, but can't change
> the past.  Do you think it is critical enough to add more compat shims,
> like extra sysctls?

I don't see a viable way to do it non-terribly.  Assuming you've already
MFC'd this it might warrant a line in the release notes for 12.2.

-- 
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: r363464 - in head: share/man/man4 sys/kern sys/opencrypto sys/sys

2020-07-23 Thread John Baldwin
Author: jhb
Date: Thu Jul 23 23:48:18 2020
New Revision: 363464
URL: https://svnweb.freebsd.org/changeset/base/363464

Log:
  Add support for KTLS RX via software decryption.
  
  Allow TLS records to be decrypted in the kernel after being received
  by a NIC.  At a high level this is somewhat similar to software KTLS
  for the transmit path except in reverse.  Protocols enqueue mbufs
  containing encrypted TLS records (or portions of records) into the
  tail of a socket buffer and the KTLS layer decrypts those records
  before returning them to userland applications.  However, there is an
  important difference:
  
  - In the transmit case, the socket buffer is always a single "record"
holding a chain of mbufs.  Not-yet-encrypted mbufs are marked not
ready (M_NOTREADY) and released to protocols for transmit by marking
mbufs ready once their data is encrypted.
  
  - In the receive case, incoming (encrypted) data appended to the
socket buffer is still a single stream of data from the protocol,
but decrypted TLS records are stored as separate records in the
socket buffer and read individually via recvmsg().
  
  Initially I tried to make this work by marking incoming mbufs as
  M_NOTREADY, but there didn't seemed to be a non-gross way to deal with
  picking a portion of the mbuf chain and turning it into a new record
  in the socket buffer after decrypting the TLS record it contained
  (along with prepending a control message).  Also, such mbufs would
  also need to be "pinned" in some way while they are being decrypted
  such that a concurrent sbcut() wouldn't free them out from under the
  thread performing decryption.
  
  As such, I settled on the following solution:
  
  - Socket buffers now contain an additional chain of mbufs (sb_mtls,
sb_mtlstail, and sb_tlscc) containing encrypted mbufs appended by
the protocol layer.  These mbufs are still marked M_NOTREADY, but
soreceive*() generally don't know about them (except that they will
block waiting for data to be decrypted for a blocking read).
  
  - Each time a new mbuf is appended to this TLS mbuf chain, the socket
buffer peeks at the TLS record header at the head of the chain to
determine the encrypted record's length.  If enough data is queued
for the TLS record, the socket is placed on a per-CPU TLS workqueue
(reusing the existing KTLS workqueues and worker threads).
  
  - The worker thread loops over the TLS mbuf chain decrypting records
until it runs out of data.  Each record is detached from the TLS
mbuf chain while it is being decrypted to keep the mbufs "pinned".
However, a new sb_dtlscc field tracks the character count of the
detached record and sbcut()/sbdrop() is updated to account for the
detached record.  After the record is decrypted, the worker thread
first checks to see if sbcut() dropped the record.  If so, it is
freed (can happen when a socket is closed with pending data).
Otherwise, the header and trailer are stripped from the original
mbufs, a control message is created holding the decrypted TLS
header, and the decrypted TLS record is appended to the "normal"
socket buffer chain.
  
  (Side note: the SBCHECK() infrastucture was very useful as I was
   able to add assertions there about the TLS chain that caught several
   bugs during development.)
  
  Tested by:rmacklem (various versions)
  Relnotes: yes
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24628

Modified:
  head/share/man/man4/tcp.4
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_sockbuf.c
  head/sys/kern/uipc_socket.c
  head/sys/opencrypto/ktls_ocf.c
  head/sys/sys/ktls.h
  head/sys/sys/sockbuf.h
  head/sys/sys/socketvar.h

Modified: head/share/man/man4/tcp.4
==
--- head/share/man/man4/tcp.4   Thu Jul 23 23:29:50 2020(r363463)
+++ head/share/man/man4/tcp.4   Thu Jul 23 23:48:18 2020(r363464)
@@ -34,7 +34,7 @@
 .\" From: @(#)tcp.48.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2020
+.Dd July 23, 2020
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -356,10 +356,22 @@ control message along with the decrypted payload.
 The control message contains a
 .Vt struct tls_get_record
 which includes fields from the TLS record header.
-If a corrupted TLS record is received,
+If an invalid or corrupted TLS record is received,
 recvmsg 2
-will fail with
-.Dv EBADMSG .
+will fail with one of the following errors:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The version fields in a TLS record's header did not match the version required
+by the
+.Vt struct tls_so_enable
+structure used to enable in-kernel TLS.
+.It Bq Er EMSGSIZE
+A TLS record's length was either too small or too large.
+.It Bq Er EMSGSIZE
+The connection was closed after sending a truncated TLS record.
+.It Bq Er EBADMSG
+The TLS record failed to match the included authe

Re: svn commit: r363188 - in head: lib/libpmc sys/dev/hwpmc

2020-07-23 Thread Mateusz Guzik
I don't think that's worth the effort. However, versioning would be
nice. Then tooling could nicely crap out immediately instead of giving
funny results (or no results).

On 7/24/20, Alexander Motin  wrote:
> On 23.07.2020 19:15, John Baldwin wrote:
>> On 7/14/20 11:11 AM, Alexander Motin wrote:
>>> Author: mav
>>> Date: Tue Jul 14 18:11:05 2020
>>> New Revision: 363188
>>> URL: https://svnweb.freebsd.org/changeset/base/363188
>>>
>>> Log:
>>>   Add stepping to the kern.hwpmc.cpuid string on x86.
>>>
>>>   It follows the equivalent Linux change to be able to differentiate
>>>   skylakex and cascadelakex, sharing the same model but not stepping.
>>>
>>>   This fixes skylakex handling broken by r363144.
>>
>> Unfortunately this breaks compatibility meaning you can't use an older
>> libpmc with a newer kernel module after this change.  Perhaps we don't
>> consider libpmc stable, but this was really annoying as I booted a test
>> kernel today on an older Haswell box whose world is from before this
>> change and pmc doesn't work at all.  (pmccontrol -L doesn't list any
>> valid counters as the older libpmc presumably chokes on the additional
>> suffix and doesn't match anything)
>
> Unfortunately so.  I've added other way compatibility, but can't change
> the past.  Do you think it is critical enough to add more compat shims,
> like extra sysctls?
>
> --
> Alexander Motin
>


-- 
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: r363188 - in head: lib/libpmc sys/dev/hwpmc

2020-07-23 Thread Alexander Motin
On 23.07.2020 19:15, John Baldwin wrote:
> On 7/14/20 11:11 AM, Alexander Motin wrote:
>> Author: mav
>> Date: Tue Jul 14 18:11:05 2020
>> New Revision: 363188
>> URL: https://svnweb.freebsd.org/changeset/base/363188
>>
>> Log:
>>   Add stepping to the kern.hwpmc.cpuid string on x86.
>>   
>>   It follows the equivalent Linux change to be able to differentiate
>>   skylakex and cascadelakex, sharing the same model but not stepping.
>>   
>>   This fixes skylakex handling broken by r363144.
> 
> Unfortunately this breaks compatibility meaning you can't use an older
> libpmc with a newer kernel module after this change.  Perhaps we don't
> consider libpmc stable, but this was really annoying as I booted a test
> kernel today on an older Haswell box whose world is from before this
> change and pmc doesn't work at all.  (pmccontrol -L doesn't list any
> valid counters as the older libpmc presumably chokes on the additional
> suffix and doesn't match anything)

Unfortunately so.  I've added other way compatibility, but can't change
the past.  Do you think it is critical enough to add more compat shims,
like extra sysctls?

-- 
Alexander Motin
___
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: r363463 - head/tests/sys/geom/class/mirror

2020-07-23 Thread Bryan Drewery
Author: bdrewery
Date: Thu Jul 23 23:29:50 2020
New Revision: 363463
URL: https://svnweb.freebsd.org/changeset/base/363463

Log:
  Limit gmirror failpoint tests to the test worker
  
  This avoids injecting errors into the test system's mirrors.
  
  gnop seems like a good solution here but it injects errors at the wrong
  place vs where these tests expect and does not support a 'max global count'
  like the failpoints do with 'n*' syntax.
  
  Reviewed by:  cem, vangyzen
  Sponsored by: Dell EMC Isilon

Modified:
  head/tests/sys/geom/class/mirror/10_test.sh
  head/tests/sys/geom/class/mirror/11_test.sh
  head/tests/sys/geom/class/mirror/12_test.sh
  head/tests/sys/geom/class/mirror/13_test.sh
  head/tests/sys/geom/class/mirror/9_test.sh
  head/tests/sys/geom/class/mirror/conf.sh
  head/tests/sys/geom/class/mirror/sync_error.sh

Modified: head/tests/sys/geom/class/mirror/10_test.sh
==
--- head/tests/sys/geom/class/mirror/10_test.sh Thu Jul 23 22:28:35 2020
(r363462)
+++ head/tests/sys/geom/class/mirror/10_test.sh Thu Jul 23 23:29:50 2020
(r363463)
@@ -30,7 +30,7 @@ tmp2=$(mktemp $base.XX)
 
 EIO=5
 # gmirror should retry a failed read from the other mirror.
-sysctl ${regreadfp}="1*return(${EIO})"
+sysctl ${regreadfp}="1*return(${EIO})[pid $(gmirror_worker_pid)]"
 dd if=/dev/mirror/$name of=$tmp1 iseek=256 bs=$ddbs count=1 >/dev/null 2>&1
 dd if=/dev/$us1 of=$tmp2 iseek=256 bs=$ddbs count=1 >/dev/null 2>&1
 sysctl ${regreadfp}='off'

Modified: head/tests/sys/geom/class/mirror/11_test.sh
==
--- head/tests/sys/geom/class/mirror/11_test.sh Thu Jul 23 22:28:35 2020
(r363462)
+++ head/tests/sys/geom/class/mirror/11_test.sh Thu Jul 23 23:29:50 2020
(r363463)
@@ -31,7 +31,7 @@ tmp2=$(mktemp $base.XX)
 ENXIO=6
 # gmirror has special handling for ENXIO. It does not mark the failed component
 # as broken, allowing it to rejoin the mirror automatically when it appears.
-sysctl ${regreadfp}="1*return(${ENXIO})"
+sysctl ${regreadfp}="1*return(${ENXIO})[pid $(gmirror_worker_pid)]"
 dd if=/dev/mirror/$name of=$tmp1 iseek=512 bs=$ddbs count=1 >/dev/null 2>&1
 dd if=/dev/$us1 of=$tmp2 iseek=512 bs=$ddbs count=1 >/dev/null 2>&1
 sysctl ${regreadfp}='off'

Modified: head/tests/sys/geom/class/mirror/12_test.sh
==
--- head/tests/sys/geom/class/mirror/12_test.sh Thu Jul 23 22:28:35 2020
(r363462)
+++ head/tests/sys/geom/class/mirror/12_test.sh Thu Jul 23 23:29:50 2020
(r363463)
@@ -29,7 +29,7 @@ dd if=/dev/random of=$tmp1 bs=$ddbs count=1 >/dev/null
 
 EIO=5
 # gmirror should kick one of the mirrors out after hitting EIO.
-sysctl ${regwritefp}="1*return(${EIO})"
+sysctl ${regwritefp}="1*return(${EIO})[pid $(gmirror_worker_pid)]"
 dd if=$tmp1 of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
 dd if=/dev/mirror/$name of=$tmp2 bs=$ddbs count=1 >/dev/null 2>&1
 sysctl ${regwritefp}='off'

Modified: head/tests/sys/geom/class/mirror/13_test.sh
==
--- head/tests/sys/geom/class/mirror/13_test.sh Thu Jul 23 22:28:35 2020
(r363462)
+++ head/tests/sys/geom/class/mirror/13_test.sh Thu Jul 23 23:29:50 2020
(r363463)
@@ -31,7 +31,7 @@ dd if=/dev/random of=$tmp1 bs=$ddbs count=1 >/dev/null
 ENXIO=6
 # gmirror has special handling for ENXIO. It does not mark the failed component
 # as broken, allowing it to rejoin the mirror automatically when it appears.
-sysctl ${regwritefp}="1*return(${ENXIO})"
+sysctl ${regwritefp}="1*return(${ENXIO})[pid $(gmirror_worker_pid)]"
 dd if=$tmp1 of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
 dd if=/dev/mirror/$name of=$tmp2 bs=$ddbs count=1 >/dev/null 2>&1
 sysctl ${regwritefp}='off'

Modified: head/tests/sys/geom/class/mirror/9_test.sh
==
--- head/tests/sys/geom/class/mirror/9_test.sh  Thu Jul 23 22:28:35 2020
(r363462)
+++ head/tests/sys/geom/class/mirror/9_test.sh  Thu Jul 23 23:29:50 2020
(r363463)
@@ -26,7 +26,7 @@ devwait
 # Break one of the mirrors by forcing a single metadata write error.
 # When dd closes the mirror provider, gmirror will attempt to mark the mirrors
 # clean, and will kick one of the mirrors out upon hitting the error.
-sysctl debug.fail_point.g_mirror_metadata_write='1*return(5)' || exit 1
+sysctl debug.fail_point.g_mirror_metadata_write="1*return(5)[pid 
$(gmirror_worker_pid)]" || exit 1
 dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1
 sysctl debug.fail_point.g_mirror_metadata_write='off' || exit 1
 

Modified: head/tests/sys/geom/class/mirror/conf.sh
==
--- head/tests/sys/geom/class/mirror/conf.shThu Jul 23 

Re: svn commit: r363188 - in head: lib/libpmc sys/dev/hwpmc

2020-07-23 Thread John Baldwin
On 7/14/20 11:11 AM, Alexander Motin wrote:
> Author: mav
> Date: Tue Jul 14 18:11:05 2020
> New Revision: 363188
> URL: https://svnweb.freebsd.org/changeset/base/363188
> 
> Log:
>   Add stepping to the kern.hwpmc.cpuid string on x86.
>   
>   It follows the equivalent Linux change to be able to differentiate
>   skylakex and cascadelakex, sharing the same model but not stepping.
>   
>   This fixes skylakex handling broken by r363144.

Unfortunately this breaks compatibility meaning you can't use an older
libpmc with a newer kernel module after this change.  Perhaps we don't
consider libpmc stable, but this was really annoying as I booted a test
kernel today on an older Haswell box whose world is from before this
change and pmc doesn't work at all.  (pmccontrol -L doesn't list any
valid counters as the older libpmc presumably chokes on the additional
suffix and doesn't match anything)

-- 
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: r363462 - head/usr.sbin/efibootmgr

2020-07-23 Thread John-Mark Gurney
Author: jmg
Date: Thu Jul 23 22:28:35 2020
New Revision: 363462
URL: https://svnweb.freebsd.org/changeset/base/363462

Log:
  update example to make it active when creating a new boot method...
  
  Clean up some of the sentences and grammar...
  
  make igor happy..

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.8

Modified: head/usr.sbin/efibootmgr/efibootmgr.8
==
--- head/usr.sbin/efibootmgr/efibootmgr.8   Thu Jul 23 21:43:06 2020
(r363461)
+++ head/usr.sbin/efibootmgr/efibootmgr.8   Thu Jul 23 22:28:35 2020
(r363462)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 24, 2019
+.Dd July 23, 2020
 .Dt EFIBOOTMGR 8
 .Os
 .Sh NAME
@@ -66,28 +66,34 @@
 .Nm
 .Fl T
 .Sh "DESCRIPTION"
+The
 .Nm
-manipulates how UEFI Boot Managers boot the system.
-Methods of booting can be created and destroyed.
-Boot methods can be activated or deactivated.
-The order of boot methods tried can be changed.
-Temporary boot methods can override the usual booting methods.
+program manipulates how UEFI Boot Managers boot the system.
+It can create and destroy methods for booting along with activating or
+deactivating them.
+It can also change the defined order of boot methods.
+It can create a temporary boot (BootNext) variable that references a
+boot method to be tried once upon the next boot.
 .Pp
 The UEFI standard defines how hosts may control what is used to
 bootstrap the system.
 Each method is encapsulated within a persistent UEFI variable, stored
 by the UEFI BIOS of the form
-.Cm Boot Ns Em  .
-These variables are numbered, describe where to load the bootstrap
-program from, and whether or not the method is active.
-The boot order of these methods is controlled by another variable
+.Cm Boot Ns Em 
+(where  are uppercase hexadecimal digits).
+These variables are numbered, each describing where to load the bootstrap
+program from, and whether or not the method is active (used for booting,
+otherwise the method will be skipped).
+The order of these methods is controlled by another variable,
 .Cm BootOrder .
-The currently booting method is communicated using
+The currently booted method is communicated using
 .Cm BootCurrent .
 A global timeout can also be set.
 .Pp
 .Nm
-requires that the kernel efirt module be loaded to get and set these
+requires that the kernel module
+.Xr efirt 9
+module be present or loaded to get and set these
 non-volatile variables.
 .Pp
 The following options are available:
@@ -113,7 +119,7 @@ boot entry.
 .It Fl c -create
 Create a new
 .Cm Boot
-variable.
+variable (aka method or entry).
 .It Fl D -dry-run
 Process but do not change any variables.
 .It Fl E -esp
@@ -136,7 +142,7 @@ The path to and name of the kernel.
 .It Fl l -loader Ar loader
 The path to and name of the loader.
 .It Fl L -label Ar label
-An optional description for the entry.
+An optional description for the method.
 .It Fl n -bootnext
 Set
 .Ar bootnum
@@ -169,32 +175,36 @@ To display the current
 .Cm Boot
 related variables in the system:
 .Pp
-.Dl efibootmgr [-v]
+.Dl efibootmgr -v
 .Pp
 This will display the optional
 .Cm BootNext
-bootnum,
-.Cm BootCurrent ,
-or currently booted bootnum, followed by the optional
+(if present),
+.Cm BootCurrent
+(currently booted method), followed by the optional
 .Cm Timeout
 value, any
 .Cm BootOrder
 that may be set, followed finally by all currently defined
 .Cm Boot
 variables, active or not.
-The verbose flag will augment this output with the disk partition uuids,
+The verbose flag,
+.Pq Fl v ,
+augments this output with the disk partition uuids,
 size/offset and device-path of the variable.
+The flag will also include any unreferenced (by BootOrder) variables.
 .Pp
 The
 .Nm
 program can be used to create new EFI boot variables.
-To create a new boot var pointing to an installation with its EFI partition
-mounted under
+The following command may be used to create a new boot method, using
+the EFI partition mounted under
 .Pa /mnt ,
-the given loader and a label
+mark the method active, using
+the given loader and label the method
 .Qq FreeBSD-11 :
 .Pp
-.Dl efibootmgr -c -l /mnt/EFI/freebsd/loader.efi -L FreeBSD-11
+.Dl efibootmgr -a -c -l /mnt/EFI/freebsd/loader.efi -L FreeBSD-11
 .Pp
 This will result in the next available bootnum being assigned to a
 new UEFI boot variable, and given the label
@@ -203,8 +213,11 @@ such as:
 .Pp
 .Dl Boot0009 FreeBSD-11
 .Pp
-Note newly created boot entries are created inactive.
-The active state is denoted by an '*' following the
+Note newly created boot entries are, by default, created inactive, hence
+the reason
+.Fl a
+flag is specified above so that it will be considered for booting.
+The active state is denoted by a '*' following the
 .Cm Boot Ns Em 
 name in the output.
 They are also inserted into the first position of current
@@ -217,7 +230,7 @@ booting from, else they are ignored.
 .Pp
 Will delete the given boot 

svn commit: r363461 - head/sys/opencrypto

2020-07-23 Thread John Baldwin
Author: jhb
Date: Thu Jul 23 21:43:06 2020
New Revision: 363461
URL: https://svnweb.freebsd.org/changeset/base/363461

Log:
  Consolidate duplicated code into a ktls_ocf_dispatch function.
  
  This function manages the loop around crypto_dispatch and coordination
  with ktls_ocf_callback.
  
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D25757

Modified:
  head/sys/opencrypto/ktls_ocf.c

Modified: head/sys/opencrypto/ktls_ocf.c
==
--- head/sys/opencrypto/ktls_ocf.c  Thu Jul 23 21:40:03 2020
(r363460)
+++ head/sys/opencrypto/ktls_ocf.c  Thu Jul 23 21:43:06 2020
(r363461)
@@ -101,6 +101,40 @@ ktls_ocf_callback(struct cryptop *crp)
 }
 
 static int
+ktls_ocf_dispatch(struct ocf_session *os, struct cryptop *crp)
+{
+   struct ocf_operation oo;
+   int error;
+
+   oo.os = os;
+   oo.done = false;
+
+   crp->crp_opaque = &oo;
+   crp->crp_callback = ktls_ocf_callback;
+   for (;;) {
+   error = crypto_dispatch(crp);
+   if (error)
+   break;
+
+   mtx_lock(&os->lock);
+   while (!oo.done)
+   mtx_sleep(&oo, &os->lock, 0, "ocfktls", 0);
+   mtx_unlock(&os->lock);
+
+   if (crp->crp_etype != EAGAIN) {
+   error = crp->crp_etype;
+   break;
+   }
+
+   crp->crp_etype = 0;
+   crp->crp_flags &= ~CRYPTO_F_DONE;
+   oo.done = false;
+   counter_u64_add(ocf_retries, 1);
+   }
+   return (error);
+}
+
+static int
 ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls,
 const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov,
 struct iovec *outiov, int iovcnt, uint64_t seqno,
@@ -110,7 +144,6 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls,
struct tls_aead_data ad;
struct cryptop crp;
struct ocf_session *os;
-   struct ocf_operation oo;
struct iovec iov[iovcnt + 1];
int i, error;
uint16_t tls_comp_len;
@@ -118,9 +151,6 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls,
 
os = tls->cipher;
 
-   oo.os = os;
-   oo.done = false;
-
uio.uio_iov = iniov;
uio.uio_iovcnt = iovcnt;
uio.uio_offset = 0;
@@ -180,35 +210,14 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls,
crypto_use_uio(&crp, &uio);
if (!inplace)
crypto_use_output_uio(&crp, &out_uio);
-   crp.crp_opaque = &oo;
-   crp.crp_callback = ktls_ocf_callback;
 
counter_u64_add(ocf_tls12_gcm_crypts, 1);
if (inplace)
counter_u64_add(ocf_inplace, 1);
else
counter_u64_add(ocf_separate_output, 1);
-   for (;;) {
-   error = crypto_dispatch(&crp);
-   if (error)
-   break;
+   error = ktls_ocf_dispatch(os, &crp);
 
-   mtx_lock(&os->lock);
-   while (!oo.done)
-   mtx_sleep(&oo, &os->lock, 0, "ocfktls", 0);
-   mtx_unlock(&os->lock);
-
-   if (crp.crp_etype != EAGAIN) {
-   error = crp.crp_etype;
-   break;
-   }
-
-   crp.crp_etype = 0;
-   crp.crp_flags &= ~CRYPTO_F_DONE;
-   oo.done = false;
-   counter_u64_add(ocf_retries, 1);
-   }
-
crypto_destroyreq(&crp);
return (error);
 }
@@ -223,16 +232,12 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls,
char nonce[12];
struct cryptop crp;
struct ocf_session *os;
-   struct ocf_operation oo;
struct iovec iov[iovcnt + 1], out_iov[iovcnt + 1];
int i, error;
bool inplace;
 
os = tls->cipher;
 
-   oo.os = os;
-   oo.done = false;
-
crypto_initreq(&crp, os->sid);
 
/* Setup the nonce. */
@@ -294,8 +299,6 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls,
 
crp.crp_op = CRYPTO_OP_ENCRYPT | CRYPTO_OP_COMPUTE_DIGEST;
crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE;
-   crp.crp_opaque = &oo;
-   crp.crp_callback = ktls_ocf_callback;
 
memcpy(crp.crp_iv, nonce, sizeof(nonce));
 
@@ -304,26 +307,7 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls,
counter_u64_add(ocf_inplace, 1);
else
counter_u64_add(ocf_separate_output, 1);
-   for (;;) {
-   error = crypto_dispatch(&crp);
-   if (error)
-   break;
-
-   mtx_lock(&os->lock);
-   while (!oo.done)
-   mtx_sleep(&oo, &os->lock, 0, "ocfktls", 0);
-   mtx_unlock(&os->lock);
-
-   if (crp.crp_etype != EAGAIN) {
-   error = crp.crp_etype;
-  

svn commit: r363460 - head/sys/arm64/arm64

2020-07-23 Thread John Baldwin
Author: jhb
Date: Thu Jul 23 21:40:03 2020
New Revision: 363460
URL: https://svnweb.freebsd.org/changeset/base/363460

Log:
  Set si_trapno to the exception code from esr.
  
  Reviewed by:  kib
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25771

Modified:
  head/sys/arm64/arm64/trap.c

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Thu Jul 23 21:33:10 2020(r363459)
+++ head/sys/arm64/arm64/trap.c Thu Jul 23 21:40:03 2020(r363460)
@@ -104,7 +104,7 @@ static abort_handler *abort_handlers[] = {
 };
 
 static __inline void
-call_trapsignal(struct thread *td, int sig, int code, void *addr)
+call_trapsignal(struct thread *td, int sig, int code, void *addr, int trapno)
 {
ksiginfo_t ksi;
 
@@ -112,6 +112,7 @@ call_trapsignal(struct thread *td, int sig, int code, 
ksi.ksi_signo = sig;
ksi.ksi_code = code;
ksi.ksi_addr = addr;
+   ksi.ksi_trapno = trapno;
trapsignal(td, &ksi);
 }
 
@@ -161,7 +162,8 @@ svc_handler(struct thread *td, struct trapframe *frame
syscallenter(td);
syscallret(td);
} else {
-   call_trapsignal(td, SIGILL, ILL_ILLOPN, (void *)frame->tf_elr);
+   call_trapsignal(td, SIGILL, ILL_ILLOPN, (void *)frame->tf_elr,
+   ESR_ELx_EXCEPTION(frame->tf_esr));
userret(td, frame);
}
 }
@@ -177,7 +179,8 @@ align_abort(struct thread *td, struct trapframe *frame
panic("Misaligned access from kernel space!");
}
 
-   call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr);
+   call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr,
+   ESR_ELx_EXCEPTION(frame->tf_esr));
userret(td, frame);
 }
 
@@ -261,7 +264,8 @@ data_abort(struct thread *td, struct trapframe *frame,
error = vm_fault_trap(map, far, ftype, VM_FAULT_NORMAL, &sig, &ucode);
if (error != KERN_SUCCESS) {
if (lower) {
-   call_trapsignal(td, sig, ucode, (void *)far);
+   call_trapsignal(td, sig, ucode, (void *)far,
+   ESR_ELx_EXCEPTION(esr));
} else {
if (td->td_intr_nesting_level == 0 &&
pcb->pcb_onfault != 0) {
@@ -483,24 +487,29 @@ do_el0_sync(struct thread *td, struct trapframe *frame
break;
case EXCP_UNKNOWN:
if (!undef_insn(0, frame))
-   call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far);
+   call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far,
+   exception);
userret(td, frame);
break;
case EXCP_SP_ALIGN:
-   call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp);
+   call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp,
+   exception);
userret(td, frame);
break;
case EXCP_PC_ALIGN:
-   call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr);
+   call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr,
+   exception);
userret(td, frame);
break;
case EXCP_BRKPT_EL0:
case EXCP_BRK:
-   call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr);
+   call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr,
+   exception);
userret(td, frame);
break;
case EXCP_MSR:
-   call_trapsignal(td, SIGILL, ILL_PRVOPC, (void *)frame->tf_elr); 
+   call_trapsignal(td, SIGILL, ILL_PRVOPC, (void *)frame->tf_elr,
+   exception);
userret(td, frame);
break;
case EXCP_SOFTSTP_EL0:
@@ -509,11 +518,12 @@ do_el0_sync(struct thread *td, struct trapframe *frame
WRITE_SPECIALREG(mdscr_el1,
READ_SPECIALREG(mdscr_el1) & ~DBG_MDSCR_SS);
call_trapsignal(td, SIGTRAP, TRAP_TRACE,
-   (void *)frame->tf_elr);
+   (void *)frame->tf_elr, exception);
userret(td, frame);
break;
default:
-   call_trapsignal(td, SIGBUS, BUS_OBJERR, (void *)frame->tf_elr);
+   call_trapsignal(td, SIGBUS, BUS_OBJERR, (void *)frame->tf_elr,
+   exception);
userret(td, frame);
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"


svn commit: r363459 - head/sys/riscv/riscv

2020-07-23 Thread John Baldwin
Author: jhb
Date: Thu Jul 23 21:33:10 2020
New Revision: 363459
URL: https://svnweb.freebsd.org/changeset/base/363459

Log:
  Pass the right size to memcpy() when copying the array of FP registers.
  
  The size of the containing structure was passed instead of the size of
  the array.  This happened to be harmless as the extra word copied is
  one we copy in the next line anyway.
  
  Reported by:  CHERI (bounds check violation)
  Reviewed by:  brooks, imp
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25791

Modified:
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Thu Jul 23 20:08:42 2020
(r363458)
+++ head/sys/riscv/riscv/machdep.c  Thu Jul 23 21:33:10 2020
(r363459)
@@ -419,7 +419,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp)
KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0,
("Non-userspace FPE flags set in get_fpcontext"));
memcpy(mcp->mc_fpregs.fp_x, curpcb->pcb_x,
-   sizeof(mcp->mc_fpregs));
+   sizeof(mcp->mc_fpregs.fp_x));
mcp->mc_fpregs.fp_fcsr = curpcb->pcb_fcsr;
mcp->mc_fpregs.fp_flags = curpcb->pcb_fpflags;
mcp->mc_flags |= _MC_FP_VALID;
@@ -446,7 +446,7 @@ set_fpcontext(struct thread *td, mcontext_t *mcp)
curpcb = curthread->td_pcb;
/* FPE usage is enabled, override registers. */
memcpy(curpcb->pcb_x, mcp->mc_fpregs.fp_x,
-   sizeof(mcp->mc_fpregs));
+   sizeof(mcp->mc_fpregs.fp_x));
curpcb->pcb_fcsr = mcp->mc_fpregs.fp_fcsr;
curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK;
td->td_frame->tf_sstatus |= SSTATUS_FS_CLEAN;
___
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: r363458 - head/sys/mips/mips

2020-07-23 Thread John Baldwin
Author: jhb
Date: Thu Jul 23 20:08:42 2020
New Revision: 363458
URL: https://svnweb.freebsd.org/changeset/base/363458

Log:
  Set si_addr to badvaddr for TLB faults.
  
  Reviewed by:  kib
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25775

Modified:
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/mips/trap.c
==
--- head/sys/mips/mips/trap.c   Thu Jul 23 20:06:24 2020(r363457)
+++ head/sys/mips/mips/trap.c   Thu Jul 23 20:08:42 2020(r363458)
@@ -740,7 +740,7 @@ dofault:
}
goto err;
}
-   addr = trapframe->pc;
+   addr = trapframe->badvaddr;
 
msg = "BAD_PAGE_FAULT";
log_bad_page_fault(msg, trapframe, type);
___
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: r363457 - head/sbin/md5

2020-07-23 Thread Ed Maste
Author: emaste
Date: Thu Jul 23 20:06:24 2020
New Revision: 363457
URL: https://svnweb.freebsd.org/changeset/base/363457

Log:
  md5: return non-zero if built-in tests (-x) fail
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/md5/md5.c

Modified: head/sbin/md5/md5.c
==
--- head/sbin/md5/md5.c Thu Jul 23 19:43:49 2020(r363456)
+++ head/sbin/md5/md5.c Thu Jul 23 20:06:24 2020(r363457)
@@ -498,10 +498,12 @@ MDTestSuite(const Algorithm_t *alg)
for (i = 0; i < MDTESTCOUNT; i++) {
(*alg->Data)(MDTestInput[i], strlen(MDTestInput[i]), buffer);
printf("%s (\"%s\") = %s", alg->name, MDTestInput[i], buffer);
-   if (strcmp(buffer, (*alg->TestOutput)[i]) == 0)
+   if (strcmp(buffer, (*alg->TestOutput)[i]) == 0) {
printf(" - verified correct\n");
-   else
+   } else {
printf(" - INCORRECT RESULT!\n");
+   failed++;
+   }
}
 }
 
___
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: r363456 - head/sys/netinet

2020-07-23 Thread Michael Tuexen
Author: tuexen
Date: Thu Jul 23 19:43:49 2020
New Revision: 363456
URL: https://svnweb.freebsd.org/changeset/base/363456

Log:
  Clear the pointer to the socket when closing it also in case of
  an ungraceful operation.
  This fixes a use-after-free bug found and reported by Taylor
  Brandstetter of Google by testing the userland stack.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Thu Jul 23 19:19:33 2020(r363455)
+++ head/sys/netinet/sctp_pcb.c Thu Jul 23 19:43:49 2020(r363456)
@@ -3545,6 +3545,11 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate,
cnt = 0;
LIST_FOREACH_SAFE(asoc, &inp->sctp_asoc_list, sctp_tcblist, nasoc) {
SCTP_TCB_LOCK(asoc);
+   if (immediate != SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE) {
+   /* Disconnect the socket please */
+   asoc->sctp_socket = NULL;
+   SCTP_ADD_SUBSTATE(asoc, SCTP_STATE_CLOSED_SOCKET);
+   }
if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) {
SCTP_CLEAR_SUBSTATE(asoc, 
SCTP_STATE_IN_ACCEPT_QUEUE);
___
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: r363455 - head/sys/modules/crypto

2020-07-23 Thread Ed Maste
Author: emaste
Date: Thu Jul 23 19:19:33 2020
New Revision: 363455
URL: https://svnweb.freebsd.org/changeset/base/363455

Log:
  modules/crypto: disable optimized assembly skein1024 implementation
  
  It is presumably broken in the same way as userland skein1024 (see r363454)
  
  PR:   248221

Modified:
  head/sys/modules/crypto/Makefile

Modified: head/sys/modules/crypto/Makefile
==
--- head/sys/modules/crypto/MakefileThu Jul 23 18:55:47 2020
(r363454)
+++ head/sys/modules/crypto/MakefileThu Jul 23 19:19:33 2020
(r363455)
@@ -28,14 +28,14 @@ SRCS+= sha1.c sha256c.c sha512c.c
 SRCS   += skein.c skein_block.c
 # unroll the 256 and 512 loops, half unroll the 1024
 CFLAGS.skein_block.c   += -DSKEIN_LOOP=995
-.if exists(${MACHINE_ARCH}/skein_block_asm.S)
-.PATH: ${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH}
-SRCS   += skein_block_asm.S
-CFLAGS += -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to 
replace with assembly: 256+512+1024 = 1792
-ACFLAGS+= -DELF -Wa,--noexecstack
-# Fully unroll all loops in the assembly optimized version
-ACFLAGS+= -DSKEIN_LOOP=0
-.endif
+#.if exists(${MACHINE_ARCH}/skein_block_asm.S)
+#.PATH:${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH}
+#SRCS  += skein_block_asm.S
+#CFLAGS+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions 
to replace with assembly: 256+512+1024 = 1792
+#ACFLAGS   += -DELF -Wa,--noexecstack
+## Fully unroll all loops in the assembly optimized version
+#ACFLAGS   += -DSKEIN_LOOP=0
+#.endif
 SRCS   += siphash.c
 SRCS   += gmac.c gfmult.c
 SRCS   += blake2b-ref.c
___
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: r363454 - head/lib/libmd

2020-07-23 Thread Ed Maste
Author: emaste
Date: Thu Jul 23 18:55:47 2020
New Revision: 363454
URL: https://svnweb.freebsd.org/changeset/base/363454

Log:
  libmd: temporarily disable optimized assembly skein1024 implementation
  
  It is apparently broken when assembled by contemporary GNU as as well as
  Clang IAS (which is used in the default configuration).
  
  PR:   248221
  Reported by:  pizzamig
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libmd/Makefile

Modified: head/lib/libmd/Makefile
==
--- head/lib/libmd/Makefile Thu Jul 23 17:39:49 2020(r363453)
+++ head/lib/libmd/Makefile Thu Jul 23 18:55:47 2020(r363454)
@@ -116,12 +116,12 @@ CFLAGS+= -DSHA1_ASM
 SRCS+= rmd160.S
 CFLAGS+= -DRMD160_ASM
 .endif
-.if exists(${MACHINE_ARCH}/skein_block_asm.S)
-# Fully unroll all loops in the assembly optimized version
-ACFLAGS+= -DSKEIN_LOOP=0
-SRCS+= skein_block_asm.S
-CFLAGS+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to replace 
with assembly: 256+512+1024 = 1792
-.endif
+#.if exists(${MACHINE_ARCH}/skein_block_asm.S)
+## Fully unroll all loops in the assembly optimized version
+#ACFLAGS+= -DSKEIN_LOOP=0
+#SRCS+= skein_block_asm.S
+#CFLAGS+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to 
replace with assembly: 256+512+1024 = 1792
+#.endif
 .if exists(${MACHINE_ARCH}/sha.S) || exists(${MACHINE_ARCH}/rmd160.S) || 
exists(${MACHINE_ARCH}/skein_block_asm.S)
 ACFLAGS+= -DELF -Wa,--noexecstack
 .endif
___
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"


Please include benchmarks in commit messages (was Re: svn commit: r363450 - in head: share/man/man3 sys/sys)

2020-07-23 Thread Colin Percival
[Picking this as an example of a general trend...]

On 2020-07-23 10:16, Doug Moore wrote:
>   [...]
>   Testing has shown that for the cases where red-black trees do worst,
>   wavl trees better balance leads to faster lookups, so that if lookups
>   outnumber insertions by a nontrivial amount, lookup time saved exceeds
>   the extra cost of balancing.

I'd like to request that commits like this include some benchmarks.  In the
review of these particular changes I see several microbenchmarks for a variety
of use cases; it could be helpful to future code spelunkers if these were
summarized in the commit message (e.g. "lookup-heavy microbenchmarks saw a
X% speedup while write-heavy microbenchmarks saw a Y% slowdown").  It would
also be nice to see a macrobenchmark (e.g. buildworld), even (and perhaps
*especially*) if the result is "no difference was observed".

Again, this is a general request -- this is just the latest in a long series
of commits I've seen by many people which have sounded like they could have
performance impacts but have not included any quantitative results.

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
___
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: r363452 - head/libexec/rc/rc.d

2020-07-23 Thread Cy Schubert
Author: cy
Date: Thu Jul 23 17:39:45 2020
New Revision: 363452
URL: https://svnweb.freebsd.org/changeset/base/363452

Log:
  Load ipfilter, ipnat, and ippool rules, and start ipmon in a vnet jail.
  
  PR:   248109
  Reported by:  jo...@a1poweruser.com
  MFC after:2 weeks

Modified:
  head/libexec/rc/rc.d/ipfilter
  head/libexec/rc/rc.d/ipmon
  head/libexec/rc/rc.d/ipnat
  head/libexec/rc/rc.d/ippool

Modified: head/libexec/rc/rc.d/ipfilter
==
--- head/libexec/rc/rc.d/ipfilter   Thu Jul 23 17:26:53 2020
(r363451)
+++ head/libexec/rc/rc.d/ipfilter   Thu Jul 23 17:39:45 2020
(r363452)
@@ -5,7 +5,7 @@
 
 # PROVIDE: ipfilter
 # REQUIRE: FILESYSTEMS
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 

Modified: head/libexec/rc/rc.d/ipmon
==
--- head/libexec/rc/rc.d/ipmon  Thu Jul 23 17:26:53 2020(r363451)
+++ head/libexec/rc/rc.d/ipmon  Thu Jul 23 17:39:45 2020(r363452)
@@ -6,7 +6,7 @@
 # PROVIDE: ipmon
 # REQUIRE: FILESYSTEMS hostname sysctl ipfilter
 # BEFORE:  SERVERS
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 

Modified: head/libexec/rc/rc.d/ipnat
==
--- head/libexec/rc/rc.d/ipnat  Thu Jul 23 17:26:53 2020(r363451)
+++ head/libexec/rc/rc.d/ipnat  Thu Jul 23 17:39:45 2020(r363452)
@@ -5,7 +5,7 @@
 
 # PROVIDE: ipnat
 # REQUIRE: ipfilter
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 

Modified: head/libexec/rc/rc.d/ippool
==
--- head/libexec/rc/rc.d/ippool Thu Jul 23 17:26:53 2020(r363451)
+++ head/libexec/rc/rc.d/ippool Thu Jul 23 17:39:45 2020(r363452)
@@ -6,7 +6,7 @@
 # PROVIDE: ippool
 # REQUIRE: FILESYSTEMS
 # BEFORE:  ipfilter
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 
___
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: r363453 - head/contrib/ipfilter/man

2020-07-23 Thread Cy Schubert
Author: cy
Date: Thu Jul 23 17:39:49 2020
New Revision: 363453
URL: https://svnweb.freebsd.org/changeset/base/363453

Log:
  Document the IPFILTER_PREDEFINED environment variable.
  
  PR:   248088
  Reported by:  jo...@a1poweruser.com
  MFC after:1 week

Modified:
  head/contrib/ipfilter/man/ipf.8

Modified: head/contrib/ipfilter/man/ipf.8
==
--- head/contrib/ipfilter/man/ipf.8 Thu Jul 23 17:39:45 2020
(r363452)
+++ head/contrib/ipfilter/man/ipf.8 Thu Jul 23 17:39:49 2020
(r363453)
@@ -158,6 +158,15 @@ display the statistics prior to them being zeroed.
 Zero global statistics held in the kernel for filtering only (this doesn't
 affect fragment or state statistics).
 .DT
+.SH ENVIRONMENT
+.NM utilizes the following environment variable.
+.TP
+.B IPF_PREDEFINED
+ipfilter variables, see VARIABLES in ipf(5), can be specified in this
+environment variable providing shell access to ipfilter and ipnat variables.
+For example,
+.br
+IPF_PREDEFINED='my_server="10.1.1.1"; my_client="10.1.1.2";'
 .SH FILES
 /dev/ipauth
 .br
___
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: r363451 - in head/sys: kern sys

2020-07-23 Thread Mateusz Guzik
Author: mjg
Date: Thu Jul 23 17:26:53 2020
New Revision: 363451
URL: https://svnweb.freebsd.org/changeset/base/363451

Log:
  locks: fix a long standing bug for primitives with kdtrace but without 
spinning
  
  In such a case the second argument to lock_delay_arg_init was NULL which was
  immediately causing a null pointer deref.
  
  Since the sructure is only used for spin count, provide a dedicate routine
  initializing it.
  
  Reported by:  andrew

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c
  head/sys/sys/lock.h

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Thu Jul 23 17:16:20 2020(r363450)
+++ head/sys/kern/kern_mutex.c  Thu Jul 23 17:26:53 2020(r363451)
@@ -538,7 +538,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v)
 #if defined(ADAPTIVE_MUTEXES)
lock_delay_arg_init(&lda, &mtx_delay);
 #elif defined(KDTRACE_HOOKS)
-   lock_delay_arg_init(&lda, NULL);
+   lock_delay_arg_init_noadapt(&lda);
 #endif
 
if (__predict_false(v == MTX_UNOWNED))

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Thu Jul 23 17:16:20 2020(r363450)
+++ head/sys/kern/kern_rwlock.c Thu Jul 23 17:26:53 2020(r363451)
@@ -475,7 +475,7 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, 
 #if defined(ADAPTIVE_RWLOCKS)
lock_delay_arg_init(&lda, &rw_delay);
 #elif defined(KDTRACE_HOOKS)
-   lock_delay_arg_init(&lda, NULL);
+   lock_delay_arg_init_noadapt(&lda);
 #endif
 
 #ifdef HWPMC_HOOKS
@@ -951,7 +951,7 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOC
 #if defined(ADAPTIVE_RWLOCKS)
lock_delay_arg_init(&lda, &rw_delay);
 #elif defined(KDTRACE_HOOKS)
-   lock_delay_arg_init(&lda, NULL);
+   lock_delay_arg_init_noadapt(&lda);
 #endif
if (__predict_false(v == RW_UNLOCKED))
v = RW_READ_VALUE(rw);

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Thu Jul 23 17:16:20 2020(r363450)
+++ head/sys/kern/kern_sx.c Thu Jul 23 17:26:53 2020(r363451)
@@ -623,7 +623,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
 #if defined(ADAPTIVE_SX)
lock_delay_arg_init(&lda, &sx_delay);
 #elif defined(KDTRACE_HOOKS)
-   lock_delay_arg_init(&lda, NULL);
+   lock_delay_arg_init_noadapt(&lda);
 #endif
 
if (__predict_false(x == SX_LOCK_UNLOCKED))
@@ -1063,7 +1063,7 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO
 #if defined(ADAPTIVE_SX)
lock_delay_arg_init(&lda, &sx_delay);
 #elif defined(KDTRACE_HOOKS)
-   lock_delay_arg_init(&lda, NULL);
+   lock_delay_arg_init_noadapt(&lda);
 #endif
 
 #ifdef HWPMC_HOOKS

Modified: head/sys/sys/lock.h
==
--- head/sys/sys/lock.h Thu Jul 23 17:16:20 2020(r363450)
+++ head/sys/sys/lock.h Thu Jul 23 17:26:53 2020(r363451)
@@ -195,6 +195,13 @@ lock_delay_arg_init(struct lock_delay_arg *la, struct 
la->spin_cnt = 0;
 }
 
+static inline void
+lock_delay_arg_init_noadapt(struct lock_delay_arg *la)
+{
+   la->delay = 0;
+   la->spin_cnt = 0;
+}
+
 #define lock_delay_spin(n) do {\
u_int _i;   \
\
___
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: r363450 - in head: share/man/man3 sys/sys

2020-07-23 Thread Doug Moore
Author: dougm
Date: Thu Jul 23 17:16:20 2020
New Revision: 363450
URL: https://svnweb.freebsd.org/changeset/base/363450

Log:
  Rank balanced (RB) trees are a class of balanced trees that includes
  AVL trees, red-black trees, and others. Weak AVL (wavl) trees are a
  recently discovered member of that class. This change replaces
  red-black rebalancing with weak AVL rebalancing in the RB tree macros.
  
  Wavl trees sit between AVL and red-black trees in terms of how
  strictly balance is enforced. They have the stricter balance of AVL
  trees as the tree is built - a wavl tree is an AVL tree until the
  first deletion. Once removals start, wavl trees are lazier about
  rebalancing than AVL trees, so that removals can be fast, but the
  balance of the tree can decay to that of a red-black tree. Subsequent
  insertions can push balance back toward the stricter AVL conditions.
  
  Removing a node from a wavl tree never requires more than two
  rotations, which is better than either red-black or AVL
  trees. Inserting a node into a wavl tree never requires more than two
  rotations, which matches red-black and AVL trees. The only
  disadvantage of wavl trees to red-black trees is that more insertions
  are likely to adjust the tree a bit. That's the cost of keeping the
  tree more balanced.
  
  Testing has shown that for the cases where red-black trees do worst,
  wavl trees better balance leads to faster lookups, so that if lookups
  outnumber insertions by a nontrivial amount, lookup time saved exceeds
  the extra cost of balancing.
  
  Reviewed by:  alc, gbe, markj
  Tested by:pho
  Discussed with:   emaste
  Differential Revision:https://reviews.freebsd.org/D25480

Modified:
  head/share/man/man3/tree.3
  head/sys/sys/tree.h

Modified: head/share/man/man3/tree.3
==
--- head/share/man/man3/tree.3  Thu Jul 23 15:03:28 2020(r363449)
+++ head/share/man/man3/tree.3  Thu Jul 23 17:16:20 2020(r363450)
@@ -99,7 +99,7 @@
 .Nm RB_INSERT ,
 .Nm RB_REMOVE ,
 .Nm RB_REINSERT
-.Nd "implementations of splay and red-black trees"
+.Nd "implementations of splay and rank-balanced (wavl) trees"
 .Sh SYNOPSIS
 .In sys/tree.h
 .Fn SPLAY_PROTOTYPE NAME TYPE FIELD CMP
@@ -195,7 +195,7 @@
 .Fn RB_REINSERT NAME "RB_HEAD *head" "struct TYPE *elm"
 .Sh DESCRIPTION
 These macros define data structures for different types of trees:
-splay trees and red-black trees.
+splay trees and rank-balanced (wavl) trees.
 .Pp
 In the macro definitions,
 .Fa TYPE
@@ -364,26 +364,26 @@ macro:
 The
 .Fn SPLAY_EMPTY
 macro should be used to check whether a splay tree is empty.
-.Sh RED-BLACK TREES
-A red-black tree is a binary search tree with the node color as an
-extra attribute.
-It fulfills a set of conditions:
-.Bl -enum -offset indent
-.It
-Every search path from the root to a leaf consists of the same number of
-black nodes.
-.It
-Each red node (except for the root) has a black parent.
-.It
-Each leaf node is black.
-.El
+.Sh RANK-BALANCED TREES
+Rank-balanced (RB) trees are a framework for defining height-balanced
+binary search trees, including AVL and red-black trees.
+Each tree node has an associated rank.
+Balance conditions are expressed by conditions on the differences in
+rank between any node and its children.
+Rank differences are stored in each tree node.
+.Pp  
+The balance conditions implemented by the RB macros lead to weak AVL
+(wavl) trees, which combine the best aspects of AVL and red-black
+trees.
+Wavl trees rebalance after an insertion in the same way AVL trees do,
+with the same worst-case time as red-black trees offer, and with
+better balance in the resulting tree.
+Wavl trees rebalance after a removal in a way that requires less
+restructuring, in the worst case, than either AVL or red-black trees
+do.  Removals can lead to a tree almost as unbalanced as a red-black
+tree; insertions lead to a tree becoming as balanced as an AVL tree.
 .Pp
-Every operation on a red-black tree is bounded as
-.Fn O "lg n" .
-The maximum height of a red-black tree is
-.Fn 2lg "n + 1" .
-.Pp
-A red-black tree is headed by a structure defined by the
+A rank-balanced tree is headed by a structure defined by the
 .Fn RB_HEAD
 macro.
 A
@@ -488,7 +488,7 @@ The
 macro initializes the tree referenced by
 .Fa head .
 .Pp
-The red-black tree can also be initialized statically by using the
+The rank-balanced tree can also be initialized statically by using the
 .Fn RB_INITIALIZER
 macro like this:
 .Bd -ragged -offset indent
@@ -567,7 +567,7 @@ and will be overwritten to provide safe traversal.
 .Pp
 The
 .Fn RB_EMPTY
-macro should be used to check whether a red-black tree is empty.
+macro should be used to check whether a rank-balanced tree is empty.
 .Pp
 The
 .Fn RB_REINSERT
@@ -581,7 +581,7 @@ a node's key.
 This is a lower overhead alternative to removing the element
 and reinserting it again.
 .Sh EXAMPLES
-The following example demo

svn commit: r363449 - head/libexec/rc

2020-07-23 Thread Mark Johnston
Author: markj
Date: Thu Jul 23 15:03:28 2020
New Revision: 363449
URL: https://svnweb.freebsd.org/changeset/base/363449

Log:
  rc.firewall: Merge two identical conditions into one.
  
  No functional change intended.
  
  PR:   247949
  Submitted by: Jose Luis Duran 
  MFC after:1 week

Modified:
  head/libexec/rc/rc.firewall

Modified: head/libexec/rc/rc.firewall
==
--- head/libexec/rc/rc.firewall Thu Jul 23 14:33:25 2020(r363448)
+++ head/libexec/rc/rc.firewall Thu Jul 23 15:03:28 2020(r363449)
@@ -222,9 +222,6 @@ case ${firewall_type} in
if [ -n "$net6" ]; then
${fwcmd} add pass all from me to ${net6}
${fwcmd} add pass all from ${net6} to me
-   fi
-
-   if [ -n "$net6" ]; then
# Allow any link-local multicast traffic
${fwcmd} add pass all from fe80::/10 to ff02::/16
${fwcmd} add pass all from ${net6} to ff02::/16
___
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: r363448 - head/sbin/nvmecontrol

2020-07-23 Thread Alexander Motin
Author: mav
Date: Thu Jul 23 14:33:25 2020
New Revision: 363448
URL: https://svnweb.freebsd.org/changeset/base/363448

Log:
  Add missing newlines.
  
  MFC after:3 days

Modified:
  head/sbin/nvmecontrol/identify.c

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cThu Jul 23 14:21:45 2020
(r363447)
+++ head/sbin/nvmecontrol/identify.cThu Jul 23 14:33:25 2020
(r363448)
@@ -151,15 +151,15 @@ print_namespace(struct nvme_namespace_data *nsdata)
   uint128_to_str(to128(nsdata->nvmcap), cbuf, sizeof(cbuf)));
if ((nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) &
NVME_NS_DATA_NSFEAT_NPVALID_MASK) {
-   printf("Preferred Write Granularity: %u blocks",
+   printf("Preferred Write Granularity: %u blocks\n",
nsdata->npwg + 1);
-   printf("Preferred Write Alignment:   %u blocks",
+   printf("Preferred Write Alignment:   %u blocks\n",
nsdata->npwa + 1);
-   printf("Preferred Deallocate Granul: %u blocks",
+   printf("Preferred Deallocate Granul: %u blocks\n",
nsdata->npdg + 1);
-   printf("Preferred Deallocate Align:  %u blocks",
+   printf("Preferred Deallocate Align:  %u blocks\n",
nsdata->npda + 1);
-   printf("Optimal Write Size:  %u blocks",
+   printf("Optimal Write Size:  %u blocks\n",
nsdata->nows + 1);
}
printf("Globally Unique Identifier:  ");
___
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: r363447 - in head/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common

2020-07-23 Thread Mark Johnston
Author: markj
Date: Thu Jul 23 14:21:45 2020
New Revision: 363447
URL: https://svnweb.freebsd.org/changeset/base/363447

Log:
  MFOpenZFS: Fix zpool history unbounded memory usage
  
  In original implementation, zpool history will read the whole history
  before printing anything, causing memory usage goes unbounded. We fix
  this by breaking it into read-print iterations.
  
  Reviewed-by: Tom Caputi 
  Reviewed-by: Matt Ahrens 
  Reviewed-by: Igor Kozhukhov 
  Reviewed-by: Brian Behlendorf 
  Signed-off-by: Chunwei Chen 
  Closes #9516
  
  Note, this change changes the libzfs.so ABI by modifying the prototype
  of zpool_get_history().  Since libzfs is effectively private to the base
  system it is anticipated that this will not be a problem.
  
  PR:   247557
  Obtained from:OpenZFS
  Reported and tested by:   Sam Vaughan 
  Discussed with:   freqlabs
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25745
  openzfs/zfs@7125a109dcc55628336ff3f58e59e503f4d7694d

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cThu Jul 23 
14:03:37 2020(r363446)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cThu Jul 23 
14:21:45 2020(r363447)
@@ -6226,25 +6226,13 @@ typedef struct hist_cbdata {
boolean_t internal;
 } hist_cbdata_t;
 
-/*
- * Print out the command history for a specific pool.
- */
-static int
-get_history_one(zpool_handle_t *zhp, void *data)
+static void
+print_history_records(nvlist_t *nvhis, hist_cbdata_t *cb)
 {
-   nvlist_t *nvhis;
nvlist_t **records;
uint_t numrecords;
-   int ret, i;
-   hist_cbdata_t *cb = (hist_cbdata_t *)data;
+   int i;
 
-   cb->first = B_FALSE;
-
-   (void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp));
-
-   if ((ret = zpool_get_history(zhp, &nvhis)) != 0)
-   return (ret);
-
verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD,
&records, &numrecords) == 0);
for (i = 0; i < numrecords; i++) {
@@ -6344,8 +6332,32 @@ get_history_one(zpool_handle_t *zhp, void *data)
(void) printf("]");
(void) printf("\n");
}
+}
+
+/*
+ * Print out the command history for a specific pool.
+ */
+static int
+get_history_one(zpool_handle_t *zhp, void *data)
+{
+   nvlist_t *nvhis;
+   int ret;
+   hist_cbdata_t *cb = (hist_cbdata_t *)data;
+   uint64_t off = 0;
+   boolean_t eof = B_FALSE;
+
+   cb->first = B_FALSE;
+
+   (void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp));
+
+   while (!eof) {
+   if ((ret = zpool_get_history(zhp, &nvhis, &off, &eof)) != 0)
+   return (ret);
+
+   print_history_records(nvhis, cb);
+   nvlist_free(nvhis);
+   }
(void) printf("\n");
-   nvlist_free(nvhis);
 
return (ret);
 }

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hThu Jul 23 
14:03:37 2020(r363446)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hThu Jul 23 
14:21:45 2020(r363447)
@@ -441,7 +441,8 @@ typedef enum {
 extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *,
 int name_flags);
 extern int zpool_upgrade(zpool_handle_t *, uint64_t);
-extern int zpool_get_history(zpool_handle_t *, nvlist_t **);
+extern int zpool_get_history(zpool_handle_t *, nvlist_t **, uint64_t *,
+boolean_t *);
 extern int zpool_history_unpack(char *, uint64_t, uint64_t *,
 nvlist_t ***, uint_t *);
 extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *,

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Thu Jul 
23 14:03:37 2020(r363446)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Thu Jul 
23 14:21:45 2020(r363447)
@@ -4124,33 +4124,37 @@ zpool_history_unpack(char *buf, uint64_t bytes_read, u
  * Retrieve the command history of a pool.
  */
 int
-zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp)
+zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp, uint64_t *off,
+boolean_t *eof)
 {
char *buf;
uint64_t buflen = HIS_BUF_LEN_DEF;
-   uint64_t off = 0;
nvlist_t **records = NULL;
uint_t numrecords = 0;
int err, i;

svn commit: r363446 - head/sys/fs/cuse

2020-07-23 Thread Mark Johnston
Author: markj
Date: Thu Jul 23 14:03:37 2020
New Revision: 363446
URL: https://svnweb.freebsd.org/changeset/base/363446

Log:
  cuse: Stop checking for failures from malloc(M_WAITOK).
  
  PR:   240545
  Submitted by: Andrew Reiter 
  Reviewed by:  hselasky
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25765

Modified:
  head/sys/fs/cuse/cuse.c

Modified: head/sys/fs/cuse/cuse.c
==
--- head/sys/fs/cuse/cuse.c Thu Jul 23 14:03:24 2020(r363445)
+++ head/sys/fs/cuse/cuse.c Thu Jul 23 14:03:37 2020(r363446)
@@ -425,8 +425,6 @@ cuse_server_alloc_memory(struct cuse_server *pcs, uint
int error;
 
mem = malloc(sizeof(*mem), M_CUSE, M_WAITOK | M_ZERO);
-   if (mem == NULL)
-   return (ENOMEM);
 
object = vm_pager_allocate(OBJT_SWAP, NULL, PAGE_SIZE * page_count,
VM_PROT_DEFAULT, 0, curthread->td_ucred);
@@ -748,8 +746,6 @@ cuse_server_open(struct cdev *dev, int fflags, int dev
struct cuse_server *pcs;
 
pcs = malloc(sizeof(*pcs), M_CUSE, M_WAITOK | M_ZERO);
-   if (pcs == NULL)
-   return (ENOMEM);
 
if (devfs_set_cdevpriv(pcs, &cuse_server_free)) {
printf("Cuse: Cannot set cdevpriv.\n");
@@ -1217,10 +1213,6 @@ cuse_server_ioctl(struct cdev *dev, unsigned long cmd,
 
pcsd = malloc(sizeof(*pcsd), M_CUSE, M_WAITOK | M_ZERO);
 
-   if (pcsd == NULL) {
-   error = ENOMEM;
-   break;
-   }
pcsd->server = pcs;
 
pcsd->user_dev = pcd->dev;
@@ -1430,11 +1422,6 @@ cuse_client_open(struct cdev *dev, int fflags, int dev
}
 
pcc = malloc(sizeof(*pcc), M_CUSE, M_WAITOK | M_ZERO);
-   if (pcc == NULL) {
-   /* drop reference on server */
-   cuse_server_unref(pcs);
-   return (ENOMEM);
-   }
if (devfs_set_cdevpriv(pcc, &cuse_client_free)) {
printf("Cuse: Cannot set cdevpriv.\n");
/* drop reference on server */
___
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: r363445 - head/sys/dev/ntb/test

2020-07-23 Thread Mark Johnston
Author: markj
Date: Thu Jul 23 14:03:24 2020
New Revision: 363445
URL: https://svnweb.freebsd.org/changeset/base/363445

Log:
  ntb: Stop checking for failures from malloc(M_WAITOK).
  
  PR:   240545
  Submitted by: Andrew Reiter 
  Reviewed by:  cem, mav
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25768

Modified:
  head/sys/dev/ntb/test/ntb_tool.c

Modified: head/sys/dev/ntb/test/ntb_tool.c
==
--- head/sys/dev/ntb/test/ntb_tool.cThu Jul 23 08:42:16 2020
(r363444)
+++ head/sys/dev/ntb/test/ntb_tool.cThu Jul 23 14:03:24 2020
(r363445)
@@ -619,10 +619,6 @@ tool_mw_write_fn(struct sysctl_oid *oidp, struct sysct
 write:
data_buf_size = *buf_size;
data_buf = malloc(data_buf_size, M_NTB_TOOL, M_WAITOK | M_ZERO);
-   if (!data_buf) {
-   rc = ENOMEM;
-   goto out;
-   }
 
if (s_pflag)
memset(data_buf, pattern, data_buf_size);
@@ -677,7 +673,7 @@ sysctl_local_port_number(SYSCTL_HANDLER_ARGS)
return (rc);
 }
 
-static int
+static void
 tool_init_peers(struct tool_ctx *tc)
 {
int pidx;
@@ -685,14 +681,10 @@ tool_init_peers(struct tool_ctx *tc)
tc->peer_cnt = ntb_peer_port_count(tc->dev);
tc->peers = malloc(tc->peer_cnt * sizeof(*tc->peers), M_NTB_TOOL,
M_WAITOK | M_ZERO);
-   if (tc->peers == NULL)
-   return (ENOMEM);
for (pidx = 0; pidx < tc->peer_cnt; pidx++) {
tc->peers[pidx].pidx = pidx;
tc->peers[pidx].tc = tc;
}
-
-   return (0);
 }
 
 static void
@@ -1016,8 +1008,6 @@ tool_init_mws(struct tool_ctx *tc)
tc->peers[pidx].inmws = malloc(tc->peers[pidx].inmw_cnt *
sizeof(*tc->peers[pidx].inmws), M_NTB_TOOL,
M_WAITOK | M_ZERO);
-   if (tc->peers[pidx].inmws == NULL)
-   return (ENOMEM);
 
for (widx = 0; widx < tc->peers[pidx].inmw_cnt; widx++) {
mw = &tc->peers[pidx].inmws[widx];
@@ -1219,7 +1209,7 @@ sysctl_peer_spad_handle(SYSCTL_HANDLER_ARGS)
return (rc);
 }
 
-static int
+static void
 tool_init_spads(struct tool_ctx *tc)
 {
int sidx, pidx;
@@ -1228,8 +1218,6 @@ tool_init_spads(struct tool_ctx *tc)
tc->inspad_cnt = ntb_spad_count(tc->dev);
tc->inspads = malloc(tc->inspad_cnt * sizeof(*tc->inspads), M_NTB_TOOL,
M_WAITOK | M_ZERO);
-   if (tc->inspads == NULL)
-   return (ENOMEM);
 
for (sidx = 0; sidx < tc->inspad_cnt; sidx++) {
tc->inspads[sidx].sidx = sidx;
@@ -1243,8 +1231,6 @@ tool_init_spads(struct tool_ctx *tc)
tc->peers[pidx].outspads =  malloc(tc->peers[pidx].outspad_cnt *
sizeof(*tc->peers[pidx].outspads), M_NTB_TOOL, M_WAITOK |
M_ZERO);
-   if (tc->peers[pidx].outspads == NULL)
-   return (ENOMEM);
 
for (sidx = 0; sidx < tc->peers[pidx].outspad_cnt; sidx++) {
tc->peers[pidx].outspads[sidx].sidx = sidx;
@@ -1252,8 +1238,6 @@ tool_init_spads(struct tool_ctx *tc)
tc->peers[pidx].outspads[sidx].tc = tc;
}
}
-
-   return (0);
 }
 
 static void
@@ -1450,17 +1434,13 @@ ntb_tool_attach(device_t dev)
if (rc)
goto out;
 
-   rc = tool_init_peers(tc);
-   if (rc)
-   goto err_clear_data;
+   tool_init_peers(tc);
 
rc = tool_init_mws(tc);
if (rc)
goto err_clear_data;
 
-   rc = tool_init_spads(tc);
-   if (rc)
-   goto err_clear_mws;
+   tool_init_spads(tc);
 
rc = tool_init_ntb(tc);
if (rc)
@@ -1472,7 +1452,6 @@ ntb_tool_attach(device_t dev)
 
 err_clear_spads:
tool_clear_spads(tc);
-err_clear_mws:
tool_clear_mws(tc);
tool_clear_peers(tc);
 err_clear_data:
___
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: r363444 - head/sys/vm

2020-07-23 Thread Mateusz Guzik
Author: mjg
Date: Thu Jul 23 08:42:16 2020
New Revision: 363444
URL: https://svnweb.freebsd.org/changeset/base/363444

Log:
  vm: annotate swap_reserved with __exclusive_cache_line
  
  The counter keeps being updated all the time and variables read afterwards
  share the cacheline. Note this still fundamentally does not scale and needs
  to be replaced, in the meantime gets a bandaid.
  
  brk1_processes -t 52 ops/s:
  before: 8598298
  after:  9098080

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cThu Jul 23 03:25:31 2020(r363443)
+++ head/sys/vm/swap_pager.cThu Jul 23 08:42:16 2020(r363444)
@@ -152,7 +152,7 @@ static int nswapdev;/* Number of swap 
devices */
 int swap_pager_avail;
 static struct sx swdev_syscall_lock;   /* serialize swap(on|off) */
 
-static u_long swap_reserved;
+static __exclusive_cache_line u_long swap_reserved;
 static u_long swap_total;
 static int sysctl_page_shift(SYSCTL_HANDLER_ARGS);
 
___
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"