svn commit: r358324 - head/tests/sys/netpfil/pf

2020-02-25 Thread Li-Wen Hsu
Author: lwhsu
Date: Wed Feb 26 04:54:50 2020
New Revision: 358324
URL: https://svnweb.freebsd.org/changeset/base/358324

Log:
  Revert r358309 after r358311.
  
  PR:   244393
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/netpfil/pf/fragmentation.sh

Modified: head/tests/sys/netpfil/pf/fragmentation.sh
==
--- head/tests/sys/netpfil/pf/fragmentation.sh  Tue Feb 25 22:15:25 2020
(r358323)
+++ head/tests/sys/netpfil/pf/fragmentation.sh  Wed Feb 26 04:54:50 2020
(r358324)
@@ -80,10 +80,6 @@ v6_head()
 
 v6_body()
 {
-   if [ "$(atf_config_get ci false)" = "true" ]; then
-   atf_skip "https://bugs.freebsd.org/244393;
-   fi
-
pft_init
 
epair_send=$(vnet_mkepair)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358323 - head/crypto/openssh

2020-02-25 Thread Ed Maste
Author: emaste
Date: Tue Feb 25 22:15:25 2020
New Revision: 358323
URL: https://svnweb.freebsd.org/changeset/base/358323

Log:
  Add a note about deleted files in OpenSSH upgrade instructions

Modified:
  head/crypto/openssh/FREEBSD-upgrade

Modified: head/crypto/openssh/FREEBSD-upgrade
==
--- head/crypto/openssh/FREEBSD-upgrade Tue Feb 25 22:03:30 2020
(r358322)
+++ head/crypto/openssh/FREEBSD-upgrade Tue Feb 25 22:15:25 2020
(r358323)
@@ -46,6 +46,11 @@
 
 $ svn merge -cNN \^/vendor-crypto/openssh/dist .
 
+A number of files have been deleted from FreeBSD's copy of ssh,
+including rendered man pages (which have a .0 extension).  When
+svn prompts for these deleted files during the merge, choose 'r'
+(leaving them deleted).
+
 0A) Resolve conflicts.  Remember to bump the version addendum in
 version.h, and update the default value in ssh{,d}_config and
 ssh{,d}_config.5.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358322 - in head/sys: contrib/ncsw/inc contrib/ncsw/user/env dev/dpaa

2020-02-25 Thread Brandon Bergren
Author: bdragon
Date: Tue Feb 25 22:03:30 2020
New Revision: 358322
URL: https://svnweb.freebsd.org/changeset/base/358322

Log:
  [PowerPC] [Book-E] Remove obsolete interrupt binding workaround
  
  Remove an old workaround that is no longer necessary since rS343824.
  
  There used to be a problem with FMan interrupts firing on multiple CPUS
  at the same time.
  
  This ended up being due to multicast interrupts being unsupported in the
  Freescale PIC (so instead of using a selection algorithm, it would do some
  unspecified action, such as interrupting multiple cpus at random.)
  
  Reviewed by:  jhibbits
  Sponsored by: Tag1 Consulting, Inc.
  Differential Revision:https://reviews.freebsd.org/D23829

Modified:
  head/sys/contrib/ncsw/inc/xx_ext.h
  head/sys/contrib/ncsw/user/env/xx.c
  head/sys/dev/dpaa/fman.c

Modified: head/sys/contrib/ncsw/inc/xx_ext.h
==
--- head/sys/contrib/ncsw/inc/xx_ext.h  Tue Feb 25 21:02:52 2020
(r358321)
+++ head/sys/contrib/ncsw/inc/xx_ext.h  Tue Feb 25 22:03:30 2020
(r358322)
@@ -794,5 +794,4 @@ t_Error XX_IpcSendMessage(t_Handle   h_Session
 
 
 void XX_PortalSetInfo(device_t dev);
-void XX_FmanFixIntr(int irq);
 #endif /* __XX_EXT_H */

Modified: head/sys/contrib/ncsw/user/env/xx.c
==
--- head/sys/contrib/ncsw/user/env/xx.c Tue Feb 25 21:02:52 2020
(r358321)
+++ head/sys/contrib/ncsw/user/env/xx.c Tue Feb 25 22:03:30 2020
(r358322)
@@ -95,7 +95,6 @@ MTX_SYSINIT(XX_MallocTrackLockInit, _MallocTrackLoc
 
 /* Interrupt info */
 #define XX_INTR_FLAG_PREALLOCATED  (1 << 0)
-#define XX_INTR_FLAG_FMAN_FIX  (1 << 1)
 
 struct XX_IntrInfo {
driver_intr_t   *handler;
@@ -295,23 +294,6 @@ XX_IsPortalIntr(uintptr_t irq)
return (0);
 }
 
-void
-XX_FmanFixIntr(int irq)
-{
-
-   XX_IntrInfo[irq].flags |= XX_INTR_FLAG_FMAN_FIX;
-}
-
-static bool
-XX_FmanNeedsIntrFix(int irq)
-{
-
-   if (XX_IntrInfo[irq].flags & XX_INTR_FLAG_FMAN_FIX)
-   return (1);
-
-   return (0);
-}
-
 static void
 XX_Dispatch(void *arg)
 {
@@ -398,21 +380,7 @@ XX_SetIntr(uintptr_t irq, t_Isr *f_Isr, t_Handle handl
 
err = bus_setup_intr(dev, r, flags, NULL, f_Isr, handle,
_IntrInfo[irq].cookie);
-   if (err)
-   goto finish;
 
-   /*
-* XXX: Bind FMan IRQ to CPU0. Current interrupt subsystem directs each
-* interrupt to all CPUs. Race between an interrupt assertion and
-* masking may occur and interrupt handler may be called multiple times
-* per one interrupt. FMan doesn't support such a situation. Workaround
-* is to bind FMan interrupt to one CPU0 only.
-*/
-#ifdef SMP
-   if (XX_FmanNeedsIntrFix(irq))
-   err = powerpc_bind_intr(irq, 0);
-#endif
-finish:
return (err);
 }
 

Modified: head/sys/dev/dpaa/fman.c
==
--- head/sys/dev/dpaa/fman.cTue Feb 25 21:02:52 2020(r358321)
+++ head/sys/dev/dpaa/fman.cTue Feb 25 22:03:30 2020(r358322)
@@ -455,13 +455,6 @@ fman_attach(device_t dev)
goto err;
}
 
-   /*
-* XXX: Fix FMan interrupt. This is workaround for the issue with
-* interrupts directed to multiple CPUs by the interrupts subsystem.
-* Workaround is to bind the interrupt to only one CPU0.
-*/
-   XX_FmanFixIntr(rman_get_start(sc->irq_res));
-
sc->err_irq_rid = 1;
sc->err_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
>err_irq_rid, RF_ACTIVE | RF_SHAREABLE);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358321 - in stable: 11/contrib/ipfilter/man 11/contrib/ipfilter/tools 12/contrib/ipfilter/man 12/contrib/ipfilter/tools

2020-02-25 Thread Cy Schubert
Author: cy
Date: Tue Feb 25 21:02:52 2020
New Revision: 358321
URL: https://svnweb.freebsd.org/changeset/base/358321

Log:
  MFC r358064:
  
  As with ipf(8), give ippool(8) the ability to load IP pools from multiple
  files. This allows for loading, during the same invocation of ippool, of
  multiple sources of input using multiple tools to concurrently maintain the
  files such as fail2ban, macro preprocessors, and manually.

Modified:
  stable/12/contrib/ipfilter/man/ippool.8
  stable/12/contrib/ipfilter/tools/ippool.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/man/ippool.8
  stable/11/contrib/ipfilter/tools/ippool.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/contrib/ipfilter/man/ippool.8
==
--- stable/12/contrib/ipfilter/man/ippool.8 Tue Feb 25 19:29:05 2020
(r358320)
+++ stable/12/contrib/ipfilter/man/ippool.8 Tue Feb 25 21:02:52 2020
(r358321)
@@ -12,7 +12,7 @@ ippool \- user interface to the IPFilter pools
 -A [-dnv] [-m ] [-o ] [-S ] -t 
 .br
 .B ippool
--f  [-dnuv]
+-f  [-dnuv] [-f ] [-t ]

Modified: stable/12/contrib/ipfilter/tools/ippool.c
==
--- stable/12/contrib/ipfilter/tools/ippool.c   Tue Feb 25 19:29:05 2020
(r358320)
+++ stable/12/contrib/ipfilter/tools/ippool.c   Tue Feb 25 21:02:52 2020
(r358321)
@@ -381,12 +381,16 @@ loadpoolfile(argc, argv, infile)
 {
int c;
 
-   while ((c = getopt(argc, argv, "dnuv")) != -1)
+   while ((c = getopt(argc, argv, "dnuvf:")) != -1)
switch (c)
{
case 'd' :
opts |= OPT_DEBUG;
ippool_yydebug++;
+   break;
+   case 'f' :
+   if (loadpoolfile(argc, argv, optarg) != 0)
+   return(-1);
break;
case 'n' :
opts |= OPT_DONOTHING|OPT_DONTOPEN;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358321 - in stable: 11/contrib/ipfilter/man 11/contrib/ipfilter/tools 12/contrib/ipfilter/man 12/contrib/ipfilter/tools

2020-02-25 Thread Cy Schubert
Author: cy
Date: Tue Feb 25 21:02:52 2020
New Revision: 358321
URL: https://svnweb.freebsd.org/changeset/base/358321

Log:
  MFC r358064:
  
  As with ipf(8), give ippool(8) the ability to load IP pools from multiple
  files. This allows for loading, during the same invocation of ippool, of
  multiple sources of input using multiple tools to concurrently maintain the
  files such as fail2ban, macro preprocessors, and manually.

Modified:
  stable/11/contrib/ipfilter/man/ippool.8
  stable/11/contrib/ipfilter/tools/ippool.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/contrib/ipfilter/man/ippool.8
  stable/12/contrib/ipfilter/tools/ippool.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/contrib/ipfilter/man/ippool.8
==
--- stable/11/contrib/ipfilter/man/ippool.8 Tue Feb 25 19:29:05 2020
(r358320)
+++ stable/11/contrib/ipfilter/man/ippool.8 Tue Feb 25 21:02:52 2020
(r358321)
@@ -12,7 +12,7 @@ ippool \- user interface to the IPFilter pools
 -A [-dnv] [-m ] [-o ] [-S ] -t 
 .br
 .B ippool
--f  [-dnuv]
+-f  [-dnuv] [-f ] [-t ]

Modified: stable/11/contrib/ipfilter/tools/ippool.c
==
--- stable/11/contrib/ipfilter/tools/ippool.c   Tue Feb 25 19:29:05 2020
(r358320)
+++ stable/11/contrib/ipfilter/tools/ippool.c   Tue Feb 25 21:02:52 2020
(r358321)
@@ -377,12 +377,16 @@ loadpoolfile(argc, argv, infile)
 {
int c;
 
-   while ((c = getopt(argc, argv, "dnuv")) != -1)
+   while ((c = getopt(argc, argv, "dnuvf:")) != -1)
switch (c)
{
case 'd' :
opts |= OPT_DEBUG;
ippool_yydebug++;
+   break;
+   case 'f' :
+   if (loadpoolfile(argc, argv, optarg) != 0)
+   return(-1);
break;
case 'n' :
opts |= OPT_DONOTHING|OPT_DONTOPEN;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2020-02-25 Thread Ravi Pokala
-Original Message-
From:  on behalf of Gleb Smirnoff 

Date: 2020-02-25, Tuesday at 11:11
To: , , 

Subject: svn commit: r358317 - head/sys/kern

Author: glebius
Date: Tue Feb 25 19:11:20 2020
New Revision: 358317
URL: https://svnweb.freebsd.org/changeset/base/358317

Log:
  When sendfile_swapin() sweeps through pages in search for a bogus page
  skip first and last pages.  This is a micro optimisation.

Yes, but *why* skip the first and last pages?

-Ravi

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c

==
--- head/sys/kern/kern_sendfile.c   Tue Feb 25 19:04:39 2020
(r358316)
+++ head/sys/kern/kern_sendfile.c   Tue Feb 25 19:11:20 2020
(r358317)
@@ -462,7 +462,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, i
 * Restore the valid page pointers.  They are already
 * unbusied, but still wired.
 */
-   for (j = i; j < i + count; j++)
+   for (j = i + 1; j < i + count - 1; j++)
if (pa[j] == bogus_page) {
pa[j] = vm_page_lookup(obj,
OFF_TO_IDX(vmoff(j, off)));



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


svn commit: r358320 - head/sys/kern

2020-02-25 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 25 19:29:05 2020
New Revision: 358320
URL: https://svnweb.freebsd.org/changeset/base/358320

Log:
  Generalize resources freeing in sendfile with different scenarios.
  Now we execute sendfile_iodone() in all possible cases, which
  guarantees that vm_object_pip_wakeup() is called and sfio structure
  is freed.
  
  At the beginning of sendfile initialize sfio->m to NULL, that would
  indicate that the mbuf chain either doesn't exist, or belongs to the
  syscall (not to I/O completion).  Fill sfio->m only at a point when
  we are positive that there are I/Os ongoing and before releasing
  syscall's reference on sfio.
  
  In sendfile_iodone() perform vm_object_pip_wakeup() once last
  reference is released, then check for sfio->m.  NULL pointer
  indicates that we need only to free the memory.
  
  Reviewed by:  jtl, gallatin

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Tue Feb 25 19:26:40 2020
(r358319)
+++ head/sys/kern/kern_sendfile.c   Tue Feb 25 19:29:05 2020
(r358320)
@@ -258,7 +258,7 @@ static void
 sendfile_iodone(void *arg, vm_page_t *pg, int count, int error)
 {
struct sf_io *sfio = arg;
-   struct socket *so = sfio->so;
+   struct socket *so;
 
for (int i = 0; i < count; i++)
if (pg[i] != bogus_page)
@@ -272,12 +272,15 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i
 
vm_object_pip_wakeup(sfio->obj);
 
-   if (__predict_false(sfio->error && sfio->m == NULL)) {
+   if (sfio->m == NULL) {
/*
-* I/O operation failed, but pru_send hadn't been executed -
-* nothing had been sent to the socket.  The syscall has
-* returned error to the user.
+* Either I/O operation failed, or we failed to allocate
+* buffers, or we bailed out on first busy page, or we
+* succeeded filling the request without any I/Os. Anyway,
+* pru_send hadn't been executed - nothing had been sent
+* to the socket yet.
 */
+   MPASS((curthread->td_pflags & TDP_KTHREAD) == 0);
free(sfio, M_TEMP);
return;
}
@@ -291,6 +294,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i
KASSERT(sfio->tls == NULL,
("non-ext_pgs mbuf with TLS session"));
 #endif
+   so = sfio->so;
CURVNET_SET(so->so_vnet);
if (__predict_false(sfio->error)) {
/*
@@ -663,7 +667,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h
for (off = offset; rem > 0; ) {
struct sf_io *sfio;
vm_page_t *pa;
-   struct mbuf *mtail;
+   struct mbuf *m0, *mtail;
int nios, space, npages, rhpages;
 
mtail = NULL;
@@ -819,11 +823,9 @@ retry_space:
sfio = malloc(sizeof(struct sf_io) +
npages * sizeof(vm_page_t), M_TEMP, M_WAITOK);
refcount_init(>nios, 1);
-   sfio->so = so;
sfio->obj = obj;
sfio->error = 0;
-   vm_object_pip_add(obj, 1);
-
+   sfio->m = NULL;
 #ifdef KERN_TLS
/*
 * This doesn't use ktls_hold() because sfio->m will
@@ -832,13 +834,12 @@ retry_space:
 */
sfio->tls = tls;
 #endif
-
+   vm_object_pip_add(obj, 1);
error = sendfile_swapin(obj, sfio, , off, space, npages,
rhpages, flags);
if (error != 0) {
if (vp != NULL)
VOP_UNLOCK(vp);
-   sfio->m = NULL;
sendfile_iodone(sfio, NULL, 0, error);
goto done;
}
@@ -876,8 +877,6 @@ retry_space:
}
 
for (int i = 0; i < npages; i++) {
-   struct mbuf *m0;
-
/*
 * If a page wasn't grabbed successfully, then
 * trim the array. Can happen only with SF_NODISKIO.
@@ -922,8 +921,6 @@ retry_space:
mtx_unlock(>mtx);
}
ext_pgs = m0->m_ext.ext_pgs;
-   if (i == 0)
-   sfio->m = m0;
ext_pgs_idx = 0;
 
/* Append to mbuf chain. */
@@ -1006,9 +1003,6 @@ retry_space:
(vmoff(i, off) & PAGE_MASK);
m0->m_len = xfsize(i, npages, off, space);
 
- 

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

2020-02-25 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 25 19:26:40 2020
New Revision: 358319
URL: https://svnweb.freebsd.org/changeset/base/358319

Log:
  Make ktls_frame() never fail.  Caller must supply correct mbufs.
  This makes sendfile code a bit simplier.

Modified:
  head/sys/kern/kern_sendfile.c
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_socket.c
  head/sys/sys/ktls.h

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Tue Feb 25 19:12:40 2020
(r358318)
+++ head/sys/kern/kern_sendfile.c   Tue Feb 25 19:26:40 2020
(r358319)
@@ -1046,12 +1046,8 @@ prepend_header:
 
CURVNET_SET(so->so_vnet);
 #ifdef KERN_TLS
-   if (tls != NULL) {
-   error = ktls_frame(m, tls, _enq_cnt,
-   TLS_RLTYPE_APP);
-   if (error != 0)
-   goto done;
-   }
+   if (tls != NULL)
+   ktls_frame(m, tls, _enq_cnt, TLS_RLTYPE_APP);
 #endif
if (nios == 0) {
/*

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Tue Feb 25 19:12:40 2020(r358318)
+++ head/sys/kern/uipc_ktls.c   Tue Feb 25 19:26:40 2020(r358319)
@@ -1231,7 +1231,7 @@ ktls_seq(struct sockbuf *sb, struct mbuf *m)
  * encryption.  The returned value should be passed to ktls_enqueue
  * when scheduling encryption of this chain of mbufs.
  */
-int
+void
 ktls_frame(struct mbuf *top, struct ktls_session *tls, int *enq_cnt,
 uint8_t record_type)
 {
@@ -1250,10 +1250,8 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls,
 * records whose payload does not exceed the maximum
 * frame length.
 */
-   if (m->m_len > maxlen || m->m_len == 0)
-   return (EINVAL);
-   tls_len = m->m_len;
-
+   KASSERT(m->m_len <= maxlen && m->m_len > 0,
+   ("ktls_frame: m %p len %d\n", m, m->m_len));
/*
 * TLS frames require unmapped mbufs to store session
 * info.
@@ -1261,6 +1259,7 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls,
KASSERT((m->m_flags & M_NOMAP) != 0,
("ktls_frame: mapped mbuf %p (top = %p)\n", m, top));
 
+   tls_len = m->m_len;
pgs = m->m_ext.ext_pgs;
 
/* Save a reference to the session. */
@@ -1346,7 +1345,6 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls,
*enq_cnt += pgs->npgs;
}
}
-   return (0);
 }
 
 void

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Tue Feb 25 19:12:40 2020(r358318)
+++ head/sys/kern/uipc_socket.c Tue Feb 25 19:26:40 2020(r358319)
@@ -1591,12 +1591,8 @@ restart:
M_NOMAP |
((flags & MSG_EOR) ? M_EOR : 0));
if (top != NULL) {
-   error = ktls_frame(top, tls,
+   ktls_frame(top, tls,
_enq_cnt, tls_rtype);
-   if (error) {
-   m_freem(top);
-   goto release;
-   }
}
tls_rtype = TLS_RLTYPE_APP;
} else

Modified: head/sys/sys/ktls.h
==
--- head/sys/sys/ktls.h Tue Feb 25 19:12:40 2020(r358318)
+++ head/sys/sys/ktls.h Tue Feb 25 19:26:40 2020(r358319)
@@ -177,7 +177,7 @@ int ktls_crypto_backend_register(struct ktls_crypto_ba
 int ktls_crypto_backend_deregister(struct ktls_crypto_backend *be);
 int ktls_enable_tx(struct socket *so, struct tls_enable *en);
 void ktls_destroy(struct ktls_session *tls);
-int ktls_frame(struct mbuf *m, struct ktls_session *tls, int *enqueue_cnt,
+void ktls_frame(struct mbuf *m, struct ktls_session *tls, int *enqueue_cnt,
 uint8_t record_type);
 void ktls_seq(struct sockbuf *sb, struct mbuf *m);
 void ktls_enqueue(struct mbuf *m, struct socket *so, int page_count);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358318 - head/sys/sys

2020-02-25 Thread Pawel Biernacki
Author: kaktus
Date: Tue Feb 25 19:12:40 2020
New Revision: 358318
URL: https://svnweb.freebsd.org/changeset/base/358318

Log:
  SYSCTL_ROOT_NODE should use the SYSCTL_ENFORCE_FLAGS macro too.
  
  Approved by:  kib (mentor, blanket)

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Tue Feb 25 19:11:20 2020(r358317)
+++ head/sys/sys/sysctl.h   Tue Feb 25 19:12:40 2020(r358318)
@@ -324,6 +324,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
SYSCTL_OID_RAW(sysctl___##name, __children,  \
nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \
handler, "N", descr, NULL); \
+   SYSCTL_ENFORCE_FLAGS(access);   \
CTASSERT(((access) & CTLTYPE) == 0 ||   \
((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358317 - head/sys/kern

2020-02-25 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 25 19:11:20 2020
New Revision: 358317
URL: https://svnweb.freebsd.org/changeset/base/358317

Log:
  When sendfile_swapin() sweeps through pages in search for a bogus page
  skip first and last pages.  This is a micro optimisation.

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Tue Feb 25 19:04:39 2020
(r358316)
+++ head/sys/kern/kern_sendfile.c   Tue Feb 25 19:11:20 2020
(r358317)
@@ -462,7 +462,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, i
 * Restore the valid page pointers.  They are already
 * unbusied, but still wired.
 */
-   for (j = i; j < i + count; j++)
+   for (j = i + 1; j < i + count - 1; j++)
if (pa[j] == bogus_page) {
pa[j] = vm_page_lookup(obj,
OFF_TO_IDX(vmoff(j, off)));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358316 - in head/sys: dev/xen/balloon dev/xen/blkfront dev/xen/netback dev/xen/xenstore xen/xenbus

2020-02-25 Thread Pawel Biernacki
Author: kaktus
Date: Tue Feb 25 19:04:39 2020
New Revision: 358316
URL: https://svnweb.freebsd.org/changeset/base/358316

Log:
  Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (16 of many)
  
  r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
  still not MPSAFE (or already are but aren’t properly marked).
  Use it in preparation for a general review of all nodes.
  
  This is non-functional change that adds annotations to SYSCTL_NODE and
  SYSCTL_PROC nodes using one of the soon-to-be-required flags.
  
  Mark all obvious cases as MPSAFE.
  
  Reviewed by:  royger
  Approved by:  kib (mentor, blanket)
  Differential Revision:https://reviews.freebsd.org/D23638

Modified:
  head/sys/dev/xen/balloon/balloon.c
  head/sys/dev/xen/blkfront/blkfront.c
  head/sys/dev/xen/netback/netback.c
  head/sys/dev/xen/xenstore/xenstore.c
  head/sys/xen/xenbus/xenbusb.c

Modified: head/sys/dev/xen/balloon/balloon.c
==
--- head/sys/dev/xen/balloon/balloon.c  Tue Feb 25 17:26:10 2020
(r358315)
+++ head/sys/dev/xen/balloon/balloon.c  Tue Feb 25 19:04:39 2020
(r358316)
@@ -79,7 +79,9 @@ static struct balloon_stats balloon_stats;
 #define bs balloon_stats
 
 SYSCTL_DECL(_dev_xen);
-static SYSCTL_NODE(_dev_xen, OID_AUTO, balloon, CTLFLAG_RD, NULL, "Balloon");
+static SYSCTL_NODE(_dev_xen, OID_AUTO, balloon,
+CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
+"Balloon");
 SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, current, CTLFLAG_RD,
 _pages, 0, "Current allocation");
 SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, target, CTLFLAG_RD,

Modified: head/sys/dev/xen/blkfront/blkfront.c
==
--- head/sys/dev/xen/blkfront/blkfront.cTue Feb 25 17:26:10 2020
(r358315)
+++ head/sys/dev/xen/blkfront/blkfront.cTue Feb 25 19:04:39 2020
(r358316)
@@ -83,7 +83,8 @@ static void xbd_startio(struct xbd_softc *sc);
 static MALLOC_DEFINE(M_XENBLOCKFRONT, "xbd", "Xen Block Front driver data");
 
 static int xbd_enable_indirect = 1;
-SYSCTL_NODE(_hw, OID_AUTO, xbd, CTLFLAG_RD, 0, "xbd driver parameters");
+SYSCTL_NODE(_hw, OID_AUTO, xbd, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
+"xbd driver parameters");
 SYSCTL_INT(_hw_xbd, OID_AUTO, xbd_enable_indirect, CTLFLAG_RDTUN,
 _enable_indirect, 0, "Enable xbd indirect segments");
 
@@ -926,8 +927,8 @@ xbd_setup_sysctl(struct xbd_softc *xbd)
"communication channel pages (negotiated)");
 
SYSCTL_ADD_PROC(sysctl_ctx, children, OID_AUTO,
-   "features", CTLTYPE_STRING|CTLFLAG_RD, xbd, 0,
-   xbd_sysctl_features, "A", "protocol features (negotiated)");
+   "features", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, xbd,
+   0, xbd_sysctl_features, "A", "protocol features (negotiated)");
 }
 
 /*

Modified: head/sys/dev/xen/netback/netback.c
==
--- head/sys/dev/xen/netback/netback.c  Tue Feb 25 17:26:10 2020
(r358315)
+++ head/sys/dev/xen/netback/netback.c  Tue Feb 25 19:04:39 2020
(r358316)
@@ -1157,7 +1157,7 @@ xnb_setup_sysctl(struct xnb_softc *xnb)
SYSCTL_CHILDREN(sysctl_tree),
OID_AUTO,
"unit_test_results",
-   CTLTYPE_STRING | CTLFLAG_RD,
+   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
xnb,
0,
xnb_unit_test_main,
@@ -1168,7 +1168,7 @@ xnb_setup_sysctl(struct xnb_softc *xnb)
SYSCTL_CHILDREN(sysctl_tree),
OID_AUTO,
"dump_rings",
-   CTLTYPE_STRING | CTLFLAG_RD,
+   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
xnb,
0,
xnb_dump_rings,

Modified: head/sys/dev/xen/xenstore/xenstore.c
==
--- head/sys/dev/xen/xenstore/xenstore.cTue Feb 25 17:26:10 2020
(r358315)
+++ head/sys/dev/xen/xenstore/xenstore.cTue Feb 25 19:04:39 2020
(r358316)
@@ -1241,7 +1241,8 @@ DRIVER_MODULE(xenstore, xenpv, xenstore_driver, xensto
 
 /*--- Sysctl Data 
*/
 /* XXX Shouldn't the node be somewhere else? */
-SYSCTL_NODE(_dev, OID_AUTO, xen, CTLFLAG_RD, NULL, "Xen");
+SYSCTL_NODE(_dev, OID_AUTO, xen, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
+"Xen");
 SYSCTL_INT(_dev_xen, OID_AUTO, xsd_port, CTLFLAG_RD, , 0, "");
 SYSCTL_ULONG(_dev_xen, OID_AUTO, xsd_kva, CTLFLAG_RD, (u_long *) _store, 
0, "");
 

Modified: head/sys/xen/xenbus/xenbusb.c
==
--- 

svn commit: r358315 - in head/sys: amd64/amd64 dev/cpuctl i386/i386 x86/acpica x86/include x86/x86

2020-02-25 Thread Konstantin Belousov
Author: kib
Date: Tue Feb 25 17:26:10 2020
New Revision: 358315
URL: https://svnweb.freebsd.org/changeset/base/358315

Log:
  Fix IBRS for machines with IBRS_ALL capability.
  
  When turning IBRS mitigation using sysctl, as opposed to loader tunable,
  send IPI to tweak MSR on all cores.  Right now code only performed MSR write
  onr the CPU where sysctl was run.
  
  Properly report hw.ibrs_active for IBRS_ALL.  Split hw_ibrs_ibpb_active out
  from ibrs_active, to keep the current semantic of guiding kernel entry and
  exit handlers.
  
  Reported and tested by:   mav
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/initcpu.c
  head/sys/amd64/amd64/support.S
  head/sys/dev/cpuctl/cpuctl.c
  head/sys/i386/i386/support.s
  head/sys/x86/acpica/acpi_wakeup.c
  head/sys/x86/include/x86_var.h
  head/sys/x86/x86/cpu_machdep.c

Modified: head/sys/amd64/amd64/initcpu.c
==
--- head/sys/amd64/amd64/initcpu.c  Tue Feb 25 17:18:59 2020
(r358314)
+++ head/sys/amd64/amd64/initcpu.c  Tue Feb 25 17:26:10 2020
(r358315)
@@ -255,7 +255,7 @@ initializecpu(void)
wrmsr(MSR_EFER, msr);
pg_nx = PG_NX;
}
-   hw_ibrs_recalculate();
+   hw_ibrs_recalculate(false);
hw_ssb_recalculate(false);
amd64_syscall_ret_flush_l1d_recalc();
switch (cpu_vendor_id) {

Modified: head/sys/amd64/amd64/support.S
==
--- head/sys/amd64/amd64/support.S  Tue Feb 25 17:18:59 2020
(r358314)
+++ head/sys/amd64/amd64/support.S  Tue Feb 25 17:26:10 2020
(r358315)
@@ -1632,7 +1632,7 @@ handle_ibrs_\l:
 
 /* all callers already saved %rax, %rdx, and %rcx */
 ENTRY(handle_ibrs_entry)
-   cmpb$0,hw_ibrs_active(%rip)
+   cmpb$0,hw_ibrs_ibpb_active(%rip)
je  1f
movl$MSR_IA32_SPEC_CTRL,%ecx
rdmsr

Modified: head/sys/dev/cpuctl/cpuctl.c
==
--- head/sys/dev/cpuctl/cpuctl.cTue Feb 25 17:18:59 2020
(r358314)
+++ head/sys/dev/cpuctl/cpuctl.cTue Feb 25 17:26:10 2020
(r358315)
@@ -538,8 +538,8 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td
set_cpu(cpu, td);
identify_cpu1();
identify_cpu2();
-   hw_ibrs_recalculate();
restore_cpu(oldcpu, is_bound, td);
+   hw_ibrs_recalculate(true);
hw_ssb_recalculate(true);
 #ifdef __amd64__
amd64_syscall_ret_flush_l1d_recalc();

Modified: head/sys/i386/i386/support.s
==
--- head/sys/i386/i386/support.sTue Feb 25 17:18:59 2020
(r358314)
+++ head/sys/i386/i386/support.sTue Feb 25 17:26:10 2020
(r358315)
@@ -446,7 +446,7 @@ msr_onfault:
ret
 
 ENTRY(handle_ibrs_entry)
-   cmpb$0,hw_ibrs_active
+   cmpb$0,hw_ibrs_ibpb_active
je  1f
movl$MSR_IA32_SPEC_CTRL,%ecx
rdmsr

Modified: head/sys/x86/acpica/acpi_wakeup.c
==
--- head/sys/x86/acpica/acpi_wakeup.c   Tue Feb 25 17:18:59 2020
(r358314)
+++ head/sys/x86/acpica/acpi_wakeup.c   Tue Feb 25 17:26:10 2020
(r358315)
@@ -244,7 +244,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
}
 #endif
 #ifdef __amd64__
-   hw_ibrs_active = 0;
+   hw_ibrs_ibpb_active = 0;
hw_ssb_active = 0;
cpu_stdext_feature3 = 0;
CPU_FOREACH(i) {

Modified: head/sys/x86/include/x86_var.h
==
--- head/sys/x86/include/x86_var.h  Tue Feb 25 17:18:59 2020
(r358314)
+++ head/sys/x86/include/x86_var.h  Tue Feb 25 17:26:10 2020
(r358315)
@@ -90,7 +90,7 @@ externuint64_t xsave_mask;
 extern u_int   max_apic_id;
 extern int i386_read_exec;
 extern int pti;
-extern int hw_ibrs_active;
+extern int hw_ibrs_ibpb_active;
 extern int hw_mds_disable;
 extern int hw_ssb_active;
 extern int x86_taa_enable;
@@ -134,7 +134,7 @@ int is_physical_memory(vm_paddr_t addr);
 intisa_nmi(int cd);
 void   handle_ibrs_entry(void);
 void   handle_ibrs_exit(void);
-void   hw_ibrs_recalculate(void);
+void   hw_ibrs_recalculate(bool all_cpus);
 void   hw_mds_recalculate(void);
 void   hw_ssb_recalculate(bool all_cpus);
 void   x86_taa_recalculate(void);

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Tue Feb 25 17:18:59 2020
(r358314)
+++ head/sys/x86/x86/cpu_machdep.c  Tue Feb 25 17:26:10 2020
(r358315)
@@ 

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

2020-02-25 Thread Ed Maste
Author: emaste
Date: Tue Feb 25 17:18:59 2020
New Revision: 358314
URL: https://svnweb.freebsd.org/changeset/base/358314

Log:
  style.9: update C99 commentary
  
  Make style.9 read as a current statement of C99 preferences, rather than a
  description of ongoing changes to our preferred style.  Alsu use the short
  form "ISO C99" on the 2nd and later instances rather than repeating the
  unwieldy `ISO/IEC 9899:1999 ("ISO C99")` each time.
  
  Reviewed by:  cem, imp, jhb, kib
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D23648

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

Modified: head/share/man/man9/style.9
==
--- head/share/man/man9/style.9 Tue Feb 25 15:53:17 2020(r358313)
+++ head/share/man/man9/style.9 Tue Feb 25 17:18:59 2020(r358314)
@@ -301,11 +301,11 @@ is treated as
 #endif /* !COMPAT_43 */
 .Ed
 .Pp
-The project is slowly moving to use the
+The project prefers the use of
 .St -isoC-99
 unsigned integer identifiers of the form
 .Vt uintXX_t
-in preference to the older
+rather than the older
 .Bx Ns -style
 integer identifiers of the form
 .Vt u_intXX_t .
@@ -317,10 +317,10 @@ Like white-space commits, care should be taken in maki
 .Vt uintXX_t
 only commits.
 .Pp
-Similarly, the project is slowly moving to use the
-.St -isoC-99
+Similarly, the project prefers the use of
+ISO C99
 .Vt bool
-in preference to the older
+rather than the older
 .Vt int
 or
 .Vt boolean_t .
@@ -341,8 +341,8 @@ Userspace code should include
 while kernel code should include
 .In sys/types.h .
 .Pp
-Likewise, the project is moving to using the
-.St -isoC-99
+Likewise, the project prefers
+ISO C99
 designated initializers when it makes sense to do so.
 .Pp
 Enumeration values are all uppercase.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358312 - in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2020-02-25 Thread Alexander Motin
Author: mav
Date: Tue Feb 25 15:52:35 2020
New Revision: 358312
URL: https://svnweb.freebsd.org/changeset/base/358312

Log:
  MFC r349381: Avoid extra taskq_dispatch() calls by DMU.
  
  DMU sync code calls taskq_dispatch() for each sublist of os_dirty_dnodes
  and os_synced_dnodes.  Since the number of sublists by default is equal
  to number of CPUs, it will dispatch equal, potentially large, number of
  tasks, waking up many CPUs to handle them, even if only one or few of
  sublists actually have any work to do.
  
  This change adds check for empty sublists to avoid this.

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c   
Tue Feb 25 15:03:41 2020(r358311)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c   
Tue Feb 25 15:52:35 2020(r358312)
@@ -1353,6 +1353,8 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx
zio_t *zio;
list_t *list;
dbuf_dirty_record_t *dr;
+   int num_sublists;
+   multilist_t *ml;
blkptr_t *blkptr_copy = kmem_alloc(sizeof (*os->os_rootbp), KM_SLEEP);
*blkptr_copy = *os->os_rootbp;
 
@@ -1421,10 +1423,13 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx
}
}
 
-   for (int i = 0;
-   i < multilist_get_num_sublists(os->os_dirty_dnodes[txgoff]); i++) {
+   ml = os->os_dirty_dnodes[txgoff];
+   num_sublists = multilist_get_num_sublists(ml);
+   for (int i = 0; i < num_sublists; i++) {
+   if (multilist_sublist_is_empty_idx(ml, i))
+   continue;
sync_dnodes_arg_t *sda = kmem_alloc(sizeof (*sda), KM_SLEEP);
-   sda->sda_list = os->os_dirty_dnodes[txgoff];
+   sda->sda_list = ml;
sda->sda_sublist_idx = i;
sda->sda_tx = tx;
(void) taskq_dispatch(dmu_objset_pool(os)->dp_sync_taskq,
@@ -1640,6 +1645,8 @@ userquota_updates_task(void *arg)
 void
 dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx)
 {
+   int num_sublists;
+
if (!dmu_objset_userused_enabled(os))
return;
 
@@ -1653,8 +1660,10 @@ dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t
DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx));
}
 
-   for (int i = 0;
-   i < multilist_get_num_sublists(os->os_synced_dnodes); i++) {
+   num_sublists = multilist_get_num_sublists(os->os_synced_dnodes);
+   for (int i = 0; i < num_sublists; i++) {
+   if (multilist_sublist_is_empty_idx(os->os_synced_dnodes, i))
+   continue;
userquota_updates_arg_t *uua =
kmem_alloc(sizeof (*uua), KM_SLEEP);
uua->uua_os = os;

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c
Tue Feb 25 15:03:41 2020(r358311)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c
Tue Feb 25 15:52:35 2020(r358312)
@@ -360,6 +360,28 @@ multilist_sublist_remove(multilist_sublist_t *mls, voi
list_remove(>mls_list, obj);
 }
 
+int
+multilist_sublist_is_empty(multilist_sublist_t *mls)
+{
+   ASSERT(MUTEX_HELD(>mls_lock));
+   return (list_is_empty(>mls_list));
+}
+
+int
+multilist_sublist_is_empty_idx(multilist_t *ml, unsigned int sublist_idx)
+{
+   multilist_sublist_t *mls;
+   int empty;
+
+   ASSERT3U(sublist_idx, <, ml->ml_num_sublists);
+   mls = >ml_sublists[sublist_idx];
+   ASSERT(!MUTEX_HELD(>mls_lock));
+   mutex_enter(>mls_lock);
+   empty = list_is_empty(>mls_list);
+   mutex_exit(>mls_lock);
+   return (empty);
+}
+
 void *
 multilist_sublist_head(multilist_sublist_t *mls)
 {

Modified: 
stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h
Tue Feb 25 15:03:41 2020(r358311)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h
Tue Feb 25 15:52:35 2020(r358312)
@@ -89,6 +89,8 @@ void multilist_sublist_insert_head(multilist_sublist_t
 void multilist_sublist_insert_tail(multilist_sublist_t *, void *);
 void multilist_sublist_move_forward(multilist_sublist_t *mls, void *obj);
 void 

svn commit: r358313 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2020-02-25 Thread Alexander Motin
Author: mav
Date: Tue Feb 25 15:53:17 2020
New Revision: 358313
URL: https://svnweb.freebsd.org/changeset/base/358313

Log:
  MFC r349381: Avoid extra taskq_dispatch() calls by DMU.
  
  DMU sync code calls taskq_dispatch() for each sublist of os_dirty_dnodes
  and os_synced_dnodes.  Since the number of sublists by default is equal
  to number of CPUs, it will dispatch equal, potentially large, number of
  tasks, waking up many CPUs to handle them, even if only one or few of
  sublists actually have any work to do.
  
  This change adds check for empty sublists to avoid this.

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c   
Tue Feb 25 15:52:35 2020(r358312)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c   
Tue Feb 25 15:53:17 2020(r358313)
@@ -1294,6 +1294,8 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx
zio_t *zio;
list_t *list;
dbuf_dirty_record_t *dr;
+   int num_sublists;
+   multilist_t *ml;
blkptr_t *blkptr_copy = kmem_alloc(sizeof (*os->os_rootbp), KM_SLEEP);
*blkptr_copy = *os->os_rootbp;
 
@@ -1362,10 +1364,13 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx
}
}
 
-   for (int i = 0;
-   i < multilist_get_num_sublists(os->os_dirty_dnodes[txgoff]); i++) {
+   ml = os->os_dirty_dnodes[txgoff];
+   num_sublists = multilist_get_num_sublists(ml);
+   for (int i = 0; i < num_sublists; i++) {
+   if (multilist_sublist_is_empty_idx(ml, i))
+   continue;
sync_dnodes_arg_t *sda = kmem_alloc(sizeof (*sda), KM_SLEEP);
-   sda->sda_list = os->os_dirty_dnodes[txgoff];
+   sda->sda_list = ml;
sda->sda_sublist_idx = i;
sda->sda_tx = tx;
(void) taskq_dispatch(dmu_objset_pool(os)->dp_sync_taskq,
@@ -1579,6 +1584,8 @@ userquota_updates_task(void *arg)
 void
 dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx)
 {
+   int num_sublists;
+
if (!dmu_objset_userused_enabled(os))
return;
 
@@ -1592,8 +1599,10 @@ dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t
DMU_OT_USERGROUP_USED, DMU_OT_NONE, 0, tx));
}
 
-   for (int i = 0;
-   i < multilist_get_num_sublists(os->os_synced_dnodes); i++) {
+   num_sublists = multilist_get_num_sublists(os->os_synced_dnodes);
+   for (int i = 0; i < num_sublists; i++) {
+   if (multilist_sublist_is_empty_idx(os->os_synced_dnodes, i))
+   continue;
userquota_updates_arg_t *uua =
kmem_alloc(sizeof (*uua), KM_SLEEP);
uua->uua_os = os;

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c
Tue Feb 25 15:52:35 2020(r358312)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c
Tue Feb 25 15:53:17 2020(r358313)
@@ -360,6 +360,28 @@ multilist_sublist_remove(multilist_sublist_t *mls, voi
list_remove(>mls_list, obj);
 }
 
+int
+multilist_sublist_is_empty(multilist_sublist_t *mls)
+{
+   ASSERT(MUTEX_HELD(>mls_lock));
+   return (list_is_empty(>mls_list));
+}
+
+int
+multilist_sublist_is_empty_idx(multilist_t *ml, unsigned int sublist_idx)
+{
+   multilist_sublist_t *mls;
+   int empty;
+
+   ASSERT3U(sublist_idx, <, ml->ml_num_sublists);
+   mls = >ml_sublists[sublist_idx];
+   ASSERT(!MUTEX_HELD(>mls_lock));
+   mutex_enter(>mls_lock);
+   empty = list_is_empty(>mls_list);
+   mutex_exit(>mls_lock);
+   return (empty);
+}
+
 void *
 multilist_sublist_head(multilist_sublist_t *mls)
 {

Modified: 
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h
Tue Feb 25 15:52:35 2020(r358312)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h
Tue Feb 25 15:53:17 2020(r358313)
@@ -90,6 +90,8 @@ void multilist_sublist_insert_head(multilist_sublist_t
 void multilist_sublist_insert_tail(multilist_sublist_t *, void *);
 void multilist_sublist_move_forward(multilist_sublist_t *mls, void *obj);
 void 

svn commit: r358311 - head/sys/netinet6

2020-02-25 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Feb 25 15:03:41 2020
New Revision: 358311
URL: https://svnweb.freebsd.org/changeset/base/358311

Log:
  ip6_output: fix regression introduced in r358167 for ipv6 fragmentation
  
  When moving the calculations for the optlen into the if (opt) block
  which deals with possible extension headers I failed to initialise
  unfragpartlen to the ipv6 header length if there were no extension
  headers present.  Correct that mistake to make IPv6 fragment length
  calculcations work again.
  
  Reported by:  hselasky, kp
  OKed by:  hselasky, kp
  MFC after:3 days
  X-MFC with:   r358167
  PR:   244393

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Tue Feb 25 12:56:06 2020
(r358310)
+++ head/sys/netinet6/ip6_output.c  Tue Feb 25 15:03:41 2020
(r358311)
@@ -497,7 +497,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
 */
bzero(, sizeof(exthdrs));
optlen = 0;
-   unfragpartlen = 0;
+   unfragpartlen = sizeof(struct ip6_hdr);
if (opt) {
/* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, _hbh, optlen);
@@ -535,7 +535,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
/* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, _rthdr, optlen);
 
-   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+   unfragpartlen += optlen;
 
/*
 * NOTE: we don't add AH/ESP length here (done in
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r358167 - head/sys/netinet6

2020-02-25 Thread Bjoern A. Zeeb

On 25 Feb 2020, at 12:44, Kristof Provost wrote:

This change introduces a slight regression when a host replies to 
IPv6 ping fragmented packets. The problem is the "unfragpartlen" must 
also be set in the else case of "if (opt)", else the payload offset 
computation for IPv6 fragments goes wrong by the size of the IPv6 
header!



Confirmed, because the pf fragmentation:v6 test also fails on this.




Patch goes like this:


diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 06c57bcec48..a6c8d148833 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -459,7 +459,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,

 */
bzero(, sizeof(exthdrs));
optlen = 0;
-   unfragpartlen = 0;
if (opt) {
/* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, _hbh, 
optlen);
@@ -497,8 +496,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,

/* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, _rthdr, 
optlen);

-   unfragpartlen = optlen + sizeof(struct ip6_hdr);
-
/*
 * NOTE: we don't add AH/ESP length here (done in
 * ip6_ipsec_output()).
@@ -508,6 +505,8 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,
MAKE_EXTHDR(opt->ip6po_dest2, _dest2, 
optlen);

}
+   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+
/*
 * If there is at least one extension header,
 * separate IP6 header from the payload.



And with this patch the test passes again.


And fails for other packets.  The patch is wrong.

Offset gets changed after we set unfragpartlen inside the block so 
moving it outside the block unfragpartlen may point to the wrong thing.


Your tests are too simple to detect this problem.

Try this one please:

Index: ip6_output.c
===
--- ip6_output.c(revision 358297)
+++ ip6_output.c(working copy)
@@ -497,7 +497,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *op
 */
bzero(, sizeof(exthdrs));
optlen = 0;
-   unfragpartlen = 0;
+   unfragpartlen = sizeof(struct ip6_hdr);
if (opt) {
/* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, _hbh, optlen);
@@ -535,7 +535,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *op
/* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, _rthdr, 
optlen);


-   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+   unfragpartlen += optlen;

/*
 * NOTE: we don't add AH/ESP length here (done in


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


svn commit: r358310 - head/sys/dev/usb/input

2020-02-25 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Feb 25 12:56:06 2020
New Revision: 358310
URL: https://svnweb.freebsd.org/changeset/base/358310

Log:
  Use hid_get_data_unsigned() instead of hid_get_data() when reading the
  key-codes from the USB keyboard. Negative key-codes are currently skipped.
  
  While at it use the bit size value provided by the HID location structure
  instead of assuming a value of 8.
  
  This fixes a regression issue after r357861.
  
  Reported by:  Minoru TANABE 
  PR:   224592
  PR:   233884
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/input/ukbd.c

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Tue Feb 25 11:56:54 2020
(r358309)
+++ head/sys/dev/usb/input/ukbd.c   Tue Feb 25 12:56:06 2020
(r358310)
@@ -702,13 +702,15 @@ ukbd_intr_callback(struct usb_xfer *xfer, usb_error_t 
} else if (id != sc->sc_id_loc_key[i]) {
continue;   /* invalid HID ID */
} else if (i == 0) {
-   offset = sc->sc_loc_key[0].count;
-   if (offset < 0 || offset > len)
-   offset = len;
-   while (offset--) {
+   struct hid_location tmp_loc = sc->sc_loc_key[0];
+   /* range check array size */
+   if (tmp_loc.count > UKBD_NKEYCODE)
+   tmp_loc.count = UKBD_NKEYCODE;
+   while (tmp_loc.count--) {
uint32_t key =
-   hid_get_data(sc->sc_buffer + 
offset, len - offset,
-   >sc_loc_key[i]);
+   
hid_get_data_unsigned(sc->sc_buffer, len, _loc);
+   /* advance to next location */
+   tmp_loc.pos += tmp_loc.size;
if (modifiers & MOD_FN)
key = ukbd_apple_fn(key);
if (sc->sc_flags & UKBD_FLAG_APPLE_SWAP)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r358167 - head/sys/netinet6

2020-02-25 Thread Kristof Provost

On 24 Feb 2020, at 15:21, Hans Petter Selasky wrote:

On 2020-02-20 11:56, Bjoern A. Zeeb wrote:

+
+   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+


Hi Bjoren,

This change introduces a slight regression when a host replies to IPv6 
ping fragmented packets. The problem is the "unfragpartlen" must also 
be set in the else case of "if (opt)", else the payload offset 
computation for IPv6 fragments goes wrong by the size of the IPv6 
header!



Confirmed, because the pf fragmentation:v6 test also fails on this.


After r358167:


ping6 -s 3000 fe80::ee0d:9aff:fed4:2c8c%mce2
PING6(3048=40+8+3000 bytes) fe80::ee0d:9aff:fed4:2c94%mce2 --> 
fe80::ee0d:9aff:fed4:2c8c%mce2

^C
--- fe80::ee0d:9aff:fed4:2c8c%mce2 ping6 statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss


With the patch mentioned in the end of this e-mail:


ping6 -s 3000 fe80::ee0d:9aff:fed4:2c8c%mce2
PING6(3048=40+8+3000 bytes) fe80::ee0d:9aff:fed4:2c8c%mce2 --> 
fe80::ee0d:9aff:fed4:2c8c%mce2
3008 bytes from fe80::ee0d:9aff:fed4:2c8c%mce2, icmp_seq=0 hlim=64 
time=0.499 ms
3008 bytes from fe80::ee0d:9aff:fed4:2c8c%mce2, icmp_seq=1 hlim=64 
time=0.405 ms
3008 bytes from fe80::ee0d:9aff:fed4:2c8c%mce2, icmp_seq=2 hlim=64 
time=0.097 ms

^C
--- fe80::ee0d:9aff:fed4:2c8c%mce2 ping6 statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.097/0.334/0.499/0.172 ms


Patch goes like this:


diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 06c57bcec48..a6c8d148833 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -459,7 +459,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,

 */
bzero(, sizeof(exthdrs));
optlen = 0;
-   unfragpartlen = 0;
if (opt) {
/* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, _hbh, 
optlen);
@@ -497,8 +496,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,

/* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, _rthdr, 
optlen);

-   unfragpartlen = optlen + sizeof(struct ip6_hdr);
-
/*
 * NOTE: we don't add AH/ESP length here (done in
 * ip6_ipsec_output()).
@@ -508,6 +505,8 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,
MAKE_EXTHDR(opt->ip6po_dest2, _dest2, 
optlen);

}
+   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+
/*
 * If there is at least one extension header,
 * separate IP6 header from the payload.



And with this patch the test passes again.

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


svn commit: r358309 - head/tests/sys/netpfil/pf

2020-02-25 Thread Li-Wen Hsu
Author: lwhsu
Date: Tue Feb 25 11:56:54 2020
New Revision: 358309
URL: https://svnweb.freebsd.org/changeset/base/358309

Log:
  Temporarily skip failing test case sys.netpfil.pf.fragmentation.v6
  
  PR:   244393
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/netpfil/pf/fragmentation.sh

Modified: head/tests/sys/netpfil/pf/fragmentation.sh
==
--- head/tests/sys/netpfil/pf/fragmentation.sh  Tue Feb 25 04:27:23 2020
(r358308)
+++ head/tests/sys/netpfil/pf/fragmentation.sh  Tue Feb 25 11:56:54 2020
(r358309)
@@ -80,6 +80,10 @@ v6_head()
 
 v6_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/244393;
+   fi
+
pft_init
 
epair_send=$(vnet_mkepair)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"