Re: svn commit: r356437 - head/lib/libprocstat

2020-01-06 Thread Cy Schubert
In message <20200107064255.18dad9d2@freyja>, "O. Hartmann" writes:
> On Tue, 7 Jan 2020 05:33:33 + (UTC)
> Mateusz Guzik  wrote:
>
> > Author: mjg
> > Date: Tue Jan  7 05:33:33 2020
> > New Revision: 356437
> > URL: https://svnweb.freebsd.org/changeset/base/356437
> >
> > Log:
> >   procstat: read lo_name instead of now removed v_tag
> >
> > Modified:
> >   head/lib/libprocstat/libprocstat.c
> >
> > Modified: head/lib/libprocstat/libprocstat.c
> > ===
> ===
> > --- head/lib/libprocstat/libprocstat.c  Tue Jan  7 04:34:29 2020
> > (r356436) +++ head/lib/libprocstat/libprocstat.cTue Jan  7 05:33:33
> > 2020(r356437) @@ -1278,10 +1278,10 @@
> > procstat_get_vnode_info_kvm(kvm_t *kd, struct filestat vn->vn_type =
> > vntype2psfsttype(vnode.v_type); if (vnode.v_type == VNON || vnode.v_type ==
> > VBAD) return (0);
> > -   error = kvm_read_all(kd, (unsigned long)vnode.v_tag, tagstr,
> > -   sizeof(tagstr));
> > +   error = kvm_read_all(kd, (unsigned
> > long)vnode.v_lock.lock_object.lo_name,
> > +   tagstr, sizeof(tagstr));
> > if (error == 0) {
> > -   warnx("can't read v_tag at %p", (void *)vp);
> > +   warnx("can't read lo_name at %p", (void *)vp);
> > goto fail;
> > }
> > tagstr[sizeof(tagstr) - 1] = '\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"
>
> This commit makes buildworld to fail:
>
> [...]
> --- lib/libprocstat__L ---
> /usr/src/lib/libprocstat/libprocstat.c:848:2: warning: variable 'files' is us
> ed
> uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
> default: ^~~
> /usr/src/lib/libprocstat/libprocstat.c:851:6: note: uninitialized use occurs
> here if (files == NULL && errno != EPERM) {
> ^
> /usr/src/lib/libprocstat/libprocstat.c:827:32: note: initialize the variable
> 'files' to silence this warning struct kinfo_file *kif, *files;
>   ^
>= NULL
> /usr/src/lib/libprocstat/libprocstat.c:1281:48: error: no member named 'v_tag
> '
> in 'struct vnode'
>
> [...]
>
> Kind regards,
>
> oh
>
>

It would appear you don't have this commit in your tree.


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

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


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


Re: svn commit: r356437 - head/lib/libprocstat

2020-01-06 Thread O. Hartmann
On Tue, 7 Jan 2020 05:33:33 + (UTC)
Mateusz Guzik  wrote:

> Author: mjg
> Date: Tue Jan  7 05:33:33 2020
> New Revision: 356437
> URL: https://svnweb.freebsd.org/changeset/base/356437
>
> Log:
>   procstat: read lo_name instead of now removed v_tag
>
> Modified:
>   head/lib/libprocstat/libprocstat.c
>
> Modified: head/lib/libprocstat/libprocstat.c
> ==
> --- head/lib/libprocstat/libprocstat.cTue Jan  7 04:34:29 2020
> (r356436) +++ head/lib/libprocstat/libprocstat.c  Tue Jan  7 05:33:33
> 2020  (r356437) @@ -1278,10 +1278,10 @@
> procstat_get_vnode_info_kvm(kvm_t *kd, struct filestat vn->vn_type =
> vntype2psfsttype(vnode.v_type); if (vnode.v_type == VNON || vnode.v_type ==
> VBAD) return (0);
> - error = kvm_read_all(kd, (unsigned long)vnode.v_tag, tagstr,
> - sizeof(tagstr));
> + error = kvm_read_all(kd, (unsigned
> long)vnode.v_lock.lock_object.lo_name,
> + tagstr, sizeof(tagstr));
>   if (error == 0) {
> - warnx("can't read v_tag at %p", (void *)vp);
> + warnx("can't read lo_name at %p", (void *)vp);
>   goto fail;
>   }
>   tagstr[sizeof(tagstr) - 1] = '\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"

This commit makes buildworld to fail:

[...]
--- lib/libprocstat__L ---
/usr/src/lib/libprocstat/libprocstat.c:848:2: warning: variable 'files' is used
uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default: ^~~
/usr/src/lib/libprocstat/libprocstat.c:851:6: note: uninitialized use occurs
here if (files == NULL && errno != EPERM) {
^
/usr/src/lib/libprocstat/libprocstat.c:827:32: note: initialize the variable
'files' to silence this warning struct kinfo_file *kif, *files;
  ^
   = NULL
/usr/src/lib/libprocstat/libprocstat.c:1281:48: error: no member named 'v_tag'
in 'struct vnode'

[...]

Kind regards,

oh
___
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: r356437 - head/lib/libprocstat

2020-01-06 Thread Mateusz Guzik
Author: mjg
Date: Tue Jan  7 05:33:33 2020
New Revision: 356437
URL: https://svnweb.freebsd.org/changeset/base/356437

Log:
  procstat: read lo_name instead of now removed v_tag

Modified:
  head/lib/libprocstat/libprocstat.c

Modified: head/lib/libprocstat/libprocstat.c
==
--- head/lib/libprocstat/libprocstat.c  Tue Jan  7 04:34:29 2020
(r356436)
+++ head/lib/libprocstat/libprocstat.c  Tue Jan  7 05:33:33 2020
(r356437)
@@ -1278,10 +1278,10 @@ procstat_get_vnode_info_kvm(kvm_t *kd, struct filestat
vn->vn_type = vntype2psfsttype(vnode.v_type);
if (vnode.v_type == VNON || vnode.v_type == VBAD)
return (0);
-   error = kvm_read_all(kd, (unsigned long)vnode.v_tag, tagstr,
-   sizeof(tagstr));
+   error = kvm_read_all(kd, (unsigned 
long)vnode.v_lock.lock_object.lo_name,
+   tagstr, sizeof(tagstr));
if (error == 0) {
-   warnx("can't read v_tag at %p", (void *)vp);
+   warnx("can't read lo_name at %p", (void *)vp);
goto fail;
}
tagstr[sizeof(tagstr) - 1] = '\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: r356436 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-01-06 Thread Mateusz Guzik
Author: mjg
Date: Tue Jan  7 04:34:29 2020
New Revision: 356436
URL: https://svnweb.freebsd.org/changeset/base/356436

Log:
  zfs: plug a vnode reserve leak in zfs_make_xattrdir

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c   Tue Jan 
 7 04:34:03 2020(r356435)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c   Tue Jan 
 7 04:34:29 2020(r356436)
@@ -829,6 +829,7 @@ zfs_make_xattrdir(znode_t *zp, vattr_t *vap, vnode_t *
if (error) {
zfs_acl_ids_free(_ids);
dmu_tx_abort(tx);
+   getnewvnode_drop_reserve();
return (error);
}
zfs_mknode(zp, vap, tx, cr, IS_XATTR, , _ids);
___
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: r356435 - head/sys/kern

2020-01-06 Thread Mateusz Guzik
Author: mjg
Date: Tue Jan  7 04:34:03 2020
New Revision: 356435
URL: https://svnweb.freebsd.org/changeset/base/356435

Log:
  vfs: prevent numvnodes and freevnodes re-reads when appropriate
  
  Otherwise in code like this:
  if (numvnodes > desiredvnodes)
vnlru_free_locked(numvnodes - desiredvnodes, NULL);
  
  numvnodes can drop below desiredvnodes prior to the call and if the
  compiler generated another read the subtraction would get a negative
  value.

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Jan  7 04:33:14 2020(r356434)
+++ head/sys/kern/vfs_subr.cTue Jan  7 04:34:03 2020(r356435)
@@ -1211,16 +1211,19 @@ vnlru_free(int count, struct vfsops *mnt_op)
 static int
 vspace(void)
 {
+   u_long rnumvnodes, rfreevnodes;
int space;
 
gapvnodes = imax(desiredvnodes - wantfreevnodes, 100);
vhiwat = gapvnodes / 11; /* 9% -- just under the 10% in vlrureclaim() */
vlowat = vhiwat / 2;
-   if (numvnodes > desiredvnodes)
+   rnumvnodes = atomic_load_long();
+   rfreevnodes = atomic_load_long();
+   if (rnumvnodes > desiredvnodes)
return (0);
-   space = desiredvnodes - numvnodes;
+   space = desiredvnodes - rnumvnodes;
if (freevnodes > wantfreevnodes)
-   space += freevnodes - wantfreevnodes;
+   space += rfreevnodes - wantfreevnodes;
return (space);
 }
 
@@ -1292,6 +1295,7 @@ static int vnlruproc_sig;
 static void
 vnlru_proc(void)
 {
+   u_long rnumvnodes, rfreevnodes;
struct mount *mp, *nmp;
unsigned long onumvnodes;
int done, force, trigger, usevnodes, vsp;
@@ -1304,13 +1308,14 @@ vnlru_proc(void)
for (;;) {
kproc_suspend_check(vnlruproc);
mtx_lock(_free_list_mtx);
+   rnumvnodes = atomic_load_long();
/*
 * If numvnodes is too large (due to desiredvnodes being
 * adjusted using its sysctl, or emergency growth), first
 * try to reduce it by discarding from the free list.
 */
-   if (numvnodes > desiredvnodes)
-   vnlru_free_locked(numvnodes - desiredvnodes, NULL);
+   if (rnumvnodes > desiredvnodes)
+   vnlru_free_locked(rnumvnodes - desiredvnodes, NULL);
/*
 * Sleep if the vnode cache is in a good state.  This is
 * when it is not over-full and has space for about a 4%
@@ -1332,7 +1337,10 @@ vnlru_proc(void)
}
mtx_unlock(_free_list_mtx);
done = 0;
-   onumvnodes = numvnodes;
+   rnumvnodes = atomic_load_long();
+   rfreevnodes = atomic_load_long();
+
+   onumvnodes = rnumvnodes;
/*
 * Calculate parameters for recycling.  These are the same
 * throughout the loop to give some semblance of fairness.
@@ -1340,10 +1348,10 @@ vnlru_proc(void)
 * of resident pages.  We aren't trying to free memory; we
 * are trying to recycle or at least free vnodes.
 */
-   if (numvnodes <= desiredvnodes)
-   usevnodes = numvnodes - freevnodes;
+   if (rnumvnodes <= desiredvnodes)
+   usevnodes = rnumvnodes - rfreevnodes;
else
-   usevnodes = numvnodes;
+   usevnodes = rnumvnodes;
if (usevnodes <= 0)
usevnodes = 1;
/*
@@ -1516,14 +1524,17 @@ getnewvnode_wait(int suspended)
 void
 getnewvnode_reserve(u_int count)
 {
+   u_long rnumvnodes, rfreevnodes;
struct thread *td;
 
/* Pre-adjust like the pre-adjust in getnewvnode(), with any count. */
/* XXX no longer so quick, but this part is not racy. */
mtx_lock(_free_list_mtx);
-   if (numvnodes + count > desiredvnodes && freevnodes > wantfreevnodes)
-   vnlru_free_locked(ulmin(numvnodes + count - desiredvnodes,
-   freevnodes - wantfreevnodes), NULL);
+   rnumvnodes = atomic_load_long();
+   rfreevnodes = atomic_load_long();
+   if (rnumvnodes + count > desiredvnodes && rfreevnodes > wantfreevnodes)
+   vnlru_free_locked(ulmin(rnumvnodes + count - desiredvnodes,
+   rfreevnodes - wantfreevnodes), NULL);
mtx_unlock(_free_list_mtx);
 
td = curthread;
___
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: r356434 - head/sbin/fsck_msdosfs

2020-01-06 Thread Xin LI
Author: delphij
Date: Tue Jan  7 04:33:14 2020
New Revision: 356434
URL: https://svnweb.freebsd.org/changeset/base/356434

Log:
  fsck_msdosfs.8: document -M.
  
  Reported by:  mckusick
  Reviewed by:  mckusick, emaste, bcr
  MFC after:28 days
  X-MFC-with:   r356313
  Differential Revision:https://reviews.freebsd.org/D23049

Modified:
  head/sbin/fsck_msdosfs/fsck_msdosfs.8

Modified: head/sbin/fsck_msdosfs/fsck_msdosfs.8
==
--- head/sbin/fsck_msdosfs/fsck_msdosfs.8   Tue Jan  7 04:30:49 2020
(r356433)
+++ head/sbin/fsck_msdosfs/fsck_msdosfs.8   Tue Jan  7 04:33:14 2020
(r356434)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 3, 2016
+.Dd January 6, 2020
 .Dt FSCK_MSDOSFS 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Op Fl Cf
 .Ar filesystem ...
 .Nm
-.Op Fl Cny
+.Op Fl CMny
 .Ar filesystem ...
 .Sh DESCRIPTION
 The
@@ -84,6 +84,21 @@ which seeks to determine whether the file system needs
 immediately in foreground, or if its cleaning can be deferred to background.
 FAT (MS-DOS) file systems must always be cleaned in the foreground.
 A non-zero exit code is always returned for this option.
+.It Fl M
+Causes
+.Nm
+to not use
+.Xr mmap 2
+when checking a FAT32 file system.
+This option is mainly for debugging purposes and is not normally necessary.
+The
+.Nm
+utility will automatically fall back to use a simple LRU cache of 4 MiB
+when it failed to perform
+.Xr mmap 2 ,
+or when
+.Fl M
+is specified.
 .It Fl f
 Force
 .Nm
___
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: r356433 - head/sys/kern

2020-01-06 Thread Mateusz Guzik
Author: mjg
Date: Tue Jan  7 04:30:49 2020
New Revision: 356433
URL: https://svnweb.freebsd.org/changeset/base/356433

Log:
  vfs: annotate numvnodes and vnode_free_list_mtx with __exclusive_cache_line

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Jan  7 04:29:34 2020(r356432)
+++ head/sys/kern/vfs_subr.cTue Jan  7 04:30:49 2020(r356433)
@@ -139,7 +139,7 @@ static int  v_inval_buf_range_locked(struct vnode *vp, 
  * Number of vnodes in existence.  Increased whenever getnewvnode()
  * allocates a new vnode, decreased in vdropl() for VIRF_DOOMED vnode.
  */
-static unsigned long   numvnodes;
+static u_long __exclusive_cache_line numvnodes;
 
 SYSCTL_ULONG(_vfs, OID_AUTO, numvnodes, CTLFLAG_RD, , 0,
 "Number of vnodes in existence");
@@ -227,7 +227,7 @@ static struct mtx mntid_mtx;
  * numvnodes
  * freevnodes
  */
-static struct mtx vnode_free_list_mtx;
+static struct mtx __exclusive_cache_line vnode_free_list_mtx;
 
 /* Publicly exported FS */
 struct nfs_public nfs_pub;
___
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: r356432 - in head/sys: kern security/mac_veriexec sys

2020-01-06 Thread Mateusz Guzik
Author: mjg
Date: Tue Jan  7 04:29:34 2020
New Revision: 356432
URL: https://svnweb.freebsd.org/changeset/base/356432

Log:
  vfs: eliminate v_tag from struct vnode
  
  There was only one consumer and it was using it incorrectly.
  
  It is given an equivalent hack.
  
  Reviewed by:  jeff
  Differential Revision:https://reviews.freebsd.org/D23037

Modified:
  head/sys/kern/vfs_subr.c
  head/sys/security/mac_veriexec/mac_veriexec.c
  head/sys/sys/vnode.h

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Jan  7 04:27:40 2020(r356431)
+++ head/sys/kern/vfs_subr.cTue Jan  7 04:29:34 2020(r356432)
@@ -1657,7 +1657,6 @@ alloc:
KASSERT(vp->v_lockf == NULL, ("stale v_lockf %p", vp));
KASSERT(vp->v_pollinfo == NULL, ("stale v_pollinfo %p", vp));
vp->v_type = VNON;
-   vp->v_tag = tag;
vp->v_op = vops;
v_init_counters(vp);
vp->v_bufobj.bo_ops = _ops_bio;
@@ -3679,7 +3678,7 @@ vgonel(struct vnode *vp)
if (mp != NULL)
vn_finished_secondary_write(mp);
VNASSERT(vp->v_object == NULL, vp,
-   ("vop_reclaim left v_object vp=%p, tag=%s", vp, vp->v_tag));
+   ("vop_reclaim left v_object vp=%p", vp));
/*
 * Clear the advisory locks and wake up waiting threads.
 */
@@ -3697,7 +3696,6 @@ vgonel(struct vnode *vp)
VI_LOCK(vp);
vp->v_vnlock = >v_lock;
vp->v_op = _vnodeops;
-   vp->v_tag = "none";
vp->v_type = VBAD;
 }
 
@@ -3733,7 +3731,7 @@ vn_printf(struct vnode *vp, const char *fmt, ...)
vprintf(fmt, ap);
va_end(ap);
printf("%p: ", (void *)vp);
-   printf("tag %s, type %s\n", vp->v_tag, typename[vp->v_type]);
+   printf("type %s\n", typename[vp->v_type]);
printf("usecount %d, writecount %d, refcount %d",
vp->v_usecount, vp->v_writecount, vp->v_holdcnt);
switch (vp->v_type) {

Modified: head/sys/security/mac_veriexec/mac_veriexec.c
==
--- head/sys/security/mac_veriexec/mac_veriexec.c   Tue Jan  7 04:27:40 
2020(r356431)
+++ head/sys/security/mac_veriexec/mac_veriexec.c   Tue Jan  7 04:29:34 
2020(r356432)
@@ -737,6 +737,22 @@ MAC_POLICY_SET(_veriexec_ops, mac_veriexec, MAC_VE
 MPC_LOADTIME_FLAG_NOTLATE, _veriexec_slot);
 MODULE_VERSION(mac_veriexec, 1);
 
+static struct vnode *
+mac_veriexec_bottom_vnode(struct vnode *vp)
+{
+   struct vnode *ldvp = NULL;
+
+   /*
+* XXX This code is bogus. nullfs is not the only stacking
+* filesystem. Less bogus code would add a VOP to reach bottom
+* vnode and would not make assumptions how to get there.
+*/
+   if (vp->v_mount != NULL &&
+   strcmp(vp->v_mount->mnt_vfc->vfc_name, "nullfs") == 0)
+   ldvp = NULLVPTOLOWERVP(vp);
+   return (ldvp);
+}
+
 /**
  * @brief Get the fingerprint status set on a vnode.
  *
@@ -748,6 +764,7 @@ fingerprint_status_t
 mac_veriexec_get_fingerprint_status(struct vnode *vp)
 {
fingerprint_status_t fps;
+   struct vnode *ldvp;
 
fps = SLOT(vp->v_label);
switch (fps) {
@@ -757,12 +774,9 @@ mac_veriexec_get_fingerprint_status(struct vnode *vp)
break;
default:
/* we may need to recurse */
-   if (strcmp(vp->v_tag, "null") == 0) {
-   struct vnode *ldvp;
-
-   ldvp = NULLVPTOLOWERVP(vp);
+   ldvp = mac_veriexec_bottom_vnode(vp);
+   if (ldvp != NULL)
return mac_veriexec_get_fingerprint_status(ldvp);
-   }
break;
}
return fps;
@@ -808,12 +822,11 @@ void
 mac_veriexec_set_fingerprint_status(struct vnode *vp,
 fingerprint_status_t fp_status)
 {
+   struct vnode *ldvp;
 
/* recurse until we find the real storage */
-   if (strcmp(vp->v_tag, "null") == 0) {
-   struct vnode *ldvp;
-
-   ldvp = NULLVPTOLOWERVP(vp);
+   ldvp = mac_veriexec_bottom_vnode(vp);
+   if (ldvp != NULL) {
mac_veriexec_set_fingerprint_status(ldvp, fp_status);
return;
}

Modified: head/sys/sys/vnode.h
==
--- head/sys/sys/vnode.hTue Jan  7 04:27:40 2020(r356431)
+++ head/sys/sys/vnode.hTue Jan  7 04:29:34 2020(r356432)
@@ -174,7 +174,6 @@ struct vnode {
int v_writecount;   /* I ref count of writers or
   (negative) text users */
u_int   v_hash;
-   const char *v_tag;  /* u type of underlying data */
 };
 
 #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */

svn commit: r356431 - head/sys/kern

2020-01-06 Thread Mateusz Guzik
Author: mjg
Date: Tue Jan  7 04:27:40 2020
New Revision: 356431
URL: https://svnweb.freebsd.org/changeset/base/356431

Log:
  vfs: add a helper for allocating marker vnodes

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Jan  7 00:54:45 2020(r356430)
+++ head/sys/kern/vfs_subr.cTue Jan  7 04:27:40 2020(r356431)
@@ -459,6 +459,28 @@ PCTRIE_DEFINE(BUF, buf, b_lblkno, buf_trie_alloc, buf_
 #defineMAXVNODES_MAX   (512 * 1024 * 1024 / 64)/* 8M */
 #endif
 
+static MALLOC_DEFINE(M_VNODE_MARKER, "vnodemarker", "vnode marker");
+
+static struct vnode *
+vn_alloc_marker(struct mount *mp)
+{
+   struct vnode *vp;
+
+   vp = malloc(sizeof(struct vnode), M_VNODE_MARKER, M_WAITOK | M_ZERO);
+   vp->v_type = VMARKER;
+   vp->v_mount = mp;
+
+   return (vp);
+}
+
+static void
+vn_free_marker(struct vnode *vp)
+{
+
+   MPASS(vp->v_type == VMARKER);
+   free(vp, M_VNODE_MARKER);
+}
+
 /*
  * Initialize a vnode as it first enters the zone.
  */
@@ -5785,7 +5807,6 @@ vfs_cache_root_set(struct mount *mp, struct vnode *vp)
  * This interface replaces MNT_VNODE_FOREACH.
  */
 
-MALLOC_DEFINE(M_VNODE_MARKER, "vnodemarker", "vnode marker");
 
 struct vnode *
 __mnt_vnode_next_all(struct vnode **mvp, struct mount *mp)
@@ -5825,11 +5846,9 @@ __mnt_vnode_first_all(struct vnode **mvp, struct mount
 {
struct vnode *vp;
 
-   *mvp = malloc(sizeof(struct vnode), M_VNODE_MARKER, M_WAITOK | M_ZERO);
+   *mvp = vn_alloc_marker(mp);
MNT_ILOCK(mp);
MNT_REF(mp);
-   (*mvp)->v_mount = mp;
-   (*mvp)->v_type = VMARKER;
 
TAILQ_FOREACH(vp, >mnt_nvnodelist, v_nmntvnodes) {
/* Allow a racy peek at VIRF_DOOMED to save a lock acquisition. 
*/
@@ -5845,7 +5864,7 @@ __mnt_vnode_first_all(struct vnode **mvp, struct mount
if (vp == NULL) {
MNT_REL(mp);
MNT_IUNLOCK(mp);
-   free(*mvp, M_VNODE_MARKER);
+   vn_free_marker(*mvp);
*mvp = NULL;
return (NULL);
}
@@ -5869,7 +5888,7 @@ __mnt_vnode_markerfree_all(struct vnode **mvp, struct 
TAILQ_REMOVE(>mnt_nvnodelist, *mvp, v_nmntvnodes);
MNT_REL(mp);
MNT_IUNLOCK(mp);
-   free(*mvp, M_VNODE_MARKER);
+   vn_free_marker(*mvp);
*mvp = NULL;
 }
 
@@ -5886,7 +5905,7 @@ mnt_vnode_markerfree_active(struct vnode **mvp, struct
MNT_ILOCK(mp);
MNT_REL(mp);
MNT_IUNLOCK(mp);
-   free(*mvp, M_VNODE_MARKER);
+   vn_free_marker(*mvp);
*mvp = NULL;
 }
 
@@ -6029,12 +6048,10 @@ __mnt_vnode_first_active(struct vnode **mvp, struct mo
 {
struct vnode *vp;
 
-   *mvp = malloc(sizeof(struct vnode), M_VNODE_MARKER, M_WAITOK | M_ZERO);
+   *mvp = vn_alloc_marker(mp);
MNT_ILOCK(mp);
MNT_REF(mp);
MNT_IUNLOCK(mp);
-   (*mvp)->v_type = VMARKER;
-   (*mvp)->v_mount = mp;
 
mtx_lock(>mnt_listmtx);
vp = TAILQ_FIRST(>mnt_activevnodelist);
___
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: r356393 - head/sys/vm

2020-01-06 Thread Gleb Smirnoff
  Jeff,

On Mon, Jan 06, 2020 at 02:51:19AM +, Jeff Roberson wrote:
J> Modified: head/sys/vm/vm_page.c
J> 
==
J> --- head/sys/vm/vm_page.cMon Jan  6 01:51:23 2020(r356392)
J> +++ head/sys/vm/vm_page.cMon Jan  6 02:51:19 2020(r356393)
J> @@ -613,10 +613,17 @@ vm_page_startup(vm_offset_t vaddr)
J>  slab_ipers(sizeof(struct vm_map), UMA_ALIGN_PTR));
J>  
J>  /*
J> - * Before going fully functional kmem_init() does allocation
J> - * from "KMAP ENTRY" and vmem_create() does allocation from "vmem".
J> + * Before we are fully boot strapped we need to account for the
J> + * following allocations:
J> + *
J> + * "KMAP ENTRY" from kmem_init()
J> + * "vmem btag" from vmem_startup()
J> + * "vmem" from vmem_create()
J> + * "KMAP" from vm_map_startup()
J> + *
J> + * Each needs at least one page per-domain.
J>   */
J> -boot_pages += 2;
J> +boot_pages += 4 * vm_ndomains;
J>  #endif
J>  /*
J>   * CTFLAG_RDTUN doesn't work during the early boot process, so we must

I think this chunk brings many extraneous pages per domain. Allocations
for "vmem btag" from vmem_startup() are covered by vmem_startup_count(),
and allocations for "KMAP" from vm_map_startup() are also counted just a
few lines above:

/* vmem_startup() calls uma_prealloc(). */
boot_pages += vmem_startup_count();
/* vm_map_startup() calls uma_prealloc(). */
boot_pages += howmany(MAX_KMAP,
slab_ipers(sizeof(struct vm_map), UMA_ALIGN_PTR));

The uma_prealloc() allocates as much memory as asked, it may not populate
all domains. So, on NUMA it will allocate same amount of pages. Not sure
if this is a right decision, but at lease the counting is correct. So, change
from 2 pages to 4 isn't needed.

The vm_ndomains multiplicator also seems incorrect, since at early stage
we run with buckets disabled, and this single allocation will end with
calling zone_alloc_item() calling zone_import() with count of 1, which
will short-circuit into keg_fetch_slab() before entering domain aware code.
Then keg_fetch_slab() will short circuit into startup_alloc().

Do machines with NUMA and lack of UMA_MD_SMALL_ALLOC exist? Interesting
to see dmesg with DIAGNOSTIC and this change.

-- 
Gleb Smirnoff
___
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: r356389 - head/sys/vm

2020-01-06 Thread Jeff Roberson

On Mon, 6 Jan 2020, Gleb Smirnoff wrote:


 Jeff,

On Sun, Jan 05, 2020 at 10:54:26PM +, Jeff Roberson wrote:
J> Author: jeff
J> Date: Sun Jan  5 22:54:25 2020
J> New Revision: 356389
J> URL: https://svnweb.freebsd.org/changeset/base/356389
J>
J> Log:
J>   The fix in r356353 was insufficient.  Not every architecture returns 0 for
J>   EARLY_COUNTER.  Only amd64 seems to.
J>
J>   Suggested by:   markj
J>   Reported by:lwhsu
J>   Reviewed by:markj
J>   PR: 243117
J>
J> Modified:
J>   head/sys/vm/uma_core.c
J>
J> Modified: head/sys/vm/uma_core.c
J> 
==
J> --- head/sys/vm/uma_core.cSun Jan  5 21:35:02 2020(r356388)
J> +++ head/sys/vm/uma_core.cSun Jan  5 22:54:25 2020(r356389)
J> @@ -4153,8 +4153,10 @@ uma_zone_get_cur(uma_zone_t zone)
J>   int64_t nitems;
J>   u_int i;
J>
J> - nitems = counter_u64_fetch(zone->uz_allocs) -
J> - counter_u64_fetch(zone->uz_frees);
J> + nitems = 0;
J> + if (zone->uz_allocs != EARLY_COUNTER && zone->uz_frees != EARLY_COUNTER)
J> + nitems = counter_u64_fetch(zone->uz_allocs) -
J> + counter_u64_fetch(zone->uz_frees);
J>   CPU_FOREACH(i)
J>   nitems += atomic_load_64(>uz_cpu[i].uc_allocs) -
J>   atomic_load_64(>uz_cpu[i].uc_frees);
J> @@ -4168,7 +4170,9 @@ uma_zone_get_allocs(uma_zone_t zone)
J>   uint64_t nitems;
J>   u_int i;
J>
J> - nitems = counter_u64_fetch(zone->uz_allocs);
J> + nitems = 0;
J> + if (zone->uz_allocs != EARLY_COUNTER)
J> + nitems = counter_u64_fetch(zone->uz_allocs);
J>   CPU_FOREACH(i)
J>   nitems += atomic_load_64(>uz_cpu[i].uc_allocs);
J>
J> @@ -4181,7 +4185,9 @@ uma_zone_get_frees(uma_zone_t zone)
J>   uint64_t nitems;
J>   u_int i;
J>
J> - nitems = counter_u64_fetch(zone->uz_frees);
J> + nitems = 0;
J> + if (zone->uz_frees != EARLY_COUNTER)
J> + nitems = counter_u64_fetch(zone->uz_frees);
J>   CPU_FOREACH(i)
J>   nitems += atomic_load_64(>uz_cpu[i].uc_frees);

IMHO, tidier code would be not to check the pointers, but check UMA booted 
status:

if (__predict_true(booted == BOOT_RUNNING))
nitems = counter_u64_fetch(zone->uz_frees);


That seems fine.  I have drained my UMA patch queue for now but if I come 
back around I will include this.


Thanks,
Jeff



--
Gleb Smirnoff


___
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: r356389 - head/sys/vm

2020-01-06 Thread Gleb Smirnoff
  Jeff,

On Sun, Jan 05, 2020 at 10:54:26PM +, Jeff Roberson wrote:
J> Author: jeff
J> Date: Sun Jan  5 22:54:25 2020
J> New Revision: 356389
J> URL: https://svnweb.freebsd.org/changeset/base/356389
J> 
J> Log:
J>   The fix in r356353 was insufficient.  Not every architecture returns 0 for
J>   EARLY_COUNTER.  Only amd64 seems to.
J>   
J>   Suggested by:  markj
J>   Reported by:   lwhsu
J>   Reviewed by:   markj
J>   PR:243117
J> 
J> Modified:
J>   head/sys/vm/uma_core.c
J> 
J> Modified: head/sys/vm/uma_core.c
J> 
==
J> --- head/sys/vm/uma_core.c   Sun Jan  5 21:35:02 2020(r356388)
J> +++ head/sys/vm/uma_core.c   Sun Jan  5 22:54:25 2020(r356389)
J> @@ -4153,8 +4153,10 @@ uma_zone_get_cur(uma_zone_t zone)
J>  int64_t nitems;
J>  u_int i;
J>  
J> -nitems = counter_u64_fetch(zone->uz_allocs) -
J> -counter_u64_fetch(zone->uz_frees);
J> +nitems = 0;
J> +if (zone->uz_allocs != EARLY_COUNTER && zone->uz_frees != EARLY_COUNTER)
J> +nitems = counter_u64_fetch(zone->uz_allocs) -
J> +counter_u64_fetch(zone->uz_frees);
J>  CPU_FOREACH(i)
J>  nitems += atomic_load_64(>uz_cpu[i].uc_allocs) -
J>  atomic_load_64(>uz_cpu[i].uc_frees);
J> @@ -4168,7 +4170,9 @@ uma_zone_get_allocs(uma_zone_t zone)
J>  uint64_t nitems;
J>  u_int i;
J>  
J> -nitems = counter_u64_fetch(zone->uz_allocs);
J> +nitems = 0;
J> +if (zone->uz_allocs != EARLY_COUNTER)
J> +nitems = counter_u64_fetch(zone->uz_allocs);
J>  CPU_FOREACH(i)
J>  nitems += atomic_load_64(>uz_cpu[i].uc_allocs);
J>  
J> @@ -4181,7 +4185,9 @@ uma_zone_get_frees(uma_zone_t zone)
J>  uint64_t nitems;
J>  u_int i;
J>  
J> -nitems = counter_u64_fetch(zone->uz_frees);
J> +nitems = 0;
J> +if (zone->uz_frees != EARLY_COUNTER)
J> +nitems = counter_u64_fetch(zone->uz_frees);
J>  CPU_FOREACH(i)
J>  nitems += atomic_load_64(>uz_cpu[i].uc_frees);

IMHO, tidier code would be not to check the pointers, but check UMA booted 
status:

if (__predict_true(booted == BOOT_RUNNING))
nitems = counter_u64_fetch(zone->uz_frees);

-- 
Gleb Smirnoff
___
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: r356426 - in head/sys/arm64: arm64 include

2020-01-06 Thread Andrew Turner
Author: andrew
Date: Mon Jan  6 20:57:59 2020
New Revision: 356426
URL: https://svnweb.freebsd.org/changeset/base/356426

Log:
  Add more Arm arm64 CPU identification values
  
   - Add all the Cortex-A CPU ID register values I can find.
   - Add the Neoverse-N1 ID regiser value [1]
   - Sort macros by register value.
  
  PR:   243065
  Submitted by: Ali Saidi  [1]
  Sponsored by: DARPA, AFRL (other than [1])

Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/include/cpu.h

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Mon Jan  6 19:47:59 2020
(r356425)
+++ head/sys/arm64/arm64/identcpu.c Mon Jan  6 20:57:59 2020
(r356426)
@@ -156,9 +156,14 @@ static const struct cpu_parts cpu_parts_arm[] = {
{ CPU_PART_CORTEX_A53, "Cortex-A53" },
{ CPU_PART_CORTEX_A55, "Cortex-A55" },
{ CPU_PART_CORTEX_A57, "Cortex-A57" },
+   { CPU_PART_CORTEX_A65, "Cortex-A65" },
{ CPU_PART_CORTEX_A72, "Cortex-A72" },
{ CPU_PART_CORTEX_A73, "Cortex-A73" },
{ CPU_PART_CORTEX_A75, "Cortex-A75" },
+   { CPU_PART_CORTEX_A76, "Cortex-A76" },
+   { CPU_PART_CORTEX_A76AE, "Cortex-A76AE" },
+   { CPU_PART_CORTEX_A77, "Cortex-A77" },
+   { CPU_PART_NEOVERSE_N1, "Neoverse-N1" },
CPU_PART_NONE,
 };
 /* Cavium */

Modified: head/sys/arm64/include/cpu.h
==
--- head/sys/arm64/include/cpu.hMon Jan  6 19:47:59 2020
(r356425)
+++ head/sys/arm64/include/cpu.hMon Jan  6 20:57:59 2020
(r356426)
@@ -81,13 +81,18 @@
 
 /* ARM Part numbers */
 #defineCPU_PART_FOUNDATION 0xD00
-#defineCPU_PART_CORTEX_A35 0xD04
 #defineCPU_PART_CORTEX_A53 0xD03
+#defineCPU_PART_CORTEX_A35 0xD04
 #defineCPU_PART_CORTEX_A55 0xD05
+#defineCPU_PART_CORTEX_A65 0xD06
 #defineCPU_PART_CORTEX_A57 0xD07
 #defineCPU_PART_CORTEX_A72 0xD08
 #defineCPU_PART_CORTEX_A73 0xD09
 #defineCPU_PART_CORTEX_A75 0xD0A
+#defineCPU_PART_CORTEX_A76 0xD0B
+#defineCPU_PART_NEOVERSE_N10xD0C
+#defineCPU_PART_CORTEX_A77 0xD0D
+#defineCPU_PART_CORTEX_A76AE   0xD0E
 
 /* Cavium Part numbers */
 #defineCPU_PART_THUNDERX   0x0A1
___
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: r356425 - head/sys/kern

2020-01-06 Thread Pawel Biernacki
Author: kaktus
Date: Mon Jan  6 19:47:59 2020
New Revision: 356425
URL: https://svnweb.freebsd.org/changeset/base/356425

Log:
  kern_sysctl: make sysctl.debug work as intended
  
  r136999 introduced SYSTCL_DEBUG but apparently "opt_sysctl.h" was never
  included making the option ignored.
  
  r322954 introduced sysctl.reuse_test with OID number equal to 0, effectively
  shadowing the very special sysctl.debug one. Use OID_AUTO as it doesn't need
  any special treatment.
  
  Reviewed by:  kib (mentor)
  Approved by:  kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D23056

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Mon Jan  6 19:35:22 2020(r356424)
+++ head/sys/kern/kern_sysctl.c Mon Jan  6 19:47:59 2020(r356425)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_capsicum.h"
 #include "opt_ddb.h"
 #include "opt_ktrace.h"
+#include "opt_sysctl.h"
 
 #include 
 #include 
@@ -404,8 +405,9 @@ sysctl_reuse_test(SYSCTL_HANDLER_ARGS)
SYSCTL_RUNLOCK();
return (0);
 }
-SYSCTL_PROC(_sysctl, 0, reuse_test, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE,
-   0, 0, sysctl_reuse_test, "-", "");
+SYSCTL_PROC(_sysctl, OID_AUTO, reuse_test,
+CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 0, sysctl_reuse_test, "-",
+"");
 #endif
 
 void
___
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: r356424 - head/stand/libsa/zfs

2020-01-06 Thread Toomas Soome
Author: tsoome
Date: Mon Jan  6 19:35:22 2020
New Revision: 356424
URL: https://svnweb.freebsd.org/changeset/base/356424

Log:
  loader: update zfsimpl.c from illumos review suggestions
  
  Add extra comments and update error handling.
  
  MFH:  1 week

Modified:
  head/stand/libsa/zfs/zfsimpl.c

Modified: head/stand/libsa/zfs/zfsimpl.c
==
--- head/stand/libsa/zfs/zfsimpl.c  Mon Jan  6 18:25:58 2020
(r356423)
+++ head/stand/libsa/zfs/zfsimpl.c  Mon Jan  6 19:35:22 2020
(r356424)
@@ -1097,7 +1097,8 @@ vdev_create(uint64_t guid, vdev_read_t *_read)
vdev->v_read = _read;
 
/*
-* root vdev has no read function.
+* root vdev has no read function, we use this fact to
+* skip setting up data we do not need for root vdev.
 * We only point root vdev from spa.
 */
if (_read != NULL) {
@@ -1142,7 +1143,7 @@ vdev_set_initial_state(vdev_t *vdev, const unsigned ch
else if (isnt_present != 0)
vdev->v_state = VDEV_STATE_CANT_OPEN;
 
-   vdev->v_islog = is_log == 1;
+   vdev->v_islog = is_log != 0;
 }
 
 static int
@@ -1234,9 +1235,8 @@ vdev_init(uint64_t guid, const unsigned char *nvlist, 
if (strcmp(type, "raidz") == 0) {
if (vdev->v_nparity < 1 ||
vdev->v_nparity > 3) {
-   printf("ZFS: can only boot from disk, "
-   "mirror, raidz1, raidz2 and raidz3 "
-   "vdevs\n");
+   printf("ZFS: invalid raidz parity: %d\n",
+   vdev->v_nparity);
return (EIO);
}
(void) asprintf(, "%s%d-%" PRIu64, type,
@@ -1310,16 +1310,17 @@ vdev_insert(vdev_t *top_vdev, vdev_t *vdev)
 
if (previous == NULL) {
STAILQ_INSERT_HEAD(_vdev->v_children, vdev, v_childlink);
-   count = vdev_child_count(top_vdev);
-   if (top_vdev->v_nchildren < count)
-   top_vdev->v_nchildren = count;
+   } else if (previous->v_id == vdev->v_id) {
+   /*
+* This vdev was configured from label config,
+* do not insert duplicate.
+*/
return;
+   } else {
+   STAILQ_INSERT_AFTER(_vdev->v_children, previous, vdev,
+   v_childlink);
}
 
-   if (previous->v_id == vdev->v_id)
-   return;
-
-   STAILQ_INSERT_AFTER(_vdev->v_children, previous, vdev, v_childlink);
count = vdev_child_count(top_vdev);
if (top_vdev->v_nchildren < count)
top_vdev->v_nchildren = count;
@@ -1365,6 +1366,10 @@ vdev_from_nvlist(spa_t *spa, uint64_t top_guid, const 
kids = nvlist_next(kids);
}
} else {
+   /*
+* When there are no children, nvlist_find() does return
+* error, reset it because leaf devices have no children.
+*/
rc = 0;
}
 
@@ -1491,7 +1496,7 @@ vdev_init_from_nvlist(spa_t *spa, const unsigned char 
 
/* Wrong guid?! */
if (spa->spa_guid != pool_guid)
-   return (EIO);
+   return (EINVAL);
 
spa->spa_root_vdev->v_nchildren = vdev_children;
 
@@ -1502,7 +1507,7 @@ vdev_init_from_nvlist(spa_t *spa, const unsigned char 
 * MOS config has at least one child for root vdev.
 */
if (rc != 0)
-   return (EIO);
+   return (rc);
 
for (int i = 0; i < nkids; i++) {
uint64_t guid;
@@ -3266,7 +3271,10 @@ zfs_spa_init(spa_t *spa)
if (rc != 0)
return (rc);
 
-   /* Update vdevs from MOS config. */
+   /*
+* Update vdevs from MOS config. Note, we do skip encoding bytes
+* here. See also vdev_label_read_config().
+*/
rc = vdev_init_from_nvlist(spa, nvlist + 4);
free(nvlist);
return (rc);
___
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: r356423 - in head: share/mk tests/sys/fs

2020-01-06 Thread Kyle Evans
Author: kevans
Date: Mon Jan  6 18:25:58 2020
New Revision: 356423
URL: https://svnweb.freebsd.org/changeset/base/356423

Log:
  Refine fusefs test workaround for mips+llvm
  
  This re-enables building the googletest suite by default on mips and instead
  specifically doesn't build fusefs tests for mips+clang builds.  clang will
  easily spent >= 1.5 hours compiling a single file due to a bug in
  optimization (see LLVM PR 43263), so turn these off for now while that's
  hashed out.
  
  GCC builds are unaffected and build the fusefs tests as-is. Clang builds
  only happen by early adopters attempting to hash out the remaining issues.
  
  The comment has been updated to reflect its new position and use less strong
  wording about imposing on people.
  
  Discussed with:   ngie, asomers
  Reviewed by:  ngie

Modified:
  head/share/mk/src.opts.mk
  head/tests/sys/fs/Makefile

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Mon Jan  6 18:15:55 2020(r356422)
+++ head/share/mk/src.opts.mk   Mon Jan  6 18:25:58 2020(r356423)
@@ -108,6 +108,7 @@ __DEFAULT_YES_OPTIONS = \
 GDB \
 GNU_DIFF \
 GNU_GREP \
+GOOGLETEST \
 GPIO \
 HAST \
 HTML \
@@ -263,15 +264,6 @@ __T=${MACHINE_ARCH}
 __TT=${TARGET}
 .else
 __TT=${MACHINE}
-.endif
-
-# Default GOOGLETEST to off for MIPS while LLVM PR 43263 is active.  Part
-# of the fusefs tests trigger excessively long compile times.  It does
-# eventually succeed, but this shouldn't be forced on those building by 
default.
-.if ${__TT} == "mips"
-__DEFAULT_NO_OPTIONS+= GOOGLETEST
-.else
-__DEFAULT_YES_OPTIONS+=GOOGLETEST
 .endif
 
 # All supported backends for LLVM_TARGET_XXX

Modified: head/tests/sys/fs/Makefile
==
--- head/tests/sys/fs/Makefile  Mon Jan  6 18:15:55 2020(r356422)
+++ head/tests/sys/fs/Makefile  Mon Jan  6 18:25:58 2020(r356423)
@@ -12,7 +12,12 @@ TESTSRC= ${SRCTOP}/contrib/netbsd-tests/fs
 #TESTS_SUBDIRS+=   nullfs  # XXX: needs rump
 # fusefs tests cannot be compiled/used without the googletest infrastructure.
 .if ${COMPILER_FEATURES:Mc++14} && ${MK_GOOGLETEST} != "no"
+# Don't build fusefs tests for MIPS while LLVM PR 43263 is active, as part
+# of the fusefs tests trigger excessively long compile time.  The build does
+# eventually succeed, but it's perhaps better to not do so by default for now.
+.if ${MACHINE_CPUARCH} != "mips" || ${COMPILER_TYPE} != "clang"
 TESTS_SUBDIRS+=fusefs
+.endif
 .endif
 TESTS_SUBDIRS+=tmpfs
 
___
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: r356422 - in head: lib/libc lib/libsysdecode targets/pseudo/userland/gnu

2020-01-06 Thread Kyle Evans
Author: kevans
Date: Mon Jan  6 18:15:55 2020
New Revision: 356422
URL: https://svnweb.freebsd.org/changeset/base/356422

Log:
  Update libssp paths in various Makefile.depend* files
  
  I've been advised that the model that uses these are fairly resilient, but
  we do know the proper path to use (or remove, in the case of ^/targets/...),
  so go ahead and update them to reflect that.

Modified:
  head/lib/libc/Makefile.depend.options
  head/lib/libsysdecode/Makefile.depend
  head/targets/pseudo/userland/gnu/Makefile.depend

Modified: head/lib/libc/Makefile.depend.options
==
--- head/lib/libc/Makefile.depend.options   Mon Jan  6 18:07:54 2020
(r356421)
+++ head/lib/libc/Makefile.depend.options   Mon Jan  6 18:15:55 2020
(r356422)
@@ -3,6 +3,6 @@
 
 DIRDEPS_OPTIONS= SSP
 
-DIRDEPS.SSP.yes= gnu/lib/libssp/libssp_nonshared
+DIRDEPS.SSP.yes= lib/libssp_nonshared
 
 .include 

Modified: head/lib/libsysdecode/Makefile.depend
==
--- head/lib/libsysdecode/Makefile.depend   Mon Jan  6 18:07:54 2020
(r356421)
+++ head/lib/libsysdecode/Makefile.depend   Mon Jan  6 18:15:55 2020
(r356422)
@@ -7,7 +7,6 @@ DIRDEPS = \
gnu/lib/libdialog \
gnu/lib/libgomp \
gnu/lib/libregex \
-   gnu/lib/libssp \
gnu/lib/libstdc++ \
gnu/lib/libsupc++ \
include \
@@ -100,6 +99,7 @@ DIRDEPS = \
lib/libsdp \
lib/libsecureboot \
lib/libsqlite3 \
+   lib/libssp \
lib/libstand \
lib/libstdthreads \
lib/libtacplus \

Modified: head/targets/pseudo/userland/gnu/Makefile.depend
==
--- head/targets/pseudo/userland/gnu/Makefile.dependMon Jan  6 18:07:54 
2020(r356421)
+++ head/targets/pseudo/userland/gnu/Makefile.dependMon Jan  6 18:15:55 
2020(r356422)
@@ -12,8 +12,6 @@ DIRDEPS = \
gnu/lib/libgcov \
gnu/lib/libgomp \
gnu/lib/libregex/doc \
-   gnu/lib/libssp \
-   gnu/lib/libssp/libssp_nonshared \
gnu/lib/libstdc++ \
gnu/lib/libsupc++ \
gnu/usr.bin/binutils/ar \
___
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: r356421 - head/share/man/man5

2020-01-06 Thread Ed Maste
Author: emaste
Date: Mon Jan  6 18:07:54 2020
New Revision: 356421
URL: https://svnweb.freebsd.org/changeset/base/356421

Log:
  src.conf.5: regen after r356419, reenabling powerpc in universe

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

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Mon Jan  6 18:02:02 2020
(r356420)
+++ head/share/man/man5/src.conf.5  Mon Jan  6 18:07:54 2020
(r356421)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd January 5, 2020
+.Dd January 6, 2020
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -197,7 +197,7 @@ 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 and sparc64/sparc64.
+amd64/amd64, arm/armv6, arm/armv7, i386/i386, powerpc/powerpc, 
powerpc/powerpc64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, 
mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and 
sparc64/sparc64.
 .It Va WITHOUT_BINUTILS_BOOTSTRAP
 Set to not build binutils (as, ld, and objdump)
 as part of the bootstrap process.
@@ -213,7 +213,7 @@ Set build binutils (as, ld, and objdump)
 as part of the bootstrap process.
 .Pp
 This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7 and i386/i386.
+amd64/amd64, arm/armv6, arm/armv7, i386/i386, powerpc/powerpc and 
powerpc/powerpc64.
 .It Va WITHOUT_BLACKLIST
 Set this if you do not want to build
 .Xr blacklistd 8
@@ -268,7 +268,7 @@ and
 .Pa crtend.o .
 .Pp
 This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf.
+amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, 
powerpc/powerpc64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and 
mips/mips64hf.
 .It Va WITH_BSD_GREP
 Install BSD-licensed grep as '[ef]grep' instead of GNU grep.
 .It Va WITHOUT_BSNMP
@@ -380,7 +380,7 @@ When set, it enforces these options:
 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, riscv/riscv64, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf.
+amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, 
powerpc/powerpc64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and 
mips/mips64hf.
 .It Va WITHOUT_CLANG_BOOTSTRAP
 Set to not build the Clang C/C++ compiler during the bootstrap phase of
 the build.
@@ -393,7 +393,7 @@ riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, 
 Set to build the Clang C/C++ compiler during the bootstrap phase of the build.
 .Pp
 This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386.
+amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc 
and powerpc/powerpc64.
 .It Va WITH_CLANG_EXTRAS
 Set to build additional clang and llvm tools, such as bugpoint and
 clang-format.
@@ -408,7 +408,7 @@ Set to build the ARCMigrate, Rewriter and StaticAnalyz
 Clang C/C++ compiler.
 .Pp
 This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf.
+amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, 
powerpc/powerpc64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and 
mips/mips64hf.
 .It Va WITHOUT_CLANG_IS_CC
 Set to install the GCC compiler as
 .Pa /usr/bin/cc ,
@@ -426,7 +426,7 @@ and
 .Pa /usr/bin/cpp .
 .Pp
 This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386.
+amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc 
and powerpc/powerpc64.
 .It Va WITHOUT_CPP
 Set to not build
 .Xr cpp 1 .
@@ -495,13 +495,13 @@ Set to not build
 .Xr cxgbetool 8
 .Pp
 This is a default setting on
-arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and 
mips/mips64hf.
+arm/armv6, arm/armv7, powerpc/powerpc, riscv/riscv64, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, 
mips/mips64elhf and mips/mips64hf.
 .It Va WITH_CXGBETOOL
 Set to build
 .Xr cxgbetool 8
 

svn commit: r356420 - head/sys/mips/mips

2020-01-06 Thread John Baldwin
Author: jhb
Date: Mon Jan  6 18:02:02 2020
New Revision: 356420
URL: https://svnweb.freebsd.org/changeset/base/356420

Log:
  Simplify arguments to signal handlers on mips.
  
  - Use ksi_addr directly as si_addr in the siginfo instead of the
'badvaddr' register.
  - Remove a duplicate assignment of si_code.
  - Use ksi_addr as the 4th argument to the old-style handler instead of
'badvaddr'.
  
  Reviewed by:  brooks, kevans
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23013

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

Modified: head/sys/mips/mips/pm_machdep.c
==
--- head/sys/mips/mips/pm_machdep.c Mon Jan  6 17:36:28 2020
(r356419)
+++ head/sys/mips/mips/pm_machdep.c Mon Jan  6 18:02:02 2020
(r356420)
@@ -147,12 +147,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
/* fill siginfo structure */
sf.sf_si = ksi->ksi_info;
sf.sf_si.si_signo = sig;
-   sf.sf_si.si_code = ksi->ksi_code;
-   sf.sf_si.si_addr = (void*)(intptr_t)regs->badvaddr;
} else {
/* Old FreeBSD-style arguments. */
regs->a1 = ksi->ksi_code;
-   regs->a3 = regs->badvaddr;
+   regs->a3 = (uintptr_t)ksi->ksi_addr;
/* sf.sf_ahu.sf_handler = catcher; */
}
 
___
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: r356419 - head

2020-01-06 Thread John Baldwin
Author: jhb
Date: Mon Jan  6 17:36:28 2020
New Revision: 356419
URL: https://svnweb.freebsd.org/changeset/base/356419

Log:
  Enable powerpc in make tinderbox using clang instead of GCC.
  
  powerpcspe is disabled for now until clang/llvm issues with spe
  have been fixed.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D23031

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Mon Jan  6 17:34:17 2020(r356418)
+++ head/Makefile   Mon Jan  6 17:36:28 2020(r356419)
@@ -491,15 +491,13 @@ worlds: .PHONY
 # honor that most of all.
 #
 _OBSOLETE_GCC_TARGETS=mips sparc64
-.if defined(MAKE_OBSOLETE_GCC)
-_OBSOLETE_GCC_TARGETS+=powerpc
-.endif
-TARGETS?=amd64 arm arm64 i386 riscv ${_OBSOLETE_GCC_TARGETS}
+TARGETS?=amd64 arm arm64 i386 powerpc riscv ${_OBSOLETE_GCC_TARGETS}
 _UNIVERSE_TARGETS= ${TARGETS}
 TARGET_ARCHES_arm?=armv6 armv7
 TARGET_ARCHES_arm64?=  aarch64
 TARGET_ARCHES_mips?=   mipsel mips mips64el mips64 mipsn32 mipselhf mipshf 
mips64elhf mips64hf
-TARGET_ARCHES_powerpc?=powerpc powerpc64 powerpcspe
+# powerpcspe excluded until clang fixed
+TARGET_ARCHES_powerpc?=powerpc powerpc64
 # riscv64sf excluded due to PR 232085
 TARGET_ARCHES_riscv?=  riscv64
 .for target in ${TARGETS}
@@ -510,12 +508,10 @@ MAKE_PARAMS_riscv?=   CROSS_TOOLCHAIN=riscv64-gcc
 .if !defined(MAKE_OBSOLETE_GCC)
 OBSOLETE_GCC_TARGETS=${_OBSOLETE_GCC_TARGETS}
 MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc6
-MAKE_PARAMS_powerpc?=  CROSS_TOOLCHAIN=powerpc64-gcc6
 MAKE_PARAMS_sparc64?=  CROSS_TOOLCHAIN=sparc64-gcc6
 .endif
 
 TOOLCHAINS_mips=   mips-gcc6
-TOOLCHAINS_powerpc=powerpc64-gcc6
 TOOLCHAINS_riscv=  riscv64-gcc
 TOOLCHAINS_sparc64=sparc64-gcc6
 
___
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: r356418 - head

2020-01-06 Thread John Baldwin
Author: jhb
Date: Mon Jan  6 17:34:17 2020
New Revision: 356418
URL: https://svnweb.freebsd.org/changeset/base/356418

Log:
  Only build kernels for enabled TARGET_ARCHes in make universe/tinderbox.
  
  Previously, all of the kernels for a given TARGET were built if that
  target was enabled.  This was implemented by having each kernel built
  via a universe_kernconf_ target that was depended on by a
  universe_kernconfs target.  However, this meant that if one did a
  build with a limited set of TARGET_ARCH values for a given TARGET,
  kernels could be built for which we hadn't built a world or toolchain.
  For example, 'make TARGETS=mips TARGET_ARCHES_mips=mips64' would build
  mips32 kernels.
  
  Fix this by adding an extra layer of indirection in the kernel make
  targets.  universe_kernconf_ is now a dependency of a new
  universe_kernconfs_.  universe_kernconfs in turn depends
  on a list of universe_kernconfs_ values, but only the
  values enabled in TARGET_ARCHES_.
  
  Reviewed by:  imp
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D23031

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Mon Jan  6 15:29:14 2020(r356417)
+++ head/Makefile   Mon Jan  6 17:34:17 2020(r356418)
@@ -724,7 +724,7 @@ TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/con
 .if empty(TARGET_ARCH_${kernel})
 .error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) 
likely too old."
 .endif
-universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
+universe_kernconfs_${TARGET_ARCH_${kernel}}: 
universe_kernconf_${TARGET}_${kernel}
 universe_kernconf_${TARGET}_${kernel}: .MAKE
@echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel started 
on `LC_ALL=C date`"
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
@@ -737,6 +737,9 @@ universe_kernconf_${TARGET}_${kernel}: .MAKE
(echo "${TARGET} ${kernel} kernel failed," \
"check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
@echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel completed 
on `LC_ALL=C date`"
+.endfor
+.for target_arch in ${TARGET_ARCHES_${TARGET}}
+universe_kernconfs: universe_kernconfs_${target_arch} .PHONY
 .endfor
 .endif # make(universe_kernels)
 universe: universe_epilogue
___
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: r356417 - in head/sys/netinet: . tcp_stacks

2020-01-06 Thread Randall Stewart
Author: rrs
Date: Mon Jan  6 15:29:14 2020
New Revision: 356417
URL: https://svnweb.freebsd.org/changeset/base/356417

Log:
  This catches rack up in the recent changes to ECN and
  also commonizes the functions that both the freebsd and
  rack stack uses.
  
  Sponsored by:Netflix Inc
  Differential Revision:https://reviews.freebsd.org/D23052

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cMon Jan  6 13:21:10 2020
(r356416)
+++ head/sys/netinet/tcp_input.cMon Jan  6 15:29:14 2020
(r356417)
@@ -514,7 +514,7 @@ cc_post_recovery(struct tcpcb *tp, struct tcphdr *th)
(tlen <= tp->t_maxseg) &&   \
(V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN)))
 
-static void inline
+void inline
 cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos)
 {
INP_WLOCK_ASSERT(tp->t_inpcb);

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Mon Jan  6 13:21:10 2020
(r356416)
+++ head/sys/netinet/tcp_stacks/rack.c  Mon Jan  6 15:29:14 2020
(r356417)
@@ -7715,6 +7715,10 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr
TCPSTAT_INC(tcps_ecn_ect1);
break;
}
+
+   /* Process a packet differently from RFC3168. */
+   cc_ecnpkt_handler(tp, th, iptos);
+
/* Congestion experienced. */
if (thflags & TH_ECE) {
rack_cong_signal(tp, th, CC_ECN);

Modified: head/sys/netinet/tcp_var.h
==
--- head/sys/netinet/tcp_var.h  Mon Jan  6 13:21:10 2020(r356416)
+++ head/sys/netinet/tcp_var.h  Mon Jan  6 15:29:14 2020(r356417)
@@ -891,6 +891,7 @@ voidcc_ack_received(struct tcpcb *tp, struct tcphdr 
*
uint16_t nsegs, uint16_t type);
 void   cc_conn_init(struct tcpcb *tp);
 void   cc_post_recovery(struct tcpcb *tp, struct tcphdr *th);
+voidcc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos);
 void   cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type);
 #ifdef TCP_HHOOK
 void   hhook_run_tcp_est_in(struct tcpcb *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"


Re: svn commit: r356097 - in head: share/man/man9 sys/compat/ndis sys/dev/oce sys/kern sys/libkern sys/sys

2020-01-06 Thread Hans Petter Selasky

On 2019-12-26 20:41, Conrad Meyer wrote:

Author: cem
Date: Thu Dec 26 19:41:09 2019
New Revision: 356097
URL: https://svnweb.freebsd.org/changeset/base/356097

Log:
   random(9): Deprecate random(9), remove meaningless srandom(9)
   
   srandom(9) is meaningless on SMP systems or any system with, say,

   interrupts.  One could never rely on random(9) to produce a reproducible
   sequence of outputs on the basis of a specific srandom() seed because the
   global state was shared by all kernel contexts.  As such, removing it is
   literally indistinguishable to random(9) consumers (as compared with
   retaining it).
   
   Mark random(9) as deprecated and slated for quick removal.  This is not to

   say we intend to remove all fast, non-cryptographic PRNG(s) in the kernel.
   It/they just won't be random(9), as it exists today, in either name or
   implementation.
   
   Before random(9) is removed, a replacement will be provided and in-tree

   consumers will be converted.
   
   Note that despite the name, the random(9) interface does not bear any

   resemblance to random(3).  Instead, it is the same crummy 1988 Park-Miller
   LCG used in libc rand(3).



Hi,

Having some kind of replacment for this using atomics(), might be useful 
for system testing. Sometimes you need a white-noise function for 
initializing test parameters and you also need srandom to reproducue 
failing tests.


--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: r356416 - head/contrib/libarchive/libarchive

2020-01-06 Thread Martin Matuska
Author: mm
Date: Mon Jan  6 13:21:10 2020
New Revision: 356416
URL: https://svnweb.freebsd.org/changeset/base/356416

Log:
  MFV r356415
  Sync libarchive with vendor
  
  Relevant vendor changes:
Issue #1302: Re-do fix for archive_write_client_open()
  
  X-MFC-With:   r356212,r356365
  MFC after:1 week

Modified:
  head/contrib/libarchive/libarchive/archive_cryptor.c
  head/contrib/libarchive/libarchive/archive_hmac.c
  head/contrib/libarchive/libarchive/archive_write.c
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/libarchive/archive_cryptor.c
==
--- head/contrib/libarchive/libarchive/archive_cryptor.cMon Jan  6 
13:13:58 2020(r356415)
+++ head/contrib/libarchive/libarchive/archive_cryptor.cMon Jan  6 
13:21:10 2020(r356416)
@@ -299,6 +299,7 @@ aes_ctr_release(archive_crypto_ctx *ctx)
 }
 
 #elif defined(HAVE_LIBMBEDCRYPTO) && defined(HAVE_MBEDTLS_AES_H)
+
 static int
 aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
 {

Modified: head/contrib/libarchive/libarchive/archive_hmac.c
==
--- head/contrib/libarchive/libarchive/archive_hmac.c   Mon Jan  6 13:13:58 
2020(r356415)
+++ head/contrib/libarchive/libarchive/archive_hmac.c   Mon Jan  6 13:21:10 
2020(r356416)
@@ -151,6 +151,7 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
 }
 
 #elif defined(HAVE_LIBMBEDCRYPTO) && defined(HAVE_MBEDTLS_MD_H)
+
 static int
 __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t 
key_len)
 {

Modified: head/contrib/libarchive/libarchive/archive_write.c
==
--- head/contrib/libarchive/libarchive/archive_write.c  Mon Jan  6 13:13:58 
2020(r356415)
+++ head/contrib/libarchive/libarchive/archive_write.c  Mon Jan  6 13:21:10 
2020(r356416)
@@ -339,6 +339,7 @@ archive_write_client_open(struct archive_write_filter 
struct archive_none *state;
void *buffer;
size_t buffer_size;
+   int ret;
 
f->bytes_per_block = archive_write_get_bytes_per_block(f->archive);
f->bytes_in_last_block =
@@ -363,7 +364,13 @@ archive_write_client_open(struct archive_write_filter 
 
if (a->client_opener == NULL)
return (ARCHIVE_OK);
-   return (a->client_opener(f->archive, a->client_data));
+   ret = a->client_opener(f->archive, a->client_data);
+   if (ret != ARCHIVE_OK) {
+   free(state->buffer);
+   free(state);
+   f->data = NULL;
+   }
+   return (ret);
 }
 
 static int
@@ -449,30 +456,6 @@ archive_write_client_write(struct archive_write_filter
 }
 
 static int
-archive_write_client_free(struct archive_write_filter *f)
-{
-   struct archive_write *a = (struct archive_write *)f->archive;
-   struct archive_none *state = (struct archive_none *)f->data;
-
-   if (state != NULL) {
-   free(state->buffer);
-   free(state);
-   state = NULL;
-   }
-
-   a->client_data = NULL;
-   /* Clear passphrase. */
-   if (a->passphrase != NULL) {
-   memset(a->passphrase, 0, strlen(a->passphrase));
-   free(a->passphrase);
-   a->passphrase = NULL;
-   }
-
-   return (ARCHIVE_OK);
-}
-
-
-static int
 archive_write_client_close(struct archive_write_filter *f)
 {
struct archive_write *a = (struct archive_write *)f->archive;
@@ -508,7 +491,15 @@ archive_write_client_close(struct archive_write_filter
}
if (a->client_closer)
(*a->client_closer)(>archive, a->client_data);
-
+   free(state->buffer);
+   free(state);
+   a->client_data = NULL;
+   /* Clear passphrase. */
+   if (a->passphrase != NULL) {
+   memset(a->passphrase, 0, strlen(a->passphrase));
+   free(a->passphrase);
+   a->passphrase = NULL;
+   }
/* Clear the close handler myself not to be called again. */
f->state = ARCHIVE_WRITE_FILTER_STATE_CLOSED;
return (ret);
@@ -539,7 +530,6 @@ archive_write_open(struct archive *_a, void *client_da
client_filter->open = archive_write_client_open;
client_filter->write = archive_write_client_write;
client_filter->close = archive_write_client_close;
-   client_filter->free = archive_write_client_free;
 
ret = __archive_write_filters_open(a);
if (ret < ARCHIVE_WARN) {
___
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: r356414 - head/sys/netinet

2020-01-06 Thread Randall Stewart
Author: rrs
Date: Mon Jan  6 12:48:06 2020
New Revision: 356414
URL: https://svnweb.freebsd.org/changeset/base/356414

Log:
  This change adds a small feature to the tcp logging code. Basically
  a connection can now have a separate tag added to the id.
  
  Obtained from:Lawrence Stewart
  Sponsored by: Netflix Inc
  Differential Revision:https://reviews.freebsd.org/D22866

Modified:
  head/sys/netinet/tcp_log_buf.c
  head/sys/netinet/tcp_log_buf.h
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_log_buf.c
==
--- head/sys/netinet/tcp_log_buf.c  Mon Jan  6 10:52:13 2020
(r356413)
+++ head/sys/netinet/tcp_log_buf.c  Mon Jan  6 12:48:06 2020
(r356414)
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include  /* Must come after qmath.h and tree.h */
 #include 
 
 #include 
@@ -78,6 +78,7 @@ static u_long tcp_log_auto_ratio = 0;
 static volatile u_long tcp_log_auto_ratio_cur = 0;
 static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL;
 static bool tcp_log_auto_all = false;
+static uint32_t tcp_disable_all_bb_logs = 0;
 
 RB_PROTOTYPE_STATIC(tcp_log_id_tree, tcp_log_id_bucket, tlb_rb, tcp_log_id_cmp)
 
@@ -111,6 +112,10 @@ SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpc
 SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, 
_log_version,
 0, "Version of log formats exported");
 
+SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, disable_all, CTLFLAG_RW,
+_disable_all_bb_logs, TCP_LOG_STATE_HEAD_AUTO,
+"Disable all BB logging for all connections");
+
 SYSCTL_ULONG(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW,
 _log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions");
 
@@ -156,7 +161,18 @@ SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, freed, 
 #ifdef INVARIANTS
 #defineTCPLOG_DEBUG_RINGBUF
 #endif
+/* Number of requests to consider a PBCID "active". */
+#defineACTIVE_REQUEST_COUNT10
 
+/* Statistic tracking for "active" PBCIDs. */
+static counter_u64_t tcp_log_pcb_ids_cur;
+static counter_u64_t tcp_log_pcb_ids_tot;
+
+SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, pcb_ids_cur, CTLFLAG_RD,
+_log_pcb_ids_cur, "Number of pcb IDs allocated in the system");
+SYSCTL_COUNTER_U64(_net_inet_tcp_bb, OID_AUTO, pcb_ids_tot, CTLFLAG_RD,
+_log_pcb_ids_tot, "Total number of pcb IDs that have been allocated");
+
 struct tcp_log_mem
 {
STAILQ_ENTRY(tcp_log_mem) tlm_queue;
@@ -240,10 +256,14 @@ struct tcp_log_id_bucket
 * (struct tcp_log_id_bucket *) and (char *) interchangeably.
 */
chartlb_id[TCP_LOG_ID_LEN];
+   chartlb_tag[TCP_LOG_TAG_LEN];
RB_ENTRY(tcp_log_id_bucket) tlb_rb;
struct tcp_log_id_head  tlb_head;
struct mtx  tlb_mtx;
volatile u_int  tlb_refcnt;
+   volatile u_int  tlb_reqcnt;
+   uint32_ttlb_loglimit;
+   uint8_t tlb_logstate;
 };
 
 struct tcp_log_id_node
@@ -285,6 +305,7 @@ tcp_log_selectauto(void)
 * this session.
 */
if (tcp_log_auto_ratio &&
+   (tcp_disable_all_bb_logs == 0) &&
(atomic_fetchadd_long(_log_auto_ratio_cur, 1) %
tcp_log_auto_ratio) == 0)
return (true);
@@ -337,6 +358,7 @@ tcp_log_remove_bucket(struct tcp_log_id_bucket *tlb)
 #endif
}
TCPID_BUCKET_LOCK_DESTROY(tlb);
+   counter_u64_add(tcp_log_pcb_ids_cur, (int64_t)-1);
uma_zfree(tcp_log_bucket_zone, tlb);
 }
 
@@ -484,7 +506,53 @@ tcp_log_grow_tlb(char *tlb_id, struct tcpcb *tp)
 #endif
 }
 
+static void
+tcp_log_increment_reqcnt(struct tcp_log_id_bucket *tlb)
+{
+
+   atomic_fetchadd_int(>tlb_reqcnt, 1);
+}
+
 /*
+ * Associate the specified tag with a particular TCP log ID.
+ * Called with INPCB locked. Returns with it unlocked.
+ * Returns 0 on success or EOPNOTSUPP if the connection has no TCP log ID.
+ */
+int
+tcp_log_set_tag(struct tcpcb *tp, char *tag)
+{
+   struct tcp_log_id_bucket *tlb;
+   int tree_locked;
+
+   INP_WLOCK_ASSERT(tp->t_inpcb);
+
+   tree_locked = TREE_UNLOCKED;
+   tlb = tp->t_lib;
+   if (tlb == NULL) {
+   INP_WUNLOCK(tp->t_inpcb);
+   return (EOPNOTSUPP);
+   }
+
+   TCPID_BUCKET_REF(tlb);
+   INP_WUNLOCK(tp->t_inpcb);
+   TCPID_BUCKET_LOCK(tlb);
+   strlcpy(tlb->tlb_tag, tag, TCP_LOG_TAG_LEN);
+   if (!tcp_log_unref_bucket(tlb, _locked, NULL))
+   TCPID_BUCKET_UNLOCK(tlb);
+
+   if (tree_locked == TREE_WLOCKED) {
+   TCPID_TREE_WLOCK_ASSERT();
+   TCPID_TREE_WUNLOCK();
+   } else if (tree_locked == TREE_RLOCKED) {
+   TCPID_TREE_RLOCK_ASSERT();
+   TCPID_TREE_RUNLOCK();
+   } else
+ 

svn commit: r356413 - in head/sys: amd64/amd64 arm64/arm64

2020-01-06 Thread Pawel Biernacki
Author: kaktus
Date: Mon Jan  6 10:52:13 2020
New Revision: 356413
URL: https://svnweb.freebsd.org/changeset/base/356413

Log:
  sysctl: mark more nodes as MPSAFE
  
  vm.kvm_size and vm.kvm_free are read only and marked as MPSAFE on i386
  already. Mark them as that on amd64 and arm64 too to avoid locking Giant.
  
  Reviewed by:  kib (mentor)
  Approved by:  kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D23039

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Jan  6 09:51:54 2020(r356412)
+++ head/sys/amd64/amd64/pmap.c Mon Jan  6 10:52:13 2020(r356413)
@@ -4072,8 +4072,9 @@ kvm_size(SYSCTL_HANDLER_ARGS)
 
return sysctl_handle_long(oidp, , 0, req);
 }
-SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG|CTLFLAG_RD, 
-0, 0, kvm_size, "LU", "Size of KVM");
+SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG | CTLFLAG_RD | 
CTLFLAG_MPSAFE,
+0, 0, kvm_size, "LU",
+"Size of KVM");
 
 static int
 kvm_free(SYSCTL_HANDLER_ARGS)
@@ -4082,8 +4083,9 @@ kvm_free(SYSCTL_HANDLER_ARGS)
 
return sysctl_handle_long(oidp, , 0, req);
 }
-SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD, 
-0, 0, kvm_free, "LU", "Amount of KVM free");
+SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG | CTLFLAG_RD | 
CTLFLAG_MPSAFE,
+0, 0, kvm_free, "LU",
+"Amount of KVM free");
 
 /*
  * Allocate physical memory for the vm_page array and map it into KVA,

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Mon Jan  6 09:51:54 2020(r356412)
+++ head/sys/arm64/arm64/pmap.c Mon Jan  6 10:52:13 2020(r356413)
@@ -1845,8 +1845,9 @@ kvm_size(SYSCTL_HANDLER_ARGS)
 
return sysctl_handle_long(oidp, , 0, req);
 }
-SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG|CTLFLAG_RD,
-0, 0, kvm_size, "LU", "Size of KVM");
+SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG | CTLFLAG_RD | 
CTLFLAG_MPSAFE,
+0, 0, kvm_size, "LU",
+"Size of KVM");
 
 static int
 kvm_free(SYSCTL_HANDLER_ARGS)
@@ -1855,8 +1856,9 @@ kvm_free(SYSCTL_HANDLER_ARGS)
 
return sysctl_handle_long(oidp, , 0, req);
 }
-SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD,
-0, 0, kvm_free, "LU", "Amount of KVM free");
+SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG | CTLFLAG_RD | 
CTLFLAG_MPSAFE,
+0, 0, kvm_free, "LU",
+"Amount of KVM free");
 
 /*
  * grow the number of kernel page table entries, if needed
___
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: r356409 - in head/sys: dev/usb sys

2020-01-06 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  6 09:49:20 2020
New Revision: 356409
URL: https://svnweb.freebsd.org/changeset/base/356409

Log:
  Add own counter for cancelled USB transfers.
  Do not count these as errors.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_transfer.c
  head/sys/sys/param.h

Modified: head/sys/dev/usb/usb_device.h
==
--- head/sys/dev/usb/usb_device.h   Mon Jan  6 09:40:59 2020
(r356408)
+++ head/sys/dev/usb/usb_device.h   Mon Jan  6 09:49:20 2020
(r356409)
@@ -191,6 +191,7 @@ struct usb_device {
/* statistics */
struct usb_device_statistics stats_err;
struct usb_device_statistics stats_ok;
+   struct usb_device_statistics stats_cancelled;
 
/* generic clear stall message */
struct usb_udev_msg cs_msg[2];

Modified: head/sys/dev/usb/usb_transfer.c
==
--- head/sys/dev/usb/usb_transfer.c Mon Jan  6 09:40:59 2020
(r356408)
+++ head/sys/dev/usb/usb_transfer.c Mon Jan  6 09:49:20 2020
(r356409)
@@ -2593,7 +2593,10 @@ usbd_transfer_done(struct usb_xfer *xfer, usb_error_t 
}
 #endif
/* keep some statistics */
-   if (xfer->error) {
+   if (xfer->error == USB_ERR_CANCELLED) {
+   info->udev->stats_cancelled.uds_requests
+   [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++;
+   } else if (xfer->error != USB_ERR_NORMAL_COMPLETION) {
info->udev->stats_err.uds_requests
[xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++;
} else {

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hMon Jan  6 09:40:59 2020(r356408)
+++ head/sys/sys/param.hMon Jan  6 09:49:20 2020(r356409)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300074  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300075  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"