svn commit: r357610 - head/sys/vm

2020-02-06 Thread Ryan Libby
Author: rlibby
Date: Thu Feb  6 08:32:25 2020
New Revision: 357610
URL: https://svnweb.freebsd.org/changeset/base/357610

Log:
  uma: remove UMA_ZFLAG_CACHEONLY flag
  
  UMA_ZFLAG_CACHEONLY was essentially the same thing as UMA_ZONE_VM, but
  with a more confusing name.  Remove the flag, make UMA_ZONE_VM an
  inherit flag, and replace all references.
  
  Reviewed by:  markj
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D23516

Modified:
  head/sys/vm/uma.h
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h

Modified: head/sys/vm/uma.h
==
--- head/sys/vm/uma.h   Thu Feb  6 07:47:28 2020(r357609)
+++ head/sys/vm/uma.h   Thu Feb  6 08:32:25 2020(r357610)
@@ -288,8 +288,8 @@ uma_zone_t uma_zcache_create(char *name, int size, uma
  */
 #defineUMA_ZONE_INHERIT
\
 (UMA_ZONE_NOTOUCH | UMA_ZONE_MALLOC | UMA_ZONE_NOFREE |\
- UMA_ZONE_NOTPAGE | UMA_ZONE_PCPU | UMA_ZONE_FIRSTTOUCH |  \
- UMA_ZONE_ROUNDROBIN)
+ UMA_ZONE_VM | UMA_ZONE_NOTPAGE | UMA_ZONE_PCPU |  \
+ UMA_ZONE_FIRSTTOUCH | UMA_ZONE_ROUNDROBIN)
 
 /* Definitions for align */
 #define UMA_ALIGN_PTR  (sizeof(void *) - 1)/* Alignment fit for ptr */

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Thu Feb  6 07:47:28 2020(r357609)
+++ head/sys/vm/uma_core.c  Thu Feb  6 08:32:25 2020(r357610)
@@ -493,7 +493,7 @@ bucket_alloc(uma_zone_t zone, void *udata, int flags)
return (NULL);
udata = (void *)((uintptr_t)udata | UMA_ZFLAG_BUCKET);
}
-   if ((uintptr_t)udata & UMA_ZFLAG_CACHEONLY)
+   if (((uintptr_t)udata & UMA_ZONE_VM) != 0)
flags |= M_NOVM;
ubz = bucket_zone_lookup(zone->uz_bucket_size);
if (ubz->ubz_zone == zone && (ubz + 1)->ubz_entries != 0)
@@ -1897,8 +1897,7 @@ keg_layout(uma_keg_t keg)
("%s: cannot configure for PCPU: keg=%s, size=%u, flags=0x%b",
 __func__, keg->uk_name, keg->uk_size, keg->uk_flags,
 PRINT_UMA_ZFLAGS));
-   KASSERT((keg->uk_flags &
-   (UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY)) == 0 ||
+   KASSERT((keg->uk_flags & (UMA_ZFLAG_INTERNAL | UMA_ZONE_VM)) == 0 ||
(keg->uk_flags & (UMA_ZONE_NOTOUCH | UMA_ZONE_PCPU)) == 0,
("%s: incompatible flags 0x%b", __func__, keg->uk_flags,
 PRINT_UMA_ZFLAGS));
@@ -1947,16 +1946,16 @@ keg_layout(uma_keg_t keg)
/*
 * We can't do OFFPAGE if we're internal or if we've been
 * asked to not go to the VM for buckets.  If we do this we
-* may end up going to the VM  for slabs which we do not
-* want to do if we're UMA_ZFLAG_CACHEONLY as a result
-* of UMA_ZONE_VM, which clearly forbids it.  In those cases,
-* evaluate a pseudo-format called INTERNAL which has an inline
-* slab header and one extra page to guarantee that it fits.
+* may end up going to the VM for slabs which we do not want
+* to do if we're UMA_ZONE_VM, which clearly forbids it.
+* In those cases, evaluate a pseudo-format called INTERNAL
+* which has an inline slab header and one extra page to
+* guarantee that it fits.
 *
 * Otherwise, see if using an OFFPAGE slab will improve our
 * efficiency.
 */
-   if ((keg->uk_flags & (UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY)) != 0)
+   if ((keg->uk_flags & (UMA_ZFLAG_INTERNAL | UMA_ZONE_VM)) != 0)
fmts[nfmt++] = UMA_ZFLAG_INTERNAL;
else
fmts[nfmt++] = UMA_ZFLAG_OFFPAGE;
@@ -2073,9 +2072,6 @@ keg_ctor(void *mem, int size, void *udata, int flags)
zone = arg->zone;
keg->uk_name = zone->uz_name;
 
-   if (arg->flags & UMA_ZONE_VM)
-   keg->uk_flags |= UMA_ZFLAG_CACHEONLY;
-
if (arg->flags & UMA_ZONE_ZINIT)
keg->uk_init = zero_init;
 
@@ -2461,8 +2457,6 @@ zone_ctor(void *mem, int size, void *udata, int flags)
if (arg->import) {
KASSERT((arg->flags & UMA_ZFLAG_CACHE) != 0,
("zone_ctor: Import specified for non-cache zone."));
-   if (arg->flags & UMA_ZONE_VM)
-   arg->flags |= UMA_ZFLAG_CACHEONLY;
zone->uz_flags = arg->flags;
zone->uz_size = arg->size;
zone->uz_import = arg->import;

Modified: head/sys/vm/uma_int.h
==
--- head/sys/vm/uma_int.h   Thu Feb  6 07:47:28 2020(r357609)
+++ head/sys/vm/uma_int.h   Thu Feb  6 08:32:25 2020(r357610)
@@ -166,14 +166,12 @@
 #defineUMA_ZFLAG_BUCKET0x1000 

svn commit: r357611 - head/libexec/rc/rc.d

2020-02-06 Thread Ryan Libby
Author: rlibby
Date: Thu Feb  6 08:32:30 2020
New Revision: 357611
URL: https://svnweb.freebsd.org/changeset/base/357611

Log:
  auditd_stop: wait_for_pids instead of sleeping
  
  It's faster and more reliable to wait_for_pids than to sleep 1.
  
  cem@ suggested just to remove auditd_stop() and use the rc.subr default
  stop action (SIGTERM instead of audit -t), which has a built-in
  wait_for_pids.  That may be a better solution.
  
  Discussed with:   cem
  Reviewed by:  asomers
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D23223

Modified:
  head/libexec/rc/rc.d/auditd

Modified: head/libexec/rc/rc.d/auditd
==
--- head/libexec/rc/rc.d/auditd Thu Feb  6 08:32:25 2020(r357610)
+++ head/libexec/rc/rc.d/auditd Thu Feb  6 08:32:30 2020(r357611)
@@ -26,7 +26,9 @@ auditd_stop()
 {
 
/usr/sbin/audit -t
-   sleep 1
+   if [ -n "$rc_pid" ]; then
+   wait_for_pids $rc_pid
+   fi
 }
 
 load_rc_config $name
___
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: r357614 - in head/sys: kern sys

2020-02-06 Thread Pawel Biernacki
Author: kaktus
Date: Thu Feb  6 12:45:58 2020
New Revision: 357614
URL: https://svnweb.freebsd.org/changeset/base/357614

Log:
  sysctl(9): add CTLFLAG_NEEDGIANT flag
  
  Add CTLFLAG_NEEDGIANT flag (modelled after D_NEEDGIANT) that will be used to
  mark sysctls that still require locking Giant.
  
  Rewrite sysctl_handle_string() to use internal locking instead of locking
  Giant.
  
  Mark SYSCTL_STRING, SYSCTL_OPAQUE and their variants as MPSAFE.
  
  Add infrastructure support for enforcing proper use of CTLFLAG_NEEDGIANT
  and CTLFLAG_MPSAFE flags with SYSCTL_PROC and SYSCTL_NODE, not enabled yet.
  
  Reviewed by:  kib (mentor)
  Approved by:  kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D23378

Modified:
  head/sys/kern/kern_sysctl.c
  head/sys/sys/sysctl.h

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Thu Feb  6 10:11:41 2020(r357613)
+++ head/sys/kern/kern_sysctl.c Thu Feb  6 12:45:58 2020(r357614)
@@ -96,9 +96,13 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysctltmp", "sysctl
  * The sysctlmemlock is used to limit the amount of user memory wired for
  * sysctl requests.  This is implemented by serializing any userland
  * sysctl requests larger than a single page via an exclusive lock.
+ *
+ * The sysctlstringlock is used to protect concurrent access to writable
+ * string nodes in sysctl_handle_string().
  */
 static struct rmlock sysctllock;
 static struct sx __exclusive_cache_line sysctlmemlock;
+static struct sx sysctlstringlock;
 
 #defineSYSCTL_WLOCK()  rm_wlock(&sysctllock)
 #defineSYSCTL_WUNLOCK()rm_wunlock(&sysctllock)
@@ -170,10 +174,16 @@ sysctl_root_handler_locked(struct sysctl_oid *oid, voi
else
SYSCTL_WUNLOCK();
 
-   if (!(oid->oid_kind & CTLFLAG_MPSAFE))
+   /*
+* Treat set CTLFLAG_NEEDGIANT and unset CTLFLAG_MPSAFE flags the same,
+* untill we're ready to remove all traces of Giant from sysctl(9).
+*/
+   if ((oid->oid_kind & CTLFLAG_NEEDGIANT) ||
+   (!(oid->oid_kind & CTLFLAG_MPSAFE)))
mtx_lock(&Giant);
error = oid->oid_handler(oid, arg1, arg2, req);
-   if (!(oid->oid_kind & CTLFLAG_MPSAFE))
+   if ((oid->oid_kind & CTLFLAG_NEEDGIANT) ||
+   (!(oid->oid_kind & CTLFLAG_MPSAFE)))
mtx_unlock(&Giant);
 
KFAIL_POINT_ERROR(_debug_fail_point, sysctl_running, error);
@@ -917,6 +927,7 @@ sysctl_register_all(void *arg)
struct sysctl_oid **oidp;
 
sx_init(&sysctlmemlock, "sysctl mem");
+   sx_init(&sysctlstringlock, "sysctl string handler");
SYSCTL_INIT();
SYSCTL_WLOCK();
SET_FOREACH(oidp, sysctl_set)
@@ -1632,48 +1643,69 @@ sysctl_handle_64(SYSCTL_HANDLER_ARGS)
 int
 sysctl_handle_string(SYSCTL_HANDLER_ARGS)
 {
+   char *tmparg;
size_t outlen;
int error = 0, ro_string = 0;
 
/*
+* If the sysctl isn't writable, microoptimise and treat it as a
+* const string.
 * A zero-length buffer indicates a fixed size read-only
 * string.  In ddb, don't worry about trying to make a malloced
 * snapshot.
 */
-   if (arg2 == 0 || kdb_active) {
+   if (!(oidp->oid_kind & CTLFLAG_WR) || arg2 == 0 || kdb_active) {
arg2 = strlen((char *)arg1) + 1;
ro_string = 1;
}
 
if (req->oldptr != NULL) {
-   char *tmparg;
-
if (ro_string) {
tmparg = arg1;
+   outlen = strlen(tmparg) + 1;
} else {
-   /* try to make a coherent snapshot of the string */
tmparg = malloc(arg2, M_SYSCTLTMP, M_WAITOK);
+   sx_slock(&sysctlstringlock);
memcpy(tmparg, arg1, arg2);
+   sx_sunlock(&sysctlstringlock);
+   outlen = strlen(tmparg) + 1;
}
 
-   outlen = strnlen(tmparg, arg2 - 1) + 1;
error = SYSCTL_OUT(req, tmparg, outlen);
 
if (!ro_string)
free(tmparg, M_SYSCTLTMP);
} else {
-   outlen = strnlen((char *)arg1, arg2 - 1) + 1;
+   if (!ro_string)
+   sx_slock(&sysctlstringlock);
+   outlen = strlen((char *)arg1) + 1;
+   if (!ro_string)
+   sx_sunlock(&sysctlstringlock);
error = SYSCTL_OUT(req, NULL, outlen);
}
if (error || !req->newptr)
return (error);
 
-   if ((req->newlen - req->newidx) >= arg2) {
+   if (req->newlen - req->newidx >= arg2 ||
+   req->newlen - req->newidx <= 0) {
error = EINVAL;
} else {
-   arg2 = (req->newlen - req->newidx);
-   error = SY

svn commit: r357615 - in head: lib/libkvm sys/sys

2020-02-06 Thread Leandro Lupori
Author: luporl
Date: Thu Feb  6 13:21:59 2020
New Revision: 357615
URL: https://svnweb.freebsd.org/changeset/base/357615

Log:
  Implement kvm_kerndisp
  
  This change adds a new libkvm function, kvm_kerndisp(), that can be used to
  retrieve the kernel displacement, that is the difference between the kernel's
  base virtual address at run time and the kernel base virtual address specified
  in the kernel image file.
  
  This will be used by kgdb, to properly relocate kernel symbols, when needed.
  
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D23285

Added:
  head/lib/libkvm/kvm_kerndisp.3   (contents, props changed)
Modified:
  head/lib/libkvm/Makefile
  head/lib/libkvm/kvm.3
  head/lib/libkvm/kvm.c
  head/lib/libkvm/kvm.h
  head/lib/libkvm/kvm_minidump_powerpc64.c
  head/lib/libkvm/kvm_private.h
  head/sys/sys/types.h

Modified: head/lib/libkvm/Makefile
==
--- head/lib/libkvm/MakefileThu Feb  6 12:45:58 2020(r357614)
+++ head/lib/libkvm/MakefileThu Feb  6 13:21:59 2020(r357615)
@@ -25,8 +25,8 @@ INCS= kvm.h
 LIBADD=elf
 
 MAN=   kvm.3 kvm_getcptime.3 kvm_geterr.3 kvm_getloadavg.3 \
-   kvm_getpcpu.3 kvm_getprocs.3 kvm_getswapinfo.3 kvm_native.3 \
-   kvm_nlist.3 kvm_open.3 kvm_read.3
+   kvm_getpcpu.3 kvm_getprocs.3 kvm_getswapinfo.3 kvm_kerndisp.3 \
+   kvm_native.3 kvm_nlist.3 kvm_open.3 kvm_read.3
 
 MLINKS+=kvm_getpcpu.3 kvm_getmaxcpu.3 \
kvm_getpcpu.3 kvm_dpcpu_setcpu.3 \

Modified: head/lib/libkvm/kvm.3
==
--- head/lib/libkvm/kvm.3   Thu Feb  6 12:45:58 2020(r357614)
+++ head/lib/libkvm/kvm.3   Thu Feb  6 13:21:59 2020(r357615)
@@ -32,7 +32,7 @@
 .\" @(#)kvm.3  8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd April 30, 2016
+.Dd February 5, 2020
 .Dt KVM 3
 .Os
 .Sh NAME
@@ -133,7 +133,8 @@ respectively.
 Finally, only a limited subset of operations are supported for non-native
 crash dumps:
 .Fn kvm_close ,
-.Fn kvm_geterr
+.Fn kvm_geterr ,
+.Fn kvm_kerndisp ,
 .Fn kvm_open2 ,
 .Fn kvm_native ,
 .Fn kvm_nlist2 ,
@@ -147,6 +148,7 @@ and
 .Xr kvm_getloadavg 3 ,
 .Xr kvm_getprocs 3 ,
 .Xr kvm_getswapinfo 3 ,
+.Xr kvm_kerndisp 3 ,
 .Xr kvm_native 3 ,
 .Xr kvm_nlist 3 ,
 .Xr kvm_nlist2 3 ,

Modified: head/lib/libkvm/kvm.c
==
--- head/lib/libkvm/kvm.c   Thu Feb  6 12:45:58 2020(r357614)
+++ head/lib/libkvm/kvm.c   Thu Feb  6 13:21:59 2020(r357615)
@@ -46,6 +46,7 @@ __SCCSID("@(#)kvm.c   8.2 (Berkeley) 2/13/94");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -498,4 +499,33 @@ kvm_walk_pages(kvm_t *kd, kvm_walk_pages_cb_t *cb, voi
return (0);
 
return (kd->arch->ka_walk_pages(kd, cb, closure));
+}
+
+kssize_t
+kvm_kerndisp(kvm_t *kd)
+{
+   unsigned long kernbase, rel_kernbase;
+   size_t kernbase_len = sizeof(kernbase);
+   size_t rel_kernbase_len = sizeof(rel_kernbase);
+
+   if (ISALIVE(kd)) {
+   if (sysctlbyname("kern.base_address", &kernbase,
+   &kernbase_len, NULL, 0) == -1) {
+   _kvm_syserr(kd, kd->program,
+   "failed to get kernel base address");
+   return (0);
+   }
+   if (sysctlbyname("kern.relbase_address", &rel_kernbase,
+   &rel_kernbase_len, NULL, 0) == -1) {
+   _kvm_syserr(kd, kd->program,
+   "failed to get relocated kernel base address");
+   return (0);
+   }
+   return (rel_kernbase - kernbase);
+   }
+
+   if (kd->arch->ka_kerndisp == NULL)
+   return (0);
+
+   return (kd->arch->ka_kerndisp(kd));
 }

Modified: head/lib/libkvm/kvm.h
==
--- head/lib/libkvm/kvm.h   Thu Feb  6 12:45:58 2020(r357614)
+++ head/lib/libkvm/kvm.h   Thu Feb  6 13:21:59 2020(r357615)
@@ -124,6 +124,7 @@ ssize_t   kvm_read(kvm_t *, unsigned long, void *, siz
 ssize_t  kvm_read_zpcpu(kvm_t *, unsigned long, void *, size_t, int);
 ssize_t  kvm_read2(kvm_t *, kvaddr_t, void *, size_t);
 ssize_t  kvm_write(kvm_t *, unsigned long, const void *, size_t);
+kssize_t  kvm_kerndisp(kvm_t *);
 
 typedef int kvm_walk_pages_cb_t(struct kvm_page *, void *);
 int kvm_walk_pages(kvm_t *, kvm_walk_pages_cb_t *, void *);

Added: head/lib/libkvm/kvm_kerndisp.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libkvm/kvm_kerndisp.3  Thu Feb  6 13:21:59 2020
(r357615)
@@ -0,0 +1,57 @@
+.\"
+.\" Copyri

svn commit: r357616 - head/sys/dev/xen/console

2020-02-06 Thread Roger Pau Monné
Author: royger
Date: Thu Feb  6 14:02:47 2020
New Revision: 357616
URL: https://svnweb.freebsd.org/changeset/base/357616

Log:
  xen/console: fix priority of Xen console
  
  Currently the Xen console is always attached with priority CN_REMOTE
  (highest), which means that when booting with a single console the Xen
  console will take preference over the VGA for example, and that's not
  intended unless the user has also selected to use a serial console.
  
  Fix this by lowering the priority of the Xen console to NORMAL unless
  the user has selected to use a serial console. This keeps the usual
  FreeBSD behavior of outputting to the internal consoles (ie: VGA) when
  booted as a Xen dom0.
  
  MFC after:3 days
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/dev/xen/console/xen_console.c

Modified: head/sys/dev/xen/console/xen_console.c
==
--- head/sys/dev/xen/console/xen_console.c  Thu Feb  6 13:21:59 2020
(r357615)
+++ head/sys/dev/xen/console/xen_console.c  Thu Feb  6 14:02:47 2020
(r357616)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -590,7 +591,7 @@ xencons_cnprobe(struct consdev *cp)
if (!xen_domain())
return;
 
-   cp->cn_pri = CN_REMOTE;
+   cp->cn_pri = (boothowto & RB_SERIAL) ? CN_REMOTE : CN_NORMAL;
sprintf(cp->cn_name, "%s0", driver_name);
 }
 
___
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: r357617 - head/tools/build/options

2020-02-06 Thread Ed Maste
Author: emaste
Date: Thu Feb  6 14:13:33 2020
New Revision: 357617
URL: https://svnweb.freebsd.org/changeset/base/357617

Log:
  Update WITH_/WITHOUT_BINUTILS_BOOTSTRAP descriptions
  
  Use of binutils is being incrementally reduced.  The specific binutils
  are listed in the WITH_BINUTILS and WITHOUT_BINUTILS descriptions; there
  is no need to list the specific tools again in the descriptions for the
  _BOOTSTRAP options.
  
  MFC after:1 week

Modified:
  head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
  head/tools/build/options/WITH_BINUTILS_BOOTSTRAP

Modified: head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
==
--- head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP Thu Feb  6 14:02:47 
2020(r357616)
+++ head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP Thu Feb  6 14:13:33 
2020(r357617)
@@ -1,3 +1,3 @@
 .\" $FreeBSD$
-Do not build binutils (as, ld.bfd, and objdump)
+Do not build GNU binutils
 as part of the bootstrap process.

Modified: head/tools/build/options/WITH_BINUTILS_BOOTSTRAP
==
--- head/tools/build/options/WITH_BINUTILS_BOOTSTRAPThu Feb  6 14:02:47 
2020(r357616)
+++ head/tools/build/options/WITH_BINUTILS_BOOTSTRAPThu Feb  6 14:13:33 
2020(r357617)
@@ -1,3 +1,3 @@
 .\" $FreeBSD$
-Build binutils (as on i386 and amd64, objdump, and ld on powerpc)
+Build GNU binutils
 as part of the bootstrap process.
___
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: r357618 - head/share/man/man5

2020-02-06 Thread Ed Maste
Author: emaste
Date: Thu Feb  6 14:18:48 2020
New Revision: 357618
URL: https://svnweb.freebsd.org/changeset/base/357618

Log:
  src.conf.5: regen after r357617, BINUTILS_BOOTSTRAP description update

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Thu Feb  6 14:13:33 2020
(r357617)
+++ head/share/man/man5/src.conf.5  Thu Feb  6 14:18:48 2020
(r357618)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd February 4, 2020
+.Dd February 6, 2020
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -198,15 +198,15 @@ and
 on powerpc as part of the normal system build.
 .Pp
 This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, 
mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and 
sparc64/sparc64.
+amd64/amd64, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, 
mips/mips64elhf, mips/mips64hf, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_BINUTILS_BOOTSTRAP
-Do not build binutils (as, ld.bfd, and objdump)
+Do not build GNU binutils
 as part of the bootstrap process.
 .Pp
 This is a default setting on
-arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, 
mips/mips64hf, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64.
+arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, 
mips/mips64hf, riscv/riscv64 and riscv/riscv64sf.
 .It Va WITH_BINUTILS_BOOTSTRAP
-Build binutils (as on i386 and amd64, objdump, and ld on powerpc)
+Build GNU binutils
 as part of the bootstrap process.
 .Pp
 This is a default setting on
@@ -344,9 +344,6 @@ When set, it enforces these options:
 .El
 .It Va WITHOUT_CLANG
 Set to not build the Clang C/C++ compiler during the regular phase of the 
build.
-.Pp
-This is a default setting on
-sparc64/sparc64.
 When set, it enforces these options:
 .Pp
 .Bl -item -compact
@@ -357,11 +354,6 @@ When set, it enforces these options:
 .It
 .Va WITHOUT_LLVM_COV
 .El
-.It Va WITH_CLANG
-Set to build the Clang C/C++ compiler during the normal phase of the build.
-.Pp
-This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, 
mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, 
mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, 
powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf.
 .It Va WITHOUT_CLANG_BOOTSTRAP
 Set to not build the Clang C/C++ compiler during the bootstrap phase of
 the build.
@@ -369,7 +361,7 @@ To be able to build the system, either gcc or clang bo
 enabled unless an alternate compiler is provided via XCC.
 .Pp
 This is a default setting on
-mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64.
+mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf.
 .It Va WITH_CLANG_BOOTSTRAP
 Set to build the Clang C/C++ compiler during the bootstrap phase of the build.
 .Pp
@@ -381,15 +373,6 @@ clang-format.
 .It Va WITHOUT_CLANG_FULL
 Set to avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of
 the Clang C/C++ compiler.
-.Pp
-This is a default setting on
-sparc64/sparc64.
-.It Va WITH_CLANG_FULL
-Set to build the ARCMigrate, Rewriter and StaticAnalyzer components of the
-Clang C/C++ compiler.
-.Pp
-This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, 
mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, 
mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, 
powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf.
 .It Va WITHOUT_CLANG_IS_CC
 Do not install links to the Clang C/C++ compiler as
 .Pa /usr/bin/cc ,
@@ -401,7 +384,7 @@ If
 is set then links to the GCC C/C++ compiler will be installed instead.
 .Pp
 This is a default setting on
-mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64.
+mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf.
 .It Va WITH_CLANG_IS_CC
 Install links to the Clang C/C++ compiler as
 .Pa /usr/bin/cc ,
@@ -489,7 +472,7 @@ Set to build
 .Xr cxgbetool 8
 .Pp
 This is a default setting on
-amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64 and sparc64/sparc64.
+amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64.
 .It Va WITHOUT_CXX
 Set to no

svn commit: r357619 - head/usr.sbin/mixer/tests

2020-02-06 Thread Luca Pizzamiglio
Author: pizzamig (ports committer)
Date: Thu Feb  6 14:31:29 2020
New Revision: 357619
URL: https://svnweb.freebsd.org/changeset/base/357619

Log:
  mixer: call the cleanup function in a test
  
  The set_empty_value test has a cleanup function, but is not called.
  Fix it
  
  Reviewed by:  0mp
  Approved by:  kp
  Differential Revision:https://reviews.freebsd.org/D23498

Modified:
  head/usr.sbin/mixer/tests/mixer_test.sh

Modified: head/usr.sbin/mixer/tests/mixer_test.sh
==
--- head/usr.sbin/mixer/tests/mixer_test.sh Thu Feb  6 14:18:48 2020
(r357618)
+++ head/usr.sbin/mixer/tests/mixer_test.sh Thu Feb  6 14:31:29 2020
(r357619)
@@ -93,7 +93,7 @@ S_flag_cleanup()
restore_mixer_vol
 }
 
-atf_test_case set_empty_value
+atf_test_case set_empty_value cleanup
 set_empty_value_head()
 {
atf_set "descr" "Verify that mixer returns when the provided " \
___
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: r356818 - in head/sys/geom: . concat eli gate journal linux_lvm mirror nop part raid raid3 shsec stripe

2020-02-06 Thread Mark Johnston
On Fri, Jan 17, 2020 at 01:15:55AM +, Warner Losh wrote:
> Author: imp
> Date: Fri Jan 17 01:15:55 2020
> New Revision: 356818
> URL: https://svnweb.freebsd.org/changeset/base/356818
> 
> Log:
>   Pass BIO_SPEEDUP through all the geom layers
>   
>   While some geom layers pass unknown commands down, not all do. For the ones 
> that
>   don't, pass BIO_SPEEDUP down to the providers that constittue the geom, as
>   applicable. No changes to vinum or virstor because I was unsure how to add 
> this
>   support, and I'm also unsure how to test these. gvinum doesn't implement
>   BIO_FLUSH either, so it may just be poorly maintained. gvirstor is for 
> testing
>   and not supportig BIO_SPEEDUP is fine.
>   
>   Reviewed by: chs
>   Differential Revision: https://reviews.freebsd.org/D23183

Hi Warner,

BIO_SPEEDUP triggers an assertion failure in virtblk, as found by
syzkaller.  I'm not sure how best to handle it - I don't think there's
anything the driver can really do with BIO_SPEEDUP, so it could be
dropped, but maybe it's unexpected that it's made it to this layer in
the first place.

http://syzkaller.backtrace.io:8080/file?name=crashes%2f1e84321d4576307b788b7c3e4526facc7d10a46c%2freport0
___
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: r357614 - in head/sys: kern sys

2020-02-06 Thread Conrad Meyer
Hi Pawel,

I don't think the (notyet) static assertion is quite right.

On Thu, Feb 6, 2020 at 4:46 AM Pawel Biernacki  wrote:
>
> Author: kaktus
> Date: Thu Feb  6 12:45:58 2020
> New Revision: 357614
> URL: https://svnweb.freebsd.org/changeset/base/357614
>
> Log:
>   sysctl(9): add CTLFLAG_NEEDGIANT flag
> ...
> Modified: head/sys/sys/sysctl.h
> ==
> --- head/sys/sys/sysctl.h   Thu Feb  6 10:11:41 2020(r357613)
> +++ head/sys/sys/sysctl.h   Thu Feb  6 12:45:58 2020(r357614)
> @@ -105,6 +105,13 @@ struct ctlname {
> ...
> + * One, and only one of CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT is required
> + * for SYSCTL_PROC and SYSCTL_NODE.
> ...
> @@ -263,6 +270,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
>  #define__DESCR(d) ""
>  #endif
>
> +#ifdef notyet
> +#defineSYSCTL_ENFORCE_FLAGS(x)   
>   \
> +_Static_assert(((CTLFLAG_MPSAFE ^ CTLFLAG_NEEDGIANT) & (x)),   \
> +"Has to be either CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT")

The current (notyet) assertion checks for one or both flags being set,
but you want to disallow both being set.  The XOR operator here is
meaningless; it is the same as OR for different bit flags.

That would be something like:

#define _CTLFLAG_MUTUALLY_EXCLUSIVE(CTLFLAG_MPSAFE | CTLFLAG_NEEDGIANT);
#define SYSCTL_ENFORCE_FLAGS(x)  do { \
_Static_assert(((x) & _CTLFLAG_MUTUALLY_EXCLUSIVE) != 0 && \
((x) & _CTLFLAG_MUTUALLY_EXCLUSIVE) !=
_CTLFLAG_MUTUALLY_EXCLUSIVE, \
"Must set exactly one of CTLFLAG_MPSAFE, CTLFLAG_NEEDGIANT"); \
} while (0)

Best,
Conrad
___
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: r357621 - head/share/man/man5

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 16:38:02 2020
New Revision: 357621
URL: https://svnweb.freebsd.org/changeset/base/357621

Log:
  'is now deprecated' -> 'is deprecated'
  
  Man pages are written in a more timeless voice than news flashes,
  so adopt the language to what we do elsewhere.

Modified:
  head/share/man/man5/make.conf.5

Modified: head/share/man/man5/make.conf.5
==
--- head/share/man/man5/make.conf.5 Thu Feb  6 16:22:16 2020
(r357620)
+++ head/share/man/man5/make.conf.5 Thu Feb  6 16:38:02 2020
(r357621)
@@ -574,7 +574,7 @@ Use with caution as a make install will overwrite any 
 .Pa /etc/mail/sendmail.cf .
 Note that
 .Va SENDMAIL_CF
-is now deprecated.
+is deprecated.
 .It Va SENDMAIL_SET_USER_ID
 .Pq Vt bool
 If set, install
___
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: r357622 - head/share/man/man5

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 16:38:06 2020
New Revision: 357622
URL: https://svnweb.freebsd.org/changeset/base/357622

Log:
  Avoid the phrase 'now deprecated'
  
  Reword this construct to be more consistent with normal man page language.

Modified:
  head/share/man/man5/rc.conf.5

Modified: head/share/man/man5/rc.conf.5
==
--- head/share/man/man5/rc.conf.5   Thu Feb  6 16:38:02 2020
(r357621)
+++ head/share/man/man5/rc.conf.5   Thu Feb  6 16:38:06 2020
(r357622)
@@ -1317,12 +1317,12 @@ ifconfig_em0_alias3="inet 192.0.2.1-5/28"
 .Pp
 and so on.
 .Pp
-Note that
+Note that deprecated
 .Va ipv4_addrs_ Ns Aq Ar interface
 variable was supported for IPv4 CIDR address notation.
-It is now deprecated because the functionality was integrated into
+The
 .Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n
-though
+variable replaces it, though
 .Va ipv4_addrs_ Ns Aq Ar interface
 is still supported for backward compatibility.
 .Pp
___
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: r357614 - in head/sys: kern sys

2020-02-06 Thread Hans Petter Selasky

On 2020-02-06 13:45, Pawel Biernacki wrote:

+#ifdef notyet
+#defineSYSCTL_ENFORCE_FLAGS(x) 
\
+_Static_assert(((CTLFLAG_MPSAFE ^ CTLFLAG_NEEDGIANT) & (x)),   \
+"Has to be either CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT")
+#else
+#defineSYSCTL_ENFORCE_FLAGS(x)
+#endif


Like cem@ pointed out, either you expand the XOR via OR or you can also 
do it like this:


(((x) & CTLFLAG_MPSAFE) != 0) ^ (((x) & CTLFLAG_NEEDGIANT) != 0)

which avoids having to define another macro.

--HPS
___
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: r357624 - in head/sbin: . sunlabel

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 17:52:02 2020
New Revision: 357624
URL: https://svnweb.freebsd.org/changeset/base/357624

Log:
  No need to make sunlabel anymore
  
  It was only built on sparc64. Since it wasn't a general tool on other
  architectures, no need to keep it around for another release.
  
  Reviewed by: emaste
  Differential Revision: https://reviews.freebsd.org/D23524

Deleted:
  head/sbin/Makefile.sparc64
  head/sbin/sunlabel/Makefile
  head/sbin/sunlabel/Makefile.depend
  head/sbin/sunlabel/runtest.sh
  head/sbin/sunlabel/sun_disklabel.h
  head/sbin/sunlabel/sunlabel.8
  head/sbin/sunlabel/sunlabel.c
  head/sbin/sunlabel/sunlabel_enc.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: r357625 - head/usr.bin

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 17:52:07 2020
New Revision: 357625
URL: https://svnweb.freebsd.org/changeset/base/357625

Log:
  No need to have a special sparc64 list here.
  
  Reviewed by: emaste
  Differential Revision: https://reviews.freebsd.org/D23525

Deleted:
  head/usr.bin/Makefile.sparc64
___
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: r357626 - head/usr.bin/elf2aout

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 17:52:11 2020
New Revision: 357626
URL: https://svnweb.freebsd.org/changeset/base/357626

Log:
  Mark elf2aout as deprecated.
  
  Only sparc64 used this, so we will be removing it from FreeBSD 13. Add
  the usual deprecation notice in a MFC-able way.
  
  Reviewed by: emaste, rgrimes
  Differential Revision: https://reviews.freebsd.org/D23526

Modified:
  head/usr.bin/elf2aout/elf2aout.1

Modified: head/usr.bin/elf2aout/elf2aout.1
==
--- head/usr.bin/elf2aout/elf2aout.1Thu Feb  6 17:52:07 2020
(r357625)
+++ head/usr.bin/elf2aout/elf2aout.1Thu Feb  6 17:52:11 2020
(r357626)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 23, 2008
+.Dd February 6, 2020
 .Dt ELF2AOUT 1
 .Os
 .Sh NAME
@@ -46,6 +46,12 @@ and this utility is designed to accommodate.
 If
 .Ar infile
 is not in ELF format, an error message will be presented.
+.Sh DEPRECATION NOTICE
+The
+.Nm
+utility is not present in
+.Fx 13.0
+and later.
 .Sh SEE ALSO
 .Xr elf 3 ,
 .Xr a.out 5
___
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: r357623 - head

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 17:51:48 2020
New Revision: 357623
URL: https://svnweb.freebsd.org/changeset/base/357623

Log:
  Restore missing comment
  
  I was overly agressive about removing the entire comment. It was still
  valid, except the part about being only for some architectures.
  
  Reviewed by: emaste
  Differenial Revision: https://reviews.freebsd.org/D23523

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Feb  6 16:38:06 2020(r357622)
+++ head/Makefile.inc1  Thu Feb  6 17:51:48 2020(r357623)
@@ -2912,6 +2912,7 @@ _cddl_lib_libctf= cddl/lib/libctf
 _cddl_lib= cddl/lib
 cddl/lib/libctf__L: lib/libz__L
 .endif
+# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db
 _prebuild_libs+=   lib/libprocstat lib/libproc lib/librtld_db
 lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L
 lib/libproc__L: lib/libprocstat__L
___
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: r357627 - in head: . usr.bin usr.bin/elf2aout

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 17:52:16 2020
New Revision: 357627
URL: https://svnweb.freebsd.org/changeset/base/357627

Log:
  Remove elf2aout
  
  Remove the long obsolete elf2aout utility. Should any ports need to
  know when this left the tree, use 1300077 as the revision so we
  avoid multiple bumps for the sparc64 removal.
  
  Reviewed by: brooks@, emaste@
  Differential Revision: https://reviews.freebsd.org/D23527

Deleted:
  head/usr.bin/elf2aout/Makefile
  head/usr.bin/elf2aout/Makefile.depend
  head/usr.bin/elf2aout/elf2aout.1
  head/usr.bin/elf2aout/elf2aout.c
Modified:
  head/ObsoleteFiles.inc
  head/usr.bin/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Thu Feb  6 17:52:11 2020(r357626)
+++ head/ObsoleteFiles.inc  Thu Feb  6 17:52:16 2020(r357627)
@@ -36,6 +36,10 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20200206: Remove elf2aout
+OLD_FILES+=usr/bin/elf2aout
+OLD_FILES+=usr/share/man/man1/elf2aout.1.gz
+
 # 20200204: simple_httpd removed
 OLD_FILES+=usr/sbin/simple_httpd
 

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Thu Feb  6 17:52:11 2020(r357626)
+++ head/usr.bin/Makefile   Thu Feb  6 17:52:16 2020(r357627)
@@ -31,7 +31,6 @@ SUBDIR=   alias \
diff \
dirname \
du \
-   elf2aout \
elfdump \
enigma \
env \
___
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: r357624 - in head/sbin: . sunlabel

2020-02-06 Thread Rodney W. Grimes
> Author: imp
> Date: Thu Feb  6 17:52:02 2020
> New Revision: 357624
> URL: https://svnweb.freebsd.org/changeset/base/357624
> 
> Log:
>   No need to make sunlabel anymore
>   
>   It was only built on sparc64. Since it wasn't a general tool on other
>   architectures, no need to keep it around for another release.
>   
>   Reviewed by: emaste
>   Differential Revision: https://reviews.freebsd.org/D23524

Should not this whole sparc64 removal have had some deprecation notices
put in and merged back to 11 and 12 to give users a pro-active notice
that it is gone_in(13)?


> Deleted:
>   head/sbin/Makefile.sparc64
>   head/sbin/sunlabel/Makefile
>   head/sbin/sunlabel/Makefile.depend
>   head/sbin/sunlabel/runtest.sh
>   head/sbin/sunlabel/sun_disklabel.h
>   head/sbin/sunlabel/sunlabel.8
>   head/sbin/sunlabel/sunlabel.c
>   head/sbin/sunlabel/sunlabel_enc.c
> 

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


svn commit: r357629 - head

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 18:00:50 2020
New Revision: 357629
URL: https://svnweb.freebsd.org/changeset/base/357629

Log:
  Add elf2aout removal
  
  After committing, I noticed elf2aout commit missed the relnotes
  yes. It's unlikely to be interesting, since it's just part of sparc64
  removal and quite niche, but it was installed on all FreeBSD machines.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Thu Feb  6 18:00:46 2020(r357628)
+++ head/RELNOTES   Thu Feb  6 18:00:50 2020(r357629)
@@ -10,6 +10,9 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r357627:
+   remove elf2aout.
+
 r357560-r357565:
init(8), service(8), and cron(8) will now adopt user/class environment
variables (excluding PATH, by default, which will be overwritten) by
___
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: r357628 - head

2020-02-06 Thread Warner Losh
Author: imp
Date: Thu Feb  6 18:00:46 2020
New Revision: 357628
URL: https://svnweb.freebsd.org/changeset/base/357628

Log:
  Add relnotes entries for armv5 and sparc64 being removed.
  
  These commits lacked the proper relnotes entries in the commit
  message.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Thu Feb  6 17:52:16 2020(r357627)
+++ head/RELNOTES   Thu Feb  6 18:00:46 2020(r357628)
@@ -16,6 +16,9 @@ r357560-r357565:
default.  Notably, environment variables for all cron jobs and rc
services can now be set via login.conf(5).
 
+r357455:
+   sparc64 has been removed from FreeBSD.
+
 r355677:
Adds support for NFSv4.2 (RFC-7862) and Extended Attributes
(RFC-8276) to the NFS client and server.
@@ -37,6 +40,9 @@ r355677:
server.
Setting vfs.nfsd.server_max_minorversion4 to 0 or 1 will disable NFSv4.2
on the server.
+
+r356263:
+   armv5 support has been removed from FreeBSD.
 
 r354517:
iwm(4) now supports most Intel 9260, 9460 and 9560 Wi-Fi devices.
___
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: r357630 - head/sys/riscv/riscv

2020-02-06 Thread John Baldwin
Author: jhb
Date: Thu Feb  6 18:02:38 2020
New Revision: 357630
URL: https://svnweb.freebsd.org/changeset/base/357630

Log:
  Fix DDB to unwind across exception frames.
  
  While here, add an extra line of information for exceptions and
  interrupts and compress the per-frame line down to one line to match
  other architectures.
  
  Reviewed by:  mhorne, br
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23508

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

Modified: head/sys/riscv/riscv/db_trace.c
==
--- head/sys/riscv/riscv/db_trace.c Thu Feb  6 18:00:50 2020
(r357629)
+++ head/sys/riscv/riscv/db_trace.c Thu Feb  6 18:02:38 2020
(r357630)
@@ -2,6 +2,7 @@
  * Copyright (c) 2015 The FreeBSD Foundation
  * Copyright (c) 2016 Ruslan Bukin 
  * All rights reserved.
+ * Copyright (c) 2020 John Baldwin 
  *
  * Portions of this software were developed by Semihalf under
  * the sponsorship of the FreeBSD Foundation.
@@ -38,15 +39,18 @@
 
 #include 
 __FBSDID("$FreeBSD$");
+
 #include 
-#include 
 #include 
-#include 
+#include 
+
 #include 
 #include 
 
+#include 
 #include 
 #include 
+#include 
 
 void
 db_md_list_watchpoints()
@@ -80,9 +84,6 @@ db_stack_trace_cmd(struct unwind_state *frame)
while (1) {
pc = frame->pc;
 
-   if (unwind_frame(frame) < 0)
-   break;
-
sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
if (sym == C_DB_SYM_NULL) {
value = 0;
@@ -94,11 +95,32 @@ db_stack_trace_cmd(struct unwind_state *frame)
db_printsym(frame->pc, DB_STGY_PROC);
db_printf("\n");
 
-   db_printf("\t pc = 0x%016lx ra = 0x%016lx\n",
-   pc, frame->pc);
-   db_printf("\t sp = 0x%016lx fp = 0x%016lx\n",
-   frame->sp, frame->fp);
-   db_printf("\n");
+   if (strcmp(name, "cpu_exception_handler_supervisor") == 0 ||
+   strcmp(name, "cpu_exception_handler_user") == 0) {
+   struct trapframe *tf;
+
+   tf = (struct trapframe *)(uintptr_t)frame->sp;
+
+   if (tf->tf_scause & EXCP_INTR)
+   db_printf("--- interrupt %ld\n",
+   tf->tf_scause & EXCP_MASK);
+   else
+   db_printf("--- exception %ld, tval = %#lx\n",
+   tf->tf_scause & EXCP_MASK,
+   tf->tf_stval);
+   frame->sp = (uint64_t)tf->tf_sp;
+   frame->fp = (uint64_t)tf->tf_s[0];
+   frame->pc = (uint64_t)tf->tf_sepc;
+   if (!INKERNEL(frame->fp))
+   break;
+   continue;
+   }
+
+   if (strcmp(name, "fork_trampoline") == 0)
+   break;
+
+   if (unwind_frame(frame) < 0)
+   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: r357632 - head/sys/riscv/riscv

2020-02-06 Thread John Baldwin
Author: jhb
Date: Thu Feb  6 18:04:45 2020
New Revision: 357632
URL: https://svnweb.freebsd.org/changeset/base/357632

Log:
  Use the context created in makectx() for stack traces.
  
  Always use the kdb_thr_ctx() for db_trace_thread() as on other
  architectures.  Initialize pcb_ra to be the sepc from the saved
  trapframe rather than the saved ra to avoid skipping a frame.
  
  Reviewed by:  mhorne, br
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23513

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

Modified: head/sys/riscv/riscv/db_trace.c
==
--- head/sys/riscv/riscv/db_trace.c Thu Feb  6 18:04:15 2020
(r357631)
+++ head/sys/riscv/riscv/db_trace.c Thu Feb  6 18:04:45 2020
(r357632)
@@ -130,15 +130,12 @@ db_trace_thread(struct thread *thr, int count)
struct unwind_state frame;
struct pcb *ctx;
 
-   if (thr != curthread) {
-   ctx = kdb_thr_ctx(thr);
+   ctx = kdb_thr_ctx(thr);
 
-   frame.sp = (uint64_t)ctx->pcb_sp;
-   frame.fp = (uint64_t)ctx->pcb_s[0];
-   frame.pc = (uint64_t)ctx->pcb_ra;
-   db_stack_trace_cmd(&frame);
-   } else
-   db_trace_self();
+   frame.sp = (uint64_t)ctx->pcb_sp;
+   frame.fp = (uint64_t)ctx->pcb_s[0];
+   frame.pc = (uint64_t)ctx->pcb_ra;
+   db_stack_trace_cmd(&frame);
return (0);
 }
 

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Thu Feb  6 18:04:15 2020
(r357631)
+++ head/sys/riscv/riscv/machdep.c  Thu Feb  6 18:04:45 2020
(r357632)
@@ -571,7 +571,7 @@ makectx(struct trapframe *tf, struct pcb *pcb)
 
memcpy(pcb->pcb_s, tf->tf_s, sizeof(tf->tf_s));
 
-   pcb->pcb_ra = tf->tf_ra;
+   pcb->pcb_ra = tf->tf_sepc;
pcb->pcb_sp = tf->tf_sp;
pcb->pcb_gp = tf->tf_gp;
pcb->pcb_tp = tf->tf_tp;
___
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: r357631 - head/usr.sbin/fstyp

2020-02-06 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Feb  6 18:04:15 2020
New Revision: 357631
URL: https://svnweb.freebsd.org/changeset/base/357631

Log:
  fstyp: sync HAMMER1/2 detection support with DragonFly BSD.
  
  Submitted by: Tomohiro Kusumi
  PR:   243929

Modified:
  head/usr.sbin/fstyp/hammer.c
  head/usr.sbin/fstyp/hammer2.c

Modified: head/usr.sbin/fstyp/hammer.c
==
--- head/usr.sbin/fstyp/hammer.cThu Feb  6 18:02:38 2020
(r357630)
+++ head/usr.sbin/fstyp/hammer.cThu Feb  6 18:04:15 2020
(r357631)
@@ -1,5 +1,6 @@
 /*-
- * Copyright (c) 2016 The DragonFly Project
+ * Copyright (c) 2016-2019 The DragonFly Project
+ * Copyright (c) 2016-2019 Tomohiro Kusumi 
  * All rights reserved.
  *
  * This software was developed by Edward Tomasz Napierala under sponsorship
@@ -43,7 +44,7 @@ __FBSDID("$FreeBSD$");
 #include "fstyp.h"
 
 static hammer_volume_ondisk_t
-__read_ondisk(FILE *fp)
+read_ondisk(FILE *fp)
 {
hammer_volume_ondisk_t ondisk;
 
@@ -55,7 +56,7 @@ __read_ondisk(FILE *fp)
 }
 
 static int
-__test_ondisk(const hammer_volume_ondisk_t ondisk)
+test_ondisk(const hammer_volume_ondisk_t ondisk)
 {
static int count = 0;
static hammer_uuid_t fsid, fstype;
@@ -97,23 +98,23 @@ fstyp_hammer(FILE *fp, char *label, size_t size)
hammer_volume_ondisk_t ondisk;
int error = 1;
 
-   ondisk = __read_ondisk(fp);
+   ondisk = read_ondisk(fp);
if (ondisk->vol_no != HAMMER_ROOT_VOLNO)
-   goto done;
+   goto fail;
if (ondisk->vol_count != 1)
-   goto done;
-   if (__test_ondisk(ondisk))
-   goto done;
+   goto fail;
+   if (test_ondisk(ondisk))
+   goto fail;
 
strlcpy(label, ondisk->vol_label, size);
error = 0;
-done:
+fail:
free(ondisk);
return (error);
 }
 
 static int
-__test_volume(const char *volpath)
+test_volume(const char *volpath)
 {
hammer_volume_ondisk_t ondisk;
FILE *fp;
@@ -122,13 +123,13 @@ __test_volume(const char *volpath)
if ((fp = fopen(volpath, "r")) == NULL)
err(1, "failed to open %s", volpath);
 
-   ondisk = __read_ondisk(fp);
+   ondisk = read_ondisk(fp);
fclose(fp);
-   if (__test_ondisk(ondisk))
-   goto done;
+   if (test_ondisk(ondisk))
+   goto fail;
 
volno = ondisk->vol_no;
-done:
+fail:
free(ondisk);
return (volno);
 }
@@ -136,51 +137,60 @@ done:
 static int
 __fsvtyp_hammer(const char *blkdevs, char *label, size_t size, int partial)
 {
-   hammer_volume_ondisk_t ondisk;
+   hammer_volume_ondisk_t ondisk = NULL;
FILE *fp;
char *dup, *p, *volpath, x[HAMMER_MAX_VOLUMES];
int i, volno, error = 1;
 
+   if (!blkdevs)
+   goto fail;
+
memset(x, 0, sizeof(x));
dup = strdup(blkdevs);
p = dup;
 
+   volpath = NULL;
+   volno = -1;
while (p) {
volpath = p;
if ((p = strchr(p, ':')) != NULL)
*p++ = '\0';
-   if ((volno = __test_volume(volpath)) == -1)
+   if ((volno = test_volume(volpath)) == -1)
break;
+   assert(volno >= 0);
+   assert(volno < HAMMER_MAX_VOLUMES);
x[volno]++;
}
 
+   if (!volpath)
+   err(1, "invalid path %s", blkdevs);
if ((fp = fopen(volpath, "r")) == NULL)
err(1, "failed to open %s", volpath);
-   ondisk = __read_ondisk(fp);
+   ondisk = read_ondisk(fp);
fclose(fp);
 
free(dup);
 
if (volno == -1)
-   goto done;
+   goto fail;
if (partial)
goto success;
 
for (i = 0; i < HAMMER_MAX_VOLUMES; i++)
if (x[i] > 1)
-   goto done;
+   goto fail;
for (i = 0; i < HAMMER_MAX_VOLUMES; i++)
if (x[i] == 0)
break;
if (ondisk->vol_count != i)
-   goto done;
+   goto fail;
for (; i < HAMMER_MAX_VOLUMES; i++)
if (x[i] != 0)
-   goto done;
+   goto fail;
 success:
strlcpy(label, ondisk->vol_label, size);
error = 0;
-done:
+fail:
free(ondisk);
return (error);
 }

Modified: head/usr.sbin/fstyp/hammer2.c
==
--- head/usr.sbin/fstyp/hammer2.c   Thu Feb  6 18:02:38 2020
(r357630)
+++ head/usr.sbin/fstyp/hammer2.c   Thu Feb  6 18:04:15 2020
(r357631)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2017-2019 The DragonFly Project
+ * Copyright (c) 2017-2019 Tomohiro Kusumi 
  * All rights reserved.
  *
  * This software was developed by Edward Tomasz

Re: svn commit: r357624 - in head/sbin: . sunlabel

2020-02-06 Thread Warner Losh
On Thu, Feb 6, 2020 at 10:57 AM Rodney W. Grimes 
wrote:

> > Author: imp
> > Date: Thu Feb  6 17:52:02 2020
> > New Revision: 357624
> > URL: https://svnweb.freebsd.org/changeset/base/357624
> >
> > Log:
> >   No need to make sunlabel anymore
> >
> >   It was only built on sparc64. Since it wasn't a general tool on other
> >   architectures, no need to keep it around for another release.
> >
> >   Reviewed by: emaste
> >   Differential Revision: https://reviews.freebsd.org/D23524
>
> Should not this whole sparc64 removal have had some deprecation notices
> put in and merged back to 11 and 12 to give users a pro-active notice
> that it is gone_in(13)?
>

We should definitely put it in the 11 and 12 release notes. That's a good
idea.

We can put a printf in the kernel so everybody sees it on boot. I'll make
that change, though I don't think gone_in is quite right there (I'll check
before I commit). This should cover all bases.

For all the utilities that are installed on all the platforms I'll do it
(like I did for elf2aout), but for utilities that are only on sparc64, I
have no plans to do it. They are covered by the general 'sparc64 is removed
in FreeBSD 13.0'. I think this is a reasonable compromise that catches the
corner cases where people are using a utility not on sparc64, but that
we're removing it while saving a little bit of work which is rather tedious
and error prone for a utility that one could not reasonably expect to be in
13. It's the MFC bit that makes this somewhat tedious because we normally
do those days later...

Warner
___
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: r357624 - in head/sbin: . sunlabel

2020-02-06 Thread Rodney W. Grimes
> On Thu, Feb 6, 2020 at 10:57 AM Rodney W. Grimes 
> wrote:
> 
> > > Author: imp
> > > Date: Thu Feb  6 17:52:02 2020
> > > New Revision: 357624
> > > URL: https://svnweb.freebsd.org/changeset/base/357624
> > >
> > > Log:
> > >   No need to make sunlabel anymore
> > >
> > >   It was only built on sparc64. Since it wasn't a general tool on other
> > >   architectures, no need to keep it around for another release.
> > >
> > >   Reviewed by: emaste
> > >   Differential Revision: https://reviews.freebsd.org/D23524
> >
> > Should not this whole sparc64 removal have had some deprecation notices
> > put in and merged back to 11 and 12 to give users a pro-active notice
> > that it is gone_in(13)?
> >
> 
> We should definitely put it in the 11 and 12 release notes. That's a good
> idea.

Random thought, dont pay it too much attention but:  DEPRECATED sitting
next to RELNOTES?  Or even a specific section in RELNOTES?  Thought that
is not suppose to be MFC'ed.

> We can put a printf in the kernel so everybody sees it on boot. I'll make
> that change, though I don't think gone_in is quite right there (I'll check
> before I commit). This should cover all bases.
> 
> For all the utilities that are installed on all the platforms I'll do it
> (like I did for elf2aout), but for utilities that are only on sparc64, I
> have no plans to do it. They are covered by the general 'sparc64 is removed
> in FreeBSD 13.0'. I think this is a reasonable compromise that catches the
> corner cases where people are using a utility not on sparc64, but that
> we're removing it while saving a little bit of work which is rather tedious
> and error prone for a utility that one could not reasonably expect to be in
> 13.

That seems a reasonble best effort to me.

> It's the MFC bit that makes this somewhat tedious because we normally
> do those days later...

That shouldnt effect it as long as the MFC'able commit is done first,
then the removal commit.

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


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

2020-02-06 Thread Paweł Biernacki
Thanks, will be fixed before enabling it.


> On 6 Feb 2020, at 17:41, Hans Petter Selasky  wrote:
> 
> On 2020-02-06 13:45, Pawel Biernacki wrote:
>> +#ifdef notyet
>> +#define SYSCTL_ENFORCE_FLAGS(x) 
>> \
>> +_Static_assert(((CTLFLAG_MPSAFE ^ CTLFLAG_NEEDGIANT) & (x)),\
>> +"Has to be either CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT")
>> +#else
>> +#define SYSCTL_ENFORCE_FLAGS(x)
>> +#endif
> 
> Like cem@ pointed out, either you expand the XOR via OR or you can also do it 
> like this:
> 
> (((x) & CTLFLAG_MPSAFE) != 0) ^ (((x) & CTLFLAG_NEEDGIANT) != 0)
> 
> which avoids having to define another macro.
> 
> --HPS

___
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: r357636 - head/contrib/netbsd-tests/lib/libc/c063

2020-02-06 Thread Kyle Evans
Author: kevans
Date: Thu Feb  6 18:51:36 2020
New Revision: 357636
URL: https://svnweb.freebsd.org/changeset/base/357636

Log:
  MFV r357635: imnport v1.9 of the O_SEARCH tests
  
  The RCSID data was wrong, so this is effectively a record-only merge
  with correction of said data. No further changes should be needed in this
  area, as we've now upstreamed our local changes to this specific test.

Modified:
  head/contrib/netbsd-tests/lib/libc/c063/t_o_search.c
Directory Properties:
  head/contrib/netbsd-tests/   (props changed)

Modified: head/contrib/netbsd-tests/lib/libc/c063/t_o_search.c
==
--- head/contrib/netbsd-tests/lib/libc/c063/t_o_search.cThu Feb  6 
18:48:12 2020(r357635)
+++ head/contrib/netbsd-tests/lib/libc/c063/t_o_search.cThu Feb  6 
18:51:36 2020(r357636)
@@ -1,4 +1,4 @@
-/* $NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $ */
+/* $NetBSD: t_o_search.c,v 1.9 2020/02/06 12:18:06 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.9 2020/02/06 12:18:06 martin Exp $");
 
 #include 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357637 - head/sys/kern

2020-02-06 Thread Jeff Roberson
Author: jeff
Date: Thu Feb  6 20:10:21 2020
New Revision: 357637
URL: https://svnweb.freebsd.org/changeset/base/357637

Log:
  Add some global counters for SMR.  These may eventually become per-smr
  counters.  In my stress test there is only one poll for every 15,000
  frees.  This means we are effectively amortizing the cache coherency
  overhead even with very high write rates (3M/s/core).
  
  Reviewed by:  markj, rlibby
  Differential Revision:https://reviews.freebsd.org/D23463

Modified:
  head/sys/kern/subr_smr.c

Modified: head/sys/kern/subr_smr.c
==
--- head/sys/kern/subr_smr.cThu Feb  6 18:51:36 2020(r357636)
+++ head/sys/kern/subr_smr.cThu Feb  6 20:10:21 2020(r357637)
@@ -30,11 +30,13 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -162,6 +164,17 @@ static uma_zone_t smr_zone;
 #defineSMR_SEQ_MAX_ADVANCE SMR_SEQ_MAX_DELTA / 2
 #endif
 
+static SYSCTL_NODE(_debug, OID_AUTO, smr, CTLFLAG_RW, NULL, "SMR Stats");
+static counter_u64_t advance = EARLY_COUNTER;
+SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, advance, CTLFLAG_RD, &advance, "");
+static counter_u64_t advance_wait = EARLY_COUNTER;
+SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, advance_wait, CTLFLAG_RD, 
&advance_wait, "");
+static counter_u64_t poll = EARLY_COUNTER;
+SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll, CTLFLAG_RD, &poll, "");
+static counter_u64_t poll_scan = EARLY_COUNTER;
+SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll_scan, CTLFLAG_RD, &poll_scan, 
"");
+
+
 /*
  * Advance the write sequence and return the new value for use as the
  * wait goal.  This guarantees that any changes made by the calling
@@ -197,14 +210,17 @@ smr_advance(smr_t smr)
 */
s = zpcpu_get(smr)->c_shared;
goal = atomic_fetchadd_int(&s->s_wr_seq, SMR_SEQ_INCR) + SMR_SEQ_INCR;
+   counter_u64_add(advance, 1);
 
/*
 * Force a synchronization here if the goal is getting too
 * far ahead of the read sequence number.  This keeps the
 * wrap detecting arithmetic working in pathological cases.
 */
-   if (goal - atomic_load_int(&s->s_rd_seq) >= SMR_SEQ_MAX_DELTA)
+   if (goal - atomic_load_int(&s->s_rd_seq) >= SMR_SEQ_MAX_DELTA) {
+   counter_u64_add(advance_wait, 1);
smr_wait(smr, goal - SMR_SEQ_MAX_ADVANCE);
+   }
 
return (goal);
 }
@@ -263,6 +279,7 @@ smr_poll(smr_t smr, smr_seq_t goal, bool wait)
success = true;
critical_enter();
s = zpcpu_get(smr)->c_shared;
+   counter_u64_add_protected(poll, 1);
 
/*
 * Acquire barrier loads s_wr_seq after s_rd_seq so that we can not
@@ -306,6 +323,7 @@ smr_poll(smr_t smr, smr_seq_t goal, bool wait)
 * gone inactive.  Keep track of the oldest sequence currently
 * active as rd_seq.
 */
+   counter_u64_add_protected(poll_scan, 1);
rd_seq = s_wr_seq;
CPU_FOREACH(i) {
c = zpcpu_get_cpu(smr, i);
@@ -366,7 +384,7 @@ smr_poll(smr_t smr, smr_seq_t goal, bool wait)
s_rd_seq = atomic_load_int(&s->s_rd_seq);
do {
if (SMR_SEQ_LEQ(rd_seq, s_rd_seq))
-   break;
+   goto out;
} while (atomic_fcmpset_int(&s->s_rd_seq, &s_rd_seq, rd_seq) == 0);
 
 out:
@@ -426,3 +444,14 @@ smr_init(void)
smr_zone = uma_zcreate("SMR CPU", sizeof(struct smr),
NULL, NULL, NULL, NULL, (CACHE_LINE_SIZE * 2) - 1, UMA_ZONE_PCPU);
 }
+
+static void
+smr_init_counters(void *unused)
+{
+
+   advance = counter_u64_alloc(M_WAITOK);
+   advance_wait = counter_u64_alloc(M_WAITOK);
+   poll = counter_u64_alloc(M_WAITOK);
+   poll_scan = counter_u64_alloc(M_WAITOK);
+}
+SYSINIT(smr_counters, SI_SUB_CPU, SI_ORDER_ANY, smr_init_counters, NULL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357638 - head/usr.sbin/bsdinstall

2020-02-06 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Thu Feb  6 20:18:45 2020
New Revision: 357638
URL: https://svnweb.freebsd.org/changeset/base/357638

Log:
  Improve documentation of bootconfig and PARTITIONS
  
  - Mention bootconfig target in TARGETS section.
  - Document PARTITIONS variable, which is only mentioned in the examples,
but doesn't have its own point.
  
  Submitted by: arrowd@
  Reviewed by:  bcr
  Approved by:  bcr (mentor)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D22927

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

Modified: head/usr.sbin/bsdinstall/bsdinstall.8
==
--- head/usr.sbin/bsdinstall/bsdinstall.8   Thu Feb  6 20:10:21 2020
(r357637)
+++ head/usr.sbin/bsdinstall/bsdinstall.8   Thu Feb  6 20:18:45 2020
(r357638)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 21, 2019
+.Dd February 6, 2020
 .Dt BSDINSTALL 8
 .Os
 .Sh NAME
@@ -118,6 +118,8 @@ is set, also configures the network interfaces of the 
 Provides the installer's interactive guided disk partitioner for single-disk
 installations.
 Defaults to UFS.
+.It Cm bootconfig
+Detects an appropriate partition and installs UEFI boot loader files.
 .It Cm zfsboot
 Provides a ZFS-only automatic interactive disk partitioner.
 Creates a single
@@ -266,6 +268,15 @@ Default:
 .It Ev DISTRIBUTIONS
 The set of distributions to install, e.g., "base.txz kernel.txz ports.txz".
 Default: unset
+.It Ev PARTITIONS
+The partitioning of the disk onto which the system is being installed.
+See
+.Cm scriptedpart
+of
+the
+.Sx TARGETS
+section for format details.
+Default: unset
 .It Ev BSDINSTALL_DISTDIR
 The directory in which the distribution files can be found (or to which they
 should be downloaded).
@@ -443,6 +454,7 @@ PARTITIONS=ada0
 DISTRIBUTIONS="kernel.txz base.txz"
 
 #!/bin/sh
+gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
 sysrc ifconfig_em0=DHCP
 sysrc sshd_enable=YES
 pkg install puppet
___
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: r357639 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2020-02-06 Thread Alexander Motin
Author: mav
Date: Thu Feb  6 20:32:53 2020
New Revision: 357639
URL: https://svnweb.freebsd.org/changeset/base/357639

Log:
  Reduce number of atomic_add() calls in aggsum.
  
  Previous code used 4 atomics to do aggsum_flush_bucket() and 2 more to
  re-borrow after the flush.  But since asc_borrowed and asc_delta are
  accessed only while holding asc_lock, it makes no any sense to modify
  as_lower_bound and as_upper_bound in multiple steps.  Instead of that
  the new code uses only 2 atomics in all the cases, one per as_*_bound
  variable.  I think even that is overkill, simple atomic store and
  load could be used here, since all modifications are done under the
  as_lock, but there are no such primitives in ZFS code now.
  
  While there, make borrow code consider previous borrow value, so that
  on mixed request patterns reduce chance of needing to borrow again if
  much larger request follows tiny one that needed borrow.
  
  Also reduce as_numbuckets from uint64_t to u_int.  It makes no sense
  to use so large division operation on every aggsum_add().
  
  Reviewed by:  Brian Behlendorf, Paul Dagnelie
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.cThu Feb 
 6 20:18:45 2020(r357638)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.cThu Feb 
 6 20:32:53 2020(r357639)
@@ -125,13 +125,11 @@ aggsum_flush_bucket(aggsum_t *as, struct aggsum_bucket
 * We use atomic instructions for this because we read the upper and
 * lower bounds without the lock, so we need stores to be atomic.
 */
-   atomic_add_64((volatile uint64_t *)&as->as_lower_bound, asb->asc_delta);
-   atomic_add_64((volatile uint64_t *)&as->as_upper_bound, asb->asc_delta);
-   asb->asc_delta = 0;
-   atomic_add_64((volatile uint64_t *)&as->as_upper_bound,
-   -asb->asc_borrowed);
atomic_add_64((volatile uint64_t *)&as->as_lower_bound,
-   asb->asc_borrowed);
+   asb->asc_delta + asb->asc_borrowed);
+   atomic_add_64((volatile uint64_t *)&as->as_upper_bound,
+   asb->asc_delta - asb->asc_borrowed);
+   asb->asc_delta = 0;
asb->asc_borrowed = 0;
 }
 
@@ -163,40 +161,43 @@ aggsum_value(aggsum_t *as)
return (rv);
 }
 
-static void
-aggsum_borrow(aggsum_t *as, int64_t delta, struct aggsum_bucket *asb)
-{
-   int64_t abs_delta = (delta < 0 ? -delta : delta);
-   mutex_enter(&as->as_lock);
-   mutex_enter(&asb->asc_lock);
-
-   aggsum_flush_bucket(as, asb);
-
-   atomic_add_64((volatile uint64_t *)&as->as_upper_bound, abs_delta);
-   atomic_add_64((volatile uint64_t *)&as->as_lower_bound, -abs_delta);
-   asb->asc_borrowed = abs_delta;
-
-   mutex_exit(&asb->asc_lock);
-   mutex_exit(&as->as_lock);
-}
-
 void
 aggsum_add(aggsum_t *as, int64_t delta)
 {
struct aggsum_bucket *asb =
&as->as_buckets[CPU_SEQID % as->as_numbuckets];
+   int64_t borrow;
 
-   for (;;) {
-   mutex_enter(&asb->asc_lock);
-   if (asb->asc_delta + delta <= (int64_t)asb->asc_borrowed &&
-   asb->asc_delta + delta >= -(int64_t)asb->asc_borrowed) {
-   asb->asc_delta += delta;
-   mutex_exit(&asb->asc_lock);
-   return;
-   }
+   /* Try fast path if we already borrowed enough before. */
+   mutex_enter(&asb->asc_lock);
+   if (asb->asc_delta + delta <= (int64_t)asb->asc_borrowed &&
+   asb->asc_delta + delta >= -(int64_t)asb->asc_borrowed) {
+   asb->asc_delta += delta;
mutex_exit(&asb->asc_lock);
-   aggsum_borrow(as, delta * aggsum_borrow_multiplier, asb);
+   return;
}
+   mutex_exit(&asb->asc_lock);
+
+   /*
+* We haven't borrowed enough.  Take the global lock and borrow
+* considering what is requested now and what we borrowed before.
+*/
+   borrow = (delta < 0 ? -delta : delta) * aggsum_borrow_multiplier;
+   mutex_enter(&as->as_lock);
+   mutex_enter(&asb->asc_lock);
+   delta += asb->asc_delta;
+   asb->asc_delta = 0;
+   if (borrow >= asb->asc_borrowed)
+   borrow -= asb->asc_borrowed;
+   else
+   borrow = (borrow - (int64_t)asb->asc_borrowed) / 4;
+   asb->asc_borrowed += borrow;
+   atomic_add_64((volatile uint64_t *)&as->as_lower_bound,
+   delta - borrow);
+   atomic_add_64((volatile uint64_t *)&as->as_upper_bound,
+   delta + borrow);
+   mutex_exit(&asb->asc_lock);
+   mutex_exit(&as->as_loc

svn commit: r357640 - head/sys/net

2020-02-06 Thread Jeff Roberson
Author: jeff
Date: Thu Feb  6 20:47:50 2020
New Revision: 357640
URL: https://svnweb.freebsd.org/changeset/base/357640

Log:
  Temporarily force IFF_NEEDSEPOCH until drivers have been resolved.
  
  Recent network epoch changes have left some drivers unexpectedly broken
  and there is not yet a consensus on the correct fix.  This is patch is
  a minor performance impact until we can agree on the correct path
  forward.
  
  Reviewed by:  core, network, imp, glebius, hselasky
  Differential Revision:https://reviews.freebsd.org/D23515

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Thu Feb  6 20:32:53 2020(r357639)
+++ head/sys/net/if.c   Thu Feb  6 20:47:50 2020(r357640)
@@ -546,6 +546,8 @@ if_alloc_domain(u_char type, int numa_domain)
 #ifdef VIMAGE
ifp->if_vnet = curvnet;
 #endif
+   /* XXX */
+   ifp->if_flags |= IFF_NEEDSEPOCH;
if (if_com_alloc[type] != NULL) {
ifp->if_l2com = if_com_alloc[type](type, ifp);
if (ifp->if_l2com == NULL) {
@@ -4152,7 +4154,8 @@ if_setdrvflags(if_t ifp, int flags)
 int
 if_setflags(if_t ifp, int flags)
 {
-   ((struct ifnet *)ifp)->if_flags = flags;
+   /* XXX Temporary */
+   ((struct ifnet *)ifp)->if_flags = flags | IFF_NEEDSEPOCH;
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357641 - head/sys/kern

2020-02-06 Thread Jeff Roberson
Author: jeff
Date: Thu Feb  6 20:51:46 2020
New Revision: 357641
URL: https://svnweb.freebsd.org/changeset/base/357641

Log:
  Fix a race in smr_advance() that could result in unnecessary poll calls.
  
  This was relatively harmless but surprising to see in counters.  The
  race occurred when rd_seq was read after the goal was updated and we
  incorrectly calculated the delta between them.
  
  Reviewed by:  rlibby
  Differential Revision:https://reviews.freebsd.org/D23464

Modified:
  head/sys/kern/subr_smr.c

Modified: head/sys/kern/subr_smr.c
==
--- head/sys/kern/subr_smr.cThu Feb  6 20:47:50 2020(r357640)
+++ head/sys/kern/subr_smr.cThu Feb  6 20:51:46 2020(r357641)
@@ -160,7 +160,7 @@ static uma_zone_t smr_zone;
 #defineSMR_SEQ_INCR(UINT_MAX / 1)
 #defineSMR_SEQ_INIT(UINT_MAX - 10)
 /* Force extra polls to test the integer overflow detection. */
-#defineSMR_SEQ_MAX_DELTA   (1000)
+#defineSMR_SEQ_MAX_DELTA   (SMR_SEQ_INCR * 32)
 #defineSMR_SEQ_MAX_ADVANCE SMR_SEQ_MAX_DELTA / 2
 #endif
 
@@ -188,7 +188,7 @@ smr_seq_t
 smr_advance(smr_t smr)
 {
smr_shared_t s;
-   smr_seq_t goal;
+   smr_seq_t goal, s_rd_seq;
 
/*
 * It is illegal to enter while in an smr section.
@@ -203,12 +203,18 @@ smr_advance(smr_t smr)
atomic_thread_fence_rel();
 
/*
+* Load the current read seq before incrementing the goal so
+* we are guaranteed it is always < goal.
+*/
+   s = zpcpu_get(smr)->c_shared;
+   s_rd_seq = atomic_load_acq_int(&s->s_rd_seq);
+
+   /*
 * Increment the shared write sequence by 2.  Since it is
 * initialized to 1 this means the only valid values are
 * odd and an observed value of 0 in a particular CPU means
 * it is not currently in a read section.
 */
-   s = zpcpu_get(smr)->c_shared;
goal = atomic_fetchadd_int(&s->s_wr_seq, SMR_SEQ_INCR) + SMR_SEQ_INCR;
counter_u64_add(advance, 1);
 
@@ -217,7 +223,7 @@ smr_advance(smr_t smr)
 * far ahead of the read sequence number.  This keeps the
 * wrap detecting arithmetic working in pathological cases.
 */
-   if (goal - atomic_load_int(&s->s_rd_seq) >= SMR_SEQ_MAX_DELTA) {
+   if (SMR_SEQ_DELTA(goal, s_rd_seq) >= SMR_SEQ_MAX_DELTA) {
counter_u64_add(advance_wait, 1);
smr_wait(smr, goal - SMR_SEQ_MAX_ADVANCE);
}
___
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: r357642 - in head/sys/modules: ix ixv lio oce vmm

2020-02-06 Thread Mark Johnston
Author: markj
Date: Thu Feb  6 21:01:19 2020
New Revision: 357642
URL: https://svnweb.freebsd.org/changeset/base/357642

Log:
  Remove more manual additions of -DSMP.
  
  Since r357598 this should no longer be necessary.

Modified:
  head/sys/modules/ix/Makefile
  head/sys/modules/ixv/Makefile
  head/sys/modules/lio/Makefile
  head/sys/modules/oce/Makefile
  head/sys/modules/vmm/Makefile

Modified: head/sys/modules/ix/Makefile
==
--- head/sys/modules/ix/MakefileThu Feb  6 20:51:46 2020
(r357641)
+++ head/sys/modules/ix/MakefileThu Feb  6 21:01:19 2020
(r357642)
@@ -10,6 +10,6 @@ SRCS+= if_ix.c if_bypass.c if_fdir.c if_sriov.c ix
 SRCS+= ixgbe_common.c ixgbe_api.c ixgbe_phy.c ixgbe_mbx.c ixgbe_vf.c
 SRCS+= ixgbe_dcb.c ixgbe_dcb_82598.c ixgbe_dcb_82599.c
 SRCS+= ixgbe_82598.c ixgbe_82599.c ixgbe_x540.c ixgbe_x550.c
-CFLAGS+= -I${SRCTOP}/sys/dev/ixgbe -DSMP
+CFLAGS+= -I${SRCTOP}/sys/dev/ixgbe
 
 .include 

Modified: head/sys/modules/ixv/Makefile
==
--- head/sys/modules/ixv/Makefile   Thu Feb  6 20:51:46 2020
(r357641)
+++ head/sys/modules/ixv/Makefile   Thu Feb  6 21:01:19 2020
(r357642)
@@ -10,6 +10,6 @@ SRCS+= if_ixv.c if_fdir.c ix_txrx.c ixgbe_osdep.c
 SRCS+= ixgbe_common.c ixgbe_api.c ixgbe_phy.c ixgbe_mbx.c ixgbe_vf.c
 SRCS+= ixgbe_dcb.c ixgbe_dcb_82598.c ixgbe_dcb_82599.c
 SRCS+= ixgbe_82598.c ixgbe_82599.c ixgbe_x540.c ixgbe_x550.c
-CFLAGS+= -I${SRCTOP}/sys/dev/ixgbe -DSMP
+CFLAGS+= -I${SRCTOP}/sys/dev/ixgbe
 
 .include 

Modified: head/sys/modules/lio/Makefile
==
--- head/sys/modules/lio/Makefile   Thu Feb  6 20:51:46 2020
(r357641)
+++ head/sys/modules/lio/Makefile   Thu Feb  6 21:01:19 2020
(r357642)
@@ -7,7 +7,6 @@
 KMOD = if_lio
 CFLAGS += -I${.CURDIR}/../../dev/liquidio
 CFLAGS += -I${.CURDIR}/../../dev/liquidio/base
-CFLAGS += -DSMP
 
 SRCS = device_if.h bus_if.h pci_if.h vnode_if.h opt_inet.h opt_inet6.h
 SRCS += vnode_if_newproto.h vnode_if_typedef.h

Modified: head/sys/modules/oce/Makefile
==
--- head/sys/modules/oce/Makefile   Thu Feb  6 20:51:46 2020
(r357641)
+++ head/sys/modules/oce/Makefile   Thu Feb  6 21:01:19 2020
(r357642)
@@ -7,7 +7,7 @@ KMOD= if_oce
 SRCS= oce_if.c oce_hw.c oce_mbox.c oce_util.c oce_queue.c oce_sysctl.c
 SRCS+= bus_if.h device_if.h pci_if.h opt_inet.h opt_inet6.h
 
-CFLAGS+= -I${SRCTOP}/sys/dev/oce -DSMP
+CFLAGS+= -I${SRCTOP}/sys/dev/oce
 
 # uncomment for lock profiling statistics
 #CFLAGS  += -DLOCK_PROFILING

Modified: head/sys/modules/vmm/Makefile
==
--- head/sys/modules/vmm/Makefile   Thu Feb  6 20:51:46 2020
(r357641)
+++ head/sys/modules/vmm/Makefile   Thu Feb  6 21:01:19 2020
(r357642)
@@ -6,7 +6,7 @@ SRCS=   opt_acpi.h opt_ddb.h device_if.h bus_if.h pci_if
 DPSRCS+=   vmx_assym.h svm_assym.h
 DPSRCS+=   vmx_genassym.c svm_genassym.c offset.inc
 
-CFLAGS+= -DVMM_KEEP_STATS -DSMP
+CFLAGS+= -DVMM_KEEP_STATS
 CFLAGS+= -I${SRCTOP}/sys/amd64/vmm
 CFLAGS+= -I${SRCTOP}/sys/amd64/vmm/io
 CFLAGS+= -I${SRCTOP}/sys/amd64/vmm/intel
___
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: r357614 - in head/sys: kern sys

2020-02-06 Thread Konstantin Belousov
On Thu, Feb 06, 2020 at 05:41:52PM +0100, Hans Petter Selasky wrote:
> On 2020-02-06 13:45, Pawel Biernacki wrote:
> > +#ifdef notyet
> > +#defineSYSCTL_ENFORCE_FLAGS(x) 
> > \
> > +_Static_assert(((CTLFLAG_MPSAFE ^ CTLFLAG_NEEDGIANT) & (x)),   \
> > +"Has to be either CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT")
> > +#else
> > +#defineSYSCTL_ENFORCE_FLAGS(x)
> > +#endif
> 
> Like cem@ pointed out, either you expand the XOR via OR or you can also do
> it like this:
> 
> (((x) & CTLFLAG_MPSAFE) != 0) ^ (((x) & CTLFLAG_NEEDGIANT) != 0)
The intent was to do exactly this, xor the bools.

> 
> which avoids having to define another macro.
> 
> --HPS
___
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: r357643 - head/lib/libc/riscv/gen

2020-02-06 Thread John Baldwin
Author: jhb
Date: Thu Feb  6 21:46:15 2020
New Revision: 357643
URL: https://svnweb.freebsd.org/changeset/base/357643

Log:
  Tidy the _set_tp function for RISC-V.
  
  - Use a constant for the offset instead of a magic number.
  - Use an addi instruction that writes to tp directly instead of a mv
that writes the result of a compiler-generated addi.
  
  Reviewed by:  mhorne
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23521

Modified:
  head/lib/libc/riscv/gen/_set_tp.c

Modified: head/lib/libc/riscv/gen/_set_tp.c
==
--- head/lib/libc/riscv/gen/_set_tp.c   Thu Feb  6 21:01:19 2020
(r357642)
+++ head/lib/libc/riscv/gen/_set_tp.c   Thu Feb  6 21:46:15 2020
(r357643)
@@ -38,13 +38,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include 
 
+/* NB: size of 'struct tcb'. */
+#defineTP_OFFSET   (sizeof(void *) * 2)
+
 void
 _set_tp(void *tp)
 {
 
-   __asm __volatile("mv  tp, %0" :: "r"((char*)tp + 0x10));
+   __asm __volatile("addi  tp, %0, %1" :: "r" (tp), "I" (TP_OFFSET));
 }
___
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: r357641 - head/sys/kern

2020-02-06 Thread Michael Tuexen



> On 6. Feb 2020, at 21:51, Jeff Roberson  wrote:
> 
> Author: jeff
> Date: Thu Feb  6 20:51:46 2020
> New Revision: 357641
> URL: https://svnweb.freebsd.org/changeset/base/357641
> 
> Log:
>  Fix a race in smr_advance() that could result in unnecessary poll calls.
> 
>  This was relatively harmless but surprising to see in counters.  The
>  race occurred when rd_seq was read after the goal was updated and we
>  incorrectly calculated the delta between them.
> 
>  Reviewed by: rlibby
>  Differential Revision:   https://reviews.freebsd.org/D23464
> 
> Modified:
>  head/sys/kern/subr_smr.c
> 
> Modified: head/sys/kern/subr_smr.c
> ==
> --- head/sys/kern/subr_smr.c  Thu Feb  6 20:47:50 2020(r357640)
> +++ head/sys/kern/subr_smr.c  Thu Feb  6 20:51:46 2020(r357641)
> @@ -160,7 +160,7 @@ static uma_zone_t smr_zone;
> #define   SMR_SEQ_INCR(UINT_MAX / 1)
> #define   SMR_SEQ_INIT(UINT_MAX - 10)
> /* Force extra polls to test the integer overflow detection. */
> -#define  SMR_SEQ_MAX_DELTA   (1000)
> +#define  SMR_SEQ_MAX_DELTA   (SMR_SEQ_INCR * 32)
> #define   SMR_SEQ_MAX_ADVANCE SMR_SEQ_MAX_DELTA / 2
> #endif
> 
> @@ -188,7 +188,7 @@ smr_seq_t
> smr_advance(smr_t smr)
> {
>   smr_shared_t s;
> - smr_seq_t goal;
> + smr_seq_t goal, s_rd_seq;
> 
>   /*
>* It is illegal to enter while in an smr section.
> @@ -203,12 +203,18 @@ smr_advance(smr_t smr)
>   atomic_thread_fence_rel();
> 
>   /*
> +  * Load the current read seq before incrementing the goal so
> +  * we are guaranteed it is always < goal.
> +  */
> + s = zpcpu_get(smr)->c_shared;
> + s_rd_seq = atomic_load_acq_int(&s->s_rd_seq);
> +
> + /*
>* Increment the shared write sequence by 2.  Since it is
>* initialized to 1 this means the only valid values are
>* odd and an observed value of 0 in a particular CPU means
>* it is not currently in a read section.
>*/
> - s = zpcpu_get(smr)->c_shared;
>   goal = atomic_fetchadd_int(&s->s_wr_seq, SMR_SEQ_INCR) + SMR_SEQ_INCR;
>   counter_u64_add(advance, 1);
> 
> @@ -217,7 +223,7 @@ smr_advance(smr_t smr)
>* far ahead of the read sequence number.  This keeps the
>* wrap detecting arithmetic working in pathological cases.
>*/
> - if (goal - atomic_load_int(&s->s_rd_seq) >= SMR_SEQ_MAX_DELTA) {
> + if (SMR_SEQ_DELTA(goal, s_rd_seq) >= SMR_SEQ_MAX_DELTA) {
SMR_SEQ_DELTA is not defined, therefore compilation fails.

Best regards
Michael
>   counter_u64_add(advance_wait, 1);
>   smr_wait(smr, goal - SMR_SEQ_MAX_ADVANCE);
>   }

___
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: r357641 - head/sys/kern

2020-02-06 Thread Jung-uk Kim
On 2/6/20, Michael Tuexen wrote:
> 
> 
>> On 6. Feb 2020, at 21:51, Jeff Roberson  wrote:
>>
>> Author: jeff
>> Date: Thu Feb  6 20:51:46 2020
>> New Revision: 357641
>> URL: https://svnweb.freebsd.org/changeset/base/357641
>>
>> Log:
>>  Fix a race in smr_advance() that could result in unnecessary poll calls.
>>
>>  This was relatively harmless but surprising to see in counters.  The
>>  race occurred when rd_seq was read after the goal was updated and we
>>  incorrectly calculated the delta between them.
>>
>>  Reviewed by:rlibby
>>  Differential Revision:  https://reviews.freebsd.org/D23464
>>
>> Modified:
>>  head/sys/kern/subr_smr.c
>>
>> Modified: head/sys/kern/subr_smr.c
>> ==
>> --- head/sys/kern/subr_smr.c Thu Feb  6 20:47:50 2020(r357640)
>> +++ head/sys/kern/subr_smr.c Thu Feb  6 20:51:46 2020(r357641)
>> @@ -160,7 +160,7 @@ static uma_zone_t smr_zone;
>> #define  SMR_SEQ_INCR(UINT_MAX / 1)
>> #define  SMR_SEQ_INIT(UINT_MAX - 10)
>> /* Force extra polls to test the integer overflow detection. */
>> -#define SMR_SEQ_MAX_DELTA   (1000)
>> +#define SMR_SEQ_MAX_DELTA   (SMR_SEQ_INCR * 32)
>> #define  SMR_SEQ_MAX_ADVANCE SMR_SEQ_MAX_DELTA / 2
>> #endif
>>
>> @@ -188,7 +188,7 @@ smr_seq_t
>> smr_advance(smr_t smr)
>> {
>>  smr_shared_t s;
>> -smr_seq_t goal;
>> +smr_seq_t goal, s_rd_seq;
>>
>>  /*
>>   * It is illegal to enter while in an smr section.
>> @@ -203,12 +203,18 @@ smr_advance(smr_t smr)
>>  atomic_thread_fence_rel();
>>
>>  /*
>> + * Load the current read seq before incrementing the goal so
>> + * we are guaranteed it is always < goal.
>> + */
>> +s = zpcpu_get(smr)->c_shared;
>> +s_rd_seq = atomic_load_acq_int(&s->s_rd_seq);
>> +
>> +/*
>>   * Increment the shared write sequence by 2.  Since it is
>>   * initialized to 1 this means the only valid values are
>>   * odd and an observed value of 0 in a particular CPU means
>>   * it is not currently in a read section.
>>   */
>> -s = zpcpu_get(smr)->c_shared;
>>  goal = atomic_fetchadd_int(&s->s_wr_seq, SMR_SEQ_INCR) + SMR_SEQ_INCR;
>>  counter_u64_add(advance, 1);
>>
>> @@ -217,7 +223,7 @@ smr_advance(smr_t smr)
>>   * far ahead of the read sequence number.  This keeps the
>>   * wrap detecting arithmetic working in pathological cases.
>>   */
>> -if (goal - atomic_load_int(&s->s_rd_seq) >= SMR_SEQ_MAX_DELTA) {
>> +if (SMR_SEQ_DELTA(goal, s_rd_seq) >= SMR_SEQ_MAX_DELTA) {
> SMR_SEQ_DELTA is not defined, therefore compilation fails.

https://reviews.freebsd.org/D23464#516866
https://reviews.freebsd.org/D23464#516881

Jung-uk Kim

> Best regards
> Michael
>>  counter_u64_add(advance_wait, 1);
>>  smr_wait(smr, goal - SMR_SEQ_MAX_ADVANCE);
>>  }



signature.asc
Description: OpenPGP digital signature


svn commit: r357644 - head/sys/sys

2020-02-06 Thread Ryan Libby
Author: rlibby
Date: Fri Feb  7 00:47:58 2020
New Revision: 357644
URL: https://svnweb.freebsd.org/changeset/base/357644

Log:
  smr.h: fix build after r357641
  
  r357641 missed committing the change to sys/sys/smr.h.
  
  Reported by:  jkim
  Submitted by: jeff
  Reviewed by:  rlibby
  Differential Revision:https://reviews.freebsd.org/D23464

Modified:
  head/sys/sys/smr.h

Modified: head/sys/sys/smr.h
==
--- head/sys/sys/smr.h  Thu Feb  6 21:46:15 2020(r357643)
+++ head/sys/sys/smr.h  Fri Feb  7 00:47:58 2020(r357644)
@@ -49,6 +49,7 @@
 #defineSMR_SEQ_LEQ(a, b)   ((int32_t)((a)-(b)) <= 0)
 #defineSMR_SEQ_GT(a, b)((int32_t)((a)-(b)) > 0)
 #defineSMR_SEQ_GEQ(a, b)   ((int32_t)((a)-(b)) >= 0)
+#defineSMR_SEQ_DELTA(a, b) ((int32_t)((a)-(b)))
 
 #defineSMR_SEQ_INVALID 0
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"