svn commit: r357360 - head/sys/ufs/ufs

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb  1 06:41:44 2020
New Revision: 357360
URL: https://svnweb.freebsd.org/changeset/base/357360

Log:
  ufs: drop ufs_markatime from ufs_fifoops
  
  The routine is only called on mmap and exec, both of which are invalid for
  this type.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D23421

Modified:
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cSat Feb  1 06:40:35 2020
(r357359)
+++ head/sys/ufs/ufs/ufs_vnops.cSat Feb  1 06:41:44 2020
(r357360)
@@ -2783,7 +2783,6 @@ struct vop_vector ufs_fifoops = {
.vop_getattr =  ufs_getattr,
.vop_inactive = ufs_inactive,
.vop_kqfilter = ufsfifo_kqfilter,
-   .vop_markatime =ufs_markatime,
.vop_pathconf = ufs_pathconf,
.vop_print =ufs_print,
.vop_read = VOP_PANIC,
___
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: r357359 - head/sys/kern

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb  1 06:40:35 2020
New Revision: 357359
URL: https://svnweb.freebsd.org/changeset/base/357359

Log:
  vfs: save on atomics on the root vnode for absolute lookups
  
  There are 2 back-to-back atomics on the vnode, but we can check upfront if one
  is sufficient. Similarly we can handle relative lookups where current working
  directory == root directory.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D23427

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==
--- head/sys/kern/vfs_lookup.c  Sat Feb  1 06:39:49 2020(r357358)
+++ head/sys/kern/vfs_lookup.c  Sat Feb  1 06:40:35 2020(r357359)
@@ -254,7 +254,7 @@ namei_cleanup_cnp(struct componentname *cnp)
 }
 
 static int
-namei_handle_root(struct nameidata *ndp, struct vnode **dpp)
+namei_handle_root(struct nameidata *ndp, struct vnode **dpp, u_int n)
 {
struct componentname *cnp;
 
@@ -276,7 +276,7 @@ namei_handle_root(struct nameidata *ndp, struct vnode 
ndp->ni_pathlen--;
}
*dpp = ndp->ni_rootdir;
-   vrefact(*dpp);
+   vrefactn(*dpp, n);
return (0);
 }
 
@@ -395,8 +395,11 @@ namei(struct nameidata *ndp)
 * Get starting point for the translation.
 */
FILEDESC_SLOCK(fdp);
+   /*
+* The reference on ni_rootdir is acquired in the block below to avoid
+* back-to-back atomics for absolute lookups.
+*/
ndp->ni_rootdir = fdp->fd_rdir;
-   vrefact(ndp->ni_rootdir);
ndp->ni_topdir = fdp->fd_jdir;
 
/*
@@ -412,15 +415,29 @@ namei(struct nameidata *ndp)
cnp->cn_nameptr = cnp->cn_pnbuf;
if (cnp->cn_pnbuf[0] == '/') {
ndp->ni_resflags |= NIRES_ABS;
-   error = namei_handle_root(ndp, );
+   error = namei_handle_root(ndp, , 2);
+   if (error != 0) {
+   /*
+* Simplify error handling, we should almost never be
+* here.
+*/
+   vrefact(ndp->ni_rootdir);
+   }
} else {
if (ndp->ni_startdir != NULL) {
+   vrefact(ndp->ni_rootdir);
dp = ndp->ni_startdir;
startdir_used = 1;
} else if (ndp->ni_dirfd == AT_FDCWD) {
dp = fdp->fd_cdir;
-   vrefact(dp);
+   if (dp == ndp->ni_rootdir) {
+   vrefactn(dp, 2);
+   } else {
+   vrefact(ndp->ni_rootdir);
+   vrefact(dp);
+   }
} else {
+   vrefact(ndp->ni_rootdir);
rights = ndp->ni_rightsneeded;
cap_rights_set(, CAP_LOOKUP);
 
@@ -567,7 +584,7 @@ namei(struct nameidata *ndp)
cnp->cn_nameptr = cnp->cn_pnbuf;
if (*(cnp->cn_nameptr) == '/') {
vrele(dp);
-   error = namei_handle_root(ndp, );
+   error = namei_handle_root(ndp, , 1);
if (error != 0)
goto out;
}
___
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: r357357 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb  1 06:39:10 2020
New Revision: 357357
URL: https://svnweb.freebsd.org/changeset/base/357357

Log:
  zfs: ZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED -> ZFS_TEARDOWN_INACTIVE_WLOCKED
  
  Fix up the argument used in one case as well.

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
Fri Jan 31 22:54:44 2020(r357356)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
Sat Feb  1 06:39:10 2020(r357357)
@@ -106,7 +106,7 @@ struct zfsvfs {
 #defineZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
rms_wunlock(&(zfsvfs)->z_teardown_inactive_lock)
 
-#defineZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \
+#defineZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \
rms_wowned(&(zfsvfs)->z_teardown_inactive_lock)
 
 /*

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Jan 
31 22:54:44 2020(r357356)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cSat Feb 
 1 06:39:10 2020(r357357)
@@ -2437,7 +2437,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
znode_t *zp;
 
ASSERT(RRM_WRITE_HELD(>z_teardown_lock));
-   ASSERT(ZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED(zp->z_zfsvfs));
+   ASSERT(ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs));
 
/*
 * We already own this, so just update the objset_t, as the one we

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Fri Jan 
31 22:54:44 2020(r357356)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Feb 
 1 06:39:10 2020(r357357)
@@ -606,7 +606,7 @@ zfs_znode_dmu_fini(znode_t *zp)
 {
ASSERT(MUTEX_HELD(ZFS_OBJ_MUTEX(zp->z_zfsvfs, zp->z_id)) ||
zp->z_unlinked ||
-   ZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED(zp->z_zfsvfs));
+   ZFS_TEARDOWN_INACTIVE_WLOCKED(zp->z_zfsvfs));
 
sa_handle_destroy(zp->z_sa_hdl);
zp->z_sa_hdl = 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: r357361 - in head/sys: kern sys ufs/ufs vm

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb  1 06:46:55 2020
New Revision: 357361
URL: https://svnweb.freebsd.org/changeset/base/357361

Log:
  vfs: replace VOP_MARKATIME with VOP_MMAPPED
  
  The routine is only provided by ufs and is only used on mmap and exec.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D23422

Modified:
  head/sys/kern/kern_exec.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vnode_if.src
  head/sys/sys/vnode.h
  head/sys/ufs/ufs/ufs_vnops.c
  head/sys/vm/vm_mmap.c

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Sat Feb  1 06:41:44 2020(r357360)
+++ head/sys/kern/kern_exec.c   Sat Feb  1 06:46:55 2020(r357361)
@@ -870,7 +870,7 @@ interpret:
/* Set values passed into the program in registers. */
(*p->p_sysent->sv_setregs)(td, imgp, stack_base);
 
-   vfs_mark_atime(imgp->vp, td->td_ucred);
+   VOP_MMAPPED(imgp->vp);
 
SDT_PROBE1(proc, , , exec__success, args->fname);
 

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cSat Feb  1 06:41:44 2020(r357360)
+++ head/sys/kern/vfs_subr.cSat Feb  1 06:46:55 2020(r357361)
@@ -5956,23 +5956,6 @@ vfs_read_dirent(struct vop_readdir_args *ap, struct di
 }
 
 /*
- * Mark for update the access time of the file if the filesystem
- * supports VOP_MARKATIME.  This functionality is used by execve and
- * mmap, so we want to avoid the I/O implied by directly setting
- * va_atime for the sake of efficiency.
- */
-void
-vfs_mark_atime(struct vnode *vp, struct ucred *cred)
-{
-   struct mount *mp;
-
-   mp = vp->v_mount;
-   ASSERT_VOP_LOCKED(vp, "vfs_mark_atime");
-   if (mp != NULL && (mp->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
-   (void)VOP_MARKATIME(vp);
-}
-
-/*
  * The purpose of this routine is to remove granularity from accmode_t,
  * reducing it into standard unix access bits - VEXEC, VREAD, VWRITE,
  * VADMIN and VAPPEND.

Modified: head/sys/kern/vnode_if.src
==
--- head/sys/kern/vnode_if.src  Sat Feb  1 06:41:44 2020(r357360)
+++ head/sys/kern/vnode_if.src  Sat Feb  1 06:46:55 2020(r357361)
@@ -181,9 +181,9 @@ vop_setattr {
 };
 
 
-%% markatime   vp  L L L
+%% mmapped vp  L L L
 
-vop_markatime {
+vop_mmapped {
IN struct vnode *vp;
 };
 

Modified: head/sys/sys/vnode.h
==
--- head/sys/sys/vnode.hSat Feb  1 06:41:44 2020(r357360)
+++ head/sys/sys/vnode.hSat Feb  1 06:46:55 2020(r357361)
@@ -937,7 +937,6 @@ void vfs_hash_rehash(struct vnode *vp, u_int hash);
 void vfs_hash_remove(struct vnode *vp);
 
 int vfs_kqfilter(struct vop_kqfilter_args *);
-void vfs_mark_atime(struct vnode *vp, struct ucred *cred);
 struct dirent;
 int vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off);
 int vfs_emptydir(struct vnode *vp);

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cSat Feb  1 06:41:44 2020
(r357360)
+++ head/sys/ufs/ufs/ufs_vnops.cSat Feb  1 06:46:55 2020
(r357361)
@@ -108,7 +108,7 @@ static vop_getattr_tufs_getattr;
 static vop_ioctl_t ufs_ioctl;
 static vop_link_t  ufs_link;
 static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct 
componentname *, const char *);
-static vop_markatime_t ufs_markatime;
+static vop_mmapped_t   ufs_mmapped;
 static vop_mkdir_t ufs_mkdir;
 static vop_mknod_t ufs_mknod;
 static vop_open_t  ufs_open;
@@ -676,19 +676,22 @@ out:
 }
 #endif /* UFS_ACL */
 
-/*
- * Mark this file's access time for update for vfs_mark_atime().  This
- * is called from execve() and mmap().
- */
 static int
-ufs_markatime(ap)
-   struct vop_markatime_args /* {
+ufs_mmapped(ap)
+   struct vop_mmapped_args /* {
struct vnode *a_vp;
} */ *ap;
 {
-   struct inode *ip = VTOI(ap->a_vp);
+   struct vnode *vp;
+   struct inode *ip;
+   struct mount *mp;
 
-   UFS_INODE_SET_FLAG_SHARED(ip, IN_ACCESS);
+   vp = ap->a_vp;
+   ip = VTOI(vp);
+   mp = vp->v_mount;
+
+   if ((mp->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
+   UFS_INODE_SET_FLAG_SHARED(ip, IN_ACCESS);
/*
 * XXXKIB No UFS_UPDATE(ap->a_vp, 0) there.
 */
@@ -2741,7 +2744,7 @@ struct vop_vector ufs_vnodeops = {
.vop_ioctl =ufs_ioctl,
.vop_link = ufs_link,
.vop_lookup =   vfs_cache_lookup,
-   .vop_markatime =ufs_markatime,
+   .vop_mmapped =  ufs_mmapped,
.vop_mkdir =

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

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Sat Feb  1 06:39:49 2020
New Revision: 357358
URL: https://svnweb.freebsd.org/changeset/base/357358

Log:
  vfs: add vrefactn
  
  Differential Revision:https://reviews.freebsd.org/D23427

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

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cSat Feb  1 06:39:10 2020(r357357)
+++ head/sys/kern/vfs_subr.cSat Feb  1 06:39:49 2020(r357358)
@@ -3046,6 +3046,19 @@ vrefact(struct vnode *vp)
 #endif
 }
 
+void
+vrefactn(struct vnode *vp, u_int n)
+{
+
+   CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
+#ifdef INVARIANTS
+   int old = atomic_fetchadd_int(>v_usecount, n);
+   VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old));
+#else
+   atomic_add_int(>v_usecount, n);
+#endif
+}
+
 /*
  * Return reference count of a vnode.
  *

Modified: head/sys/sys/vnode.h
==
--- head/sys/sys/vnode.hSat Feb  1 06:39:10 2020(r357357)
+++ head/sys/sys/vnode.hSat Feb  1 06:39:49 2020(r357358)
@@ -900,6 +900,7 @@ voidvrele(struct vnode *vp);
 void   vref(struct vnode *vp);
 void   vrefl(struct vnode *vp);
 void   vrefact(struct vnode *vp);
+void   vrefactn(struct vnode *vp, u_int n);
 intvrefcnt(struct vnode *vp);
 void   v_addpollinfo(struct vnode *vp);
 
___
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: r357337 - head/sys/riscv/include

2020-01-31 Thread John Baldwin
On 1/31/20 1:17 PM, Conrad Meyer wrote:
> Hi John,
> 
> Isn't the 32-bit MSTATUS_SD and SSTATUS_SD also UB without explicit
> unsigned suffix?

Possibly, but I doubt we will have a 32-bit RISC-V port.  I'd
probably prefer to just use explicit hex values (0x8000, etc.)
since the compiler will always get those correct.

-- 
John Baldwin
___
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: r357356 - head/sys/net

2020-01-31 Thread Kristof Provost
Author: kp
Date: Fri Jan 31 22:54:44 2020
New Revision: 357356
URL: https://svnweb.freebsd.org/changeset/base/357356

Log:
  vlan: Fix panic when vnet jail with a vlan interface is destroyed
  
  During vnet cleanup vnet_if_uninit() checks that no more interfaces remain in
  the vnet. Any interface borrowed from another vnet is returned by
  vnet_if_return(). Other interfaces (i.e. cloned interfaces) should have been
  destroyed by their cloner at this point.
  
  The if_vlan VNET_SYSUNINIT had priority SI_ORDER_FIRST, which means it had
  equal priority as vnet_if_uninit(). In other words: it was possible for it to
  be called *after* vnet_if_uninit(), which would lead to assertion failures.
  
  Set the priority to SI_ORDER_ANY, like other cloners to ensure that vlan
  interfaces are destroyed before we enter vnet_if_uninit().
  
  The sys/net/if_vlan test provoked this.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Fri Jan 31 22:21:15 2020(r357355)
+++ head/sys/net/if_vlan.c  Fri Jan 31 22:54:44 2020(r357356)
@@ -921,7 +921,7 @@ vnet_vlan_uninit(const void *unused __unused)
 
if_clone_detach(V_vlan_cloner);
 }
-VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_INIT_IF, SI_ORDER_FIRST,
+VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY,
 vnet_vlan_uninit, NULL);
 #endif
 
___
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: r357349 - in head/sys: conf modules/tpm

2020-01-31 Thread Dimitry Andric
Hmm yes, you are quite right.  Other parts of the code also seem to use 
~TPM_XXX, and the WR4() inline function called takes a uint32_t.  I'll revert 
my change and apply the tilde version instead!

-Dimitry

> On 31 Jan 2020, at 22:13, Conrad Meyer  wrote:
> 
> Hi Dimitry,
> 
> Do you think maybe the intent is to use ~TPM_CRB_CTRL_CANCEL_CMD
> instead?  Plain "0" might also make sense.  But I think the compiler
> is right here and the warning should not be disabled — !BIT(foo)
> doesn't really make sense for a register.  It happens to affect the
> right bit only because CANCEL_CMD is BIT(0).
> 
> Thanks,
> Conrad
> 
> On Fri, Jan 31, 2020 at 11:36 AM Dimitry Andric  wrote:
>> 
>> Author: dim
>> Date: Fri Jan 31 19:36:14 2020
>> New Revision: 357349
>> URL: https://svnweb.freebsd.org/changeset/base/357349
>> 
>> Log:
>>  Merge r357348 from the clang 10.0.0 import branch:
>> 
>>  Disable new clang 10.0.0 warnings about converting the result of shift
>>  operations to a boolean in tpm(4):
>> 
>>  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a 
>> boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
>>  WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
>>^
>>  sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 
>> 'TPM_CRB_CTRL_CANCEL_CMD'
>>  #define TPM_CRB_CTRL_CANCEL_CMD BIT(0)
>>  ^
>>  sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
>>  #define BIT(x) (1 << (x))
>>^
>> 
>>  Such warnings can be useful in C++ contexts, but not so much in kernel
>>  drivers, where this type of bit twiddling is commonplace.  So disable it
>>  for this case.
>> 
>>  MFC after:3 days
>> 
>> Modified:
>>  head/sys/conf/files.amd64
>>  head/sys/conf/kern.mk
>>  head/sys/modules/tpm/Makefile
>> Directory Properties:
>>  head/   (props changed)
>> 
>> Modified: head/sys/conf/files.amd64
>> ==
>> --- head/sys/conf/files.amd64   Fri Jan 31 19:35:21 2020(r357348)
>> +++ head/sys/conf/files.amd64   Fri Jan 31 19:36:14 2020(r357349)
>> @@ -323,7 +323,8 @@ dev/syscons/scvesactl.c optionalsc 
>> vga vesa
>> dev/syscons/scvgarndr.coptionalsc vga
>> dev/tpm/tpm.c  optionaltpm
>> dev/tpm/tpm20.coptionaltpm
>> -dev/tpm/tpm_crb.c  optionaltpm acpi
>> +dev/tpm/tpm_crb.c  optionaltpm acpi \
>> +   compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}"
>> dev/tpm/tpm_tis.c  optionaltpm acpi
>> dev/tpm/tpm_acpi.c optionaltpm acpi
>> dev/tpm/tpm_isa.c  optionaltpm isa
>> 
>> Modified: head/sys/conf/kern.mk
>> ==
>> --- head/sys/conf/kern.mk   Fri Jan 31 19:35:21 2020(r357348)
>> +++ head/sys/conf/kern.mk   Fri Jan 31 19:36:14 2020(r357349)
>> @@ -37,6 +37,9 @@ CWARNEXTRA+=  -Wno-error-shift-negative-value
>> .if ${COMPILER_VERSION} >= 4
>> CWARNEXTRA+=   -Wno-address-of-packed-member
>> .endif
>> +.if ${COMPILER_VERSION} >= 10
>> +NO_WINT_IN_BOOL_CONTEXT=   -Wno-int-in-bool-context
>> +.endif
>> .endif
>> 
>> .if ${COMPILER_TYPE} == "gcc"
>> 
>> Modified: head/sys/modules/tpm/Makefile
>> ==
>> --- head/sys/modules/tpm/Makefile   Fri Jan 31 19:35:21 2020
>> (r357348)
>> +++ head/sys/modules/tpm/Makefile   Fri Jan 31 19:36:14 2020
>> (r357349)
>> @@ -11,3 +11,5 @@ SRCS+=tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h 
>> acpi_i
>> SRCS+= tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h
>> 
>> .include 
>> +
>> +CWARNFLAGS.tpm_crb.c+= ${NO_WINT_IN_BOOL_CONTEXT}



signature.asc
Description: Message signed with OpenPGP


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

2020-01-31 Thread Jeff Roberson
Author: jeff
Date: Fri Jan 31 22:21:15 2020
New Revision: 357355
URL: https://svnweb.freebsd.org/changeset/base/357355

Log:
  Add two missing fences with comments describing them.  These were found by
  inspection and after a lengthy discussion with jhb and kib.  They have not
  produced test failures.
  
  Don't pointer chase through cpu0's smr.  Use cpu correct smr even when not
  in a critical section to reduce the likelihood of false sharing.

Modified:
  head/sys/kern/subr_smr.c
  head/sys/sys/smr.h

Modified: head/sys/kern/subr_smr.c
==
--- head/sys/kern/subr_smr.cFri Jan 31 21:20:22 2020(r357354)
+++ head/sys/kern/subr_smr.cFri Jan 31 22:21:15 2020(r357355)
@@ -195,7 +195,7 @@ smr_advance(smr_t smr)
 * odd and an observed value of 0 in a particular CPU means
 * it is not currently in a read section.
 */
-   s = smr->c_shared;
+   s = zpcpu_get(smr)->c_shared;
goal = atomic_fetchadd_int(>s_wr_seq, SMR_SEQ_INCR) + SMR_SEQ_INCR;
 
/*
@@ -242,16 +242,21 @@ smr_poll(smr_t smr, smr_seq_t goal, bool wait)
 */
success = true;
critical_enter();
-   s = smr->c_shared;
+   s = zpcpu_get(smr)->c_shared;
 
/*
 * Acquire barrier loads s_wr_seq after s_rd_seq so that we can not
 * observe an updated read sequence that is larger than write.
 */
s_rd_seq = atomic_load_acq_int(>s_rd_seq);
-   s_wr_seq = smr_current(smr);
 
/*
+* wr_seq must be loaded prior to any c_seq value so that a stale
+* c_seq can only reference time after this wr_seq.
+*/
+   s_wr_seq = atomic_load_acq_int(>s_wr_seq);
+
+   /*
 * Detect whether the goal is valid and has already been observed.
 *
 * The goal must be in the range of s_wr_seq >= goal >= s_rd_seq for
@@ -335,6 +340,12 @@ smr_poll(smr_t smr, smr_seq_t goal, bool wait)
 
 out:
critical_exit();
+
+   /*
+* Serialize with smr_advance()/smr_exit().  The caller is now free
+* to modify memory as expected.
+*/
+   atomic_thread_fence_acq();
 
return (success);
 }

Modified: head/sys/sys/smr.h
==
--- head/sys/sys/smr.h  Fri Jan 31 21:20:22 2020(r357354)
+++ head/sys/sys/smr.h  Fri Jan 31 22:21:15 2020(r357355)
@@ -70,10 +70,17 @@ struct smr {
  * Return the current write sequence number.
  */
 static inline smr_seq_t
+smr_shared_current(smr_shared_t s)
+{
+
+   return (atomic_load_int(>s_wr_seq));
+}
+
+static inline smr_seq_t
 smr_current(smr_t smr)
 {
 
-   return (atomic_load_int(>c_shared->s_wr_seq));
+   return (smr_shared_current(zpcpu_get(smr)->c_shared));
 }
 
 /*
@@ -106,7 +113,7 @@ smr_enter(smr_t smr)
 * is detected and handled there.
 */
/* This is an add because we do not have atomic_store_acq_int */
-   atomic_add_acq_int(>c_seq, smr_current(smr));
+   atomic_add_acq_int(>c_seq, smr_shared_current(smr->c_shared));
 }
 
 /*
___
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: r357354 - in stable: 11/stand/i386/gptboot 12/stand/i386/gptboot

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 21:20:22 2020
New Revision: 357354
URL: https://svnweb.freebsd.org/changeset/base/357354

Log:
  MFC r357232:
  
  Merge r357231 from the clang1000-import branch:
  
  Work around assembler error from clang 10.0.0 in gptboot:
  
  stand/i386/gptboot/gptldr.S:141:3: error: value of 36878 is too large for 
field of 2 bytes.
jmp MEM_JMP # Start BTX
^
  
  Use the same construct as in stand/i386/boot2/boot1.S, which ensures the
  jump distance does not become too large.

Modified:
  stable/12/stand/i386/gptboot/gptldr.S
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/stand/i386/gptboot/gptldr.S
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/stand/i386/gptboot/gptldr.S
==
--- stable/12/stand/i386/gptboot/gptldr.S   Fri Jan 31 21:08:33 2020
(r357353)
+++ stable/12/stand/i386/gptboot/gptldr.S   Fri Jan 31 21:20:22 2020
(r357354)
@@ -138,5 +138,5 @@ seta20.3:   sti # Enable 
interrupts
  * Save drive number from BIOS so boot2 can see it and start BTX.
  */
movb %dl,MEM_ARG
-   jmp MEM_JMP # Start BTX
+   jmp start+MEM_JMP-MEM_ORG   # Start BTX
 end:
___
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: r357354 - in stable: 11/stand/i386/gptboot 12/stand/i386/gptboot

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 21:20:22 2020
New Revision: 357354
URL: https://svnweb.freebsd.org/changeset/base/357354

Log:
  MFC r357232:
  
  Merge r357231 from the clang1000-import branch:
  
  Work around assembler error from clang 10.0.0 in gptboot:
  
  stand/i386/gptboot/gptldr.S:141:3: error: value of 36878 is too large for 
field of 2 bytes.
jmp MEM_JMP # Start BTX
^
  
  Use the same construct as in stand/i386/boot2/boot1.S, which ensures the
  jump distance does not become too large.

Modified:
  stable/11/stand/i386/gptboot/gptldr.S
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/stand/i386/gptboot/gptldr.S
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/stand/i386/gptboot/gptldr.S
==
--- stable/11/stand/i386/gptboot/gptldr.S   Fri Jan 31 21:08:33 2020
(r357353)
+++ stable/11/stand/i386/gptboot/gptldr.S   Fri Jan 31 21:20:22 2020
(r357354)
@@ -138,5 +138,5 @@ seta20.3:   sti # Enable 
interrupts
  * Save drive number from BIOS so boot2 can see it and start BTX.
  */
movb %dl,MEM_ARG
-   jmp MEM_JMP # Start BTX
+   jmp start+MEM_JMP-MEM_ORG   # Start BTX
 end:
___
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: r357337 - head/sys/riscv/include

2020-01-31 Thread Conrad Meyer
Hi John,

Isn't the 32-bit MSTATUS_SD and SSTATUS_SD also UB without explicit
unsigned suffix?

Best,
Conrad

On Fri, Jan 31, 2020 at 9:49 AM John Baldwin  wrote:
>
> Author: jhb
> Date: Fri Jan 31 17:49:15 2020
> New Revision: 357337
> URL: https://svnweb.freebsd.org/changeset/base/357337
>
> Log:
>   Fix 64-bit value of SSTATUS_SD to use an unsigned long.
>
>   While here, fix MSTATUS_SD to match SSTATUS_SD.
>
>   Reviewed by:  mhorne
>   MFC after:2 weeks
>   Sponsored by: DARPA
>   Differential Revision:https://reviews.freebsd.org/D23434
>
> Modified:
>   head/sys/riscv/include/riscvreg.h
>
> Modified: head/sys/riscv/include/riscvreg.h
> ==
> --- head/sys/riscv/include/riscvreg.h   Fri Jan 31 17:40:41 2020
> (r357336)
> +++ head/sys/riscv/include/riscvreg.h   Fri Jan 31 17:49:15 2020
> (r357337)
> @@ -73,7 +73,7 @@
>  #defineSSTATUS_XS_MASK (0x3 << SSTATUS_XS_SHIFT)
>  #defineSSTATUS_SUM (1 << 18)
>  #if __riscv_xlen == 64
> -#defineSSTATUS_SD  (1 << 63)
> +#defineSSTATUS_SD  (1ul << 63)
>  #else
>  #defineSSTATUS_SD  (1 << 31)
>  #endif
> @@ -110,8 +110,11 @@
>  #define MSTATUS_VM_SV4810
>  #define MSTATUS_VM_SV5711
>  #define MSTATUS_VM_SV6412
> -#defineMSTATUS32_SD(1 << 63)
> -#defineMSTATUS64_SD(1 << 31)
> +#if __riscv_xlen == 64
> +#defineMSTATUS_SD  (1ul << 63)
> +#else
> +#defineMSTATUS_SD  (1 << 31)
> +#endif
>
>  #defineMSTATUS_PRV_U   0   /* user */
>  #defineMSTATUS_PRV_S   1   /* supervisor */
___
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: r357349 - in head/sys: conf modules/tpm

2020-01-31 Thread Conrad Meyer
Hi Dimitry,

Do you think maybe the intent is to use ~TPM_CRB_CTRL_CANCEL_CMD
instead?  Plain "0" might also make sense.  But I think the compiler
is right here and the warning should not be disabled — !BIT(foo)
doesn't really make sense for a register.  It happens to affect the
right bit only because CANCEL_CMD is BIT(0).

Thanks,
Conrad

On Fri, Jan 31, 2020 at 11:36 AM Dimitry Andric  wrote:
>
> Author: dim
> Date: Fri Jan 31 19:36:14 2020
> New Revision: 357349
> URL: https://svnweb.freebsd.org/changeset/base/357349
>
> Log:
>   Merge r357348 from the clang 10.0.0 import branch:
>
>   Disable new clang 10.0.0 warnings about converting the result of shift
>   operations to a boolean in tpm(4):
>
>   sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a 
> boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
>   WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
> ^
>   sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 
> 'TPM_CRB_CTRL_CANCEL_CMD'
>   #define TPM_CRB_CTRL_CANCEL_CMD BIT(0)
>   ^
>   sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
>   #define BIT(x) (1 << (x))
> ^
>
>   Such warnings can be useful in C++ contexts, but not so much in kernel
>   drivers, where this type of bit twiddling is commonplace.  So disable it
>   for this case.
>
>   MFC after:3 days
>
> Modified:
>   head/sys/conf/files.amd64
>   head/sys/conf/kern.mk
>   head/sys/modules/tpm/Makefile
> Directory Properties:
>   head/   (props changed)
>
> Modified: head/sys/conf/files.amd64
> ==
> --- head/sys/conf/files.amd64   Fri Jan 31 19:35:21 2020(r357348)
> +++ head/sys/conf/files.amd64   Fri Jan 31 19:36:14 2020(r357349)
> @@ -323,7 +323,8 @@ dev/syscons/scvesactl.c optionalsc 
> vga vesa
>  dev/syscons/scvgarndr.coptionalsc vga
>  dev/tpm/tpm.c  optionaltpm
>  dev/tpm/tpm20.coptionaltpm
> -dev/tpm/tpm_crb.c  optionaltpm acpi
> +dev/tpm/tpm_crb.c  optionaltpm acpi \
> +   compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}"
>  dev/tpm/tpm_tis.c  optionaltpm acpi
>  dev/tpm/tpm_acpi.c optionaltpm acpi
>  dev/tpm/tpm_isa.c  optionaltpm isa
>
> Modified: head/sys/conf/kern.mk
> ==
> --- head/sys/conf/kern.mk   Fri Jan 31 19:35:21 2020(r357348)
> +++ head/sys/conf/kern.mk   Fri Jan 31 19:36:14 2020(r357349)
> @@ -37,6 +37,9 @@ CWARNEXTRA+=  -Wno-error-shift-negative-value
>  .if ${COMPILER_VERSION} >= 4
>  CWARNEXTRA+=   -Wno-address-of-packed-member
>  .endif
> +.if ${COMPILER_VERSION} >= 10
> +NO_WINT_IN_BOOL_CONTEXT=   -Wno-int-in-bool-context
> +.endif
>  .endif
>
>  .if ${COMPILER_TYPE} == "gcc"
>
> Modified: head/sys/modules/tpm/Makefile
> ==
> --- head/sys/modules/tpm/Makefile   Fri Jan 31 19:35:21 2020
> (r357348)
> +++ head/sys/modules/tpm/Makefile   Fri Jan 31 19:36:14 2020
> (r357349)
> @@ -11,3 +11,5 @@ SRCS+=tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h 
> acpi_i
>  SRCS+= tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h
>
>  .include 
> +
> +CWARNFLAGS.tpm_crb.c+= ${NO_WINT_IN_BOOL_CONTEXT}
___
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: r357353 - head/sys/conf

2020-01-31 Thread Bryan Drewery
Author: bdrewery
Date: Fri Jan 31 21:08:33 2020
New Revision: 357353
URL: https://svnweb.freebsd.org/changeset/base/357353

Log:
  make all is needed to generate .depend.*
  
  PR:   241746
  X-MFC-With:   r357043
  MFC after:1 week

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Fri Jan 31 20:30:50 2020(r357352)
+++ head/sys/conf/kern.post.mk  Fri Jan 31 21:08:33 2020(r357353)
@@ -389,7 +389,7 @@ kernel-cleandepend: .PHONY
 
 kernel-tags:
@ls .depend.* > /dev/null 2>&1 || \
-   { echo "you must make depend first"; exit 1; }
+   { echo "you must make all first"; exit 1; }
sh $S/conf/systags.sh
 
 kernel-install: .PHONY
___
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: r357352 - head/tools/uma/smrstress

2020-01-31 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 31 20:30:50 2020
New Revision: 357352
URL: https://svnweb.freebsd.org/changeset/base/357352

Log:
  smrstress: Add 'publishing' fences to operations on smrs_current.
  
  Reported and tested by:   andrew
  Reviewed by:  jeff
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D23440

Modified:
  head/tools/uma/smrstress/smrstress.c

Modified: head/tools/uma/smrstress/smrstress.c
==
--- head/tools/uma/smrstress/smrstress.cFri Jan 31 20:04:32 2020
(r357351)
+++ head/tools/uma/smrstress/smrstress.cFri Jan 31 20:30:50 2020
(r357352)
@@ -84,7 +84,7 @@ smrs_read(void)
/* Wait for the writer to exit. */
while (smrs_completed == 0) {
smr_enter(smrs_smr);
-   cur = (void *)atomic_load_ptr(_current);
+   cur = (void *)atomic_load_acq_ptr(_current);
if (cur->generation == -1)
smrs_error(cur, "read early: Use after free!\n");
atomic_add_int(>count, 1);
@@ -107,6 +107,7 @@ smrs_write(void)
 
for (i = 0; i < smrs_iterations; i++) {
cur = uma_zalloc_smr(smrs_zone, M_WAITOK);
+   atomic_thread_fence_rel();
cur = (void *)atomic_swap_ptr(_current, (uintptr_t)cur);
uma_zfree_smr(smrs_zone, cur);
}
___
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: r357351 - in stable: 10/contrib/binutils/bfd 11/contrib/binutils/bfd 12/contrib/binutils/bfd 9/contrib/binutils/bfd

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 20:04:32 2020
New Revision: 357351
URL: https://svnweb.freebsd.org/changeset/base/357351

Log:
  MFC r357226:
  
  Merge r357224 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0 in binutils:
  
  contrib/binutils/bfd/peicode.h:1356:3: error: misleading indentation; 
statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (efi)
  ^
  contrib/binutils/bfd/peicode.h:1353:8: note: previous statement is here
if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
^
  contrib/binutils/bfd/peicode.h:1370:3: error: misleading indentation; 
statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (!efi)
  ^
  contrib/binutils/bfd/peicode.h:1367:8: note: previous statement is here
if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
^

Modified:
  stable/9/contrib/binutils/bfd/peicode.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/binutils/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/binutils/bfd/peicode.h
  stable/11/contrib/binutils/bfd/peicode.h
  stable/12/contrib/binutils/bfd/peicode.h
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)
  stable/12/   (props changed)

Modified: stable/9/contrib/binutils/bfd/peicode.h
==
--- stable/9/contrib/binutils/bfd/peicode.h Fri Jan 31 19:40:40 2020
(r357350)
+++ stable/9/contrib/binutils/bfd/peicode.h Fri Jan 31 20:04:32 2020
(r357351)
@@ -1353,13 +1353,13 @@ pe_bfd_object_p (bfd * abfd)
  if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
continue;
 
-   if (efi)
- {
-   /* TARGET_PTR is an EFI backend.  Don't match
-  TARGET with a EFI file.  */
-   bfd_set_error (bfd_error_wrong_format);
-   return NULL;
- }
+ if (efi)
+   {
+ /* TARGET_PTR is an EFI backend.  Don't match
+TARGET with a EFI file.  */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+   }
}
  else if (bfd_target_pei_p (*target_ptr))
{
@@ -1367,13 +1367,13 @@ pe_bfd_object_p (bfd * abfd)
  if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
continue;
 
-   if (!efi)
- {
-   /* TARGET_PTR is a PE backend.  Don't match
-  TARGET with a PE file.  */
-   bfd_set_error (bfd_error_wrong_format);
-   return NULL;
- }
+ if (!efi)
+   {
+ /* TARGET_PTR is a PE backend.  Don't match
+TARGET with a PE file.  */
+ bfd_set_error (bfd_error_wrong_format);
+ return 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: r357351 - in stable: 10/contrib/binutils/bfd 11/contrib/binutils/bfd 12/contrib/binutils/bfd 9/contrib/binutils/bfd

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 20:04:32 2020
New Revision: 357351
URL: https://svnweb.freebsd.org/changeset/base/357351

Log:
  MFC r357226:
  
  Merge r357224 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0 in binutils:
  
  contrib/binutils/bfd/peicode.h:1356:3: error: misleading indentation; 
statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (efi)
  ^
  contrib/binutils/bfd/peicode.h:1353:8: note: previous statement is here
if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
^
  contrib/binutils/bfd/peicode.h:1370:3: error: misleading indentation; 
statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (!efi)
  ^
  contrib/binutils/bfd/peicode.h:1367:8: note: previous statement is here
if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
^

Modified:
  stable/10/contrib/binutils/bfd/peicode.h
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/binutils/bfd/peicode.h
  stable/12/contrib/binutils/bfd/peicode.h
  stable/9/contrib/binutils/bfd/peicode.h
Directory Properties:
  stable/11/   (props changed)
  stable/12/   (props changed)
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/binutils/   (props changed)

Modified: stable/10/contrib/binutils/bfd/peicode.h
==
--- stable/10/contrib/binutils/bfd/peicode.hFri Jan 31 19:40:40 2020
(r357350)
+++ stable/10/contrib/binutils/bfd/peicode.hFri Jan 31 20:04:32 2020
(r357351)
@@ -1353,13 +1353,13 @@ pe_bfd_object_p (bfd * abfd)
  if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
continue;
 
-   if (efi)
- {
-   /* TARGET_PTR is an EFI backend.  Don't match
-  TARGET with a EFI file.  */
-   bfd_set_error (bfd_error_wrong_format);
-   return NULL;
- }
+ if (efi)
+   {
+ /* TARGET_PTR is an EFI backend.  Don't match
+TARGET with a EFI file.  */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+   }
}
  else if (bfd_target_pei_p (*target_ptr))
{
@@ -1367,13 +1367,13 @@ pe_bfd_object_p (bfd * abfd)
  if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
continue;
 
-   if (!efi)
- {
-   /* TARGET_PTR is a PE backend.  Don't match
-  TARGET with a PE file.  */
-   bfd_set_error (bfd_error_wrong_format);
-   return NULL;
- }
+ if (!efi)
+   {
+ /* TARGET_PTR is a PE backend.  Don't match
+TARGET with a PE file.  */
+ bfd_set_error (bfd_error_wrong_format);
+ return 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: r357351 - in stable: 10/contrib/binutils/bfd 11/contrib/binutils/bfd 12/contrib/binutils/bfd 9/contrib/binutils/bfd

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 20:04:32 2020
New Revision: 357351
URL: https://svnweb.freebsd.org/changeset/base/357351

Log:
  MFC r357226:
  
  Merge r357224 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0 in binutils:
  
  contrib/binutils/bfd/peicode.h:1356:3: error: misleading indentation; 
statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (efi)
  ^
  contrib/binutils/bfd/peicode.h:1353:8: note: previous statement is here
if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
^
  contrib/binutils/bfd/peicode.h:1370:3: error: misleading indentation; 
statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (!efi)
  ^
  contrib/binutils/bfd/peicode.h:1367:8: note: previous statement is here
if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
^

Modified:
  stable/11/contrib/binutils/bfd/peicode.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/binutils/bfd/peicode.h
  stable/12/contrib/binutils/bfd/peicode.h
  stable/9/contrib/binutils/bfd/peicode.h
Directory Properties:
  stable/10/   (props changed)
  stable/12/   (props changed)
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/binutils/   (props changed)

Modified: stable/11/contrib/binutils/bfd/peicode.h
==
--- stable/11/contrib/binutils/bfd/peicode.hFri Jan 31 19:40:40 2020
(r357350)
+++ stable/11/contrib/binutils/bfd/peicode.hFri Jan 31 20:04:32 2020
(r357351)
@@ -1353,13 +1353,13 @@ pe_bfd_object_p (bfd * abfd)
  if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
continue;
 
-   if (efi)
- {
-   /* TARGET_PTR is an EFI backend.  Don't match
-  TARGET with a EFI file.  */
-   bfd_set_error (bfd_error_wrong_format);
-   return NULL;
- }
+ if (efi)
+   {
+ /* TARGET_PTR is an EFI backend.  Don't match
+TARGET with a EFI file.  */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+   }
}
  else if (bfd_target_pei_p (*target_ptr))
{
@@ -1367,13 +1367,13 @@ pe_bfd_object_p (bfd * abfd)
  if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
continue;
 
-   if (!efi)
- {
-   /* TARGET_PTR is a PE backend.  Don't match
-  TARGET with a PE file.  */
-   bfd_set_error (bfd_error_wrong_format);
-   return NULL;
- }
+ if (!efi)
+   {
+ /* TARGET_PTR is a PE backend.  Don't match
+TARGET with a PE file.  */
+ bfd_set_error (bfd_error_wrong_format);
+ return 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: r357351 - in stable: 10/contrib/binutils/bfd 11/contrib/binutils/bfd 12/contrib/binutils/bfd 9/contrib/binutils/bfd

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 20:04:32 2020
New Revision: 357351
URL: https://svnweb.freebsd.org/changeset/base/357351

Log:
  MFC r357226:
  
  Merge r357224 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0 in binutils:
  
  contrib/binutils/bfd/peicode.h:1356:3: error: misleading indentation; 
statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (efi)
  ^
  contrib/binutils/bfd/peicode.h:1353:8: note: previous statement is here
if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
^
  contrib/binutils/bfd/peicode.h:1370:3: error: misleading indentation; 
statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (!efi)
  ^
  contrib/binutils/bfd/peicode.h:1367:8: note: previous statement is here
if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
^

Modified:
  stable/12/contrib/binutils/bfd/peicode.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/binutils/bfd/peicode.h
  stable/11/contrib/binutils/bfd/peicode.h
  stable/9/contrib/binutils/bfd/peicode.h
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/binutils/   (props changed)

Modified: stable/12/contrib/binutils/bfd/peicode.h
==
--- stable/12/contrib/binutils/bfd/peicode.hFri Jan 31 19:40:40 2020
(r357350)
+++ stable/12/contrib/binutils/bfd/peicode.hFri Jan 31 20:04:32 2020
(r357351)
@@ -1353,13 +1353,13 @@ pe_bfd_object_p (bfd * abfd)
  if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
continue;
 
-   if (efi)
- {
-   /* TARGET_PTR is an EFI backend.  Don't match
-  TARGET with a EFI file.  */
-   bfd_set_error (bfd_error_wrong_format);
-   return NULL;
- }
+ if (efi)
+   {
+ /* TARGET_PTR is an EFI backend.  Don't match
+TARGET with a EFI file.  */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+   }
}
  else if (bfd_target_pei_p (*target_ptr))
{
@@ -1367,13 +1367,13 @@ pe_bfd_object_p (bfd * abfd)
  if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
continue;
 
-   if (!efi)
- {
-   /* TARGET_PTR is a PE backend.  Don't match
-  TARGET with a PE file.  */
-   bfd_set_error (bfd_error_wrong_format);
-   return NULL;
- }
+ if (!efi)
+   {
+ /* TARGET_PTR is a PE backend.  Don't match
+TARGET with a PE file.  */
+ bfd_set_error (bfd_error_wrong_format);
+ return 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: r357349 - in head/sys: conf modules/tpm

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 19:36:14 2020
New Revision: 357349
URL: https://svnweb.freebsd.org/changeset/base/357349

Log:
  Merge r357348 from the clang 10.0.0 import branch:
  
  Disable new clang 10.0.0 warnings about converting the result of shift
  operations to a boolean in tpm(4):
  
  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a 
boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
  WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
^
  sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 
'TPM_CRB_CTRL_CANCEL_CMD'
  #define TPM_CRB_CTRL_CANCEL_CMD BIT(0)
  ^
  sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
  #define BIT(x) (1 << (x))
^
  
  Such warnings can be useful in C++ contexts, but not so much in kernel
  drivers, where this type of bit twiddling is commonplace.  So disable it
  for this case.
  
  MFC after:3 days

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/kern.mk
  head/sys/modules/tpm/Makefile
Directory Properties:
  head/   (props changed)

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Fri Jan 31 19:35:21 2020(r357348)
+++ head/sys/conf/files.amd64   Fri Jan 31 19:36:14 2020(r357349)
@@ -323,7 +323,8 @@ dev/syscons/scvesactl.c optionalsc vga 
vesa
 dev/syscons/scvgarndr.coptionalsc vga
 dev/tpm/tpm.c  optionaltpm
 dev/tpm/tpm20.coptionaltpm
-dev/tpm/tpm_crb.c  optionaltpm acpi
+dev/tpm/tpm_crb.c  optionaltpm acpi \
+   compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}"
 dev/tpm/tpm_tis.c  optionaltpm acpi
 dev/tpm/tpm_acpi.c optionaltpm acpi
 dev/tpm/tpm_isa.c  optionaltpm isa

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Fri Jan 31 19:35:21 2020(r357348)
+++ head/sys/conf/kern.mk   Fri Jan 31 19:36:14 2020(r357349)
@@ -37,6 +37,9 @@ CWARNEXTRA+=  -Wno-error-shift-negative-value
 .if ${COMPILER_VERSION} >= 4
 CWARNEXTRA+=   -Wno-address-of-packed-member
 .endif
+.if ${COMPILER_VERSION} >= 10
+NO_WINT_IN_BOOL_CONTEXT=   -Wno-int-in-bool-context
+.endif
 .endif
 
 .if ${COMPILER_TYPE} == "gcc"

Modified: head/sys/modules/tpm/Makefile
==
--- head/sys/modules/tpm/Makefile   Fri Jan 31 19:35:21 2020
(r357348)
+++ head/sys/modules/tpm/Makefile   Fri Jan 31 19:36:14 2020
(r357349)
@@ -11,3 +11,5 @@ SRCS+=tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h acpi_i
 SRCS+= tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h
 
 .include 
+
+CWARNFLAGS.tpm_crb.c+= ${NO_WINT_IN_BOOL_CONTEXT}
___
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: r357347 - in head: share/mk usr.bin/lex

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 19:06:49 2020
New Revision: 357347
URL: https://svnweb.freebsd.org/changeset/base/357347

Log:
  Merge r357345 from the clang1000-import branch:
  
  Disable new clang 10.0.0 warnings about misleading indentation in flex.
  
  As this is contributed code with very messy indentation, which will
  almost certainly never be upgraded, just disable the warning.
  
  MFC after:3 days

Modified:
  head/share/mk/bsd.sys.mk
  head/usr.bin/lex/Makefile
Directory Properties:
  head/   (props changed)

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkFri Jan 31 19:06:01 2020(r357346)
+++ head/share/mk/bsd.sys.mkFri Jan 31 19:06:49 2020(r357347)
@@ -111,6 +111,11 @@ CWARNFLAGS.clang+= -Wno-parentheses
 .if defined(NO_WARRAY_BOUNDS)
 CWARNFLAGS.clang+= -Wno-array-bounds
 .endif # NO_WARRAY_BOUNDS
+.if defined(NO_WMISLEADING_INDENTATION) && \
+((${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 10) || \
+ (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100))
+CWARNFLAGS+=   -Wno-misleading-indentation
+.endif # NO_WMISLEADING_INDENTATION
 .endif # WARNS
 
 .if defined(FORMAT_AUDIT)
@@ -154,8 +159,7 @@ CWARNFLAGS+=-Wno-error=address  
\
 
 # GCC 6.1.0
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100
-CWARNFLAGS+=   -Wno-error=misleading-indentation   \
-   -Wno-error=nonnull-compare  \
+CWARNFLAGS+=   -Wno-error=nonnull-compare  \
-Wno-error=shift-negative-value \
-Wno-error=tautological-compare \
-Wno-error=unused-const-variable

Modified: head/usr.bin/lex/Makefile
==
--- head/usr.bin/lex/Makefile   Fri Jan 31 19:06:01 2020(r357346)
+++ head/usr.bin/lex/Makefile   Fri Jan 31 19:06:49 2020(r357347)
@@ -32,6 +32,8 @@ MLINKS+=  lex.1 lex++.1
 
 WARNS?=3
 
+NO_WMISLEADING_INDENTATION=
+
 CLEANFILES=scan.c skel.c
 GENFILES=  parse.c parse.h scan.c skel.c
 
___
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: r357346 - head/share/mk

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 19:06:01 2020
New Revision: 357346
URL: https://svnweb.freebsd.org/changeset/base/357346

Log:
  Merge r357342 from the clang1000-import branch:
  
  Work around two -Werror warning issues in googletest, which have been
  solved upstream in the mean time.
  
  The first issue is because one of googletest's generated headers contain
  classes with a user-declared copy assignment operator, but rely on the
  generation by the compiler of an implicit copy constructor, which is now
  deprecated:
  
  
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-param-util-generated.h:5284:8:
 error: definition of implicit copy constructor for 
'CartesianProductHolder3, 
testing::internal::ValueArray3, 
testing::internal::ValueArray4 
>' is deprecated because it has a user-declared copy assignment operator 
[-Werror,-Wdeprecated-copy]
void operator=(const CartesianProductHolder3& other);
 ^
  
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/gtest-param-test.h:1277:10:
 note: in implicit copy constructor for 
'testing::internal::CartesianProductHolder3,
 testing::internal::ValueArray3, 
testing::internal::ValueArray4 
>' first required here
return internal::CartesianProductHolder3(
   ^
  /usr/src/tests/sys/fs/fusefs/io.cc:534:2: note: in instantiation of function 
template specialization 
'testing::Combine, 
testing::internal::ValueArray3, 
testing::internal::ValueArray4 
>' requested here
  Combine(Bool(), /* async read */
  ^
  
  For now, silence the warning using -Wno-deprecated-copy.
  
  The second issue is because one of the googlemock test programs attempts
  to use "unsigned wchar_t" and "signed wchar_t", which are non-standard
  and at best, hazily defined:
  
  contrib/googletest/googlemock/test/gmock-actions_test.cc:111:37: error: 
'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
EXPECT_EQ(0U, BuiltInDefaultValue::Get());
  ^
  contrib/googletest/googlemock/test/gmock-actions_test.cc:112:36: error: 
'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
EXPECT_EQ(0, BuiltInDefaultValue::Get());
 ^
  
  For now, silence the warning using -Wno-signed-unsigned-wchar.
  
  MFC after:3 days

Modified:
  head/share/mk/googletest.test.inc.mk
Directory Properties:
  head/   (props changed)

Modified: head/share/mk/googletest.test.inc.mk
==
--- head/share/mk/googletest.test.inc.mkFri Jan 31 19:02:53 2020
(r357345)
+++ head/share/mk/googletest.test.inc.mkFri Jan 31 19:06:01 2020
(r357346)
@@ -5,6 +5,18 @@ GTESTS_CXXFLAGS+= -DGTEST_HAS_PTHREAD=1
 GTESTS_CXXFLAGS+= -DGTEST_HAS_STREAM_REDIRECTION=1
 GTESTS_CXXFLAGS+= -frtti
 
+.include 
+
+.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 10
+# Required until googletest is upgraded to a more recent version (after
+# upstream commit efecb0bfa687cf87836494f5d62868485c00fb66).
+GTESTS_CXXFLAGS+= -Wno-deprecated-copy
+
+# Required until googletest is upgraded to a more recent version (after
+# upstream commit d44b137fd104dfffdcdea103f7de11b9eccc45c2).
+GTESTS_CXXFLAGS+= -Wno-signed-unsigned-wchar
+.endif
+
 # XXX: src.libnames.mk should handle adding this directory for libgtest's,
 # libgmock's, etc, headers.
 CXXFLAGS+= -I${DESTDIR}${INCLUDEDIR}/private
___
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: r357344 - head/sys/riscv/riscv

2020-01-31 Thread John Baldwin
Author: jhb
Date: Fri Jan 31 19:00:48 2020
New Revision: 357344
URL: https://svnweb.freebsd.org/changeset/base/357344

Log:
  Add stricter checks on user changes to SSTATUS.
  
  Rather than trying to blacklist which bits userland can't write to via
  sigreturn() or setcontext(), only permit changes to whitelisted bits.
  
  - Permit arbitrary writes to bits in the user-writable USTATUS
register that shadows SSTATUS.
  
  - Ignore changes in write-only bits maintained by the CPU.
  
  - Ignore the user-supplied value of the FS field used to track
floating point state and instead set it to a value matching the
actions taken by set_fpcontext().
  
  Discussed with:   mhorne
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23338

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

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Fri Jan 31 18:55:21 2020
(r357343)
+++ head/sys/riscv/riscv/machdep.c  Fri Jan 31 19:00:48 2020
(r357344)
@@ -368,11 +368,16 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
tf = td->td_frame;
 
/*
-* Make sure the processor mode has not been tampered with and
-* interrupts have not been disabled.
-* Supervisor interrupts in user mode are always enabled.
+* Permit changes to the USTATUS bits of SSTATUS.
+*
+* Ignore writes to read-only bits (SD, XS).
+*
+* Ignore writes to the FS field as set_fpcontext() will set
+* it explicitly.
 */
-   if ((mcp->mc_gpregs.gp_sstatus & SSTATUS_SPP) != 0)
+   if (((mcp->mc_gpregs.gp_sstatus ^ tf->tf_sstatus) &
+   ~(SSTATUS_SD | SSTATUS_XS_MASK | SSTATUS_FS_MASK | SSTATUS_UPIE |
+   SSTATUS_UIE)) != 0)
return (EINVAL);
 
memcpy(tf->tf_t, mcp->mc_gpregs.gp_t, sizeof(tf->tf_t));
@@ -426,7 +431,12 @@ set_fpcontext(struct thread *td, mcontext_t *mcp)
 {
 #ifdef FPE
struct pcb *curpcb;
+#endif
 
+   td->td_frame->tf_sstatus &= ~SSTATUS_FS_MASK;
+   td->td_frame->tf_sstatus |= SSTATUS_FS_OFF;
+
+#ifdef FPE
critical_enter();
 
if ((mcp->mc_flags & _MC_FP_VALID) != 0) {
@@ -436,6 +446,7 @@ set_fpcontext(struct thread *td, mcontext_t *mcp)
sizeof(mcp->mc_fpregs));
curpcb->pcb_fcsr = mcp->mc_fpregs.fp_fcsr;
curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK;
+   td->td_frame->tf_sstatus |= SSTATUS_FS_CLEAN;
}
 
critical_exit();
___
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: r357343 - head/usr.sbin/services_mkdb

2020-01-31 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jan 31 18:55:21 2020
New Revision: 357343
URL: https://svnweb.freebsd.org/changeset/base/357343

Log:
  services: Add PROFInet and EtherCAT.
  
  Both are used in industrial networks.
  
  MFC after:1 week

Modified:
  head/usr.sbin/services_mkdb/services

Modified: head/usr.sbin/services_mkdb/services
==
--- head/usr.sbin/services_mkdb/servicesFri Jan 31 18:26:23 2020
(r357342)
+++ head/usr.sbin/services_mkdb/servicesFri Jan 31 18:55:21 2020
(r357343)
@@ -2494,6 +2494,14 @@ wnn6_DS  26208/tcp  #Wnn6 (Dserver)
 sgsap  29118/sctp #SGsAP in 3GPP
 sbcap  29168/sctp #SBcAP in 3GPP
 iuhsctpassoc   29169/sctp #HNBAP and RUA Common Association
+profinet-rt34962/tcp  #PROFInet RT Unicast
+profinet-rt34962/udp  #PROFInet RT Unicast
+profinet-rtm   34963/tcp  #PROFInet RT Multicast
+profinet-rtm   34963/udp  #PROFInet RT Multicast
+profinet-cm34964/tcp  #PROFInet Context Manager
+profinet-cm34964/udp  #PROFInet Context Manager
+ethercat   34980/tcp  #EtherCAT Port
+ethercat   34980/udp  #EhterCAT Port
 s1-control 36412/sctp #S1-Control Plane (3GPP)
 x2-control 36422/sctp #X2-Control Plane (3GPP)
 dbbrowse   47557/tcp  #Databeam Corporation
___
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: r357341 - head/share/man/man5

2020-01-31 Thread Ed Maste
Author: emaste
Date: Fri Jan 31 18:26:13 2020
New Revision: 357341
URL: https://svnweb.freebsd.org/changeset/base/357341

Log:
  regen src.conf.5 after r357338 BSD_CRTBEGIN retirement

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

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Fri Jan 31 18:13:00 2020
(r357340)
+++ head/share/man/man5/src.conf.5  Fri Jan 31 18:26:13 2020
(r357341)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd January 19, 2020
+.Dd January 31, 2020
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -250,22 +250,6 @@ and related programs.
 .It Va WITHOUT_BSD_CPIO
 Set to not build the BSD licensed version of cpio based on
 .Xr libarchive 3 .
-.It Va WITHOUT_BSD_CRTBEGIN
-Disable the BSD licensed
-.Pa crtbegin.o
-and
-.Pa crtend.o .
-.Pp
-This is a default setting on
-sparc64/sparc64.
-.It Va WITH_BSD_CRTBEGIN
-Enable the BSD licensed
-.Pa crtbegin.o
-and
-.Pa crtend.o .
-.Pp
-This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, 
mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, 
mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, 
powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf.
 .It Va WITH_BSD_GREP
 Install BSD-licensed grep as '[ef]grep' instead of GNU grep.
 .It Va WITHOUT_BSNMP
___
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: r357340 - head/usr.sbin/bsnmpd/modules/snmp_pf

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 18:13:00 2020
New Revision: 357340
URL: https://svnweb.freebsd.org/changeset/base/357340

Log:
  Merge r357339 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0 in bsnmpd:
  
  usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading 
indentation; statement is not part of the previous 'else' 
[-Werror,-Wmisleading-indentation]
  return (-1);
  ^
  usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is 
here
  } else
^
  
  The intent was to group the return statement with the previous syslog()
  call.
  
  MFC after:3 days

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
Directory Properties:
  head/   (props changed)

Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c  Fri Jan 31 18:09:27 
2020(r357339)
+++ head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c  Fri Jan 31 18:13:00 
2020(r357340)
@@ -1655,10 +1655,11 @@ altq_is_enabled(int pfdev)
syslog(LOG_INFO, "No ALTQ support in kernel\n"
"ALTQ related functions disabled\n");
return (0);
-   } else
+   } else {
syslog(LOG_ERR, "DIOCGETALTQS returned an error: %s",
strerror(errno));
return (-1);
+   }
}
return (1);
 }
___
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: r357338 - in head: . contrib/bmake/mk gnu/lib lib/csu share/mk targets/pseudo/userland/gnu tools/build/options

2020-01-31 Thread Ed Maste
Author: emaste
Date: Fri Jan 31 18:04:04 2020
New Revision: 357338
URL: https://svnweb.freebsd.org/changeset/base/357338

Log:
  retire BSD_CRTBEGIN option
  
  BSD crt is currently used on all architectures (other than sparc64).
  Remove the option and use BSD crt everywhere as part of the GCC 4.2.1
  retirement plan.
  
  https://lists.freebsd.org/pipermail/freebsd-arch/2020-January/019823.html
  
  PR:   239851
  Reviewed by:  andrew, brooks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D23122

Deleted:
  head/tools/build/options/WITHOUT_BSD_CRTBEGIN
  head/tools/build/options/WITH_BSD_CRTBEGIN
Modified:
  head/Makefile.inc1
  head/contrib/bmake/mk/meta2deps.sh
  head/gnu/lib/Makefile
  head/lib/csu/Makefile.inc
  head/share/mk/local.dirdeps-options.mk
  head/share/mk/local.dirdeps.mk
  head/share/mk/local.gendirdeps.mk
  head/share/mk/meta2deps.sh
  head/share/mk/src.opts.mk
  head/targets/pseudo/userland/gnu/Makefile.depend

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Jan 31 17:49:15 2020(r357337)
+++ head/Makefile.inc1  Fri Jan 31 18:04:04 2020(r357338)
@@ -2783,13 +2783,10 @@ _prereq_libs+= lib/libssp_nonshared
 
 # These dependencies are not automatically generated:
 #
-# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
+# gnu/lib/libgcc, lib/csu and lib/libc must be built before
 # all shared libraries for ELF.
 #
 _startup_libs= lib/csu
-.if ${MK_BSD_CRTBEGIN} == "no"
-_startup_libs+=gnu/lib/csu
-.endif
 _startup_libs+=lib/libc
 _startup_libs+=lib/libc_nonshared
 .if ${MK_LIBCPLUSPLUS} != "no"

Modified: head/contrib/bmake/mk/meta2deps.sh
==
--- head/contrib/bmake/mk/meta2deps.sh  Fri Jan 31 17:49:15 2020
(r357337)
+++ head/contrib/bmake/mk/meta2deps.sh  Fri Jan 31 18:04:04 2020
(r357338)
@@ -49,7 +49,6 @@
 #  The output, is a set of absolute paths with "SB" like:
 #.nf
 #
-#  $SB/obj-i386/bsd/gnu/lib/csu
 #  $SB/obj-i386/bsd/gnu/lib/libgcc
 #  $SB/obj-i386/bsd/include
 #  $SB/obj-i386/bsd/lib/csu/i386

Modified: head/gnu/lib/Makefile
==
--- head/gnu/lib/Makefile   Fri Jan 31 17:49:15 2020(r357337)
+++ head/gnu/lib/Makefile   Fri Jan 31 18:04:04 2020(r357338)
@@ -10,10 +10,6 @@ SUBDIR+= libgomp
 .endif
 SUBDIR.${MK_TESTS}+=   tests
 
-.if ${MK_BSD_CRTBEGIN} == "no"
-SUBDIR+=   csu
-.endif
-
 .if ${MK_GNU_GREP} != "no" || ${MK_GNU_GREP_COMPAT} != "no" || \
 ${MK_GDB} != "no"
 SUBDIR+=   libregex

Modified: head/lib/csu/Makefile.inc
==
--- head/lib/csu/Makefile.inc   Fri Jan 31 17:49:15 2020(r357337)
+++ head/lib/csu/Makefile.inc   Fri Jan 31 18:04:04 2020(r357338)
@@ -8,7 +8,7 @@ NO_WMISSING_VARIABLE_DECLARATIONS=
 
 .include 
 
-.if ${MK_BSD_CRTBEGIN} != "no" && !defined(BUILDING_TESTS)
+.if !defined(BUILDING_TESTS)
 
 OBJS+= crtbegin.o crtbeginS.o crtbeginT.o
 OBJS+= crtend.o crtendS.o

Modified: head/share/mk/local.dirdeps-options.mk
==
--- head/share/mk/local.dirdeps-options.mk  Fri Jan 31 17:49:15 2020
(r357337)
+++ head/share/mk/local.dirdeps-options.mk  Fri Jan 31 18:04:04 2020
(r357338)
@@ -3,7 +3,6 @@
 # avoid duplication
 DIRDEPS.AUDIT.yes= lib/libbsm
 DIRDEPS.BLACKLIST_SUPPORT.yes+= lib/libblacklist
-DIRDEPS.BSD_CRTBEGIN.no+= gnu/lib/csu
 DIRDEPS.CASPER.yes+= lib/libcasper/libcasper
 DIRDEPS.GSSAPI.yes+= lib/libgssapi
 DIRDEPS.JAIL.yes+= lib/libjail

Modified: head/share/mk/local.dirdeps.mk
==
--- head/share/mk/local.dirdeps.mk  Fri Jan 31 17:49:15 2020
(r357337)
+++ head/share/mk/local.dirdeps.mk  Fri Jan 31 18:04:04 2020
(r357338)
@@ -38,7 +38,6 @@ DIRDEPS_FILTER.host = \
Nlib/csu* \
Nlib/libc \
Nlib/[mn]* \
-   Ngnu/lib/csu* \
Ngnu/lib/lib[a-r]* \
Nsecure/lib* \
Nusr.bin/xinstall* \
@@ -219,11 +218,6 @@ DIRDEPS+= ${_lib${_lib}reldir}
 .if ${DEP_RELDIR} != "targets/pseudo/stage"
 DIRDEPS += targets/pseudo/stage
 .endif
-.endif
-
-# this one is too pervasive
-.if ${MK_BSD_CRTBEGIN} == "no" && 
${DEP_RELDIR:N.:Ngnu/lib/csu:Ninclude*:Ntargets/*} != ""
-DIRDEPS+= gnu/lib/csu
 .endif
 
 DEP_MACHINE_ARCH = ${MACHINE_ARCH.${DEP_MACHINE}}

Modified: head/share/mk/local.gendirdeps.mk
==
--- head/share/mk/local.gendirdeps.mk   Fri Jan 31 17:49:15 2020
(r357337)
+++ head/share/mk/local.gendirdeps.mk   Fri Jan 31 

svn commit: r357337 - head/sys/riscv/include

2020-01-31 Thread John Baldwin
Author: jhb
Date: Fri Jan 31 17:49:15 2020
New Revision: 357337
URL: https://svnweb.freebsd.org/changeset/base/357337

Log:
  Fix 64-bit value of SSTATUS_SD to use an unsigned long.
  
  While here, fix MSTATUS_SD to match SSTATUS_SD.
  
  Reviewed by:  mhorne
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23434

Modified:
  head/sys/riscv/include/riscvreg.h

Modified: head/sys/riscv/include/riscvreg.h
==
--- head/sys/riscv/include/riscvreg.h   Fri Jan 31 17:40:41 2020
(r357336)
+++ head/sys/riscv/include/riscvreg.h   Fri Jan 31 17:49:15 2020
(r357337)
@@ -73,7 +73,7 @@
 #defineSSTATUS_XS_MASK (0x3 << SSTATUS_XS_SHIFT)
 #defineSSTATUS_SUM (1 << 18)
 #if __riscv_xlen == 64
-#defineSSTATUS_SD  (1 << 63)
+#defineSSTATUS_SD  (1ul << 63)
 #else
 #defineSSTATUS_SD  (1 << 31)
 #endif
@@ -110,8 +110,11 @@
 #define MSTATUS_VM_SV4810
 #define MSTATUS_VM_SV5711
 #define MSTATUS_VM_SV6412
-#defineMSTATUS32_SD(1 << 63)
-#defineMSTATUS64_SD(1 << 31)
+#if __riscv_xlen == 64
+#defineMSTATUS_SD  (1ul << 63)
+#else
+#defineMSTATUS_SD  (1 << 31)
+#endif
 
 #defineMSTATUS_PRV_U   0   /* user */
 #defineMSTATUS_PRV_S   1   /* supervisor */
___
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: r357336 - in head: share/man/man4 sys/x86/cpufreq

2020-01-31 Thread Conrad Meyer
Author: cem
Date: Fri Jan 31 17:40:41 2020
New Revision: 357336
URL: https://svnweb.freebsd.org/changeset/base/357336

Log:
  hwpstate(4): Ignore CurPstateLimit by default
  
  Add a sysctl knob to allow users to re-enable it, and document the knob and
  default in cpufreq.4.  (While here, add a few unrelated updates to
  cpufreq.4.)
  
  It seems that the register value in some hardware simply reflects the
  configured P-state.  This results in an inadvertent and unintended outcome
  where the P-state can only walk down, and then the driver becomes "stuck" in
  the slowest possible P-state.
  
  The Linux driver never consults this register, so that's some evidence that
  ignoring the contents are relatively harmless.
  
  PR:   234733
  Reported by:  sigsys AT gmail.com, Erich Dollanksy 

Modified:
  head/share/man/man4/cpufreq.4
  head/sys/x86/cpufreq/hwpstate_amd.c

Modified: head/share/man/man4/cpufreq.4
==
--- head/share/man/man4/cpufreq.4   Fri Jan 31 15:56:08 2020
(r357335)
+++ head/share/man/man4/cpufreq.4   Fri Jan 31 17:40:41 2020
(r357336)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 22, 2020
+.Dd January 31, 2020
 .Dt CPUFREQ 4
 .Os
 .Sh NAME
@@ -73,9 +73,13 @@ has passed (e.g., the system has cooled sufficiently).
 If a sysctl cannot be set due to an override condition, it will return
 .Er EPERM .
 .Pp
-The frequency cannot be changed if TSC is in use as the timecounter.
+The frequency cannot be changed if TSC is in use as the timecounter and the
+hardware does not support invariant TSC.
 This is because the timecounter system needs to use a source that has a
 constant rate.
+(On invariant TSC hardware, the TSC runs at the P0 rate regardless of the
+configured P-state.)
+Modern hardware mostly has invariant TSC.
 The timecounter source can be changed with the
 .Pa kern.timecounter.hardware
 sysctl.
@@ -105,6 +109,15 @@ some systems.
 .It Va debug.cpufreq.verbose
 Print verbose messages.
 This setting is also accessible via a tunable with the same name.
+.It Va debug.hwpstate_pstate_limit
+If enabled, the AMD hwpstate driver limits administrative control of P-states
+(including by
+.Xr powerd 8 )
+to the value in the 0xc0010061 MSR, known as "PStateCurLim[CurPstateLimit]."
+It is disabled (0) by default.
+On some hardware, the limit register seems to simply follow the configured
+P-state, which results in the inability to ever raise the P-state back to P0
+from a reduced frequency state.
 .El
 .Sh SUPPORTED DRIVERS
 The following device drivers offer absolute frequency control via the
@@ -112,11 +125,15 @@ The following device drivers offer absolute frequency 
 interface.
 Usually, only one of these can be active at a time.
 .Pp
-.Bl -tag -compact -width ".Pa acpi_perf"
+.Bl -tag -compact -width ".Pa hwpstate_intel"
 .It Pa acpi_perf
 ACPI CPU performance states
 .It Pa est
 Intel Enhanced SpeedStep
+.It Pa hwpstate
+AMD Cool'n'Quiet2 used in K10 through Family 17h
+.It Pa hwpstate_intel
+Intel SpeedShift driver
 .It Pa ichss
 Intel SpeedStep for ICH
 .It Pa powernow

Modified: head/sys/x86/cpufreq/hwpstate_amd.c
==
--- head/sys/x86/cpufreq/hwpstate_amd.c Fri Jan 31 15:56:08 2020
(r357335)
+++ head/sys/x86/cpufreq/hwpstate_amd.c Fri Jan 31 17:40:41 2020
(r357336)
@@ -131,6 +131,12 @@ static int hwpstate_verify;
 SYSCTL_INT(_debug, OID_AUTO, hwpstate_verify, CTLFLAG_RWTUN,
 _verify, 0, "Verify P-state after setting");
 
+static boolhwpstate_pstate_limit;
+SYSCTL_BOOL(_debug, OID_AUTO, hwpstate_pstate_limit, CTLFLAG_RWTUN,
+_pstate_limit, 0,
+"If enabled (1), limit administrative control of P-states to the value in "
+"CurPstateLimit");
+
 static device_method_t hwpstate_methods[] = {
/* Device interface */
DEVMETHOD(device_identify,  hwpstate_identify),
@@ -161,7 +167,8 @@ static driver_t hwpstate_driver = {
 DRIVER_MODULE(hwpstate, cpu, hwpstate_driver, hwpstate_devclass, 0, 0);
 
 /*
- * Go to Px-state on all cpus considering the limit.
+ * Go to Px-state on all cpus, considering the limit register (if so
+ * configured).
  */
 static int
 hwpstate_goto_pstate(device_t dev, int id)
@@ -170,14 +177,15 @@ hwpstate_goto_pstate(device_t dev, int id)
uint64_t msr;
int cpu, i, j, limit;
 
-   /* get the current pstate limit */
-   msr = rdmsr(MSR_AMD_10H_11H_LIMIT);
-   limit = AMD_10H_11H_GET_PSTATE_LIMIT(msr);
-   if (limit > id) {
-   HWPSTATE_DEBUG(dev,
-   "Restricting requested P%d to P%d due to HW limit\n", id,
-   limit);
-   id = limit;
+   if (hwpstate_pstate_limit) {
+   /* get the current pstate limit */
+   msr = rdmsr(MSR_AMD_10H_11H_LIMIT);
+   limit = AMD_10H_11H_GET_PSTATE_LIMIT(msr);
+   if 

svn commit: r357335 - head/release/arm64

2020-01-31 Thread Kyle Evans
Author: kevans
Date: Fri Jan 31 15:56:08 2020
New Revision: 357335
URL: https://svnweb.freebsd.org/changeset/base/357335

Log:
  RPI3: Add RPi4 firmware files to the FAT partition
  
  I've discovered I have this local diff that never got committed -- this
  should have been a part of r355424.
  
  Reproted by:  Klaus Küchemann 

Modified:
  head/release/arm64/RPI3.conf

Modified: head/release/arm64/RPI3.conf
==
--- head/release/arm64/RPI3.confFri Jan 31 15:43:33 2020
(r357334)
+++ head/release/arm64/RPI3.confFri Jan 31 15:56:08 2020
(r357335)
@@ -25,7 +25,9 @@ arm_install_uboot() {
UBOOT_FILES="README u-boot.bin"
DTB_FILES="armstub8.bin armstub8-gic.bin bootcode.bin fixup_cd.dat \
fixup_db.dat fixup_x.dat fixup.dat LICENCE.broadcom \
-   start_cd.elf start_db.elf start_x.elf start.elf ${DTB}"
+   start_cd.elf start_db.elf start_x.elf start.elf \
+   fixup4.dat fixup4cd.dat fixup4db.dat fixup4x.dat start4.elf \
+   start4cd.elf start4db.elf start4x.elf ${DTB}"
FATMOUNT="${DESTDIR%${KERNEL}}fat"
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}"
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
___
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: r357334 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 sys/sys sys/x8...

2020-01-31 Thread Mark Johnston
Author: markj
Date: Fri Jan 31 15:43:33 2020
New Revision: 357334
URL: https://svnweb.freebsd.org/changeset/base/357334

Log:
  Reimplement stack capture of running threads on i386 and amd64.
  
  After r355784 the td_oncpu field is no longer synchronized by the thread
  lock, so the stack capture interrupt cannot be delievered precisely.
  Fix this using a loop which drops the thread lock and restarts if the
  wrong thread was sampled from the stack capture interrupt handler.
  
  Change the implementation to use a regular interrupt instead of an NMI.
  Now that we drop the thread lock, there is no advantage to the latter.
  
  Simplify the KPIs.  Remove stack_save_td_running() and add a return
  value to stack_save_td().  On platforms that do not support stack
  capture of running threads, stack_save_td() returns EOPNOTSUPP.  If the
  target thread is running in user mode, stack_save_td() returns EBUSY.
  
  Reviewed by:  kib
  Reported by:  mjg, pho
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D23355

Modified:
  head/share/man/man9/stack.9
  head/sys/amd64/amd64/trap.c
  head/sys/arm/arm/stack_machdep.c
  head/sys/arm64/arm64/stack_machdep.c
  head/sys/i386/i386/trap.c
  head/sys/kern/kern_proc.c
  head/sys/kern/subr_kdb.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/kern/tty_info.c
  head/sys/mips/mips/stack_machdep.c
  head/sys/powerpc/powerpc/stack_machdep.c
  head/sys/riscv/riscv/stack_machdep.c
  head/sys/sparc64/sparc64/stack_machdep.c
  head/sys/sys/stack.h
  head/sys/x86/include/apicvar.h
  head/sys/x86/include/stack.h
  head/sys/x86/x86/mp_x86.c
  head/sys/x86/x86/stack_machdep.c

Modified: head/share/man/man9/stack.9
==
--- head/share/man/man9/stack.9 Fri Jan 31 13:18:25 2020(r357333)
+++ head/share/man/man9/stack.9 Fri Jan 31 15:43:33 2020(r357334)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 6, 2017
+.Dd January 31, 2020
 .Dt STACK 9
 .Os
 .Sh NAME
@@ -65,10 +65,8 @@ In the kernel configuration file:
 .Fn stack_sbuf_print_ddb "struct sbuf sb*" "const struct stack *st"
 .Ft void
 .Fn stack_save "struct stack *st"
-.Ft void
-.Fn stack_save_td "struct stack *st" "struct thread *td"
 .Ft int
-.Fn stack_save_td_running "struct stack *st" "struct thread *td"
+.Fn stack_save_td "struct stack *st" "struct thread *td"
 .Sh DESCRIPTION
 The
 .Nm
@@ -93,18 +91,17 @@ argument is passed to
 Memory associated with a trace is freed by calling
 .Fn stack_destroy .
 .Pp
-A trace of the current kernel thread's call stack may be captured using
+A trace of the current thread's kernel call stack may be captured using
 .Fn stack_save .
 .Fn stack_save_td
-and
-.Fn stack_save_td_running
-can also be used to capture the stack of a caller-specified thread.
-Callers of these functions must own the thread lock of the specified thread.
+can be used to capture the kernel stack of a caller-specified thread.
+Callers of these functions must own the thread lock of the specified thread,
+and the thread's stack must not be swapped out.
 .Fn stack_save_td
-can capture the stack of a kernel thread that is not running or
-swapped out at the time of the call.
-.Fn stack_save_td_running
-can capture the stack of a running kernel thread.
+can capture the kernel stack of a running thread, though note that this is
+not implemented on all platforms.
+If the thread is running, the caller must also hold the process lock for the
+target thread.
 .Pp
 .Fn stack_print
 and
@@ -157,11 +154,11 @@ Otherwise the
 does not contain space to record additional frames, and a non-zero value is
 returned.
 .Pp
-.Fn stack_save_td_running
+.Fn stack_save_td
 returns 0 when the stack capture was successful and a non-zero error number
 otherwise.
 In particular,
-.Er EAGAIN
+.Er EBUSY
 is returned if the thread was running in user mode at the time that the
 capture was attempted, and
 .Er EOPNOTSUPP

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Fri Jan 31 13:18:25 2020(r357333)
+++ head/sys/amd64/amd64/trap.c Fri Jan 31 15:43:33 2020(r357334)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_hwpmc_hooks.h"
 #include "opt_isa.h"
 #include "opt_kdb.h"
-#include "opt_stack.h"
 
 #include 
 #include 
@@ -226,11 +225,6 @@ trap(struct trapframe *frame)
 */
if (pmc_intr != NULL &&
(*pmc_intr)(frame) != 0)
-   return;
-#endif
-
-#ifdef STACK
-   if (stack_nmi_handler(frame) != 0)
return;
 #endif
}

Modified: head/sys/arm/arm/stack_machdep.c
==
--- head/sys/arm/arm/stack_machdep.cFri Jan 31 13:18:25 2020
(r357333)
+++ head/sys/arm/arm/stack_machdep.cFri Jan 

Re: svn commit: r357006 - head/sys/net

2020-01-31 Thread Hans Petter Selasky

On 2020-01-23 02:27, Gleb Smirnoff wrote:

@@ -6811,6 +6816,7 @@ iflib_debugnet_transmit(if_t ifp, struct mbuf *m)
  static int
  iflib_debugnet_poll(if_t ifp, int count)
  {
+   struct epoch_tracker et;
if_ctx_t ctx;
if_softc_ctx_t scctx;
iflib_txq_t txq;
@@ -6826,8 +6832,10 @@ iflib_debugnet_poll(if_t ifp, int count)
txq = >ifc_txqs[0];
(void)iflib_completed_tx_reclaim(txq, RECLAIM_THRESH(ctx));
  
+	NET_EPOCH_ENTER(et);

for (i = 0; i < scctx->isc_nrxqsets; i++)
(void)iflib_rxeof(>ifc_rxqs[i], 16 /* XXX */);
+   NET_EPOCH_EXIT(et);
return (0);
  }
  #endif /* DEBUGNET */


Debugnet is not under EPOCH(9) ???

--HPS
___
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: r357333 - in stable/12: etc libexec/rc libexec/rc/rc.d share/man/man5 sys/sys

2020-01-31 Thread Warner Losh
Author: imp
Date: Fri Jan 31 13:18:25 2020
New Revision: 357333
URL: https://svnweb.freebsd.org/changeset/base/357333

Log:
  MFC r354922
  
  > Author: imp 
  > Date:   Wed Nov 20 23:45:31 2019 +
  >
  >Create /etc/os-release file.
  >
  >Each boot, regenerate /var/run/os-release based on the currently running
  >system. Create a /etc/os-release symlink pointing to this file (so that 
this
  >doesn't create a new reason /etc can not be mounted read-only).
  >
  >This is compatible with what other systems do and is what the 
sysutil/os-release
  >port attempted to do, but in an incomplete way. Linux, Solaris and 
DragonFly all
  >implement this natively as well. The complete standard can be found at
  >https://www.freedesktop.org/software/systemd/man/os-release.html
  >
  >Moving this to the base solves both the non-standard location problem 
with the
  >port, as well as the lack of update of this file on system update.
  >
  >Bump __FreeBSD_version to 1300060
  >
  >PR: 238953
  >Differential Revision:  https://reviews.freebsd.org/D22271
  
  Execpt bump __FreeBSD_version to 1201511

Added:
  stable/12/libexec/rc/rc.d/os-release
 - copied unchanged from r354922, head/libexec/rc/rc.d/os-release
  stable/12/share/man/man5/os-release.5
 - copied unchanged from r354922, head/share/man/man5/os-release.5
Modified:
  stable/12/etc/Makefile
  stable/12/libexec/rc/rc.conf
  stable/12/libexec/rc/rc.d/Makefile
  stable/12/share/man/man5/Makefile
  stable/12/sys/sys/param.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/etc/Makefile
==
--- stable/12/etc/Makefile  Fri Jan 31 12:39:51 2020(r357332)
+++ stable/12/etc/Makefile  Fri Jan 31 13:18:25 2020(r357333)
@@ -82,6 +82,8 @@ distribution:
${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
+   ${INSTALL_SYMLINK} ../var/run/os-release \
+   ${DESTDIR}/etc/os-release
 .if ${MK_UNBOUND} != "no"
if [ ! -e ${DESTDIR}/etc/unbound ]; then \
${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \

Modified: stable/12/libexec/rc/rc.conf
==
--- stable/12/libexec/rc/rc.confFri Jan 31 12:39:51 2020
(r357332)
+++ stable/12/libexec/rc/rc.confFri Jan 31 13:18:25 2020
(r357333)
@@ -680,6 +680,9 @@ entropy_save_sz="4096"  # Size of the entropy cache fil
 entropy_save_num="8"   # Number of entropy cache files to save.
 harvest_mask="511" # Entropy device harvests all but the very invasive 
sources.
# (See 'sysctl kern.random.harvest' and random(4))
+osrelease_enable="YES" # Update /var/run/os-release on boot (or NO).
+osrelease_file="/var/run/os-release" # File to update for os-release.
+osrelease_perms="444"  # Default permission for os-release file.
 dmesg_enable="YES" # Save dmesg(8) to /var/run/dmesg.boot
 watchdogd_enable="NO"  # Start the software watchdog daemon
 watchdogd_flags="" # Flags to watchdogd (if enabled)

Modified: stable/12/libexec/rc/rc.d/Makefile
==
--- stable/12/libexec/rc/rc.d/Makefile  Fri Jan 31 12:39:51 2020
(r357332)
+++ stable/12/libexec/rc/rc.d/Makefile  Fri Jan 31 13:18:25 2020
(r357333)
@@ -80,6 +80,7 @@ CONFS=DAEMON \
nsswitch \
ntpdate \
${_opensm} \
+   os-release \
pf \
pflog \
pfsync \

Copied: stable/12/libexec/rc/rc.d/os-release (from r354922, 
head/libexec/rc/rc.d/os-release)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/libexec/rc/rc.d/os-releaseFri Jan 31 13:18:25 2020
(r357333, copy of r354922, head/libexec/rc/rc.d/os-release)
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: os-release
+# REQUIRE: mountcritremote FILESYSTEMS
+# BEFORE:  LOGIN
+
+. /etc/rc.subr
+
+: ${osrelease_file:=/var/run/os-release}
+: ${osrelease_perms:=444}
+name="osrelease"
+desc="Update ${osrelease_file}"
+start_cmd="osrelease_start"
+stop_cmd=":"
+
+osrelease_start()
+{
+   local _version _version_id
+
+   check_startmsgs && echo -n "Updating ${osrelease_file} "
+   _version=$(freebsd-version -u)
+   _version_id=${_version%%[^0-9.]*}
+   t=$(mktemp -t os-release)
+   cat > "$t" <<-__EOF__
+   NAME=FreeBSD
+   VERSION=$_version
+   VERSION_ID=$_version_id
+   ID=freebsd
+   ANSI_COLOR="0;31"
+   PRETTY_NAME="FreeBSD $_version"
+   CPE_NAME=cpe:/o:freebsd:freebsd:$_version_id
+ 

svn commit: r357332 - stable/11/sys/conf

2020-01-31 Thread Takahashi Yoshihiro
Author: nyan
Date: Fri Jan 31 12:39:51 2020
New Revision: 357332
URL: https://svnweb.freebsd.org/changeset/base/357332

Log:
  MFC r357043: Fix kernel-tags target.
  
  >  - A depend-file is broken up into .depend.*.o files. [1]
  >  - Fix an assembly file support.
  >
  >  PR:   241746
  >  Submitted by: leres [1]

Modified:
  stable/11/sys/conf/kern.post.mk
  stable/11/sys/conf/systags.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/conf/kern.post.mk
==
--- stable/11/sys/conf/kern.post.mk Fri Jan 31 12:38:53 2020
(r357331)
+++ stable/11/sys/conf/kern.post.mk Fri Jan 31 12:39:51 2020
(r357332)
@@ -312,7 +312,8 @@ kernel-cleandepend: .PHONY
rm -f ${DEPENDFILES} ${_ILINKS}
 
 kernel-tags:
-   @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
+   @ls .depend.* > /dev/null 2>&1 || \
+   { echo "you must make depend first"; exit 1; }
sh $S/conf/systags.sh
 
 kernel-install: .PHONY

Modified: stable/11/sys/conf/systags.sh
==
--- stable/11/sys/conf/systags.sh   Fri Jan 31 12:38:53 2020
(r357331)
+++ stable/11/sys/conf/systags.sh   Fri Jan 31 12:39:51 2020
(r357332)
@@ -37,14 +37,14 @@
 
 rm -f tags tags.tmp tags.cfiles tags.sfiles tags.hfiles
 sed -e "s, machine/, ../../include/,g" \
-   -e 's,[a-z][^/]*/\.\./,,g' .depend | awk '{
+   -e 's,[a-z][^/]*/\.\./,,g' .depend.* | awk '{
for (i = 1; i <= NF; ++i) {
t = substr($i, length($i) - 1)
if (t == ".c")
cfiles[$i] = 1;
else if (t == ".h")
hfiles[$i] = 1;
-   else if (t == ".s")
+   else if (t == ".s" || t == ".S")
sfiles[$i] = 1;
}
};
___
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: r357331 - stable/12/sys/conf

2020-01-31 Thread Takahashi Yoshihiro
Author: nyan
Date: Fri Jan 31 12:38:53 2020
New Revision: 357331
URL: https://svnweb.freebsd.org/changeset/base/357331

Log:
  MFC r357043: Fix kernel-tags target.
  
  >  - A depend-file is broken up into .depend.*.o files. [1]
  >  - Fix an assembly file support.
  >
  >  PR:   241746
  >  Submitted by: leres [1]

Modified:
  stable/12/sys/conf/kern.post.mk
  stable/12/sys/conf/systags.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/kern.post.mk
==
--- stable/12/sys/conf/kern.post.mk Fri Jan 31 11:33:11 2020
(r357330)
+++ stable/12/sys/conf/kern.post.mk Fri Jan 31 12:38:53 2020
(r357331)
@@ -355,7 +355,8 @@ kernel-cleandepend: .PHONY
rm -f .depend .depend.* ${_ILINKS}
 
 kernel-tags:
-   @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
+   @ls .depend.* > /dev/null 2>&1 || \
+   { echo "you must make depend first"; exit 1; }
sh $S/conf/systags.sh
 
 kernel-install: .PHONY

Modified: stable/12/sys/conf/systags.sh
==
--- stable/12/sys/conf/systags.sh   Fri Jan 31 11:33:11 2020
(r357330)
+++ stable/12/sys/conf/systags.sh   Fri Jan 31 12:38:53 2020
(r357331)
@@ -39,14 +39,14 @@
 
 rm -f tags tags.tmp tags.cfiles tags.sfiles tags.hfiles
 sed -e "s, machine/, ../../include/,g" \
-   -e 's,[a-z][^/]*/\.\./,,g' .depend | awk '{
+   -e 's,[a-z][^/]*/\.\./,,g' .depend.* | awk '{
for (i = 1; i <= NF; ++i) {
t = substr($i, length($i) - 1)
if (t == ".c")
cfiles[$i] = 1;
else if (t == ".h")
hfiles[$i] = 1;
-   else if (t == ".s")
+   else if (t == ".s" || t == ".S")
sfiles[$i] = 1;
}
};
___
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: r357330 - head/sys/arm64/arm64

2020-01-31 Thread Andrew Turner
Author: andrew
Date: Fri Jan 31 11:33:11 2020
New Revision: 357330
URL: https://svnweb.freebsd.org/changeset/base/357330

Log:
  Call the MAPTI command earlier in the ITS driver
  
  The GICv3 Software Overview suggests when allocating a new MSI/MSI-X
  interrupt we need to call MAPD followed by MAPTI. Unfortunately the code
  would place a MOVI command between these. This is invalid as it needs
  values set by the MAPTI to be present.
  
  Re-order so we allocate a temporary CPU for the interrupt, then use the
  MAPTI command to assign the MSI to it.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

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

Modified: head/sys/arm64/arm64/gicv3_its.c
==
--- head/sys/arm64/arm64/gicv3_its.cFri Jan 31 11:31:14 2020
(r357329)
+++ head/sys/arm64/arm64/gicv3_its.cFri Jan 31 11:33:11 2020
(r357330)
@@ -928,21 +928,29 @@ gicv3_its_post_filter(device_t dev, struct intr_irqsrc
 }
 
 static int
-gicv3_its_bind_intr(device_t dev, struct intr_irqsrc *isrc)
+gicv3_its_select_cpu(device_t dev, struct intr_irqsrc *isrc)
 {
-   struct gicv3_its_irqsrc *girq;
struct gicv3_its_softc *sc;
 
sc = device_get_softc(dev);
-   girq = (struct gicv3_its_irqsrc *)isrc;
if (CPU_EMPTY(>isrc_cpu)) {
sc->gic_irq_cpu = intr_irq_next_cpu(sc->gic_irq_cpu,
>sc_cpus);
CPU_SETOF(sc->gic_irq_cpu, >isrc_cpu);
}
 
-   its_cmd_movi(dev, girq);
+   return (0);
+}
 
+static int
+gicv3_its_bind_intr(device_t dev, struct intr_irqsrc *isrc)
+{
+   struct gicv3_its_irqsrc *girq;
+
+   gicv3_its_select_cpu(dev, isrc);
+
+   girq = (struct gicv3_its_irqsrc *)isrc;
+   its_cmd_movi(dev, girq);
return (0);
 }
 
@@ -1129,6 +1137,10 @@ gicv3_its_alloc_msi(device_t dev, device_t child, int 
girq = >sc_irqs[irq];
girq->gi_its_dev = its_dev;
srcs[i] = (struct intr_irqsrc *)girq;
+
+   /* Map the message to the given IRQ */
+   gicv3_its_select_cpu(dev, (struct intr_irqsrc *)girq);
+   its_cmd_mapti(dev, girq);
}
its_dev->lpis.lpi_busy += count;
*pic = dev;
@@ -1189,6 +1201,10 @@ gicv3_its_alloc_msix(device_t dev, device_t child, dev
girq = >sc_irqs[irq];
girq->gi_its_dev = its_dev;
 
+   /* Map the message to the given IRQ */
+   gicv3_its_select_cpu(dev, (struct intr_irqsrc *)girq);
+   its_cmd_mapti(dev, girq);
+
*pic = dev;
*isrcp = (struct intr_irqsrc *)girq;
 
@@ -1228,9 +1244,6 @@ gicv3_its_map_msi(device_t dev, device_t child, struct
 
sc = device_get_softc(dev);
girq = (struct gicv3_its_irqsrc *)isrc;
-
-   /* Map the message to the given IRQ */
-   its_cmd_mapti(dev, girq);
 
*addr = vtophys(rman_get_virtual(sc->sc_its_res)) + GITS_TRANSLATER;
*data = girq->gi_irq - girq->gi_its_dev->lpis.lpi_base;
___
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: r357329 - head/sys/kern

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Fri Jan 31 11:31:14 2020
New Revision: 357329
URL: https://svnweb.freebsd.org/changeset/base/357329

Log:
  vfs: revert the overzealous assert added in r357285 to vgone
  
  The intent was to make it more likely to catch filesystems with custom
  need_inactive routines which fail to call vn_need_pageq_flush (or do an
  equivalent).
  
  One immediate case which is missed is vgone from called by inactive itself.
  
  A better assertion may land later. The routine is not added to vputx because
  it is of no use to tmpfs et al.
  
  Reported by:  syzbot+5f697ec11f89b6094...@syzkaller.appspotmail.com

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cFri Jan 31 10:51:13 2020(r357328)
+++ head/sys/kern/vfs_subr.cFri Jan 31 11:31:14 2020(r357329)
@@ -3862,7 +3862,6 @@ vgonel(struct vnode *vp)
vinactivef(vp);
VI_UNLOCK(vp);
}
-   VNPASS(!vn_need_pageq_flush(vp), vp);
if (vp->v_type == VSOCK)
vfs_unp_reclaim(vp);
 
@@ -4994,7 +4993,7 @@ vn_need_pageq_flush(struct vnode *vp)
struct vm_object *obj;
int need;
 
-   VNPASS(VN_IS_DOOMED(vp) || mtx_owned(VI_MTX(vp)), vp);
+   MPASS(mtx_owned(VI_MTX(vp)));
need = 0;
if ((obj = vp->v_object) != NULL && (vp->v_vflag & VV_NOSYNC) == 0 &&
vm_object_mightbedirty(obj))
___
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: r357328 - head/sys/net

2020-01-31 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 31 10:51:13 2020
New Revision: 357328
URL: https://svnweb.freebsd.org/changeset/base/357328

Log:
  Revert r357293.
  The netisr uses rm_ locks not rms_ locks as noted by jeff@ .
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/net/netisr.c

Modified: head/sys/net/netisr.c
==
--- head/sys/net/netisr.c   Fri Jan 31 10:41:47 2020(r357327)
+++ head/sys/net/netisr.c   Fri Jan 31 10:51:13 2020(r357328)
@@ -920,7 +920,6 @@ netisr_process_workstream_proto(struct netisr_workstre
 static void
 swi_net(void *arg)
 {
-   struct epoch_tracker et;
 #ifdef NETISR_LOCKING
struct rm_priotracker tracker;
 #endif
@@ -932,9 +931,7 @@ swi_net(void *arg)
 #ifdef DEVICE_POLLING
KASSERT(nws_count == 1,
("%s: device_polling but nws_count != 1", __func__));
-   NET_EPOCH_ENTER(et);
netisr_poll();
-   NET_EPOCH_EXIT(et);
 #endif
 #ifdef NETISR_LOCKING
NETISR_RLOCK();
@@ -943,7 +940,6 @@ swi_net(void *arg)
KASSERT(!(nwsp->nws_flags & NWS_RUNNING), ("swi_net: running"));
if (nwsp->nws_flags & NWS_DISPATCHING)
goto out;
-   NET_EPOCH_ENTER(et);
nwsp->nws_flags |= NWS_RUNNING;
nwsp->nws_flags &= ~NWS_SCHEDULED;
while ((bits = nwsp->nws_pendingbits) != 0) {
@@ -954,7 +950,6 @@ swi_net(void *arg)
}
}
nwsp->nws_flags &= ~NWS_RUNNING;
-   NET_EPOCH_EXIT(et);
 out:
NWS_UNLOCK(nwsp);
 #ifdef NETISR_LOCKING
___
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: r357327 - head/sys/dev/mlx4/mlx4_en

2020-01-31 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 31 10:41:47 2020
New Revision: 357327
URL: https://svnweb.freebsd.org/changeset/base/357327

Log:
  Widen EPOCH(9) usage in mlx4en(4).
  
  Make sure all receive completion callbacks are covered by the network
  EPOCH(9), because this is required when calling if_input() and
  ether_input() after r357012.
  
  Convert some spaces to tabs while at it.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c  Fri Jan 31 10:34:38 2020
(r357326)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c  Fri Jan 31 10:41:47 2020
(r357327)
@@ -866,14 +866,16 @@ out:
 /* Rx CQ polling - called by NAPI */
 static int mlx4_en_poll_rx_cq(struct mlx4_en_cq *cq, int budget)
 {
-struct net_device *dev = cq->dev;
-int done;
+   struct net_device *dev = cq->dev;
+   struct epoch_tracker et;
+   int done;
 
-done = mlx4_en_process_rx_cq(dev, cq, budget);
-cq->tot_rx += done;
+   NET_EPOCH_ENTER(et);
+   done = mlx4_en_process_rx_cq(dev, cq, budget);
+   NET_EPOCH_EXIT(et);
+   cq->tot_rx += done;
 
-return done;
-
+   return done;
 }
 void mlx4_en_rx_irq(struct mlx4_cq *mcq)
 {
___
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: r357326 - stable/11/sys/net

2020-01-31 Thread Kristof Provost
Author: kp
Date: Fri Jan 31 10:34:38 2020
New Revision: 357326
URL: https://svnweb.freebsd.org/changeset/base/357326

Log:
  MFC r357233:
  
  epair: Do not abuse params to register the second interface
  
  if_epair used the 'params' argument to pass a pointer to the b interface
  through if_clone_create().
  This pointer can be controlled by userspace, which means it could be abused to
  trigger a panic. While this requires PRIV_NET_IFCREATE
  privileges those are assigned to vnet jails, which means that vnet jails
  could panic the system.
  
  Reported by:  Ilja Van Sprundel 

Modified:
  stable/11/sys/net/if_clone.c
  stable/11/sys/net/if_clone.h
  stable/11/sys/net/if_epair.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_clone.c
==
--- stable/11/sys/net/if_clone.cFri Jan 31 10:34:36 2020
(r357325)
+++ stable/11/sys/net/if_clone.cFri Jan 31 10:34:38 2020
(r357326)
@@ -208,6 +208,17 @@ if_clone_create(char *name, size_t len, caddr_t params
return (if_clone_createif(ifc, name, len, params));
 }
 
+void
+if_clone_addif(struct if_clone *ifc, struct ifnet *ifp)
+{
+
+   if_addgroup(ifp, ifc->ifc_name);
+
+   IF_CLONE_LOCK(ifc);
+   IFC_IFLIST_INSERT(ifc, ifp);
+   IF_CLONE_UNLOCK(ifc);
+}
+
 /*
  * Create a clone network interface.
  */
@@ -230,11 +241,7 @@ if_clone_createif(struct if_clone *ifc, char *name, si
if (ifp == NULL)
panic("%s: lookup failed for %s", __func__, name);
 
-   if_addgroup(ifp, ifc->ifc_name);
-
-   IF_CLONE_LOCK(ifc);
-   IFC_IFLIST_INSERT(ifc, ifp);
-   IF_CLONE_UNLOCK(ifc);
+   if_clone_addif(ifc, ifp);
}
 
return (err);

Modified: stable/11/sys/net/if_clone.h
==
--- stable/11/sys/net/if_clone.hFri Jan 31 10:34:36 2020
(r357325)
+++ stable/11/sys/net/if_clone.hFri Jan 31 10:34:38 2020
(r357326)
@@ -72,7 +72,8 @@ int   if_clone_list(struct if_clonereq *);
 struct if_clone *if_clone_findifc(struct ifnet *);
 void   if_clone_addgroup(struct ifnet *, struct if_clone *);
 
-/* The below interface used only by epair(4). */
+/* The below interfaces are used only by epair(4). */
+void   if_clone_addif(struct if_clone *, struct ifnet *);
 intif_clone_destroyif(struct if_clone *, struct ifnet *);
 
 #endif /* _KERNEL */

Modified: stable/11/sys/net/if_epair.c
==
--- stable/11/sys/net/if_epair.cFri Jan 31 10:34:36 2020
(r357325)
+++ stable/11/sys/net/if_epair.cFri Jan 31 10:34:38 2020
(r357326)
@@ -704,6 +704,23 @@ epair_clone_match(struct if_clone *ifc, const char *na
return (1);
 }
 
+static void
+epair_clone_add(struct if_clone *ifc, struct epair_softc *scb)
+{
+   struct ifnet *ifp;
+   uint8_t eaddr[ETHER_ADDR_LEN];  /* 00:00:00:00:00:00 */
+
+   ifp = scb->ifp;
+   /* Assign a hopefully unique, locally administered etheraddr. */
+   eaddr[0] = 0x02;
+   eaddr[3] = (ifp->if_index >> 8) & 0xff;
+   eaddr[4] = ifp->if_index & 0xff;
+   eaddr[5] = 0x0b;
+   ether_ifattach(ifp, eaddr);
+
+   if_clone_addif(ifc, ifp);
+}
+
 static int
 epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t 
params)
 {
@@ -713,26 +730,6 @@ epair_clone_create(struct if_clone *ifc, char *name, s
int error, unit, wildcard;
uint8_t eaddr[ETHER_ADDR_LEN];  /* 00:00:00:00:00:00 */
 
-   /*
-* We are abusing params to create our second interface.
-* Actually we already created it and called if_clone_create()
-* for it to do the official insertion procedure the moment we knew
-* it cannot fail anymore. So just do attach it here.
-*/
-   if (params) {
-   scb = (struct epair_softc *)params;
-   ifp = scb->ifp;
-   /* Assign a hopefully unique, locally administered etheraddr. */
-   eaddr[0] = 0x02;
-   eaddr[3] = (ifp->if_index >> 8) & 0xff;
-   eaddr[4] = ifp->if_index & 0xff;
-   eaddr[5] = 0x0b;
-   ether_ifattach(ifp, eaddr);
-   /* Correctly set the name for the cloner list. */
-   strlcpy(name, scb->ifp->if_xname, len);
-   return (0);
-   }
-
/* Try to see if a special unit was requested. */
error = ifc_name2unit(name, );
if (error != 0)
@@ -860,10 +857,11 @@ epair_clone_create(struct if_clone *ifc, char *name, s
ifp->if_snd.ifq_maxlen = ifqmaxlen;
/* We need to play some tricks here for the second interface. */
strlcpy(name, epairname, len);
-   error = if_clone_create(name, len, (caddr_t)scb);
- 

svn commit: r357325 - stable/12/sys/net

2020-01-31 Thread Kristof Provost
Author: kp
Date: Fri Jan 31 10:34:36 2020
New Revision: 357325
URL: https://svnweb.freebsd.org/changeset/base/357325

Log:
  MFC r357233:
  
  epair: Do not abuse params to register the second interface
  
  if_epair used the 'params' argument to pass a pointer to the b interface
  through if_clone_create().
  This pointer can be controlled by userspace, which means it could be abused to
  trigger a panic. While this requires PRIV_NET_IFCREATE
  privileges those are assigned to vnet jails, which means that vnet jails
  could panic the system.
  
  Reported by:  Ilja Van Sprundel 

Modified:
  stable/12/sys/net/if_clone.c
  stable/12/sys/net/if_clone.h
  stable/12/sys/net/if_epair.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_clone.c
==
--- stable/12/sys/net/if_clone.cFri Jan 31 10:30:13 2020
(r357324)
+++ stable/12/sys/net/if_clone.cFri Jan 31 10:34:36 2020
(r357325)
@@ -211,6 +211,18 @@ if_clone_create(char *name, size_t len, caddr_t params
return (if_clone_createif(ifc, name, len, params));
 }
 
+void
+if_clone_addif(struct if_clone *ifc, struct ifnet *ifp)
+{
+
+   if ((ifc->ifc_flags & IFC_NOGROUP) == 0)
+   if_addgroup(ifp, ifc->ifc_name);
+
+   IF_CLONE_LOCK(ifc);
+   IFC_IFLIST_INSERT(ifc, ifp);
+   IF_CLONE_UNLOCK(ifc);
+}
+
 /*
  * Create a clone network interface.
  */
@@ -233,12 +245,7 @@ if_clone_createif(struct if_clone *ifc, char *name, si
if (ifp == NULL)
panic("%s: lookup failed for %s", __func__, name);
 
-   if ((ifc->ifc_flags & IFC_NOGROUP) == 0)
-   if_addgroup(ifp, ifc->ifc_name);
-
-   IF_CLONE_LOCK(ifc);
-   IFC_IFLIST_INSERT(ifc, ifp);
-   IF_CLONE_UNLOCK(ifc);
+   if_clone_addif(ifc, ifp);
}
 
return (err);

Modified: stable/12/sys/net/if_clone.h
==
--- stable/12/sys/net/if_clone.hFri Jan 31 10:30:13 2020
(r357324)
+++ stable/12/sys/net/if_clone.hFri Jan 31 10:34:36 2020
(r357325)
@@ -79,7 +79,8 @@ int   if_clone_list(struct if_clonereq *);
 struct if_clone *if_clone_findifc(struct ifnet *);
 void   if_clone_addgroup(struct ifnet *, struct if_clone *);
 
-/* The below interface used only by epair(4). */
+/* The below interfaces are used only by epair(4). */
+void   if_clone_addif(struct if_clone *, struct ifnet *);
 intif_clone_destroyif(struct if_clone *, struct ifnet *);
 
 #endif /* _KERNEL */

Modified: stable/12/sys/net/if_epair.c
==
--- stable/12/sys/net/if_epair.cFri Jan 31 10:30:13 2020
(r357324)
+++ stable/12/sys/net/if_epair.cFri Jan 31 10:34:36 2020
(r357325)
@@ -711,6 +711,21 @@ epair_clone_match(struct if_clone *ifc, const char *na
return (1);
 }
 
+static void
+epair_clone_add(struct if_clone *ifc, struct epair_softc *scb)
+{
+   struct ifnet *ifp;
+   uint8_t eaddr[ETHER_ADDR_LEN];  /* 00:00:00:00:00:00 */
+
+   ifp = scb->ifp;
+   /* Copy epairNa etheraddr and change the last byte. */
+   memcpy(eaddr, scb->oifp->if_hw_addr, ETHER_ADDR_LEN);
+   eaddr[5] = 0x0b;
+   ether_ifattach(ifp, eaddr);
+
+   if_clone_addif(ifc, ifp);
+}
+
 static int
 epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t 
params)
 {
@@ -723,24 +738,6 @@ epair_clone_create(struct if_clone *ifc, char *name, s
uint32_t hash;
uint8_t eaddr[ETHER_ADDR_LEN];  /* 00:00:00:00:00:00 */
 
-   /*
-* We are abusing params to create our second interface.
-* Actually we already created it and called if_clone_create()
-* for it to do the official insertion procedure the moment we knew
-* it cannot fail anymore. So just do attach it here.
-*/
-   if (params) {
-   scb = (struct epair_softc *)params;
-   ifp = scb->ifp;
-   /* Copy epairNa etheraddr and change the last byte. */
-   memcpy(eaddr, scb->oifp->if_hw_addr, ETHER_ADDR_LEN);
-   eaddr[5] = 0x0b;
-   ether_ifattach(ifp, eaddr);
-   /* Correctly set the name for the cloner list. */
-   strlcpy(name, ifp->if_xname, len);
-   return (0);
-   }
-
/* Try to see if a special unit was requested. */
error = ifc_name2unit(name, );
if (error != 0)
@@ -891,10 +888,11 @@ epair_clone_create(struct if_clone *ifc, char *name, s
if_setsendqready(ifp);
/* We need to play some tricks here for the second interface. */
strlcpy(name, epairname, len);
-   error = if_clone_create(name, len, (caddr_t)scb);
-   if (error)
-   panic("%s: 

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

2020-01-31 Thread Andrew Turner
Author: andrew
Date: Fri Jan 31 10:30:13 2020
New Revision: 357324
URL: https://svnweb.freebsd.org/changeset/base/357324

Log:
  Only create one ITS configuration table
  
  When there are multiple ITS devices in the system we would allocate a
  configuration table for each, however only one table is needed as all the
  ITS devices share this.
  
  Allocate a table only when the global table is unset.
  
  While here fix the type of this to be a pointer to a uint8_t array as the
  entries are all 8 bits wide.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

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

Modified: head/sys/arm64/arm64/gicv3_its.c
==
--- head/sys/arm64/arm64/gicv3_its.cFri Jan 31 09:51:38 2020
(r357323)
+++ head/sys/arm64/arm64/gicv3_its.cFri Jan 31 10:30:13 2020
(r357324)
@@ -224,6 +224,7 @@ struct its_col {
 struct gicv3_its_irqsrc {
struct intr_irqsrc  gi_isrc;
u_int   gi_irq;
+   u_int   gi_lpi;
struct its_dev  *gi_its_dev;
 };
 
@@ -241,7 +242,7 @@ struct gicv3_its_softc {
 * TODO: We should get these from the parent as we only want a
 * single copy of each across the interrupt controller.
 */
-   vm_offset_t sc_conf_base;
+   uint8_t *sc_conf_base;
vm_offset_t sc_pend_base[MAXCPU];
 
/* Command handling */
@@ -263,6 +264,8 @@ struct gicv3_its_softc {
u_int sc_its_flags;
 };
 
+static void *conf_base;
+
 typedef void (its_quirk_func_t)(device_t);
 static its_quirk_func_t its_quirk_cavium_22375;
 
@@ -542,17 +545,29 @@ gicv3_its_table_init(device_t dev, struct gicv3_its_so
 static void
 gicv3_its_conftable_init(struct gicv3_its_softc *sc)
 {
+   void *conf_table;
 
-   sc->sc_conf_base = (vm_offset_t)contigmalloc(LPI_CONFTAB_SIZE,
-   M_GICV3_ITS, M_WAITOK, 0, LPI_CONFTAB_MAX_ADDR, LPI_CONFTAB_ALIGN,
-   0);
+   conf_table = (void *)atomic_load_ptr((uintptr_t *)_base);
+   if (conf_table == NULL) {
+   conf_table = contigmalloc(LPI_CONFTAB_SIZE,
+   M_GICV3_ITS, M_WAITOK, 0, LPI_CONFTAB_MAX_ADDR,
+   LPI_CONFTAB_ALIGN, 0);
 
+   if (atomic_cmpset_ptr((uintptr_t *)_base,
+   (uintptr_t)NULL, (uintptr_t)conf_table) == 0) {
+   contigfree(conf_table, LPI_CONFTAB_SIZE, M_GICV3_ITS);
+   conf_table =
+   (void *)atomic_load_ptr((uintptr_t *)_base);
+   }
+   }
+   sc->sc_conf_base = conf_table;
+
/* Set the default configuration */
-   memset((void *)sc->sc_conf_base, GIC_PRIORITY_MAX | LPI_CONF_GROUP1,
+   memset(sc->sc_conf_base, GIC_PRIORITY_MAX | LPI_CONF_GROUP1,
LPI_CONFTAB_SIZE);
 
/* Flush the table to memory */
-   cpu_dcache_wb_range(sc->sc_conf_base, LPI_CONFTAB_SIZE);
+   cpu_dcache_wb_range((vm_offset_t)sc->sc_conf_base, LPI_CONFTAB_SIZE);
 }
 
 static void
@@ -792,6 +807,7 @@ gicv3_its_attach(device_t dev)
name = device_get_nameunit(dev);
for (i = 0; i < sc->sc_irq_length; i++) {
sc->sc_irqs[i].gi_irq = i;
+   sc->sc_irqs[i].gi_lpi = i + sc->sc_irq_base - GIC_FIRST_LPI;
err = intr_isrc_register(>sc_irqs[i].gi_isrc, dev, 0,
"%s,%u", name, i);
}
@@ -824,13 +840,13 @@ gicv3_its_disable_intr(device_t dev, struct intr_irqsr
 
sc = device_get_softc(dev);
girq = (struct gicv3_its_irqsrc *)isrc;
-   conf = (uint8_t *)sc->sc_conf_base;
+   conf = sc->sc_conf_base;
 
-   conf[girq->gi_irq] &= ~LPI_CONF_ENABLE;
+   conf[girq->gi_lpi] &= ~LPI_CONF_ENABLE;
 
if ((sc->sc_its_flags & ITS_FLAGS_LPI_CONF_FLUSH) != 0) {
/* Clean D-cache under command. */
-   cpu_dcache_wb_range((vm_offset_t)[girq->gi_irq], 1);
+   cpu_dcache_wb_range((vm_offset_t)[girq->gi_lpi], 1);
} else {
/* DSB inner shareable, store */
dsb(ishst);
@@ -848,13 +864,13 @@ gicv3_its_enable_intr(device_t dev, struct intr_irqsrc
 
sc = device_get_softc(dev);
girq = (struct gicv3_its_irqsrc *)isrc;
-   conf = (uint8_t *)sc->sc_conf_base;
+   conf = sc->sc_conf_base;
 
-   conf[girq->gi_irq] |= LPI_CONF_ENABLE;
+   conf[girq->gi_lpi] |= LPI_CONF_ENABLE;
 
if ((sc->sc_its_flags & ITS_FLAGS_LPI_CONF_FLUSH) != 0) {
/* Clean D-cache under command. */
-   cpu_dcache_wb_range((vm_offset_t)[girq->gi_irq], 1);
+   cpu_dcache_wb_range((vm_offset_t)[girq->gi_lpi], 1);
} else {
/* DSB inner shareable, store */
dsb(ishst);
___
svn-src-all@freebsd.org mailing list

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

2020-01-31 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: jeff
> Date: Fri Jan 31 02:08:09 2020
> New Revision: 357316
> URL: https://svnweb.freebsd.org/changeset/base/357316
> 
> Log:
>   Don't use "All rights reserved" in new copyrights.
>   
>   Requested by:   rgrimes

Thank you.

> 
> Modified:
>   head/sys/kern/subr_smr.c
>   head/sys/sys/_smr.h
>   head/sys/sys/smr.h
> 
> Modified: head/sys/kern/subr_smr.c
> ==
> --- head/sys/kern/subr_smr.c  Fri Jan 31 02:03:22 2020(r357315)
> +++ head/sys/kern/subr_smr.c  Fri Jan 31 02:08:09 2020(r357316)
> @@ -1,8 +1,7 @@
>  /*-
>   * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>   *
> - * Copyright (c) 2019 Jeffrey Roberson 
> - * All rights reserved.
> + * Copyright (c) 2019,2020 Jeffrey Roberson 
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions
> 
> Modified: head/sys/sys/_smr.h
> ==
> --- head/sys/sys/_smr.h   Fri Jan 31 02:03:22 2020(r357315)
> +++ head/sys/sys/_smr.h   Fri Jan 31 02:08:09 2020(r357316)
> @@ -1,8 +1,7 @@
>  /*-
>   * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>   *
> - * Copyright (c) 2019,2020 Jeffrey Roberson 
> - * All rights reserved.
> + * Copyright (c) 2019, 2020 Jeffrey Roberson 
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions
> 
> Modified: head/sys/sys/smr.h
> ==
> --- head/sys/sys/smr.hFri Jan 31 02:03:22 2020(r357315)
> +++ head/sys/sys/smr.hFri Jan 31 02:08:09 2020(r357316)
> @@ -1,8 +1,7 @@
>  /*-
>   * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>   *
> - * Copyright (c) 2019,2020 Jeffrey Roberson 
> - * All rights reserved.
> + * Copyright (c) 2019, 2020 Jeffrey Roberson 
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r357323 - head/sys/arm64/acpica

2020-01-31 Thread Andrew Turner
Author: andrew
Date: Fri Jan 31 09:51:38 2020
New Revision: 357323
URL: https://svnweb.freebsd.org/changeset/base/357323

Log:
  Ignore the SMMUv3 and PMCG interrupt controller in the IORT tables
  
  When mapping MSI/MSI-X interrupts throught he Arm IORT ACPI tables we may
  need to ignore an interrupt controller even if it is within the bounds the
  entry describes. When the SMMUv3 is not using GSIV (non-MSI/MSI-X)
  interrupts we need to read the defined field. The Performance Monitoring
  Counter Group always ignores the first table entry.
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/acpica/acpi_iort.c

Modified: head/sys/arm64/acpica/acpi_iort.c
==
--- head/sys/arm64/acpica/acpi_iort.c   Fri Jan 31 08:38:38 2020
(r357322)
+++ head/sys/arm64/acpica/acpi_iort.c   Fri Jan 31 09:51:38 2020
(r357323)
@@ -89,6 +89,7 @@ struct iort_node {
u_int   node_offset;/* offset in IORT - node ID */
u_int   nentries;   /* items in array below */
u_int   usecount;   /* for bookkeeping */
+   u_int   revision;   /* node revision */
union {
ACPI_IORT_ROOT_COMPLEX  pci_rc; /* PCI root complex */
ACPI_IORT_SMMU  smmu;
@@ -105,6 +106,39 @@ static TAILQ_HEAD(, iort_node) pci_nodes = TAILQ_HEAD_
 static TAILQ_HEAD(, iort_node) smmu_nodes = TAILQ_HEAD_INITIALIZER(smmu_nodes);
 static TAILQ_HEAD(, iort_node) its_groups = TAILQ_HEAD_INITIALIZER(its_groups);
 
+static int
+iort_entry_get_id_mapping_index(struct iort_node *node)
+{
+
+   switch(node->type) {
+   case ACPI_IORT_NODE_SMMU_V3:
+   /* The ID mapping field was added in version 1 */
+   if (node->revision < 1)
+   return (-1);
+
+   /*
+* If all the control interrupts are GISCV based the ID
+* mapping field is ignored.
+*/
+   if (node->data.smmu_v3.EventGsiv != 0 &&
+   node->data.smmu_v3.PriGsiv != 0 &&
+   node->data.smmu_v3.GerrGsiv != 0 &&
+   node->data.smmu_v3.SyncGsiv != 0)
+   return (-1);
+
+   if (node->data.smmu_v3.IdMappingIndex >= node->nentries)
+   return (-1);
+
+   return (node->data.smmu_v3.IdMappingIndex);
+   case ACPI_IORT_NODE_PMCG:
+   return (0);
+   default:
+   break;
+   }
+
+   return (-1);
+}
+
 /*
  * Lookup an ID in the mappings array. If successful, map the input ID
  * to the output ID and return the output node found.
@@ -113,10 +147,13 @@ static struct iort_node *
 iort_entry_lookup(struct iort_node *node, u_int id, u_int *outid)
 {
struct iort_map_entry *entry;
-   int i;
+   int i, id_map;
 
+   id_map = iort_entry_get_id_mapping_index(node);
entry = node->entries.mappings;
for (i = 0; i < node->nentries; i++, entry++) {
+   if (i == id_map)
+   continue;
if (entry->base <= id && id <= entry->end)
break;
}
@@ -243,6 +280,7 @@ iort_add_nodes(ACPI_IORT_NODE *node_entry, u_int node_
node = malloc(sizeof(*node), M_DEVBUF, M_WAITOK | M_ZERO);
node->type =  node_entry->Type;
node->node_offset = node_offset;
+   node->revision = node_entry->Revision;
 
/* copy nodes depending on type */
switch(node_entry->Type) {
___
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: r357322 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Fri Jan 31 08:38:38 2020
New Revision: 357322
URL: https://svnweb.freebsd.org/changeset/base/357322

Log:
  zfs: convert z_teardown_inactive_lock to sleepable read-mostly lock
  
  This eliminates a global serialisation point. It only gets write locked
  on unmount.
  
  Sample result doing an incremental -j 40 build:
  before: 173.30s user 458.97s system 2595% cpu 24.358 total
  after:  168.58s user 254.92s system 2211% cpu 19.147 total

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
Fri Jan 31 08:37:35 2020(r357321)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
Fri Jan 31 08:38:38 2020(r357322)
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -65,7 +66,7 @@ struct zfsvfs {
boolean_t   z_atime;/* enable atimes mount option */
boolean_t   z_unmounted;/* unmounted */
rrmlock_t   z_teardown_lock;
-   krwlock_t   z_teardown_inactive_lock;
+   struct rmslock  z_teardown_inactive_lock;
list_t  z_all_znodes;   /* all vnodes in the fs */
kmutex_tz_znodes_lock;  /* lock for z_all_znodes */
struct zfsctl_root  *z_ctldir;  /* .zfs directory pointer */
@@ -91,22 +92,22 @@ struct zfsvfs {
 };
 
 #defineZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \
-   rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
+   rms_try_rlock(&(zfsvfs)->z_teardown_inactive_lock)
 
 #defineZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \
-   rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
+   rms_rlock(&(zfsvfs)->z_teardown_inactive_lock)
 
 #defineZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
-   rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
+   rms_runlock(&(zfsvfs)->z_teardown_inactive_lock)
 
 #defineZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \
-   rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER)
+   rms_wlock(&(zfsvfs)->z_teardown_inactive_lock)
 
 #defineZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
-   rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
+   rms_wunlock(&(zfsvfs)->z_teardown_inactive_lock)
 
 #defineZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \
-   RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock)
+   rms_wowned(&(zfsvfs)->z_teardown_inactive_lock)
 
 /*
  * Normal filesystems (those not under .zfs/snapshot) have a total

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Jan 
31 08:37:35 2020(r357321)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Jan 
31 08:38:38 2020(r357322)
@@ -1205,7 +1205,7 @@ zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, 
 #else
rrm_init(>z_teardown_lock, B_FALSE);
 #endif
-   rw_init(>z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL);
+   rms_init(>z_teardown_inactive_lock, "zfs teardown inactive");
rw_init(>z_fuid_lock, NULL, RW_DEFAULT, NULL);
for (int i = 0; i != ZFS_OBJ_MTX_SZ; i++)
mutex_init(>z_hold_mtx[i], NULL, MUTEX_DEFAULT, NULL);
@@ -1322,7 +1322,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs)
mutex_destroy(>z_lock);
list_destroy(>z_all_znodes);
rrm_destroy(>z_teardown_lock);
-   rw_destroy(>z_teardown_inactive_lock);
+   rms_destroy(>z_teardown_inactive_lock);
rw_destroy(>z_fuid_lock);
for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
mutex_destroy(>z_hold_mtx[i]);
___
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: r357321 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Fri Jan 31 08:37:35 2020
New Revision: 357321
URL: https://svnweb.freebsd.org/changeset/base/357321

Log:
  zfs: provide macros to handle z_teardown_inactive_lock

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
Fri Jan 31 08:36:49 2020(r357320)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
Fri Jan 31 08:37:35 2020(r357321)
@@ -90,6 +90,24 @@ struct zfsvfs {
 #endif
 };
 
+#defineZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \
+   rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
+
+#defineZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \
+   rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
+
+#defineZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
+   rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
+
+#defineZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \
+   rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER)
+
+#defineZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
+   rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
+
+#defineZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \
+   RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock)
+
 /*
  * Normal filesystems (those not under .zfs/snapshot) have a total
  * file ID size limited to 12 bytes (including the length field) due to

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Jan 
31 08:36:49 2020(r357320)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Jan 
31 08:37:35 2020(r357321)
@@ -2055,7 +2055,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting
zfsvfs->z_log = NULL;
}
 
-   rw_enter(>z_teardown_inactive_lock, RW_WRITER);
+   ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs);
 
/*
 * If we are not unmounting (ie: online recv) and someone already
@@ -2063,7 +2063,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting
 * or a reopen of z_os failed then just bail out now.
 */
if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) {
-   rw_exit(>z_teardown_inactive_lock);
+   ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
rrm_exit(>z_teardown_lock, FTAG);
return (SET_ERROR(EIO));
}
@@ -2091,7 +2091,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting
 */
if (unmounting) {
zfsvfs->z_unmounted = B_TRUE;
-   rw_exit(>z_teardown_inactive_lock);
+   ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
rrm_exit(>z_teardown_lock, FTAG);
}
 
@@ -2437,7 +2437,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
znode_t *zp;
 
ASSERT(RRM_WRITE_HELD(>z_teardown_lock));
-   ASSERT(RW_WRITE_HELD(>z_teardown_inactive_lock));
+   ASSERT(ZFS_WLOCK_TEARDOWN_INACTIVE_WLOCKED(zp->z_zfsvfs));
 
/*
 * We already own this, so just update the objset_t, as the one we
@@ -2471,7 +2471,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
 
 bail:
/* release the VOPs */
-   rw_exit(>z_teardown_inactive_lock);
+   ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
rrm_exit(>z_teardown_lock, FTAG);
 
if (err) {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Jan 
31 08:36:49 2020(r357320)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Jan 
31 08:37:35 2020(r357321)
@@ -4247,13 +4247,13 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
int error;
 
-   rw_enter(>z_teardown_inactive_lock, RW_READER);
+   ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs);
if (zp->z_sa_hdl == NULL) {
/*
 * The fs has been unmounted, or we did a
 * suspend/resume and this file no longer exists.
 */
-   rw_exit(>z_teardown_inactive_lock);
+   ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
vrecycle(vp);
return;
}
@@ -4262,7 +4262,7 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t

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

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Fri Jan 31 08:36:49 2020
New Revision: 357320
URL: https://svnweb.freebsd.org/changeset/base/357320

Log:
  Add rms_try_rlock and rms_wowned.

Modified:
  head/sys/kern/kern_rmlock.c
  head/sys/sys/rmlock.h

Modified: head/sys/kern/kern_rmlock.c
==
--- head/sys/kern/kern_rmlock.c Fri Jan 31 08:36:23 2020(r357319)
+++ head/sys/kern/kern_rmlock.c Fri Jan 31 08:36:49 2020(r357320)
@@ -934,6 +934,30 @@ rms_rlock(struct rmslock *rms)
critical_exit();
 }
 
+int
+rms_try_rlock(struct rmslock *rms)
+{
+   int *influx;
+
+   critical_enter();
+   influx = zpcpu_get(rms->readers_influx);
+   __compiler_membar();
+   *influx = 1;
+   __compiler_membar();
+   if (__predict_false(rms->writers > 0)) {
+   __compiler_membar();
+   *influx = 0;
+   critical_exit();
+   return (0);
+   }
+   __compiler_membar();
+   (*zpcpu_get(rms->readers_pcpu))++;
+   __compiler_membar();
+   *influx = 0;
+   critical_exit();
+   return (1);
+}
+
 static void __noinline
 rms_runlock_fallback(struct rmslock *rms)
 {

Modified: head/sys/sys/rmlock.h
==
--- head/sys/sys/rmlock.h   Fri Jan 31 08:36:23 2020(r357319)
+++ head/sys/sys/rmlock.h   Fri Jan 31 08:36:49 2020(r357320)
@@ -136,9 +136,21 @@ struct rm_args {
 void   rms_init(struct rmslock *rms, const char *name);
 void   rms_destroy(struct rmslock *rms);
 void   rms_rlock(struct rmslock *rms);
+intrms_try_rlock(struct rmslock *rms);
 void   rms_runlock(struct rmslock *rms);
 void   rms_wlock(struct rmslock *rms);
 void   rms_wunlock(struct rmslock *rms);
+
+/*
+ * Writers are not explicitly tracked, thus until that changes the best we can
+ * do is indicate the lock is taken for writing by *someone*.
+ */
+static inline int
+rms_wowned(struct rmslock *rms)
+{
+
+   return (rms->writers > 0);
+}
 
 #endif /* _KERNEL */
 #endif /* !_SYS_RMLOCK_H_ */
___
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: r357319 - head/sys/kern

2020-01-31 Thread Mateusz Guzik
Author: mjg
Date: Fri Jan 31 08:36:23 2020
New Revision: 357319
URL: https://svnweb.freebsd.org/changeset/base/357319

Log:
  Remove an overzealous assert from rms_runlock.

Modified:
  head/sys/kern/kern_rmlock.c

Modified: head/sys/kern/kern_rmlock.c
==
--- head/sys/kern/kern_rmlock.c Fri Jan 31 02:23:48 2020(r357318)
+++ head/sys/kern/kern_rmlock.c Fri Jan 31 08:36:23 2020(r357319)
@@ -956,8 +956,6 @@ rms_runlock(struct rmslock *rms)
 {
int *influx;
 
-   WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
-
critical_enter();
influx = zpcpu_get(rms->readers_influx);
__compiler_membar();
___
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"