svn commit: r354167 - head/sys/x86/include

2019-10-29 Thread Conrad Meyer
Author: cem
Date: Wed Oct 30 04:00:44 2019
New Revision: 354167
URL: https://svnweb.freebsd.org/changeset/base/354167

Log:
  amd64: Fix typo: RDPRU bit is 0x10, not 0x04
  
  Bit 4 != 4, of course.
  
  X-MFC-With:   r354162

Modified:
  head/sys/x86/include/specialreg.h

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Wed Oct 30 02:33:43 2019
(r354166)
+++ head/sys/x86/include/specialreg.h   Wed Oct 30 04:00:44 2019
(r354167)
@@ -386,7 +386,7 @@
 #defineAMDFEID_CLZERO  0x0001
 #defineAMDFEID_IRPERF  0x0002
 #defineAMDFEID_XSAVEERPTR  0x0004
-#defineAMDFEID_RDPRU   0x0004
+#defineAMDFEID_RDPRU   0x0010
 #defineAMDFEID_MCOMMIT 0x0100
 #defineAMDFEID_WBNOINVD0x0200
 #defineAMDFEID_IBPB0x1000
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354166 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-10-29 Thread Alan Somers
Author: asomers
Date: Wed Oct 30 02:33:43 2019
New Revision: 354166
URL: https://svnweb.freebsd.org/changeset/base/354166

Log:
  MFC r353439:
  
  MFZol: Fix performance of "zfs recv" with many deletions
  
  This patch fixes 2 issues with the DMU free throttle implemented
  in dmu_free_long_range(). The first issue is that get_next_chunk()
  was calculating the number of L1 blocks the free would dirty
  incorrectly. In some cases involving extremely large files, this
  code would greatly overestimate the number of affected L1 blocks,
  causing excessive calls to txg_wait_open(). This patch corrects
  the calculation.
  
  The second issue is that the free throttle uses the total number
  of free'd blocks in all (open, quiescing, and syncing) txgs to
  determine whether to throttle. This causes large frees (such as
  those created by the first issue) to cause 4 txg syncs before
  any further frees were allowed to proceed. This patch ensures
  that the accounting is done entirely in a per-txg fashion, so
  that frees from a given txg don't affect those that immediately
  follow it.
  
  Reviewed-by: Brian Behlendorf 
  Reviewed-by: Matthew Ahrens 
  Signed-off-by: Tom Caputi 
  zfsonlinux/zfs@f4c594da94d856c422512a54e48070f890b2685b
  
  Freeing throttle should account for holes
  
  Deletion throttle currently does not account for holes in a file.
  This means that it can activate when it shouldn't.
  To fix it we switch the throttle to be based on the number of
  L1 blocks we will have to dirty when freeing
  
  Reviewed-by: Tom Caputi 
  Reviewed-by: Matt Ahrens 
  Reviewed-by: Brian Behlendorf 
  Signed-off-by: Alek Pinchuk 
  zfsonlinux/zfs@65282ee9e06b130f1f0169baf5d9bf0dd8fc1ef9
  
  Submitted by: Alek Pinchuk 
  Reviewed by:  allanjude
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D21895

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

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c  Wed Oct 
30 02:03:37 2019(r354165)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c  Wed Oct 
30 02:33:43 2019(r354166)
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2019 Datto Inc.
  */
 /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */
 /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */
@@ -62,14 +63,15 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, nopwrite_enabled, CTLFL
 _nopwrite_enabled, 0, "Enable nopwrite feature");
 
 /*
- * Tunable to control percentage of dirtied blocks from frees in one TXG.
- * After this threshold is crossed, additional dirty blocks from frees
- * wait until the next TXG.
+ * Tunable to control percentage of dirtied L1 blocks from frees allowed into
+ * one TXG. After this threshold is crossed, additional dirty blocks from frees
+ * will wait until the next TXG.
  * A value of zero will disable this throttle.
  */
-uint32_t zfs_per_txg_dirty_frees_percent = 30;
+uint32_t zfs_per_txg_dirty_frees_percent = 5;
 SYSCTL_INT(_vfs_zfs, OID_AUTO, per_txg_dirty_frees_percent, CTLFLAG_RWTUN,
-   _per_txg_dirty_frees_percent, 0, "Percentage of dirtied blocks from 
frees in one txg");
+   _per_txg_dirty_frees_percent, 0,
+   "Percentage of dirtied indirect blocks from frees allowed in one txg");
 
 /*
  * This can be used for testing, to ensure that certain actions happen
@@ -683,11 +685,13 @@ dmu_prefetch(objset_t *os, uint64_t object, int64_t le
  *
  * On input, *start should be the first offset that does not need to be
  * freed (e.g. "offset + length").  On return, *start will be the first
- * offset that should be freed.
+ * offset that should be freed and l1blks is set to the number of level 1
+ * indirect blocks found within the chunk.
  */
 static int
-get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum)
+get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum, uint64_t 
*l1blks)
 {
+   uint64_t blks;
uint64_t maxblks = DMU_MAX_ACCESS >> (dn->dn_indblkshift + 1);
/* bytes of data covered by a level-1 indirect block */
uint64_t iblkrange =
@@ -695,13 +699,23 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t 
 
ASSERT3U(minimum, <=, *start);
 
-   if (*start - minimum <= iblkrange * maxblks) {
+   /*
+* Check if we can free the entire range assuming that all of the
+* L1 blocks in this range have data. If we can, we use this
+* worst case value as an estimate so we can avoid having to look
+* at the object's actual data.
+*/
+   uint64_t total_l1blks =
+   (roundup(*start, iblkrange) - 

svn commit: r354165 - in stable/12: . tests/sys/cddl/zfs/include tests/sys/cddl/zfs/tests/cli_root/zdb tests/sys/cddl/zfs/tests/cli_root/zpool_add tests/sys/cddl/zfs/tests/cli_root/zpool_create tes...

2019-10-29 Thread Alan Somers
Author: asomers
Date: Wed Oct 30 02:03:37 2019
New Revision: 354165
URL: https://svnweb.freebsd.org/changeset/base/354165

Log:
  MFC r353117-r353118, r353281-r353282, r353284-r353289, r353309-r353310, 
r353360-r353361, r353366, r353379
  
  r353117:
  ZFS: the hotspare_add_004_neg test needs at least two disks
  
  Sponsored by: Axcient
  
  r353118:
  ZFS: fix several of the "zpool create" tests
  
  * Remove zpool_create_013_neg.  FreeBSD doesn't have an equivalent of
Solaris's metadevices.  GEOM would be the equivalent, but since all geoms
are the same from ZFS's perspective, this test would be redundant with
zpool_create_012_neg
  
  * Remove zpool_create_014_neg.  FreeBSD does not support swapping to regular
files.
  
  * Remove zpool_create_016_pos.  This test is redundant with literally every
other test that creates a disk-backed pool.
  
  * s:/etc/vfstab:/etc/fstab in zpool_create_011_neg
  
  * Delete the VTOC-related portion of zpool_create_008_pos.  FreeBSD doesn't
use VTOC.
  
  * Replace dumpadm with dumpon and swap with swapon in multiple tests.
  
  * In zpool_create_015_neg, don't require "zpool create -n" to fail.  It's
reasonable for that variant to succeed, because it doesn't actually open
the zvol.
  
  * Greatly simplify zpool_create_012_neg.  Make it safer, too, but not
interfering with the system's regular swap devices.
  
  * Expect zpool_create_011_neg to fail (PR 241070)
  
  * Delete some redundant cleanup steps in various tests
  
  * Remove some unneeeded ATF timeout specifications.  The default is fine.
  
  PR:   241070
  Sponsored by: Axcient
  
  r353281:
  ZFS: fix several zvol_misc tests
  
  * Adapt zvol_misc_001_neg to use dumpon instead of Solaris's dumpadm
  * Disable zvol_misc_003_neg, zvol_misc_005_neg, and zvol_misc_006_pos,
because they involve using a zvol as a dump device, which FreeBSD does not
yet support.
  
  Sponsored by: Axcient
  
  r353282:
  zfs: fix the slog_012_neg test
  
  This test attempts to corrupt a file-backed vdev by deleting it and then
  recreating it with truncate.  But that doesn't work, because the pool
  already has the vdev open, and it happily hangs on to the open-but-deleted
  file.  Fix by truncating the file without deleting it.
  
  Sponsored by: Axcient
  
  r353284:
  ZFS: fix the zpool_get_002_pos test
  
  ZFS has grown some additional properties that hadn't been added to the
  config file yet.  While I'm here, improve the error message, and remove a
  superfluous command.
  
  Sponsored by: Axcient
  
  r353285:
  zfs: fix the zdb_001_neg test
  
  The test needed to be updated for r331701 (MFV illumos 8671400), which added
  a "-k" option.
  
  Sponsored by: Axcient
  
  r353286:
  zfs: skip the zfsd tests if zfsd is not running
  
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D21878
  
  r353287:
  ZFS: fix the delegate tests
  
  These tests have never worked correctly
  
  * Replace runwattr with sudo
  * Fix a scoping bug with the "dtst" variable
  * Cleanup user properties created during tests
  * Eliminate the checks for refreservation and send support. They will always
be supported.
  * Fix verify_fs_snapshot. It seemed to assume that permissions would not yet
be delegated, but that's not how it's actually used.
  * Combine verify_fs_promote with verify_vol_promote
  * Remove some useless sleeps
  * Fix backwards condition in verify_vol_volsize
  * Remove some redundant cleanup steps in the tests. cleanup.ksh will handle
everything.
  * Disable some parts of the tests that FreeBSD doesn't support:
  * Creating snapshots with mkdir
  * devices
  * shareisci
  * sharenfs
  * xattr
  * zoned
  
  The sharenfs parts could probably be reenabled with more work to remove the
  Solarisms.
  
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D21898
  
  r353288:
  ZFS: mark hotspare_scrub_002_pos as an expected failure
  
  "zpool scrub" doesn't detect all errors on active spares in raidz arrays
  
  PR:   241069
  Sponsored by: Axcient
  
  r353289:
  ZFS: fix the redundancy tests
  
  * Fix force_sync_path, which ensures that a file is fully flushed to disk.
Apparently "zpool history"'s performance has improved, but exporting and
importing the pool still works.
  * Fix file_dva by using undocumented zdb syntax to clarify that we're
interested in the pool's root file system, not the pool itself. This
should also fix the zpool_clear_001_pos test.
  * Remove a redundant cleanup step
  
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D21901
  
  r353309:
  zfs: fix the zfsd_autoreplace_003_pos test
  
  The test declared that it only needed 5 disks, but actually tried to use 6.
  Fix it to use just 5, which is all it really needs.
  
  Sponsored by: Axcient
  
  r353310:
  zfs: fix the zfsd_hotspare_007_pos 

svn commit: r354164 - in stable/12/sys/fs: nfs nfsclient

2019-10-29 Thread Rick Macklem
Author: rmacklem
Date: Wed Oct 30 01:57:40 2019
New Revision: 354164
URL: https://svnweb.freebsd.org/changeset/base/354164

Log:
  MFC: r352736
  Replace all mtx_assert() calls for n_mtx and ncl_iod_mutex with macros.
  
  To be consistent with replacing the mtx_lock()/mtx_unlock() calls on
  the NFS node mutex (n_mtx) and ncl_iod_mutex, this patch replaces
  all mtx_assert() calls on these mutexes with macros as well.
  This will simplify changing these locks to sx locks in a future commit.
  However, this change may be delayed indefinitely, since it appears there
  is a deadlock when vnode_pager_setsize() is called to shrink the size
  and the NFS node lock is held.
  There is no semantic change as a result of this commit.

Modified:
  stable/12/sys/fs/nfs/nfsport.h
  stable/12/sys/fs/nfsclient/nfs_clnfsiod.c
  stable/12/sys/fs/nfsclient/nfs_clnode.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfs/nfsport.h
==
--- stable/12/sys/fs/nfs/nfsport.h  Wed Oct 30 01:41:49 2019
(r354163)
+++ stable/12/sys/fs/nfs/nfsport.h  Wed Oct 30 01:57:40 2019
(r354164)
@@ -688,10 +688,12 @@ void nfsrvd_rcv(struct socket *, void *, int);
 #defineNFSUNLOCKV4ROOTMUTEX()  mtx_unlock(_v4root_mutex)
 #defineNFSLOCKNODE(n)  mtx_lock(&((n)->n_mtx))
 #defineNFSUNLOCKNODE(n)mtx_unlock(&((n)->n_mtx))
+#defineNFSASSERTNODE(n)mtx_assert(&((n)->n_mtx), MA_OWNED)
 #defineNFSLOCKMNT(m)   mtx_lock(&((m)->nm_mtx))
 #defineNFSUNLOCKMNT(m) mtx_unlock(&((m)->nm_mtx))
 #defineNFSLOCKIOD()mtx_lock(_iod_mutex)
 #defineNFSUNLOCKIOD()  mtx_unlock(_iod_mutex)
+#defineNFSASSERTIOD()  mtx_assert(_iod_mutex, MA_OWNED)
 #defineNFSLOCKREQUEST(r)   mtx_lock(&((r)->r_mtx))
 #defineNFSUNLOCKREQUEST(r) mtx_unlock(&((r)->r_mtx))
 #defineNFSPROCLISTLOCK()   sx_slock(_lock)

Modified: stable/12/sys/fs/nfsclient/nfs_clnfsiod.c
==
--- stable/12/sys/fs/nfsclient/nfs_clnfsiod.c   Wed Oct 30 01:41:49 2019
(r354163)
+++ stable/12/sys/fs/nfsclient/nfs_clnfsiod.c   Wed Oct 30 01:57:40 2019
(r354164)
@@ -169,7 +169,7 @@ nfs_nfsiodnew_sync(void)
 {
int error, i;
 
-   mtx_assert(_iod_mutex, MA_OWNED);
+   NFSASSERTIOD();
for (i = 0; i < ncl_iodmax; i++) {
if (nfs_asyncdaemon[i] == 0) {
nfs_asyncdaemon[i] = 1;
@@ -206,7 +206,7 @@ void
 ncl_nfsiodnew(void)
 {
 
-   mtx_assert(_iod_mutex, MA_OWNED);
+   NFSASSERTIOD();
taskqueue_enqueue(taskqueue_thread, _nfsiodnew_task);
 }
 

Modified: stable/12/sys/fs/nfsclient/nfs_clnode.c
==
--- stable/12/sys/fs/nfsclient/nfs_clnode.c Wed Oct 30 01:41:49 2019
(r354163)
+++ stable/12/sys/fs/nfsclient/nfs_clnode.c Wed Oct 30 01:57:40 2019
(r354164)
@@ -212,7 +212,7 @@ ncl_releasesillyrename(struct vnode *vp, struct thread
 
ASSERT_VOP_ELOCKED(vp, "releasesillyrename");
np = VTONFS(vp);
-   mtx_assert(>n_mtx, MA_OWNED);
+   NFSASSERTNODE(np);
if (vp->v_type != VDIR) {
sp = np->n_sillyrename;
np->n_sillyrename = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354163 - stable/12/usr.bin/tftp

2019-10-29 Thread Alan Somers
Author: asomers
Date: Wed Oct 30 01:41:49 2019
New Revision: 354163
URL: https://svnweb.freebsd.org/changeset/base/354163

Log:
  MFC r353068:
  
  tftp: fix two minor Coverity CIDs
  
  Reported by:  Coverity
  CID 1394842: file descriptor leak in an error path
  CID 1007603: single byte array overflow
  Differential Revision:https://reviews.freebsd.org/D21695

Modified:
  stable/12/usr.bin/tftp/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/tftp/main.c
==
--- stable/12/usr.bin/tftp/main.c   Wed Oct 30 01:41:14 2019
(r354162)
+++ stable/12/usr.bin/tftp/main.c   Wed Oct 30 01:41:49 2019
(r354163)
@@ -491,6 +491,7 @@ put(int argc, char *argv[])
 
if (fstat(fd, ) < 0) {
warn("%s", cp);
+   close(fd);
return;
}
asprintf([OPT_TSIZE].o_request, "%ju", sb.st_size);
@@ -746,7 +747,7 @@ command(bool interactive, EditLine *el, History *hist,
exit(0);
len = MIN(MAXLINE, num);
memcpy(line, bp, len);
-   line[len] = '\0';
+   line[len - 1] = '\0';
history(hist, hep, H_ENTER, bp);
} else {
line[0] = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354162 - in head/sys/x86: include x86

2019-10-29 Thread Conrad Meyer
Author: cem
Date: Wed Oct 30 01:41:14 2019
New Revision: 354162
URL: https://svnweb.freebsd.org/changeset/base/354162

Log:
  amd64: Define and decode new AMD64 feature bits
  
  These are documented in revisions 3.32 of the public AMD64 Vol. 2 and
  revision 3.28 of Vol. 3, published October and September 2019, respectively.

Modified:
  head/sys/x86/include/specialreg.h
  head/sys/x86/x86/identcpu.c

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Wed Oct 30 01:35:00 2019
(r354161)
+++ head/sys/x86/include/specialreg.h   Wed Oct 30 01:41:14 2019
(r354162)
@@ -71,6 +71,7 @@
 #defineCR4_PCE 0x0100  /* Performance monitoring counter 
enable */
 #defineCR4_FXSR 0x0200 /* Fast FPU save/restore used by OS */
 #defineCR4_XMM 0x0400  /* enable SIMD/MMX2 to use except 16 */
+#defineCR4_UMIP 0x0800 /* User Mode Instruction Prevention */
 #defineCR4_VMXE 0x2000 /* enable VMX operation 
(Intel-specific) */
 #defineCR4_FSGSBASE 0x0001 /* Enable FS/GS BASE accessing 
instructions */
 #defineCR4_PCIDE 0x0002/* Enable Context ID */
@@ -90,6 +91,7 @@
 #defineEFER_LMSLE 0x02000  /* Long Mode Segment Limit Enable */
 #defineEFER_FFXSR 0x04000  /* Fast FXSAVE/FSRSTOR */
 #defineEFER_TCE   0x08000  /* Translation Cache Extension */
+#defineEFER_MCOMMIT0x0002  /* Enable MCOMMIT (AMD) */
 
 /*
  * Intel Extended Features registers
@@ -384,6 +386,9 @@
 #defineAMDFEID_CLZERO  0x0001
 #defineAMDFEID_IRPERF  0x0002
 #defineAMDFEID_XSAVEERPTR  0x0004
+#defineAMDFEID_RDPRU   0x0004
+#defineAMDFEID_MCOMMIT 0x0100
+#defineAMDFEID_WBNOINVD0x0200
 #defineAMDFEID_IBPB0x1000
 #defineAMDFEID_IBRS0x4000
 #defineAMDFEID_STIBP   0x8000

Modified: head/sys/x86/x86/identcpu.c
==
--- head/sys/x86/x86/identcpu.c Wed Oct 30 01:35:00 2019(r354161)
+++ head/sys/x86/x86/identcpu.c Wed Oct 30 01:41:14 2019(r354162)
@@ -1067,6 +1067,9 @@ printcpuinfo(void)
"\001CLZERO"
"\002IRPerf"
"\003XSaveErPtr"
+   "\005RDPRU"
+   "\011MCOMMIT"
+   "\012WBNOINVD"
"\015IBPB"
"\017IBRS"
"\020STIBP"
@@ -2355,7 +2358,7 @@ print_svm_info(void)
   "\017"
   "\020V_VMSAVE_VMLOAD"
   "\021vGIF"
-  "\022"
+  "\022GMET"   /* Guest Mode Execute Trap */
   "\023"
   "\024"
   "\025"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354161 - in stable/12: sys/fs/fuse tests/sys/fs/fusefs

2019-10-29 Thread Alan Somers
Author: asomers
Date: Wed Oct 30 01:35:00 2019
New Revision: 354161
URL: https://svnweb.freebsd.org/changeset/base/354161

Log:
  MFC r352404, r352413-r352414
  
  r352404:
  fusefs: fix some minor issues with fuse_vnode_setparent
  
  * When unparenting a vnode, actually clear the flag. AFAIK this is basically
a no-op because we only unparent a vnode when reclaiming it or when
unlinking.
  
  * There's no need to call fuse_vnode_setparent during reclaim, because we're
about to free the vnode data anyway.
  
  Reviewed by:  emaste
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21630
  
  r352413:
  fusefs: fix some minor Coverity CIDs in the tests
  
  Where open(2) is expected to fail, the tests should assert or expect that
  its return value is -1.  These tests all accepted too much but happened to
  pass anyway.
  
  Reported by:  Coverity
  Coverity CID: 1404512, 1404378, 1404504, 1404483
  Sponsored by: The FreeBSD Foundation
  
  r352414:
  fusefs: initialize C++ classes the Coverity way
  
  Coverity complained that I wasn't initializing some class members until the
  SetUp method.  Do it in the constructor instead.
  
  Reported by:  Coverity
  Coverity CIDs:1404352, 1404378
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/fs/fuse/fuse_node.h
  stable/12/sys/fs/fuse/fuse_vnops.c
  stable/12/tests/sys/fs/fusefs/create.cc
  stable/12/tests/sys/fs/fusefs/default_permissions.cc
  stable/12/tests/sys/fs/fusefs/io.cc
  stable/12/tests/sys/fs/fusefs/mknod.cc
  stable/12/tests/sys/fs/fusefs/opendir.cc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/fuse/fuse_node.h
==
--- stable/12/sys/fs/fuse/fuse_node.h   Wed Oct 30 01:24:28 2019
(r354160)
+++ stable/12/sys/fs/fuse/fuse_node.h   Wed Oct 30 01:35:00 2019
(r354161)
@@ -174,6 +174,8 @@ fuse_vnode_setparent(struct vnode *vp, struct vnode *d
MPASS(dvp->v_type == VDIR);
VTOFUD(vp)->parent_nid = VTOI(dvp);
VTOFUD(vp)->flag |= FN_PARENT_NID;
+   } else {
+   VTOFUD(vp)->flag &= ~FN_PARENT_NID;
}
 }
 

Modified: stable/12/sys/fs/fuse/fuse_vnops.c
==
--- stable/12/sys/fs/fuse/fuse_vnops.c  Wed Oct 30 01:24:28 2019
(r354160)
+++ stable/12/sys/fs/fuse/fuse_vnops.c  Wed Oct 30 01:35:00 2019
(r354161)
@@ -1526,11 +1526,10 @@ fuse_vnop_reclaim(struct vop_reclaim_args *ap)
fuse_filehandle_close(vp, fufh, td, NULL);
}
 
-   if ((!fuse_isdeadfs(vp)) && (fvdat->nlookup)) {
+   if (!fuse_isdeadfs(vp) && fvdat->nlookup > 0) {
fuse_internal_forget_send(vnode_mount(vp), td, NULL, VTOI(vp),
fvdat->nlookup);
}
-   fuse_vnode_setparent(vp, NULL);
cache_purge(vp);
vfs_hash_remove(vp);
vnode_destroy_vobject(vp);

Modified: stable/12/tests/sys/fs/fusefs/create.cc
==
--- stable/12/tests/sys/fs/fusefs/create.cc Wed Oct 30 01:24:28 2019
(r354160)
+++ stable/12/tests/sys/fs/fusefs/create.cc Wed Oct 30 01:35:00 2019
(r354161)
@@ -204,7 +204,7 @@ TEST_F(Create, eexist)
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
.WillOnce(Invoke(ReturnErrno(ENOENT)));
expect_create(RELPATH, mode, ReturnErrno(EEXIST));
-   EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
+   EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode));
EXPECT_EQ(EEXIST, errno);
 }
 
@@ -342,7 +342,7 @@ TEST_F(Create, eperm)
.WillOnce(Invoke(ReturnErrno(ENOENT)));
expect_create(RELPATH, mode, ReturnErrno(EPERM));
 
-   EXPECT_NE(0, open(FULLPATH, O_CREAT | O_EXCL, mode));
+   EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, mode));
EXPECT_EQ(EPERM, errno);
 }
 

Modified: stable/12/tests/sys/fs/fusefs/default_permissions.cc
==
--- stable/12/tests/sys/fs/fusefs/default_permissions.ccWed Oct 30 
01:24:28 2019(r354160)
+++ stable/12/tests/sys/fs/fusefs/default_permissions.ccWed Oct 30 
01:35:00 2019(r354161)
@@ -749,7 +749,7 @@ TEST_F(Open, eacces)
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0755, UINT64_MAX, 1);
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX);
 
-   EXPECT_NE(0, open(FULLPATH, O_RDWR));
+   EXPECT_EQ(-1, open(FULLPATH, O_RDWR));
EXPECT_EQ(EACCES, errno);
 }
 

Modified: stable/12/tests/sys/fs/fusefs/io.cc
==
--- stable/12/tests/sys/fs/fusefs/io.cc Wed Oct 30 01:24:28 2019
(r354160)
+++ stable/12/tests/sys/fs/fusefs/io.cc Wed Oct 30 

svn commit: r354160 - stable/12/libexec/rc

2019-10-29 Thread Cy Schubert
Author: cy
Date: Wed Oct 30 01:24:28 2019
New Revision: 354160
URL: https://svnweb.freebsd.org/changeset/base/354160

Log:
  MFC r354129:
  
  Remove trailing tab.

Modified:
  stable/12/libexec/rc/rc.subr
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/rc/rc.subr
==
--- stable/12/libexec/rc/rc.subrTue Oct 29 21:25:19 2019
(r354159)
+++ stable/12/libexec/rc/rc.subrWed Oct 30 01:24:28 2019
(r354160)
@@ -1266,7 +1266,7 @@ $command $rc_flags $command_args"
${PROTECT} -p ${pid}
;;
esac
-   fi  
+   fi
;;
esac
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354159 - head/sys/cddl/contrib/opensolaris/uts/common/zmod

2019-10-29 Thread Alexander Motin
Author: mav
Date: Tue Oct 29 21:25:19 2019
New Revision: 354159
URL: https://svnweb.freebsd.org/changeset/base/354159

Log:
  FreeBSD'fy ZFS zlib zalloc/zfree callbacks.
  
  The previous code came from OpenSolaris, which in my understanding require
  allocation size to be known to free memory.  To store that size previous
  code allocated additional 8 byte header.  But I have noticed that zlib
  with present settings allocates 64KB context buffers for each call, that
  could be efficiently cached by UMA, but addition of those 8 bytes makes
  them fall back to physical RAM allocations, that cause huge overhead and
  lock congestion on small blocks.  Since FreeBSD's free() does not have
  the size argument, switching to it solves the problem, increasing write
  speed to ZVOLs with 4KB block size and GZIP compression on my 40-threads
  test system from ~60MB/s to ~600MB/s.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.cTue Oct 29 
21:06:34 2019(r354158)
+++ head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.cTue Oct 29 
21:25:19 2019(r354159)
@@ -27,45 +27,28 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 #include 
 
-struct zchdr {
-   uint_t zch_magic;
-   uint_t zch_size;
-};
-
-#defineZCH_MAGIC   0x3cc13cc1
-
 /*ARGSUSED*/
 static void *
 zfs_zcalloc(void *opaque, uint_t items, uint_t size)
 {
-   size_t nbytes = sizeof (struct zchdr) + items * size;
-   struct zchdr *z = kobj_zalloc(nbytes, KM_NOWAIT|KM_TMP);
+   void *ptr;
 
-   if (z == NULL)
-   return (NULL);
-
-   z->zch_magic = ZCH_MAGIC;
-   z->zch_size = nbytes;
-
-   return (z + 1);
+   ptr = malloc((size_t)items * size, M_SOLARIS, M_NOWAIT);
+   return ptr;
 }
 
 /*ARGSUSED*/
 static void
 zfs_zcfree(void *opaque, void *ptr)
 {
-   struct zchdr *z = ((struct zchdr *)ptr) - 1;
 
-   if (z->zch_magic != ZCH_MAGIC)
-   panic("zcfree region corrupt: hdr=%p ptr=%p", (void *)z, ptr);
-
-   kobj_free(z, z->zch_size);
+   free(ptr, M_SOLARIS);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354158 - in head/sys: fs/nfsclient fs/nfsserver fs/tmpfs kern ufs/ffs vm

2019-10-29 Thread Jeff Roberson
Author: jeff
Date: Tue Oct 29 21:06:34 2019
New Revision: 354158
URL: https://svnweb.freebsd.org/changeset/base/354158

Log:
  Replace OBJ_MIGHTBEDIRTY with a system using atomics.  Remove the TMPFS_DIRTY
  flag and use the same system.
  
  This enables further fault locking improvements by allowing more faults to
  proceed with a shared lock.
  
  Reviewed by:  kib
  Tested by:pho
  Differential Revision:https://reviews.freebsd.org/D22116

Modified:
  head/sys/fs/nfsclient/nfs_clvnops.c
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/fs/tmpfs/tmpfs_vfsops.c
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/kern/vfs_subr.c
  head/sys/ufs/ffs/ffs_rawread.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h
  head/sys/vm/vm_page.c

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==
--- head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 29 20:58:46 2019
(r354157)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 29 21:06:34 2019
(r354158)
@@ -715,7 +715,7 @@ nfs_open(struct vop_open_args *ap)
 */
if (vp->v_writecount <= -1) {
if ((obj = vp->v_object) != NULL &&
-   (obj->flags & OBJ_MIGHTBEDIRTY) != 0) {
+   vm_object_mightbedirty(obj)) {
VM_OBJECT_WLOCK(obj);
vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
VM_OBJECT_WUNLOCK(obj);

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==
--- head/sys/fs/nfsserver/nfs_nfsdport.cTue Oct 29 20:58:46 2019
(r354157)
+++ head/sys/fs/nfsserver/nfs_nfsdport.cTue Oct 29 21:06:34 2019
(r354158)
@@ -1498,8 +1498,7 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt,
/*
 * Give up and do the whole thing
 */
-   if (vp->v_object &&
-  (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) {
+   if (vp->v_object && vm_object_mightbedirty(vp->v_object)) {
VM_OBJECT_WLOCK(vp->v_object);
vm_object_page_clean(vp->v_object, 0, 0, OBJPC_SYNC);
VM_OBJECT_WUNLOCK(vp->v_object);
@@ -1529,8 +1528,7 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt,
}
lblkno = off / iosize;
 
-   if (vp->v_object &&
-  (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) {
+   if (vp->v_object && vm_object_mightbedirty(vp->v_object)) {
VM_OBJECT_WLOCK(vp->v_object);
vm_object_page_clean(vp->v_object, off, off + cnt,
OBJPC_SYNC);

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Tue Oct 29 20:58:46 2019
(r354157)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Tue Oct 29 21:06:34 2019
(r354158)
@@ -1477,10 +1477,10 @@ tmpfs_check_mtime(struct vnode *vp)
KASSERT((obj->flags & (OBJ_TMPFS_NODE | OBJ_TMPFS)) ==
(OBJ_TMPFS_NODE | OBJ_TMPFS), ("non-tmpfs obj"));
/* unlocked read */
-   if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) {
+   if (obj->generation != obj->cleangeneration) {
VM_OBJECT_WLOCK(obj);
-   if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) {
-   obj->flags &= ~OBJ_TMPFS_DIRTY;
+   if (obj->generation != obj->cleangeneration) {
+   obj->cleangeneration = obj->generation;
node = VP_TO_TMPFS_NODE(vp);
node->tn_status |= TMPFS_NODE_MODIFIED |
TMPFS_NODE_CHANGED;

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- head/sys/fs/tmpfs/tmpfs_vfsops.cTue Oct 29 20:58:46 2019
(r354157)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.cTue Oct 29 21:06:34 2019
(r354158)
@@ -172,7 +172,7 @@ tmpfs_update_mtime(struct mount *mp, bool lazy)
 * For non-lazy case, we must flush all pending
 * metadata changes now.
 */
-   if (!lazy || (obj->flags & OBJ_TMPFS_DIRTY) != 0) {
+   if (!lazy || obj->generation != obj->cleangeneration) {
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK,
curthread) != 0)
continue;

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Oct 29 20:58:46 2019
(r354157)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Oct 29 21:06:34 2019
(r354158)
@@ -1323,7 +1323,7 @@ 

svn commit: r354157 - in head/sys: sys vm

2019-10-29 Thread Jeff Roberson
Author: jeff
Date: Tue Oct 29 20:58:46 2019
New Revision: 354157
URL: https://svnweb.freebsd.org/changeset/base/354157

Log:
  Use atomics and a shared object lock to protect the object reference count.
  
  Certain consumers still need to guarantee a stable reference so we can not
  switch entirely to atomics yet.  Exclusive lock holders can still modify
  and examine the refcount without using the ref api.
  
  Reviewed by:  kib
  Tested by:pho
  Sponsored by: Netflix, Intel
  Differential Revision:https://reviews.freebsd.org/D21598

Modified:
  head/sys/sys/refcount.h
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h
  head/sys/vm/vnode_pager.c

Modified: head/sys/sys/refcount.h
==
--- head/sys/sys/refcount.h Tue Oct 29 20:46:25 2019(r354156)
+++ head/sys/sys/refcount.h Tue Oct 29 20:58:46 2019(r354157)
@@ -175,4 +175,22 @@ refcount_release_if_not_last(volatile u_int *count)
}
 }
 
+static __inline __result_use_check bool
+refcount_release_if_gt(volatile u_int *count, u_int n)
+{
+   u_int old;
+
+   KASSERT(n > 0,
+   ("refcount_release_if_gt: Use refcount_release for final ref"));
+   old = *count;
+   for (;;) {
+   if (REFCOUNT_COUNT(old) <= n)
+   return (false);
+   if (__predict_false(REFCOUNT_SATURATED(old)))
+   return (true);
+   if (atomic_fcmpset_int(count, , old - 1))
+   return (true);
+   }
+}
+
 #endif /* ! __SYS_REFCOUNT_H__ */

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Tue Oct 29 20:46:25 2019(r354156)
+++ head/sys/vm/vm_object.c Tue Oct 29 20:58:46 2019(r354157)
@@ -224,8 +224,8 @@ vm_object_zinit(void *mem, int size, int flags)
 
/* These are true for any object that has been freed */
object->type = OBJT_DEAD;
-   object->ref_count = 0;
vm_radix_init(>rtree);
+   refcount_init(>ref_count, 0);
refcount_init(>paging_in_progress, 0);
refcount_init(>busy, 0);
object->resident_page_count = 0;
@@ -282,7 +282,7 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, 
object->size = size;
object->domain.dr_policy = NULL;
object->generation = 1;
-   object->ref_count = 1;
+   refcount_init(>ref_count, 1);
object->memattr = VM_MEMATTR_DEFAULT;
object->cred = NULL;
object->charge = 0;
@@ -444,9 +444,9 @@ vm_object_reference(vm_object_t object)
 {
if (object == NULL)
return;
-   VM_OBJECT_WLOCK(object);
+   VM_OBJECT_RLOCK(object);
vm_object_reference_locked(object);
-   VM_OBJECT_WUNLOCK(object);
+   VM_OBJECT_RUNLOCK(object);
 }
 
 /*
@@ -461,8 +461,8 @@ vm_object_reference_locked(vm_object_t object)
 {
struct vnode *vp;
 
-   VM_OBJECT_ASSERT_WLOCKED(object);
-   object->ref_count++;
+   VM_OBJECT_ASSERT_LOCKED(object);
+   refcount_acquire(>ref_count);
if (object->type == OBJT_VNODE) {
vp = object->handle;
vref(vp);
@@ -477,24 +477,16 @@ vm_object_vndeallocate(vm_object_t object)
 {
struct vnode *vp = (struct vnode *) object->handle;
 
-   VM_OBJECT_ASSERT_WLOCKED(object);
KASSERT(object->type == OBJT_VNODE,
("vm_object_vndeallocate: not a vnode object"));
KASSERT(vp != NULL, ("vm_object_vndeallocate: missing vp"));
-#ifdef INVARIANTS
-   if (object->ref_count == 0) {
-   vn_printf(vp, "vm_object_vndeallocate ");
-   panic("vm_object_vndeallocate: bad object reference count");
-   }
-#endif
 
-   if (!umtx_shm_vnobj_persistent && object->ref_count == 1)
+   if (refcount_release(>ref_count) &&
+   !umtx_shm_vnobj_persistent)
umtx_shm_object_terminated(object);
 
-   object->ref_count--;
-
+   VM_OBJECT_RUNLOCK(object);
/* vrele may need the vnode lock. */
-   VM_OBJECT_WUNLOCK(object);
vrele(vp);
 }
 
@@ -513,24 +505,32 @@ void
 vm_object_deallocate(vm_object_t object)
 {
vm_object_t temp;
+   bool released;
 
while (object != NULL) {
-   VM_OBJECT_WLOCK(object);
+   VM_OBJECT_RLOCK(object);
if (object->type == OBJT_VNODE) {
vm_object_vndeallocate(object);
return;
}
 
-   KASSERT(object->ref_count != 0,
-   ("vm_object_deallocate: object deallocated too many 
times: %d", object->type));
-
/*
 * If the reference count goes to 0 we start calling
-* vm_object_terminate() on the object chain.
-* A ref count of 1 may be a special case depending on the
-

svn commit: r354156 - head/sys/vm

2019-10-29 Thread Jeff Roberson
Author: jeff
Date: Tue Oct 29 20:46:25 2019
New Revision: 354156
URL: https://svnweb.freebsd.org/changeset/base/354156

Log:
  Drop the object lock earlier in fault and don't relock it after pmap_enter().
  
  Recent changes in object and page locking have enabled more lock pushdown.
  
  Reviewed by:  kib
  Tested by:pho
  Differential Revision:https://reviews.freebsd.org/D22036

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Tue Oct 29 20:37:59 2019(r354155)
+++ head/sys/vm/vm_fault.c  Tue Oct 29 20:46:25 2019(r354156)
@@ -184,11 +184,10 @@ unlock_vp(struct faultstate *fs)
 }
 
 static void
-unlock_and_deallocate(struct faultstate *fs)
+fault_deallocate(struct faultstate *fs)
 {
 
vm_object_pip_wakeup(fs->object);
-   VM_OBJECT_WUNLOCK(fs->object);
if (fs->object != fs->first_object) {
VM_OBJECT_WLOCK(fs->first_object);
vm_page_free(fs->first_m);
@@ -202,6 +201,14 @@ unlock_and_deallocate(struct faultstate *fs)
 }
 
 static void
+unlock_and_deallocate(struct faultstate *fs)
+{
+
+   VM_OBJECT_WUNLOCK(fs->object);
+   fault_deallocate(fs);
+}
+
+static void
 vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_prot_t prot,
 vm_prot_t fault_type, int fault_flags, bool set_wd)
 {
@@ -1261,10 +1268,12 @@ readrest:
fs.object, OFF_TO_IDX(
fs.first_object->backing_object_offset));
 #endif
+   VM_OBJECT_WUNLOCK(fs.object);
fs.first_m = fs.m;
fs.m = NULL;
VM_CNT_INC(v_cow_optim);
} else {
+   VM_OBJECT_WUNLOCK(fs.object);
/*
 * Oh, well, lets copy it.
 */
@@ -1285,7 +1294,6 @@ readrest:
 * conditional
 */
vm_object_pip_wakeup(fs.object);
-   VM_OBJECT_WUNLOCK(fs.object);
 
/*
 * We only try to prefault read-only mappings to the
@@ -1405,7 +1413,6 @@ readrest:
vm_fault_prefault(, vaddr,
faultcount > 0 ? behind : PFBAK,
faultcount > 0 ? ahead : PFFOR, false);
-   VM_OBJECT_WLOCK(fs.object);
 
/*
 * If the page is not wired down, then put it where the pageout daemon
@@ -1427,7 +1434,7 @@ readrest:
/*
 * Unlock everything, and return
 */
-   unlock_and_deallocate();
+   fault_deallocate();
if (hardfault) {
VM_CNT_INC(v_io_faults);
curthread->td_ru.ru_majflt++;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354155 - head/sys/kern

2019-10-29 Thread Jeff Roberson
Author: jeff
Date: Tue Oct 29 20:37:59 2019
New Revision: 354155
URL: https://svnweb.freebsd.org/changeset/base/354155

Log:
  Drop the object lock in vfs_bio and cluster where it is now safe to do so.
  
  Recent changes to busy/valid/dirty have enabled page based synchronization
  and the object lock is no longer required in many cases.
  
  Reviewed by:  kib
  Sponsored by: Netflix, Intel
  Differential Revision:https://reviews.freebsd.org/D21597

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_cluster.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Tue Oct 29 20:28:02 2019(r354154)
+++ head/sys/kern/vfs_bio.c Tue Oct 29 20:37:59 2019(r354155)
@@ -162,7 +162,7 @@ static void vfs_page_set_valid(struct buf *bp, vm_ooff
 static void vfs_page_set_validclean(struct buf *bp, vm_ooffset_t off,
vm_page_t m);
 static void vfs_clean_pages_dirty_buf(struct buf *bp);
-static void vfs_setdirty_locked_object(struct buf *bp);
+static void vfs_setdirty_range(struct buf *bp);
 static void vfs_vmio_invalidate(struct buf *bp);
 static void vfs_vmio_truncate(struct buf *bp, int npages);
 static void vfs_vmio_extend(struct buf *bp, int npages, int size);
@@ -955,8 +955,6 @@ vfs_buf_test_cache(struct buf *bp, vm_ooffset_t foff, 
 vm_offset_t size, vm_page_t m)
 {
 
-   VM_OBJECT_ASSERT_LOCKED(m->object);
-
/*
 * This function and its results are protected by higher level
 * synchronization requiring vnode and buf locks to page in and
@@ -2865,7 +2863,6 @@ vfs_vmio_iodone(struct buf *bp)
 
bogus = false;
iosize = bp->b_bcount - bp->b_resid;
-   VM_OBJECT_WLOCK(obj);
for (i = 0; i < bp->b_npages; i++) {
resid = ((foff + PAGE_SIZE) & ~(off_t)PAGE_MASK) - foff;
if (resid > iosize)
@@ -2876,7 +2873,10 @@ vfs_vmio_iodone(struct buf *bp)
 */
m = bp->b_pages[i];
if (m == bogus_page) {
-   bogus = true;
+   if (bogus == false) {
+   bogus = true;
+   VM_OBJECT_RLOCK(obj);
+   }
m = vm_page_lookup(obj, OFF_TO_IDX(foff));
if (m == NULL)
panic("biodone: page disappeared!");
@@ -2900,8 +2900,9 @@ vfs_vmio_iodone(struct buf *bp)
foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK;
iosize -= resid;
}
+   if (bogus)
+   VM_OBJECT_RUNLOCK(obj);
vm_object_pip_wakeupn(obj, bp->b_npages);
-   VM_OBJECT_WUNLOCK(obj);
if (bogus && buf_mapped(bp)) {
BUF_CHECK_MAPPED(bp);
pmap_qenter(trunc_page((vm_offset_t)bp->b_data),
@@ -3029,7 +3030,6 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int 
 * are not valid for the range covered by the buffer.
 */
obj = bp->b_bufobj->bo_object;
-   VM_OBJECT_WLOCK(obj);
if (bp->b_npages < desiredpages) {
/*
 * We must allocate system pages since blocking
@@ -3041,11 +3041,13 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int 
 * deadlocks once allocbuf() is called after
 * pages are vfs_busy_pages().
 */
+   VM_OBJECT_WLOCK(obj);
(void)vm_page_grab_pages(obj,
OFF_TO_IDX(bp->b_offset) + bp->b_npages,
VM_ALLOC_SYSTEM | VM_ALLOC_IGN_SBUSY |
VM_ALLOC_NOBUSY | VM_ALLOC_WIRED,
>b_pages[bp->b_npages], desiredpages - bp->b_npages);
+   VM_OBJECT_WUNLOCK(obj);
bp->b_npages = desiredpages;
}
 
@@ -3076,7 +3078,6 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int 
toff += tinc;
tinc = PAGE_SIZE;
}
-   VM_OBJECT_WUNLOCK(obj);
 
/*
 * Step 3, fixup the KVA pmap.
@@ -3656,9 +3657,8 @@ vfs_clean_pages_dirty_buf(struct buf *bp)
KASSERT(bp->b_offset != NOOFFSET,
("vfs_clean_pages_dirty_buf: no buffer offset"));
 
-   VM_OBJECT_WLOCK(bp->b_bufobj->bo_object);
vfs_busy_pages_acquire(bp);
-   vfs_setdirty_locked_object(bp);
+   vfs_setdirty_range(bp);
for (i = 0; i < bp->b_npages; i++) {
noff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK;
eoff = noff;
@@ -3670,69 +3670,57 @@ vfs_clean_pages_dirty_buf(struct buf *bp)
foff = noff;
}
vfs_busy_pages_release(bp);
-   VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object);
 }
 
 static void
-vfs_setdirty_locked_object(struct buf *bp)
+vfs_setdirty_range(struct buf *bp)
 {
-   vm_object_t object;
+   vm_offset_t boffset;
+   vm_offset_t eoffset;
int i;
 
-   

svn commit: r354154 - head/usr.bin/vmstat

2019-10-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Oct 29 20:28:02 2019
New Revision: 354154
URL: https://svnweb.freebsd.org/changeset/base/354154

Log:
  Fix column title alignment.
  
  MFC after:2 weeks

Modified:
  head/usr.bin/vmstat/vmstat.c

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cTue Oct 29 19:36:21 2019
(r354153)
+++ head/usr.bin/vmstat/vmstat.cTue Oct 29 20:28:02 2019
(r354154)
@@ -867,11 +867,11 @@ printhdr(int maxid, u_long cpumask)
 
num_shown = MIN(num_selected, maxshowdevs);
if (hflag)
-   xo_emit("{T:procs}  {T:memory}   {T:/page%*s}", 19, "");
+   xo_emit("{T:procs}  {T:memory}  {T:/page%*s}", 19, "");
else
-   xo_emit("{T:procs} {T:memory}{T:/page%*s}", 19, "");
+   xo_emit("{T:procs} {T:memory}   {T:/page%*s}", 19, "");
if (num_shown > 1)
-   xo_emit(" {T:/disks %*s}", num_shown * 4 - 7, "");
+   xo_emit("{T:/disks %*s}", num_shown * 4 - 7, "");
else if (num_shown == 1)
xo_emit("   {T:disks}");
xo_emit("   {T:faults}  ");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-10-29 Thread Cy Schubert
Author: cy
Date: Tue Oct 29 19:36:21 2019
New Revision: 354153
URL: https://svnweb.freebsd.org/changeset/base/354153

Log:
  MFC r352784:
  
  Sync with source:
  
  Only a role of "ipf" is currently supported as the other documented
  (and undocumented) roles are #ifdef'd out.
  
  The plan is to complete ippool(8) as it is even in its current state
  a powerful feature/tool.
  
  PR:   218433

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

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

Modified: stable/12/contrib/ipfilter/man/ippool.8
==
--- stable/12/contrib/ipfilter/man/ippool.8 Tue Oct 29 18:36:16 2019
(r354152)
+++ stable/12/contrib/ipfilter/man/ippool.8 Tue Oct 29 19:36:21 2019
(r354153)
@@ -96,11 +96,8 @@ retrieving statistical information.
 .TP
 .B -o 
 Sets the role with which this pool is to be used.  Currently only
-.B ipf,
-.B auth
-and
-.B count
-are accepted as arguments to this option.
+.B ipf
+(the default) is accepted as arguments to this option.
 .TP
 .B -S 
 Sets the hashing seed to the number specified.  Only for use with
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-10-29 Thread Cy Schubert
Author: cy
Date: Tue Oct 29 19:36:21 2019
New Revision: 354153
URL: https://svnweb.freebsd.org/changeset/base/354153

Log:
  MFC r352784:
  
  Sync with source:
  
  Only a role of "ipf" is currently supported as the other documented
  (and undocumented) roles are #ifdef'd out.
  
  The plan is to complete ippool(8) as it is even in its current state
  a powerful feature/tool.
  
  PR:   218433

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

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

Modified: stable/11/contrib/ipfilter/man/ippool.8
==
--- stable/11/contrib/ipfilter/man/ippool.8 Tue Oct 29 18:36:16 2019
(r354152)
+++ stable/11/contrib/ipfilter/man/ippool.8 Tue Oct 29 19:36:21 2019
(r354153)
@@ -96,11 +96,8 @@ retrieving statistical information.
 .TP
 .B -o 
 Sets the role with which this pool is to be used.  Currently only
-.B ipf,
-.B auth
-and
-.B count
-are accepted as arguments to this option.
+.B ipf
+(the default) is accepted as arguments to this option.
 .TP
 .B -S 
 Sets the hashing seed to the number specified.  Only for use with
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354152 - head/sys/arm64/rockchip

2019-10-29 Thread Emmanuel Vadot
Author: manu
Date: Tue Oct 29 18:36:16 2019
New Revision: 354152
URL: https://svnweb.freebsd.org/changeset/base/354152

Log:
  arm64: rockchip: typec_phy: Rename timeout to retry
  
  Declare retry in the function scope.
  Rename it to retry as there is a timeout function which was
  causing to code to compile.
  
  Reported by:  jhibbits
  MFC after:1 month
  X-MFC-WITH:   r354089

Modified:
  head/sys/arm64/rockchip/rk_typec_phy.c

Modified: head/sys/arm64/rockchip/rk_typec_phy.c
==
--- head/sys/arm64/rockchip/rk_typec_phy.c  Tue Oct 29 18:24:36 2019
(r354151)
+++ head/sys/arm64/rockchip/rk_typec_phy.c  Tue Oct 29 18:36:16 2019
(r354152)
@@ -191,7 +191,7 @@ rk_typec_phy_enable(struct phynode *phynode, bool enab
device_t dev;
intptr_t phy;
uint32_t reg;
-   int err;
+   int err, retry;
 
dev = phynode_get_device(phynode);
phy = phynode_get_id(phynode);
@@ -271,13 +271,13 @@ rk_typec_phy_enable(struct phynode *phynode, bool enab
 
hwreset_deassert(sc->rst_uphy);
 
-   for (int timeout = 1; timeout > 0; timeout--) {
+   for (retry = 1; retry > 0; retry--) {
reg = RK_TYPEC_PHY_READ(sc, PMA_CMN_CTRL1);
if (reg & PMA_CMN_CTRL1_READY)
break;
DELAY(10);
}
-   if (timeout == 0) {
+   if (retry == 0) {
device_printf(sc->dev, "Timeout waiting for PMA\n");
return (ENXIO);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354151 - in head: contrib/netbsd-tests/lib/libexecinfo lib/libexecinfo/tests

2019-10-29 Thread Conrad Meyer
Author: cem
Date: Tue Oct 29 18:24:36 2019
New Revision: 354151
URL: https://svnweb.freebsd.org/changeset/base/354151

Log:
  libexecinfo test: Don't strip installed test
  
  It turns out that a test of backtrace symbol resolution and formatting
  requires symbols.  Another option mightt be building with -rdynamic instead,
  but this works for now.
  
  Re-enabled skipped CI test, as it should now pass.
  
  PR:   241562
  Submitted by: lwhsu
  Reported by:  lwhsu
  X-MFC-With:   r354126, r354135, r354144

Modified:
  head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c
  head/lib/libexecinfo/tests/Makefile

Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c
==
--- head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Tue Oct 29 
18:06:00 2019(r354150)
+++ head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Tue Oct 29 
18:24:36 2019(r354151)
@@ -151,9 +151,6 @@ ATF_TC_HEAD(backtrace_fmt_basic, tc)
 
 ATF_TC_BODY(backtrace_fmt_basic, tc)
 {
-   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
-   atf_tc_skip("https://bugs.freebsd.org/241562;);
-
myfunc(12);
 
if (prevent_inline)

Modified: head/lib/libexecinfo/tests/Makefile
==
--- head/lib/libexecinfo/tests/Makefile Tue Oct 29 18:06:00 2019
(r354150)
+++ head/lib/libexecinfo/tests/Makefile Tue Oct 29 18:24:36 2019
(r354151)
@@ -6,6 +6,12 @@ TESTSRC=   ${SRCTOP}/contrib/netbsd-tests/lib/libexecinf
 
 .include 
 
+# Perhaps not surprisingly, the backtrace symbol test needs symbols.  Leave
+# them in:
+STRIP=
+# It could probably be made to work without symbols by checking pointer values
+# instead, but part of the tested functionality is the symbol resolution logic,
+# so that doesn't seem useful.
 NETBSD_ATF_TESTS_C+=   backtrace_test
 
 LIBADD.backtrace_test+=execinfo
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354150 - stable/12

2019-10-29 Thread Jung-uk Kim
Author: jkim
Date: Tue Oct 29 18:06:00 2019
New Revision: 354150
URL: https://svnweb.freebsd.org/changeset/base/354150

Log:
  MFC:  r353907
  
  Belatedly remove stale debug symbols.

Modified:
  stable/12/ObsoleteFiles.inc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/ObsoleteFiles.inc
==
--- stable/12/ObsoleteFiles.inc Tue Oct 29 17:36:06 2019(r354149)
+++ stable/12/ObsoleteFiles.inc Tue Oct 29 18:06:00 2019(r354150)
@@ -516,6 +516,16 @@ OLD_FILES+=usr/include/openssl/kssl.h
 OLD_FILES+=usr/include/openssl/pqueue.h
 OLD_FILES+=usr/include/openssl/ssl23.h
 OLD_FILES+=usr/include/openssl/ui_compat.h
+OLD_FILES+=usr/lib/debug/usr/lib/engines/lib4758cca.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libaep.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libatalla.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libcapi.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libchil.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libcswift.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libgost.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libnuron.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libsureware.so.debug
+OLD_FILES+=usr/lib/debug/usr/lib/engines/libubsec.so.debug
 OLD_FILES+=usr/share/openssl/man/man1/dss1.1.gz
 OLD_FILES+=usr/share/openssl/man/man1/md2.1.gz
 OLD_FILES+=usr/share/openssl/man/man1/md4.1.gz
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354149 - head/sys/net

2019-10-29 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct 29 17:36:06 2019
New Revision: 354149
URL: https://svnweb.freebsd.org/changeset/base/354149

Log:
  There is a long standing problem with multicast programming for NICs
  and IPv6.  With IPv6 we may call if_addmulti() in context of processing
  of an incoming packet.  Usually this is interrupt context.  While most
  of the NIC drivers are able to reprogram multicast filters without
  sleeping, some of them can't.  An example is e1000 family of drivers.
  With iflib conversion the problem was somewhat hidden.  Iflib processes
  packets in private taskqueue, so going to sleep doesn't trigger an
  assertion.  However, the sleep would block operation of the driver and
  following incoming packets would fill the ring and eventually would
  start being dropped.  Enabling epoch for the full time of a packet
  processing again started to trigger assertions for e1000.
  
  Fix this problem once and for all using a general taskqueue to call
  if_ioctl() method in all cases when if_addmulti() is called in a
  non sleeping context.  Note that nobody cares about returned value.
  
  Reviewed by:  hselasky, kib
  Differential Revision:  https://reviews.freebsd.org/D22154

Modified:
  head/sys/net/if.c
  head/sys/net/if_var.h

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Tue Oct 29 17:28:25 2019(r354148)
+++ head/sys/net/if.c   Tue Oct 29 17:36:06 2019(r354149)
@@ -271,6 +271,7 @@ static int  if_getgroupmembers(struct ifgroupreq *);
 static voidif_delgroups(struct ifnet *);
 static voidif_attach_internal(struct ifnet *, int, struct if_clone *);
 static int if_detach_internal(struct ifnet *, int, struct if_clone **);
+static voidif_siocaddmulti(void *, int);
 #ifdef VIMAGE
 static voidif_vmove(struct ifnet *, struct vnet *);
 #endif
@@ -556,6 +557,7 @@ if_alloc_domain(u_char type, int numa_domain)
 
IF_ADDR_LOCK_INIT(ifp);
TASK_INIT(>if_linktask, 0, do_link_state_change, ifp);
+   TASK_INIT(>if_addmultitask, 0, if_siocaddmulti, ifp);
ifp->if_afdata_initialized = 0;
IF_AFDATA_LOCK_INIT(ifp);
CK_STAILQ_INIT(>if_addrhead);
@@ -1131,6 +1133,7 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc
if_delgroups(ifp);
 
taskqueue_drain(taskqueue_swi, >if_linktask);
+   taskqueue_drain(taskqueue_swi, >if_addmultitask);
 
/*
 * Check if this is a cloned interface or not. Must do even if
@@ -3538,7 +3541,10 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa,
 * interface to let them know about it.
 */
if (ifp->if_ioctl != NULL) {
-   (void) (*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0);
+   if (THREAD_CAN_SLEEP())
+   (void )(*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0);
+   else
+   taskqueue_enqueue(taskqueue_swi, >if_addmultitask);
}
 
if ((llsa != NULL) && (llsa != (struct sockaddr *)))
@@ -3553,6 +3559,19 @@ free_llsa_out:
 unlock_out:
IF_ADDR_WUNLOCK(ifp);
return (error);
+}
+
+static void
+if_siocaddmulti(void *arg, int pending)
+{
+   struct ifnet *ifp;
+
+   ifp = arg;
+#ifdef DIAGNOSTIC
+   if (pending > 1)
+   if_printf(ifp, "%d SIOCADDMULTI coalesced\n", pending);
+#endif
+   (void )(*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0);
 }
 
 /*

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Tue Oct 29 17:28:25 2019(r354148)
+++ head/sys/net/if_var.h   Tue Oct 29 17:36:06 2019(r354149)
@@ -317,6 +317,7 @@ struct ifnet {
 
struct  ifaltq if_snd;  /* output queue (includes altq) */
struct  task if_linktask;   /* task for link change events */
+   struct  task if_addmultitask;   /* task for SIOCADDMULTI */
 
/* Addresses of different protocol families assigned to this if. */
struct mtx if_addr_lock;/* lock to protect address lists */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354148 - head/sys/kern

2019-10-29 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct 29 17:28:25 2019
New Revision: 354148
URL: https://svnweb.freebsd.org/changeset/base/354148

Log:
  Merge td_epochnest with td_no_sleeping.
  
  Epoch itself doesn't rely on the counter and it is provided
  merely for sleeping subsystems to check it.
  
  - In functions that sleep use THREAD_CAN_SLEEP() to assert
correctness.  With EPOCH_TRACE compiled print epoch info.
  - _sleep() was a wrong place to put the assertion for epoch,
right place is sleepq_add(), as there ways to call the
latter bypassing _sleep().
  - Do not increase td_no_sleeping in non-preemptible epochs.
The critical section would trigger all possible safeguards,
no sleeping counter is extraneous.
  
  Reviewed by:  kib

Modified:
  head/sys/kern/genoffset.c
  head/sys/kern/kern_malloc.c
  head/sys/kern/kern_synch.c
  head/sys/kern/subr_epoch.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/kern/subr_trap.c

Modified: head/sys/kern/genoffset.c
==
--- head/sys/kern/genoffset.c   Tue Oct 29 17:19:36 2019(r354147)
+++ head/sys/kern/genoffset.c   Tue Oct 29 17:28:25 2019(r354148)
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 OFFSYM(td_priority, thread, u_char);
-OFFSYM(td_epochnest, thread, u_char);
 OFFSYM(td_critnest, thread, u_int);
 OFFSYM(td_pinned, thread, int);
 OFFSYM(td_owepreempt, thread, u_char);

Modified: head/sys/kern/kern_malloc.c
==
--- head/sys/kern/kern_malloc.c Tue Oct 29 17:19:36 2019(r354147)
+++ head/sys/kern/kern_malloc.c Tue Oct 29 17:28:25 2019(r354148)
@@ -523,12 +523,13 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_
if (flags & M_WAITOK) {
KASSERT(curthread->td_intr_nesting_level == 0,
   ("malloc(M_WAITOK) in interrupt context"));
+   if (__predict_false(!THREAD_CAN_SLEEP())) {
 #ifdef EPOCH_TRACE
-   if (__predict_false(curthread->td_epochnest > 0))
epoch_trace_list(curthread);
 #endif
-   KASSERT(curthread->td_epochnest == 0,
-   ("malloc(M_WAITOK) in epoch context")); 
+   KASSERT(1, 
+   ("malloc(M_WAITOK) with sleeping prohibited"));
+   }
}
KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(),
("malloc: called with spinlock or critical section held"));

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Tue Oct 29 17:19:36 2019(r354147)
+++ head/sys/kern/kern_synch.c  Tue Oct 29 17:28:25 2019(r354148)
@@ -151,11 +151,6 @@ _sleep(void *ident, struct lock_object *lock, int prio
("sleeping without a lock"));
KASSERT(ident != NULL, ("_sleep: NULL ident"));
KASSERT(TD_IS_RUNNING(td), ("_sleep: curthread not running"));
-#ifdef EPOCH_TRACE
-   if (__predict_false(curthread->td_epochnest > 0))
-   epoch_trace_list(curthread);
-#endif
-   KASSERT(td->td_epochnest == 0, ("sleeping in an epoch section"));
if (priority & PDROP)
KASSERT(lock != NULL && lock != _object,
("PDROP requires a non-Giant lock"));

Modified: head/sys/kern/subr_epoch.c
==
--- head/sys/kern/subr_epoch.c  Tue Oct 29 17:19:36 2019(r354147)
+++ head/sys/kern/subr_epoch.c  Tue Oct 29 17:28:25 2019(r354148)
@@ -377,7 +377,7 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et
epoch_trace_enter(td, epoch, et, file, line);
 #endif
et->et_td = td;
-   td->td_epochnest++;
+   THREAD_NO_SLEEPING();
critical_enter();
sched_pin();
td->td_pre_epoch_prio = td->td_priority;
@@ -390,13 +390,10 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et
 void
 epoch_enter(epoch_t epoch)
 {
-   struct thread *td;
epoch_record_t er;
 
MPASS(cold || epoch != NULL);
INIT_CHECK(epoch);
-   td = curthread;
-   td->td_epochnest++;
critical_enter();
er = epoch_currecord(epoch);
ck_epoch_begin(>er_record, NULL);
@@ -412,8 +409,7 @@ _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et 
td = curthread;
critical_enter();
sched_unpin();
-   MPASS(td->td_epochnest);
-   td->td_epochnest--;
+   THREAD_SLEEPING_OK();
er = epoch_currecord(epoch);
MPASS(epoch->e_flags & EPOCH_PREEMPT);
MPASS(et != NULL);
@@ -435,13 +431,9 @@ _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et 
 void
 epoch_exit(epoch_t epoch)
 {
-   struct thread *td;
epoch_record_t er;
 
INIT_CHECK(epoch);
-   td = curthread;
-   MPASS(td->td_epochnest);
-   

svn commit: r354147 - head/sys/sys

2019-10-29 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct 29 17:19:36 2019
New Revision: 354147
URL: https://svnweb.freebsd.org/changeset/base/354147

Log:
  Augment macros that manipulate td_no_sleeping with assertions to check
  underleak and overflow of the counter.
  
  Reviewed by:  kib

Modified:
  head/sys/sys/proc.h

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Tue Oct 29 16:51:12 2019(r354146)
+++ head/sys/sys/proc.h Tue Oct 29 17:19:36 2019(r354147)
@@ -246,8 +246,7 @@ struct thread {
u_char  td_lend_user_pri; /* (t) Lend user pri. */
 
 /* Cleared during fork1() */
-#definetd_startzero td_epochnest
-   u_char  td_epochnest;   /* (k) Epoch nest counter. */
+#definetd_startzero td_flags
int td_flags;   /* (t) TDF_* flags. */
int td_inhibitors;  /* (t) Why can not run. */
int td_pflags;  /* (k) Private thread (TDP_*) flags. */
@@ -299,7 +298,7 @@ struct thread {
struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */
pid_t   td_dbg_forked;  /* (c) Child pid for debugger. */
u_int   td_vp_reserv;   /* (k) Count of reserved vnodes. */
-   int td_no_sleeping; /* (k) Sleeping disabled count. */
+   u_int   td_no_sleeping; /* (k) Sleeping disabled count. */
void*td_su; /* (k) FFS SU private */
sbintime_t  td_sleeptimo;   /* (t) Sleep timeout. */
int td_rtcgen;  /* (s) rtc_generation of abs. sleep */
@@ -948,9 +947,15 @@ extern pid_t pid_max;
 #definethread_safetoswapout(td)((td)->td_flags & TDF_CANSWAP)
 
 /* Control whether or not it is safe for curthread to sleep. */
-#defineTHREAD_NO_SLEEPING()((curthread)->td_no_sleeping++)
+#defineTHREAD_NO_SLEEPING()do {
\
+   curthread->td_no_sleeping++;\
+   MPASS(curthread->td_no_sleeping > 0);   \
+} while (0)
 
-#defineTHREAD_SLEEPING_OK()((curthread)->td_no_sleeping--)
+#defineTHREAD_SLEEPING_OK()do {
\
+   MPASS(curthread->td_no_sleeping > 0);   \
+   curthread->td_no_sleeping--;\
+} while (0)
 
 #defineTHREAD_CAN_SLEEP()  ((curthread)->td_no_sleeping == 
0)
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354146 - head/contrib/llvm/lib/TableGen

2019-10-29 Thread Dimitry Andric
Author: dim
Date: Tue Oct 29 16:51:12 2019
New Revision: 354146
URL: https://svnweb.freebsd.org/changeset/base/354146

Log:
  Pull in r373338 from upstream llvm trunk (by Simon Pilgrim):
  
Revert rL349624 : Let TableGen write output only if it changed,
instead of doing so in cmake, attempt 2
  
Differential Revision: https://reviews.llvm.org/D55842
-
As discussed on PR43385 this is causing Visual Studio msbuilds to
perpetually rebuild all tablegen generated files
  
  Pull in r373664 from upstream llvm trunk (by Nico Weber):
  
Reland r349624: Let TableGen write output only if it changed, instead
of doing so in cmake
  
Move the write-if-changed logic behind a flag and don't pass it with
the MSVC generator. msbuild doesn't have a restat optimization, so
not doing write-if-change there doesn't have a cost, and it should
fix whatever causes PR43385.
  
  This should fix the scenario where an incremental build from before
  r353358 (the clang 9.0.0 upgrade) to r353358 or later fails to update
  the timestamp of the generated lib/clang/headers/arm_fp16.h header.
  
  After such a build, installing world from read-only source and object
  directories would attempt to generate the header again, leading to
  "clang-tblgen: error opening arm_fp16.h.d:Read-only file system".
  
  Reported by:  avg, np
  PR:   241402
  MFC after:1 month
  X-MFC-With:   r353358

Modified:
  head/contrib/llvm/lib/TableGen/Main.cpp

Modified: head/contrib/llvm/lib/TableGen/Main.cpp
==
--- head/contrib/llvm/lib/TableGen/Main.cpp Tue Oct 29 09:47:12 2019
(r354145)
+++ head/contrib/llvm/lib/TableGen/Main.cpp Tue Oct 29 16:51:12 2019
(r354146)
@@ -49,6 +49,9 @@ static cl::list
 MacroNames("D", cl::desc("Name of the macro to be defined"),
 cl::value_desc("macro name"), cl::Prefix);
 
+static cl::opt
+WriteIfChanged("write-if-changed", cl::desc("Only write output if it 
changed"));
+
 static int reportError(const char *ProgName, Twine Msg) {
   errs() << ProgName << ": " << Msg;
   errs().flush();
@@ -114,12 +117,14 @@ int llvm::TableGenMain(char *argv0, TableGenMainFn *Ma
   return Ret;
   }
 
-  // Only updates the real output file if there are any differences.
-  // This prevents recompilation of all the files depending on it if there
-  // aren't any.
-  if (auto ExistingOrErr = MemoryBuffer::getFile(OutputFilename))
-if (std::move(ExistingOrErr.get())->getBuffer() == Out.str())
-  return 0;
+  if (WriteIfChanged) {
+// Only updates the real output file if there are any differences.
+// This prevents recompilation of all the files depending on it if there
+// aren't any.
+if (auto ExistingOrErr = MemoryBuffer::getFile(OutputFilename))
+  if (std::move(ExistingOrErr.get())->getBuffer() == Out.str())
+return 0;
+  }
 
   std::error_code EC;
   ToolOutputFile OutFile(OutputFilename, EC, sys::fs::F_Text);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354145 - in head/tests/sys/netpfil: common pf

2019-10-29 Thread Kristof Provost
Author: kp
Date: Tue Oct 29 09:47:12 2019
New Revision: 354145
URL: https://svnweb.freebsd.org/changeset/base/354145

Log:
  netpfil tests: Add missing copyright & license statements

Modified:
  head/tests/sys/netpfil/common/pft_ping.py
  head/tests/sys/netpfil/common/sniffer.py
  head/tests/sys/netpfil/pf/CVE-2019-5597.py
  head/tests/sys/netpfil/pf/CVE-2019-5598.py
  head/tests/sys/netpfil/pf/anchor.sh
  head/tests/sys/netpfil/pf/echo_inetd.conf
  head/tests/sys/netpfil/pf/forward.sh
  head/tests/sys/netpfil/pf/fragmentation.sh
  head/tests/sys/netpfil/pf/icmp.sh
  head/tests/sys/netpfil/pf/names.sh
  head/tests/sys/netpfil/pf/nat.sh
  head/tests/sys/netpfil/pf/pass_block.sh
  head/tests/sys/netpfil/pf/pfsync.sh
  head/tests/sys/netpfil/pf/rdr.sh
  head/tests/sys/netpfil/pf/route_to.sh
  head/tests/sys/netpfil/pf/set_skip.sh
  head/tests/sys/netpfil/pf/set_tos.sh
  head/tests/sys/netpfil/pf/synproxy.sh
  head/tests/sys/netpfil/pf/utils.subr

Modified: head/tests/sys/netpfil/common/pft_ping.py
==
--- head/tests/sys/netpfil/common/pft_ping.py   Tue Oct 29 04:28:24 2019
(r354144)
+++ head/tests/sys/netpfil/common/pft_ping.py   Tue Oct 29 09:47:12 2019
(r354145)
@@ -1,4 +1,30 @@
 #!/usr/bin/env python
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2017 Kristof Provost 
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
 
 import argparse
 import scapy.all as sp

Modified: head/tests/sys/netpfil/common/sniffer.py
==
--- head/tests/sys/netpfil/common/sniffer.pyTue Oct 29 04:28:24 2019
(r354144)
+++ head/tests/sys/netpfil/common/sniffer.pyTue Oct 29 09:47:12 2019
(r354145)
@@ -1,4 +1,30 @@
 # $FreeBSD$
+#
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright (c) 2017 Kristof Provost 
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
 
 import threading
 import scapy.all as sp

Modified: head/tests/sys/netpfil/pf/CVE-2019-5597.py
==
--- head/tests/sys/netpfil/pf/CVE-2019-5597.py  Tue Oct 29 04:28:24 2019
(r354144)
+++ head/tests/sys/netpfil/pf/CVE-2019-5597.py  Tue Oct 29 09:47:12 2019
(r354145)
@@ -1,4 +1,29 @@
 #!/usr/bin/env python
+#
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright (c) 2019 Synacktiv
+#
+# Redistribution and use in source and binary 

Re: svn commit: r353937 - in head/share: man/man5 mk

2019-10-29 Thread Alexey Dokuchaev
On Tue, Oct 29, 2019 at 08:04:07AM +0100, Dimitry Andric wrote:
> On 27 Oct 2019, at 17:59, Alexey Dokuchaev  wrote:
> > 
> > On Sat, Oct 26, 2019 at 04:34:14PM +0200, Dimitry Andric wrote:
> ...
> >> I only tested -j24 on a 32-core system, but I could probably repeat the
> >> experiment with lower and higher -j values: [...]
> >> 
> >> So ~2.3% difference in real time, which is not too bad I think.
> > 
> > Well, I'd say it's acceptable. :-/
> 
> I also tested at low (-j4) and high (-j32) levels.  It turns out that at
> low -j levels, the difference is less pronounced, just ~1.1% in real
> time.  And at high -j levels, it is more pronounced, ~4.3% in real time.
> 
> Note also that at high -j levels, the difference in system time seems
> to get more influence, e.g. at low -j the difference is ~4.5%, while at
> high -j the difference is ~7.2%.  I guess it is because dynamic linking
> uses more syscalls.

Yeah, it would be definitely nice if we could optimize runtime linker.
Thanks for conducting these tests by the way, much appreciated, Dimitry!

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


Re: svn commit: r353937 - in head/share: man/man5 mk

2019-10-29 Thread Dimitry Andric
On 27 Oct 2019, at 17:59, Alexey Dokuchaev  wrote:
> 
> On Sat, Oct 26, 2019 at 04:34:14PM +0200, Dimitry Andric wrote:
...
>> I only tested -j24 on a 32-core system, but I could probably repeat the
>> experiment with lower and higher -j values: [...]
>> 
>> So ~2.3% difference in real time, which is not too bad I think.
> 
> Well, I'd say it's acceptable. :-/

I also tested at low (-j4) and high (-j32) levels.  It turns out that at
low -j levels, the difference is less pronounced, just ~1.1% in real
time.  And at high -j levels, it is more pronounced, ~4.3% in real time.

Note also that at high -j levels, the difference in system time seems
to get more influence, e.g. at low -j the difference is ~4.5%, while at
high -j the difference is ~7.2%.  I guess it is because dynamic linking
uses more syscalls.


At -j4:

Results for real time:
---
x j4-static-real.txt
+ j4-dynamic-real.txt
N   Min   MaxMedian   AvgStddev
x   7   5508.58   5548.05   5533.25 5530.2829 12.323855
+   7   5514.685660.1   5591.25 5593.5143  59.98042
Difference at 95.0% confidence
63.2314 +/- 50.4309
1.14337% +/- 0.912329%
(Student's t, pooled s = 43.2985)

Results for user time:
---
x j4-static-user.txt
+ j4-dynamic-user.txt
N   Min   MaxMedian   AvgStddev
x   7  19525.34  19607.74   19593.1  19582.78 29.037717
+   7  20178.84  20348.11  20214.28 20235.057  57.31409
Difference at 95.0% confidence
652.277 +/- 52.9155
3.33087% +/- 0.272077%
(Student's t, pooled s = 45.4318)

Results for system time:
---
x j4-static-sys.txt
+ j4-dynamic-sys.txt
N   Min   MaxMedian   AvgStddev
x   7   1622.63   1634.98   1629.87 1629.1229 4.7234017
+   7   1672.25   1722.23   1704.49 1703.1729 15.724862
Difference at 95.0% confidence
74.05 +/- 13.5224
4.54539% +/- 0.833228%
(Student's t, pooled s = 11.6099)


At -j32:

Results for real time:
---
x j32-static-real.txt
+ j32-dynamic-real.txt
N   Min   MaxMedian   AvgStddev
x   7   1689.19   1735.36   1707.32 1707.8471 16.500078
+   7   1754.98   1812.57   1777.96 1781.6329 19.554159
Difference at 95.0% confidence
73.7857 +/- 21.0718
4.32039% +/- 1.25627%
(Student's t, pooled s = 18.0917)

Results for user time:
---
x j32-static-user.txt
+ j32-dynamic-user.txt
N   Min   MaxMedian   AvgStddev
x   7  38545.36   38802.6  38609.87 38641.009 105.11904
+   7  39430.93  39924.98  39856.91 39769.979  185.3612
Difference at 95.0% confidence
1128.97 +/- 175.5
2.92169% +/- 0.457446%
(Student's t, pooled s = 150.68)

Results for system time:
---
x j32-static-sys.txt
+ j32-dynamic-sys.txt
N   Min   MaxMedian   AvgStddev
x   7   2752.81   2809.97   2781.46 2781.4986  21.86523
+   7   2906.22   3151.93   2932.59 2981.5757 103.79842
Difference at 95.0% confidence
200.077 +/- 87.3629
7.19314% +/- 3.15079%
(Student's t, pooled s = 75.0073)


-Dimitry



signature.asc
Description: Message signed with OpenPGP