svn commit: r355439 - in head/sys/arm: arm include

2019-12-05 Thread Ian Lepore
Author: ian
Date: Fri Dec  6 03:48:35 2019
New Revision: 355439
URL: https://svnweb.freebsd.org/changeset/base/355439

Log:
  Declare the global kernel symbols created by ldscript.arm in arm's machdep.h,
  and remove a couple scattered local declarations.
  
  Most of these aren't referenced in C code (there are some references in
  asm code), and they also aren't documented anywhere.  This helps a bit
  with the latter.

Modified:
  head/sys/arm/arm/mp_machdep.c
  head/sys/arm/arm/unwind.c
  head/sys/arm/include/machdep.h

Modified: head/sys/arm/arm/mp_machdep.c
==
--- head/sys/arm/arm/mp_machdep.c   Fri Dec  6 03:46:38 2019
(r355438)
+++ head/sys/arm/arm/mp_machdep.c   Fri Dec  6 03:48:35 2019
(r355439)
@@ -106,8 +106,6 @@ check_ap(void)
return (-2);
 }
 
-extern unsigned char _end[];
-
 /* Initialize and fire up non-boot processors */
 void
 cpu_mp_start(void)

Modified: head/sys/arm/arm/unwind.c
==
--- head/sys/arm/arm/unwind.c   Fri Dec  6 03:46:38 2019(r355438)
+++ head/sys/arm/arm/unwind.c   Fri Dec  6 03:48:35 2019(r355439)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include "linker_if.h"
@@ -61,12 +62,6 @@ __FBSDID("$FreeBSD$");
 #defineEXIDX_CANTUNWIND1
 
 /*
- * These are set in the linker script. Their addresses will be
- * either the start or end of the exception table or index.
- */
-extern int exidx_start, exidx_end;
-
-/*
  * Entry types.
  * These are the only entry types that have been seen in the kernel.
  */
@@ -154,9 +149,9 @@ find_index(uint32_t addr, int search_modules)
int32_t prel31_addr;
uint32_t func_addr;
 
-   start = (struct unwind_idx *)_start;
-   idx_start = (caddr_t)_start;
-   idx_end = (caddr_t)_end;
+   start = (struct unwind_idx *)&_exidx_start;
+   idx_start = (caddr_t)&_exidx_start;
+   idx_end = (caddr_t)&_exidx_end;
 
/* This may acquire a lock */
if (search_modules) {

Modified: head/sys/arm/include/machdep.h
==
--- head/sys/arm/include/machdep.h  Fri Dec  6 03:46:38 2019
(r355438)
+++ head/sys/arm/include/machdep.h  Fri Dec  6 03:48:35 2019
(r355439)
@@ -61,4 +61,24 @@ void arm_add_efi_map_entries(struct efi_map_header *ef
 struct mem_region *mr, int *mrcnt);
 #endif
 
+/*
+ * Symbols created by ldscript.arm which are accessible in the kernel as global
+ * symbols. They have uint8 type because they mark the byte location where the
+ * corresponding data starts or ends (in the end case, it's the next byte
+ * following the data, so the data size is end-start).  These are listed below
+ * in the order they occur within the kernel (i.e., the address of each 
variable
+ * should be greater than any of the ones before it).
+ */
+extern uint8_t _start; /* Kernel entry point in locore.S */
+extern uint8_t _etext; /* text segment end */
+extern uint8_t _extab_start;   /* unwind table start */
+extern uint8_t _exidx_start;   /* unwind index start */
+extern uint8_t _exidx_end; /* unwind index end */
+extern uint8_t _start_ctors;   /* ctors data start */
+extern uint8_t _stop_ctors;/* ctors data end */
+extern uint8_t _edata; /* data segment end */
+extern uint8_t __bss_start;/* bss segment start */
+extern uint8_t _ebss;  /* bss segment end */
+extern uint8_t _end;   /* End of kernel (text+ctors+unwind+data+bss) */
+
 #endif /* !_MACHINE_MACHDEP_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: r355438 - head/sys/geom

2019-12-05 Thread Alexander Motin
Author: mav
Date: Fri Dec  6 03:46:38 2019
New Revision: 355438
URL: https://svnweb.freebsd.org/changeset/base/355438

Log:
  Block ioctls for dying GEOM_DEV instances.
  
  For normal I/Os consumer and provider statuses are checked by g_io_check().
  But ioctl calls often do not go through it, being dispatched directly. This
  change makes their semantics more alike, protecting lower levels.
  
  MFC after:2 weeks

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cFri Dec  6 03:18:37 2019(r355437)
+++ head/sys/geom/geom_dev.cFri Dec  6 03:46:38 2019(r355438)
@@ -497,12 +497,6 @@ g_dev_close(struct cdev *dev, int flags, int fmt, stru
return (error);
 }
 
-/*
- * XXX: Until we have unmessed the ioctl situation, there is a race against
- * XXX: a concurrent orphanization.  We cannot close it by holding topology
- * XXX: since that would prevent us from doing our job, and stalling events
- * XXX: will break (actually: stall) the BSD disklabel hacks.
- */
 static int
 g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct 
thread *td)
 {
@@ -517,6 +511,12 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
cp = dev->si_drv2;
pp = cp->provider;
 
+   /* If consumer or provider is dying, don't disturb. */
+   if (cp->flags & G_CF_ORPHAN)
+   return (ENXIO);
+   if (pp->error)
+   return (pp->error);
+
error = 0;
KASSERT(cp->acr || cp->acw,
("Consumer with zero access count in g_dev_ioctl"));
@@ -676,8 +676,6 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
error = g_io_getattr("GEOM::ident", cp, , data);
break;
case DIOCGPROVIDERNAME:
-   if (pp == NULL)
-   return (ENOENT);
strlcpy(data, pp->name, i);
break;
case DIOCGSTRIPESIZE:
___
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: r355437 - head/sys/geom

2019-12-05 Thread Alexander Motin
Author: mav
Date: Fri Dec  6 03:18:37 2019
New Revision: 355437
URL: https://svnweb.freebsd.org/changeset/base/355437

Log:
  Make GEOM_DEV code slightly more compact.
  
  Should be no functional change.
  
  MFC after:2 weeks

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cFri Dec  6 02:43:05 2019(r355436)
+++ head/sys/geom/geom_dev.cFri Dec  6 03:18:37 2019(r355437)
@@ -524,12 +524,12 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
i = IOCPARM_LEN(cmd);
switch (cmd) {
case DIOCGSECTORSIZE:
-   *(u_int *)data = cp->provider->sectorsize;
+   *(u_int *)data = pp->sectorsize;
if (*(u_int *)data == 0)
error = ENOENT;
break;
case DIOCGMEDIASIZE:
-   *(off_t *)data = cp->provider->mediasize;
+   *(off_t *)data = pp->mediasize;
if (*(off_t *)data == 0)
error = ENOENT;
break;
@@ -626,15 +626,14 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
case DIOCGDELETE:
offset = ((off_t *)data)[0];
length = ((off_t *)data)[1];
-   if ((offset % cp->provider->sectorsize) != 0 ||
-   (length % cp->provider->sectorsize) != 0 || length <= 0) {
+   if ((offset % pp->sectorsize) != 0 ||
+   (length % pp->sectorsize) != 0 || length <= 0) {
printf("%s: offset=%jd length=%jd\n", __func__, offset,
length);
error = EINVAL;
break;
}
-   if ((cp->provider->mediasize > 0) &&
-   (offset >= cp->provider->mediasize)) {
+   if ((pp->mediasize > 0) && (offset >= pp->mediasize)) {
/*
 * Catch out-of-bounds requests here. The problem is
 * that due to historical GEOM I/O implementation
@@ -649,14 +648,12 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
}
while (length > 0) {
chunk = length;
-   if (g_dev_del_max_sectors != 0 && chunk >
-   g_dev_del_max_sectors * cp->provider->sectorsize) {
-   chunk = g_dev_del_max_sectors *
-   cp->provider->sectorsize;
-   if (cp->provider->stripesize > 0) {
+   if (g_dev_del_max_sectors != 0 &&
+   chunk > g_dev_del_max_sectors * pp->sectorsize) {
+   chunk = g_dev_del_max_sectors * pp->sectorsize;
+   if (pp->stripesize > 0) {
odd = (offset + chunk +
-   cp->provider->stripeoffset) %
-   cp->provider->stripesize;
+   pp->stripeoffset) % pp->stripesize;
if (chunk > odd)
chunk -= odd;
}
@@ -684,10 +681,10 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
strlcpy(data, pp->name, i);
break;
case DIOCGSTRIPESIZE:
-   *(off_t *)data = cp->provider->stripesize;
+   *(off_t *)data = pp->stripesize;
break;
case DIOCGSTRIPEOFFSET:
-   *(off_t *)data = cp->provider->stripeoffset;
+   *(off_t *)data = pp->stripeoffset;
break;
case DIOCGPHYSPATH:
error = g_io_getattr("GEOM::physpath", cp, , data);
@@ -739,8 +736,8 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
break;
}
default:
-   if (cp->provider->geom->ioctl != NULL) {
-   error = cp->provider->geom->ioctl(cp->provider, cmd, 
data, fflag, td);
+   if (pp->geom->ioctl != NULL) {
+   error = pp->geom->ioctl(pp, cmd, data, fflag, td);
} else {
error = ENOIOCTL;
}
___
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: r355436 - in head/sys: amd64/amd64 x86/x86

2019-12-05 Thread Scott Long
Author: scottl
Date: Fri Dec  6 02:43:05 2019
New Revision: 355436
URL: https://svnweb.freebsd.org/changeset/base/355436

Log:
  Move the mds, irbs, and ssb mitigation knobs into machdep.mitigations.
  They're in both the old and new places in HEAD for the moment for
  discussion and transition.  The old locations will be garbage collected
  in 4 weeks.  MFCs to 12 an 11 will keep the old and new for transition
  purposes.
  
  Reviewed by:  kib
  MFC after:4 weeks
  Sponsored by: Intel
  Differential Revision:https://reviews.freebsd.org/D22590

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/x86/x86/cpu_machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Fri Dec  6 01:53:02 2019
(r355435)
+++ head/sys/amd64/amd64/machdep.c  Fri Dec  6 02:43:05 2019
(r355436)
@@ -1778,10 +1778,17 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
vty_set_preferred(VTY_VT);
 
TUNABLE_INT_FETCH("hw.ibrs_disable", _ibrs_disable);
+   TUNABLE_INT_FETCH("machdep.mitigations.ibrs.disable", _ibrs_disable);
+
TUNABLE_INT_FETCH("hw.spec_store_bypass_disable", _ssb_disable);
+   TUNABLE_INT_FETCH("machdep.mitigations.ssb.disable", _ssb_disable);
+
TUNABLE_INT_FETCH("machdep.syscall_ret_l1d_flush",
_ret_l1d_flush_mode);
+
TUNABLE_INT_FETCH("hw.mds_disable", _mds_disable);
+   TUNABLE_INT_FETCH("machdep.mitigations.mds.disable", _mds_disable);
+
TUNABLE_INT_FETCH("machdep.mitigations.taa.enable", _taa_enable);
 
finishidentcpu();   /* Final stage of CPU initialization */

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Fri Dec  6 01:53:02 2019
(r355435)
+++ head/sys/x86/x86/cpu_machdep.c  Fri Dec  6 02:43:05 2019
(r355436)
@@ -877,6 +877,12 @@ int hw_ibrs_disable = 1;
 SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, _ibrs_active, 0,
 "Indirect Branch Restricted Speculation active");
 
+SYSCTL_NODE(_machdep_mitigations, OID_AUTO, ibrs, CTLFLAG_RW, 0,
+"Indirect Branch Restricted Speculation active");
+
+SYSCTL_INT(_machdep_mitigations_ibrs, OID_AUTO, active, CTLFLAG_RD,
+_ibrs_active, 0, "Indirect Branch Restricted Speculation active");
+
 void
 hw_ibrs_recalculate(void)
 {
@@ -907,6 +913,11 @@ SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT |
 CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I",
 "Disable Indirect Branch Restricted Speculation");
 
+SYSCTL_PROC(_machdep_mitigations_ibrs, OID_AUTO, disable, CTLTYPE_INT |
+CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0,
+hw_ibrs_disable_handler, "I",
+"Disable Indirect Branch Restricted Speculation");
+
 int hw_ssb_active;
 int hw_ssb_disable;
 
@@ -914,6 +925,12 @@ SYSCTL_INT(_hw, OID_AUTO, spec_store_bypass_disable_ac
 _ssb_active, 0,
 "Speculative Store Bypass Disable active");
 
+SYSCTL_NODE(_machdep_mitigations, OID_AUTO, ssb, CTLFLAG_RW, 0,
+"Speculative Store Bypass Disable active");
+
+SYSCTL_INT(_machdep_mitigations_ssb, OID_AUTO, active, CTLFLAG_RD,
+_ssb_active, 0, "Speculative Store Bypass Disable active");
+
 static void
 hw_ssb_set(bool enable, bool for_all_cpus)
 {
@@ -967,6 +984,11 @@ SYSCTL_PROC(_hw, OID_AUTO, spec_store_bypass_disable, 
 hw_ssb_disable_handler, "I",
 "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto");
 
+SYSCTL_PROC(_machdep_mitigations_ssb, OID_AUTO, disable, CTLTYPE_INT |
+CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0,
+hw_ssb_disable_handler, "I",
+"Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto");
+
 int hw_mds_disable;
 
 /*
@@ -1016,6 +1038,14 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable_state,
 sysctl_hw_mds_disable_state_handler, "A",
 "Microarchitectural Data Sampling Mitigation state");
 
+SYSCTL_NODE(_machdep_mitigations, OID_AUTO, mds, CTLFLAG_RW, 0,
+"Microarchitectural Data Sampling Mitigation state");
+
+SYSCTL_PROC(_machdep_mitigations_mds, OID_AUTO, state,
+CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
+sysctl_hw_mds_disable_state_handler, "A",
+"Microarchitectural Data Sampling Mitigation state");
+
 _Static_assert(__offsetof(struct pcpu, pc_mds_tmp) % 64 == 0, "MDS AVX512");
 
 void
@@ -1172,6 +1202,11 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT |
 "Microarchitectural Data Sampling Mitigation "
 "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO");
 
+SYSCTL_PROC(_machdep_mitigations_mds, OID_AUTO, disable, CTLTYPE_INT |
+CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0,
+sysctl_mds_disable_handler, "I",
+"Microarchitectural Data Sampling Mitigation "
+"(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO");
 
 /*
  * Intel Transactional Memory 

svn commit: r355435 - head/sys/fs/nfs

2019-12-05 Thread Rick Macklem
Author: rmacklem
Date: Fri Dec  6 01:53:02 2019
New Revision: 355435
URL: https://svnweb.freebsd.org/changeset/base/355435

Log:
  Add some definitions for NFSv4.2 which will be used by subsequent commits.
  
  This is a preliminary commit of NFSv4.2 definitions that will be used by
  subsequent commits which adds NFSv4.2 support to the NFS client and server.
  
  There will be a series of these preliminary commits that will prepare for
  a major commit of the NFSv4.2 client/server changes currently found in
  subversion under projects/nfsv42/sys.

Modified:
  head/sys/fs/nfs/nfsproto.h

Modified: head/sys/fs/nfs/nfsproto.h
==
--- head/sys/fs/nfs/nfsproto.h  Fri Dec  6 00:29:16 2019(r355434)
+++ head/sys/fs/nfs/nfsproto.h  Fri Dec  6 01:53:02 2019(r355435)
@@ -705,6 +705,7 @@
 /* Flags for File Layout. */
 #defineNFSFLAYUTIL_DENSE   0x1
 #defineNFSFLAYUTIL_COMMIT_THRU_MDS 0x2
+#defineNFSFLAYUTIL_IOADVISE_THRU_MDS   0x4
 #defineNFSFLAYUTIL_STRIPE_MASK 0xffc0
 
 /* Flags for Flex File Layout. */
@@ -874,6 +875,24 @@ struct nfsv3_sattr {
u_int32_t sa_mtimetype;
nfstime3  sa_mtime;
 };
+
+/*
+ * IO Advise hint bits for NFSv4.2.
+ * Since these go on the wire as a bitmap, the NFSATTRBIT macros are
+ * used to manipulate these bits.
+ */
+#defineNFSV4IOHINT_NORMAL  0
+#defineNFSV4IOHINT_SEQUENTIAL  1
+#defineNFSV4IOHINT_SEQUENTIALBACK  2
+#defineNFSV4IOHINT_RANDOM  3
+#defineNFSV4IOHINT_WILLNEED4
+#defineNFSV4IOHINT_WILLNEEDOPTUN   5
+#defineNFSV4IOHINT_DONTNEED6
+#defineNFSV4IOHINT_NOREUSE 7
+#defineNFSV4IOHINT_READ8
+#defineNFSV4IOHINT_WRITE   9
+#defineNFSV4IOHINT_INITPROXIMITY   10
+
 #endif /* _KERNEL */
 
 /*
@@ -960,6 +979,12 @@ struct nfsv3_sattr {
 #defineNFSATTRBIT_MODESETMASKED74
 #defineNFSATTRBIT_SUPPATTREXCLCREAT75
 #defineNFSATTRBIT_FSCHARSETCAP 76
+#defineNFSATTRBIT_CLONEBLKSIZE 77
+#defineNFSATTRBIT_SPACEFREED   78
+#defineNFSATTRBIT_CHANGEATTRTYPE   79
+#defineNFSATTRBIT_SECLABEL 80
+/* Not sure what attribute bit #81 is? */
+#defineNFSATTRBIT_XATTRSUPPORT 82
 
 #defineNFSATTRBM_SUPPORTEDATTRS0x0001
 #defineNFSATTRBM_TYPE  0x0002
@@ -1038,6 +1063,12 @@ struct nfsv3_sattr {
 #defineNFSATTRBM_MODESETMASKED 0x0400
 #defineNFSATTRBM_SUPPATTREXCLCREAT 0x0800
 #defineNFSATTRBM_FSCHARSETCAP  0x1000
+#defineNFSATTRBM_CLONEBLKSIZE  0x2000
+#defineNFSATTRBM_SPACEFREED0x4000
+#defineNFSATTRBM_CHANGEATTRTYPE0x8000
+#defineNFSATTRBM_SECLABEL  0x0001
+/* Not sure what attribute bit#81/0x0002 is? */
+#defineNFSATTRBM_XATTRSUPPORT  0x0004
 
 #defineNFSATTRBIT_MAX  77
 
@@ -1162,6 +1193,11 @@ struct nfsv3_sattr {
NFSATTRBM_SUPPATTREXCLCREAT)
 
 /*
+ * NFSATTRBIT_NFSV42 - Attributes only supported by NFSv4.2.
+ */
+#defineNFSATTRBIT_NFSV42_2 NFSATTRBM_XATTRSUPPORT
+
+/*
  * Set of attributes that the getattr vnode op needs.
  * OR of the following bits.
  * NFSATTRBIT_GETATTR0 - bits 0<->31
@@ -1462,5 +1498,14 @@ typedef struct nfsv4stateid nfsv4stateid_t;
 #defineNFSV4LAYOUTRET_FILE 1
 #defineNFSV4LAYOUTRET_FSID 2
 #defineNFSV4LAYOUTRET_ALL  3
+
+/* Seek Contents. */
+#defineNFSV4CONTENT_DATA   0
+#defineNFSV4CONTENT_HOLE   1
+
+/* Options for Set Extended attribute (RFC-8276). */
+#defineNFSV4SXATTR_EITHER  0
+#defineNFSV4SXATTR_CREATE  1
+#defineNFSV4SXATTR_REPLACE 2
 
 #endif /* _NFS_NFSPROTO_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: r355434 - stable/12/sys/conf

2019-12-05 Thread Alan Somers
Author: asomers
Date: Fri Dec  6 00:29:16 2019
New Revision: 355434
URL: https://svnweb.freebsd.org/changeset/base/355434

Log:
  MFC r354779:
  
  Actually hook CAM_IO_STATS up to the build
  
  It's still disabled by default, but now it can be enabled with config(5) and
  it will be build in LINT.
  
  Reviewed by:  imp
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D22383

Modified:
  stable/12/sys/conf/NOTES
  stable/12/sys/conf/options
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/NOTES
==
--- stable/12/sys/conf/NOTESFri Dec  6 00:27:16 2019(r355433)
+++ stable/12/sys/conf/NOTESFri Dec  6 00:29:16 2019(r355434)
@@ -1356,6 +1356,7 @@ devicectl #CAM Target Layer
 # CAM_DEBUG_TARGET Limit debugging to the given target.
 # CAM_DEBUG_LUNLimit debugging to the given lun.
 # CAM_DEBUG_DELAY  Delay in us after printing each debug line.
+# CAM_IO_STATS Publish additional CAM device statics by sysctl
 #
 # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
 # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
@@ -1377,6 +1378,7 @@ options   SCSI_NO_SENSE_STRINGS
 optionsSCSI_NO_OP_STRINGS
 optionsSCSI_DELAY=5000 # Be pessimistic about Joe SCSI device
 optionsCAM_IOSCHED_DYNAMIC
+optionsCAM_IO_STATS
 optionsCAM_TEST_FAILURE
 
 # Options for the CAM CDROM driver:

Modified: stable/12/sys/conf/options
==
--- stable/12/sys/conf/options  Fri Dec  6 00:27:16 2019(r355433)
+++ stable/12/sys/conf/options  Fri Dec  6 00:29:16 2019(r355434)
@@ -346,6 +346,7 @@ CAM_DEBUG_LUN   opt_cam.h
 CAM_DEBUG_FLAGSopt_cam.h
 CAM_BOOT_DELAY opt_cam.h
 CAM_IOSCHED_DYNAMICopt_cam.h
+CAM_IO_STATS   opt_cam.h
 CAM_TEST_FAILURE   opt_cam.h
 SCSI_DELAY opt_scsi.h
 SCSI_NO_SENSE_STRINGS  opt_scsi.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: r355433 - stable/12/share/man/man4

2019-12-05 Thread Alan Somers
Author: asomers
Date: Fri Dec  6 00:27:16 2019
New Revision: 355433
URL: https://svnweb.freebsd.org/changeset/base/355433

Log:
  MFC r354812:
  
  Update the ses(4) man page
  
  This driver was largely rewritten in 2015 (svn r235911) but the man page was
  never updated to match.
  
  Reviewed by:  trasz
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D22339

Modified:
  stable/12/share/man/man4/ses.4
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/ses.4
==
--- stable/12/share/man/man4/ses.4  Fri Dec  6 00:24:31 2019
(r355432)
+++ stable/12/share/man/man4/ses.4  Fri Dec  6 00:27:16 2019
(r355433)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 05, 2015
+.Dd November 12, 2019
 .Dt SES 4
 .Os
 .Sh NAME
@@ -77,33 +77,47 @@ calls apply to
 .Nm
 devices.
 They are defined in the header file
-.In cam/scsi/scsi_ses.h
+.In cam/scsi/scsi_enc.h
 (\fIq.v.\fR).
-.Bl -tag -width SESIOC_GETENCSTAT
-.It Dv SESIOC_GETNOBJ
+.Bl -tag -width ENCIOC_GETENCSTAT
+.It Dv ENCIOC_GETNELM
 Used to find out how many
 .Nm
-objects are driven by this particular device instance.
-.It Dv SESIOC_GETOBJMAP
-Read, from the kernel, an array of SES objects which contains
-the object identifier, which subenclosure it is in, and the
+elements are driven by this particular device instance.
+.It Dv ENCIOC_GETELMMAP
+Read, from the kernel, an array of SES elements which contains
+the element identifier, which subenclosure it is in, and the
 .Nm
-type of the object.
-.It Dv SESIOC_GETENCSTAT
+type of the element.
+.It Dv ENCIOC_GETENCSTAT
 Get the overall enclosure status.
-.It Dv SESIOC_SETENCSTAT
+.It Dv ENCIOC_SETENCSTAT
 Set the overall enclosure status.
-.It Dv SESIOC_GETOBJSTAT
-Get the status of a particular object.
-.It Dv SESIOC_SETOBJSTAT
-Set the status of a particular object.
-.It Dv SESIOC_GETTEXT
-Get the associated help text for an object (not yet implemented).
+.It Dv ENCIOC_GETELMSTAT
+Get the status of a particular element.
+.It Dv ENCIOC_SETELMSTAT
+Set the status of a particular element.
+.It Dv ENCIOC_GETTEXT
+Get the associated help text for an element (not yet implemented).
 .Nm
-devices often have descriptive text for an object which can tell
+devices often have descriptive text for an element which can tell
 you things like location (e.g., "left power supply").
-.It Dv SESIOC_INIT
+.It Dv ENCIOC_INIT
 Initialize the enclosure.
+.It Dv ENCIOC_GETELMDESC
+Get the element's descriptor string.
+.It Dv ENCIOC_GETELMDEVNAMES
+Get the device names, if any, associated with this element.
+.It Dv ENCIOC_GETSTRING
+Used to read the SES String In Diagnostic Page.
+The contents of this page are device-specific.
+.It Dv ENCIOC_SETSTRING
+Used to set the SES String Out Diagnostic Page.
+The contents of this page are device-specific.
+.It Dv ENCIOC_GETENCNAME
+Used to get the name of the enclosure.
+.It Dv ENCIOC_GETENCID
+Used to get the Enclosure Logical Identifier.
 .El
 .Sh EXAMPLE USAGE
 The files contained in
@@ -128,9 +142,12 @@ parameters to the console.
 .Sh HISTORY
 The
 .Nm
-driver was written for the
+driver was originally written for the
 .Tn CAM
 .Tn SCSI
-subsystem by Matthew Jacob.
-This is a functional equivalent of a similar
+subsystem by Matthew Jacob and first released in
+.Fx 4.3 .
+It was a functional equivalent of a similar
 driver available in Solaris, Release 7.
+It was largely rewritten by Alexander Motin, Justin Gibbs, and Will Andrews for
+.Fx 9.2 .
___
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: r355432 - stable/12/usr.sbin/sesutil

2019-12-05 Thread Alan Somers
Author: asomers
Date: Fri Dec  6 00:24:31 2019
New Revision: 355432
URL: https://svnweb.freebsd.org/changeset/base/355432

Log:
  MFC r354664-r354666
  
  r354664:
  sesutil: fix an out-of-bounds array access
  
  sesutil would allow the user to toggle an LED that was one past the maximum
  element.  If he tried, ENCIOC_GETELMSTAT would return EINVAL.
  
  Reported by:  Coverity
  Coverity CID: 1398940
  Sponsored by: Axcient
  
  r354665:
  sesutil: fix some memory leaks
  
  Reported by:  Coverity
  Coverity CID: 1331665
  Sponsored by: Axcient
  
  r354666:
  sesutil: fix another memory leak
  
  Instead of calloc()ing (and forgetting to free) in a tight loop, just put
  this small array on the stack.
  
  Reported by:  Coverity
  Coverity CID: 1331665
  Sponsored by: Axcient

Modified:
  stable/12/usr.sbin/sesutil/sesutil.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/sesutil/sesutil.c
==
--- stable/12/usr.sbin/sesutil/sesutil.cFri Dec  6 00:12:14 2019
(r355431)
+++ stable/12/usr.sbin/sesutil/sesutil.cFri Dec  6 00:24:31 2019
(r355432)
@@ -242,35 +242,38 @@ sesled(int argc, char **argv, bool setfault)
}
 
if (ioctl(fd, ENCIOC_GETELMMAP, (caddr_t) objp) < 0) {
+   free(objp);
close(fd);
xo_err(EXIT_FAILURE, "ENCIOC_GETELMMAP");
}
 
if (isses) {
-   if (sesid > nobj) {
+   if (sesid >= nobj) {
+   free(objp);
close(fd);
xo_errx(EXIT_FAILURE,
 "Requested SES ID does not exist");
}
do_led(fd, sesid, objp[sesid].elm_type, onoff, 
setfault);
ndisks++;
+   free(objp);
close(fd);
break;
}
for (j = 0; j < nobj; j++) {
+   const int devnames_size = 128;
+   char devnames[devnames_size];
+
if (all) {
do_led(fd, objp[j].elm_idx, objp[j].elm_type,
onoff, setfault);
continue;
}
memset(, 0, sizeof(objdn));
+   memset(devnames, 0, devnames_size);
objdn.elm_idx = objp[j].elm_idx;
-   objdn.elm_names_size = 128;
-   objdn.elm_devnames = calloc(128, sizeof(char));
-   if (objdn.elm_devnames == NULL) {
-   close(fd);
-   xo_err(EXIT_FAILURE, "calloc()");
-   }
+   objdn.elm_names_size = devnames_size;
+   objdn.elm_devnames = devnames;
if (ioctl(fd, ENCIOC_GETELMDEVNAMES,
(caddr_t) ) <0) {
continue;
___
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: r355431 - in head: etc/mtree sys/geom sys/geom/multipath tests/sys/geom/class tests/sys/geom/class/multipath

2019-12-05 Thread Alan Somers
Author: asomers
Date: Fri Dec  6 00:12:14 2019
New Revision: 355431
URL: https://svnweb.freebsd.org/changeset/base/355431

Log:
  gmultipath: add ATF tests
  
  Add ATF tests for most gmultipath operations. Add some dtrace probes too,
  primarily for configuration changes that happen in response to provider
  errors.
  
  PR:   178473
  MFC after:2 weeks
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D22235

Added:
  head/tests/sys/geom/class/multipath/
  head/tests/sys/geom/class/multipath/Makefile   (contents, props changed)
  head/tests/sys/geom/class/multipath/conf.sh   (contents, props changed)
  head/tests/sys/geom/class/multipath/failloop.sh   (contents, props changed)
  head/tests/sys/geom/class/multipath/misc.sh   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/sys/geom/geom_subr.c
  head/sys/geom/multipath/g_multipath.c
  head/tests/sys/geom/class/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Fri Dec  6 00:06:05 2019
(r355430)
+++ head/etc/mtree/BSD.tests.dist   Fri Dec  6 00:12:14 2019
(r355431)
@@ -754,6 +754,8 @@
 ..
 mirror
 ..
+multipath
+..
 nop
 ..
 part

Modified: head/sys/geom/geom_subr.c
==
--- head/sys/geom/geom_subr.c   Fri Dec  6 00:06:05 2019(r355430)
+++ head/sys/geom/geom_subr.c   Fri Dec  6 00:12:14 2019(r355431)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -65,6 +66,8 @@ __FBSDID("$FreeBSD$");
 #ifdef KDB
 #include 
 #endif
+
+SDT_PROVIDER_DEFINE(geom);
 
 struct class_list_head g_classes = LIST_HEAD_INITIALIZER(g_classes);
 static struct g_tailq_head geoms = TAILQ_HEAD_INITIALIZER(geoms);

Modified: head/sys/geom/multipath/g_multipath.c
==
--- head/sys/geom/multipath/g_multipath.c   Fri Dec  6 00:06:05 2019
(r355430)
+++ head/sys/geom/multipath/g_multipath.c   Fri Dec  6 00:12:14 2019
(r355431)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -61,6 +62,14 @@ static u_int g_multipath_exclusive = 1;
 SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, exclusive, CTLFLAG_RW,
 _multipath_exclusive, 0, "Exclusively open providers");
 
+SDT_PROVIDER_DECLARE(geom);
+SDT_PROBE_DEFINE2(geom, multipath, config, restore, "char*", "char*");
+SDT_PROBE_DEFINE2(geom, multipath, config, remove, "char*", "char*");
+SDT_PROBE_DEFINE2(geom, multipath, config, disconnect, "char*", "char*");
+SDT_PROBE_DEFINE3(geom, multipath, config, fail, "char*", "char*", "int");
+SDT_PROBE_DEFINE2(geom, multipath, config, taste, "char*", "char*");
+SDT_PROBE_DEFINE2(geom, multipath, io, restart, "struct bio*", "struct bio*");
+
 static enum {
GKT_NIL,
GKT_RUN,
@@ -146,6 +155,8 @@ g_multipath_fault(struct g_consumer *cp, int cause)
printf("GEOM_MULTIPATH: "
"all paths in %s were marked FAIL, restore %s\n",
sc->sc_name, lcp->provider->name);
+   SDT_PROBE2(geom, multipath, config, restore,
+   sc->sc_name, lcp->provider->name);
lcp->index &= ~MP_FAIL;
}
}
@@ -217,6 +228,8 @@ g_mpd(void *arg, int flags __unused)
if (cp->provider) {
printf("GEOM_MULTIPATH: %s removed from %s\n",
cp->provider->name, gp->name);
+   SDT_PROBE2(geom, multipath, config, remove,
+   gp->name, cp->provider->name);
g_detach(cp);
}
g_destroy_consumer(cp);
@@ -234,6 +247,8 @@ g_multipath_orphan(struct g_consumer *cp)
g_topology_assert();
printf("GEOM_MULTIPATH: %s in %s was disconnected\n",
cp->provider->name, cp->geom->name);
+   SDT_PROBE2(geom, multipath, config, disconnect,
+   cp->geom->name, cp->provider->name);
sc = cp->geom->softc;
cnt = (uintptr_t *)>private;
mtx_lock(>sc_mtx);
@@ -411,6 +426,8 @@ g_multipath_done_error(struct bio *bp)
if ((cp->index & MP_FAIL) == 0) {
printf("GEOM_MULTIPATH: Error %d, %s in %s marked FAIL\n",
bp->bio_error, pp->name, sc->sc_name);
+   SDT_PROBE3(geom, multipath, config, fail,
+   sc->sc_name, pp->name, bp->bio_error);
g_multipath_fault(cp, MP_FAIL);
}
(*cnt)--;
@@ -426,6 +443,7 @@ g_multipath_done_error(struct bio *bp)
 */
if (pbp->bio_children < 

svn commit: r355430 - head/sys/cam/scsi

2019-12-05 Thread Alan Somers
Author: asomers
Date: Fri Dec  6 00:06:05 2019
New Revision: 355430
URL: https://svnweb.freebsd.org/changeset/base/355430

Log:
  ses: sanitize illegal strings in SES element descriptors
  
  The SES4r3 standard requires that element descriptors may only contain ASCII
  characters in the range 0x20 to 0x7e.  Some SuperMicro expanders violate
  that rule.  This patch adds a sanity check to ses(4).  Descriptors in
  violation will be replaced by "".
  
  This patch fixes "sesutil --libxo xml" on such systems.  Previously it would
  generate non-well-formed XML output.
  
  PR:   241929
  Reviewed by:  allanjude
  MFC after:2 weeks
  Sponsored by: Axcient

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==
--- head/sys/cam/scsi/scsi_enc_ses.cThu Dec  5 19:39:51 2019
(r355429)
+++ head/sys/cam/scsi/scsi_enc_ses.cFri Dec  6 00:06:05 2019
(r355430)
@@ -110,7 +110,7 @@ typedef struct ses_addl_status {
 typedef struct ses_element {
uint8_t eip;/* eip bit is set */
uint16_t descr_len; /* length of the descriptor */
-   char *descr;/* descriptor for this object */
+   const char *descr;  /* descriptor for this object */
struct ses_addl_status addl;/* additional status info */
 } ses_element_t;
 
@@ -1977,6 +1977,35 @@ ses_publish_cache(enc_softc_t *enc, struct enc_fsm_sta
return (0);
 }
 
+/*
+ * \brief Sanitize an element descriptor
+ *
+ * The SES4r3 standard, sections 3.1.2 and 6.1.10, specifies that element
+ * descriptors may only contain ASCII characters in the range 0x20 to 0x7e.
+ * But some vendors violate that rule.  Ensure that we only expose compliant
+ * descriptors to userland.
+ *
+ * \param desc SES element descriptor as reported by the hardware
+ * \param len  Length of desc in bytes, not necessarily including
+ * trailing NUL.  It will be modified if desc is invalid.
+ */
+static const char*
+ses_sanitize_elm_desc(const char *desc, uint16_t *len)
+{
+   const char *invalid = "";
+   int i;
+
+   for (i = 0; i < *len; i++) {
+   if (desc[i] < 0x20 || desc[i] > 0x7e) {
+   *len = strlen(invalid);
+   return (invalid);
+   } else if (desc[i] == 0) {
+   break;
+   }
+   }
+   return (desc);
+}
+
 /**
  * \brief Parse the descriptors for each object.
  *
@@ -2061,7 +2090,8 @@ ses_process_elm_descs(enc_softc_t *enc, struct enc_fsm
if (length > 0) {
elmpriv = element->elm_private;
elmpriv->descr_len = length;
-   elmpriv->descr = [offset];
+   elmpriv->descr = ses_sanitize_elm_desc([offset],
+   >descr_len);
}
 
/* skip over the descriptor itself */
___
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: r355429 - head/sys/dev/sound/pci/hda

2019-12-05 Thread Scott Long
Author: scottl
Date: Thu Dec  5 19:39:51 2019
New Revision: 355429
URL: https://svnweb.freebsd.org/changeset/base/355429

Log:
  Add support for new sound HDA hardware
  
  Sponsored by: Intel

Modified:
  head/sys/dev/sound/pci/hda/hdac.c
  head/sys/dev/sound/pci/hda/hdac.h
  head/sys/dev/sound/pci/hda/hdacc.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==
--- head/sys/dev/sound/pci/hda/hdac.c   Thu Dec  5 19:37:30 2019
(r355428)
+++ head/sys/dev/sound/pci/hda/hdac.c   Thu Dec  5 19:39:51 2019
(r355429)
@@ -106,6 +106,7 @@ static const struct {
{ HDA_INTEL_ICLK,"Intel Ice Lake",  0, 0 },
{ HDA_INTEL_CMLKLP,  "Intel Comet Lake-LP", 0, 0 },
{ HDA_INTEL_CMLKH,   "Intel Comet Lake-H",  0, 0 },
+   { HDA_INTEL_TGLK,"Intel Tiger Lake",0, 0 },
{ HDA_INTEL_GMLK,"Intel Gemini Lake",   0, 0 },
{ HDA_INTEL_82801F,  "Intel 82801F",0, 0 },
{ HDA_INTEL_63XXESB, "Intel 631x/632xESB",  0, 0 },

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Thu Dec  5 19:37:30 2019
(r355428)
+++ head/sys/dev/sound/pci/hda/hdac.h   Thu Dec  5 19:39:51 2019
(r355429)
@@ -81,6 +81,7 @@
 #define HDA_INTEL_ICLK HDA_MODEL_CONSTRUCT(INTEL, 0x34c8)
 #define HDA_INTEL_CMLKLP   HDA_MODEL_CONSTRUCT(INTEL, 0x02c8)
 #define HDA_INTEL_CMLKHHDA_MODEL_CONSTRUCT(INTEL, 0x06c8)
+#define HDA_INTEL_TGLK HDA_MODEL_CONSTRUCT(INTEL, 0xa0c8)
 #define HDA_INTEL_GMLK HDA_MODEL_CONSTRUCT(INTEL, 0x3198)
 #define HDA_INTEL_ALL  HDA_MODEL_CONSTRUCT(INTEL, 0x)
 
@@ -703,6 +704,7 @@
 #define HDA_CODEC_INTELCNLKHDA_CODEC_CONSTRUCT(INTEL, 0x280c)
 #define HDA_CODEC_INTELGMLK1   HDA_CODEC_CONSTRUCT(INTEL, 0x280d)
 #define HDA_CODEC_INTELICLKHDA_CODEC_CONSTRUCT(INTEL, 0x280f)
+#define HDA_CODEC_INTELTGLKHDA_CODEC_CONSTRUCT(INTEL, 0x2812)
 #define HDA_CODEC_INTELCL  HDA_CODEC_CONSTRUCT(INTEL, 0x29fb)
 #define HDA_CODEC_INTELHDA_CODEC_CONSTRUCT(INTEL, 0x)
 

Modified: head/sys/dev/sound/pci/hda/hdacc.c
==
--- head/sys/dev/sound/pci/hda/hdacc.c  Thu Dec  5 19:37:30 2019
(r355428)
+++ head/sys/dev/sound/pci/hda/hdacc.c  Thu Dec  5 19:39:51 2019
(r355429)
@@ -375,6 +375,7 @@ static const struct {
{ HDA_CODEC_INTELGMLK, 0,   "Intel Geminilake" },
{ HDA_CODEC_INTELGMLK1, 0,  "Intel Geminilake" },
{ HDA_CODEC_INTELICLK, 0,   "Intel Icelake" },
+   { HDA_CODEC_INTELTGLK, 0,   "Intel Tigerlake" },
{ HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" },
{ HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" },
/* Unknown CODECs */
___
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: r355301 - head/usr.sbin/bhyve

2019-12-05 Thread Rodney W. Grimes
> On Thu, 2019-12-05 at 11:21 -0800, Rodney W. Grimes wrote:
> > > On 12/4/19 9:35 PM, Rodney W. Grimes wrote:
> > > > > I see, thanks for the pointers.
> > > > > It looks like cfmakeraw() and tcsetattr() were what I was
> > > > > looking for.
> > > > > A bhyve-specific printf wrapper looks the right solution to me.
> > > > > I can try to sketch a patch for you guys to review, if that's
> > > > > useful.
> > > > > 
> > > > > Cheers,
> > > > >   Vincenzo
> > > > 
> > > > Meanwhile could you please revert the commit, and add a note to
> > > > D22552 to the effects that this was not the right solution?
> > > 
> > > I don't think we have to revert as it isn't that big of a
> > > deal.  Just
> > > fixing it going forward is probably fine.
> > 
> > I disagree.  Not reverting this leads to a bunch of un-needed changes
> > in the forward moving review, clouding the view of what is really
> > being changed in that new review which is now a mix of undoing this
> > and adding a new set of macros to deal with end of line.
> > 
> 
> It doesn't cloud anything in the new review.  Reverting it will change
> all the \n\r back to just \n.  Then exactly the same lines will need
> changing on the do-over to remove the \n.

ACK  Ok, my oversight, I thought the \n would be staying, but your right it 
goes too.
 
> There are times when backing out a changeset and doing things over from
> scratch make sense, but this doesn't seem to be one of them.

Perhaps... but fundementally, IMHO, a wrong change should just be reverted
even if the fix is simple and soon.  Again, IMHO, we are far to shy about
using revert.

-- 
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: r355428 - in head: share/mk sys/conf

2019-12-05 Thread John Baldwin
Author: jhb
Date: Thu Dec  5 19:37:30 2019
New Revision: 355428
URL: https://svnweb.freebsd.org/changeset/base/355428

Log:
  Add a new "riscv-relaxations" linker feature.
  
  When the linker doesn't have this feature, add -mno-relax to CFLAGS
  on RISC-V.
  
  Define the feature for ld.bfd, but not lld.  If lld gains relaxation
  support in a newer version, we can enable it for those versions of lld
  in bsd.linker.mk.
  
  Reviewed by:  mhorne
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D22659

Modified:
  head/share/mk/bsd.cpu.mk
  head/share/mk/bsd.linker.mk
  head/sys/conf/kern.mk

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkThu Dec  5 19:25:49 2019(r355427)
+++ head/share/mk/bsd.cpu.mkThu Dec  5 19:37:30 2019(r355428)
@@ -375,6 +375,10 @@ CFLAGS += -march=rv64imac -mabi=lp64
 .else
 CFLAGS += -march=rv64imafdc -mabi=lp64d
 .endif
+
+.if ${LINKER_FEATURES:U:Mriscv-relaxations} == ""
+CFLAGS += -mno-relax
+.endif
 .endif
 
 # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk

Modified: head/share/mk/bsd.linker.mk
==
--- head/share/mk/bsd.linker.mk Thu Dec  5 19:25:49 2019(r355427)
+++ head/share/mk/bsd.linker.mk Thu Dec  5 19:37:30 2019(r355428)
@@ -86,6 +86,9 @@ ${X_}LINKER_FEATURES=
 ${X_}LINKER_FEATURES+= build-id
 ${X_}LINKER_FEATURES+= ifunc
 .endif
+.if ${${X_}LINKER_TYPE} == "bfd" && ${${X_}LINKER_VERSION} > 21750
+${X_}LINKER_FEATURES+= riscv-relaxations
+.endif
 .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 6
 ${X_}LINKER_FEATURES+= retpoline
 .endif

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Thu Dec  5 19:25:49 2019(r355427)
+++ head/sys/conf/kern.mk   Thu Dec  5 19:37:30 2019(r355428)
@@ -144,6 +144,10 @@ CFLAGS+=   -march=rv64imafdc -mabi=lp64
 CFLAGS.clang+= -mcmodel=medium
 CFLAGS.gcc+=   -mcmodel=medany
 INLINE_LIMIT?= 8000
+
+.if ${LINKER_FEATURES:Mriscv-relaxations} == ""
+CFLAGS+=   -mno-relax
+.endif
 .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: r355301 - head/usr.sbin/bhyve

2019-12-05 Thread Ian Lepore
On Thu, 2019-12-05 at 11:21 -0800, Rodney W. Grimes wrote:
> > On 12/4/19 9:35 PM, Rodney W. Grimes wrote:
> > > > I see, thanks for the pointers.
> > > > It looks like cfmakeraw() and tcsetattr() were what I was
> > > > looking for.
> > > > A bhyve-specific printf wrapper looks the right solution to me.
> > > > I can try to sketch a patch for you guys to review, if that's
> > > > useful.
> > > > 
> > > > Cheers,
> > > >   Vincenzo
> > > 
> > > Meanwhile could you please revert the commit, and add a note to
> > > D22552 to the effects that this was not the right solution?
> > 
> > I don't think we have to revert as it isn't that big of a
> > deal.  Just
> > fixing it going forward is probably fine.
> 
> I disagree.  Not reverting this leads to a bunch of un-needed changes
> in the forward moving review, clouding the view of what is really
> being changed in that new review which is now a mix of undoing this
> and adding a new set of macros to deal with end of line.
> 

It doesn't cloud anything in the new review.  Reverting it will change
all the \n\r back to just \n.  Then exactly the same lines will need
changing on the do-over to remove the \n.

There are times when backing out a changeset and doing things over from
scratch make sense, but this doesn't seem to be one of them.

-- Ian

___
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: r355427 - head/sys/arm64/arm64

2019-12-05 Thread Alan Cox
Author: alc
Date: Thu Dec  5 19:25:49 2019
New Revision: 355427
URL: https://svnweb.freebsd.org/changeset/base/355427

Log:
  On a context switch, handle the possibility that the old thread was
  preempted after an "ic" or "tlbi" instruction but before it performed a
  "dsb" instruction.  The "ic" and "tlbi" instructions have unusual
  synchronization requirements.  If the old thread migrates to a new
  processor, its completion of a "dsb" instruction on that new processor does
  not guarantee that the "ic" or "tlbi" instructions performed on the old
  processor have completed.
  
  This issue is not restricted to the kernel.  Since locore.S sets the UCI bit
  in SCTLR, user-space programs can perform "ic ivau" instructions (as well as
  some forms of the "dc" instruction).
  
  Reviewed by:  andrew, kib, markj, mmel
  X-MFC with:   r355145
  Differential Revision:https://reviews.freebsd.org/D22622

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

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Dec  5 18:47:29 2019(r355426)
+++ head/sys/arm64/arm64/pmap.c Thu Dec  5 19:25:49 2019(r355427)
@@ -5850,8 +5850,18 @@ pmap_activate_int(pmap_t pmap)
 
KASSERT(PCPU_GET(curpmap) != NULL, ("no active pmap"));
KASSERT(pmap != kernel_pmap, ("kernel pmap activation"));
-   if (pmap == PCPU_GET(curpmap))
+   if (pmap == PCPU_GET(curpmap)) {
+   /*
+* Handle the possibility that the old thread was preempted
+* after an "ic" or "tlbi" instruction but before it performed
+* a "dsb" instruction.  If the old thread migrates to a new
+* processor, its completion of a "dsb" instruction on that
+* new processor does not guarantee that the "ic" or "tlbi"
+* instructions performed on the old processor have completed.
+*/
+   dsb(ish);
return (false);
+   }
 
/*
 * Ensure that the store to curpmap is globally visible before the
___
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: r355301 - head/usr.sbin/bhyve

2019-12-05 Thread Rodney W. Grimes
> On 12/4/19 9:35 PM, Rodney W. Grimes wrote:
> >> I see, thanks for the pointers.
> >> It looks like cfmakeraw() and tcsetattr() were what I was looking for.
> >> A bhyve-specific printf wrapper looks the right solution to me.
> >> I can try to sketch a patch for you guys to review, if that's useful.
> >>
> >> Cheers,
> >>   Vincenzo
> > 
> > Meanwhile could you please revert the commit, and add a note to
> > D22552 to the effects that this was not the right solution?
> 
> I don't think we have to revert as it isn't that big of a deal.  Just
> fixing it going forward is probably fine.

I disagree.  Not reverting this leads to a bunch of un-needed changes
in the forward moving review, clouding the view of what is really
being changed in that new review which is now a mix of undoing this
and adding a new set of macros to deal with end of line.

-- 
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: r355426 - in head/sys: dev/ahci dev/ata dev/mvs dev/siis net/altq powerpc/mpc85xx

2019-12-05 Thread John Baldwin
Author: jhb
Date: Thu Dec  5 18:47:29 2019
New Revision: 355426
URL: https://svnweb.freebsd.org/changeset/base/355426

Log:
  Use a void * argument to callout handlers instead of timeout_t casts.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D22684

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ata/ata-all.c
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-lowlevel.c
  head/sys/dev/mvs/mvs.c
  head/sys/dev/siis/siis.c
  head/sys/net/altq/altq_rmclass.c
  head/sys/powerpc/mpc85xx/fsl_sata.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cThu Dec  5 16:50:54 2019(r355425)
+++ head/sys/dev/ahci/ahci.cThu Dec  5 18:47:29 2019(r355426)
@@ -67,7 +67,7 @@ static void ahci_ch_intr_main(struct ahci_channel *ch,
 static void ahci_begin_transaction(struct ahci_channel *ch, union ccb *ccb);
 static void ahci_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int 
error);
 static void ahci_execute_transaction(struct ahci_slot *slot);
-static void ahci_timeout(struct ahci_slot *slot);
+static void ahci_timeout(void *arg);
 static void ahci_end_transaction(struct ahci_slot *slot, enum ahci_err_type 
et);
 static int ahci_setup_fis(struct ahci_channel *ch, struct ahci_cmd_tab *ctp, 
union ccb *ccb, int tag);
 static void ahci_dmainit(device_t dev);
@@ -1793,7 +1793,7 @@ ahci_execute_transaction(struct ahci_slot *slot)
}
/* Start command execution timeout */
callout_reset_sbt(>timeout, SBT_1MS * ccb->ccb_h.timeout / 2,
-   0, (timeout_t*)ahci_timeout, slot, 0);
+   0, ahci_timeout, slot, 0);
return;
 }
 
@@ -1830,14 +1830,15 @@ ahci_rearm_timeout(struct ahci_channel *ch)
continue;
callout_reset_sbt(>timeout,
SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0,
-   (timeout_t*)ahci_timeout, slot, 0);
+   ahci_timeout, slot, 0);
}
 }
 
 /* Locked by callout mechanism. */
 static void
-ahci_timeout(struct ahci_slot *slot)
+ahci_timeout(void *arg)
 {
+   struct ahci_slot *slot = arg;
struct ahci_channel *ch = slot->ch;
device_t dev = ch->dev;
uint32_t sstatus;
@@ -1864,7 +1865,7 @@ ahci_timeout(struct ahci_slot *slot)
 
callout_reset_sbt(>timeout,
SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0,
-   (timeout_t*)ahci_timeout, slot, 0);
+   ahci_timeout, slot, 0);
return;
}
 

Modified: head/sys/dev/ata/ata-all.c
==
--- head/sys/dev/ata/ata-all.c  Thu Dec  5 16:50:54 2019(r355425)
+++ head/sys/dev/ata/ata-all.c  Thu Dec  5 18:47:29 2019(r355426)
@@ -702,10 +702,12 @@ ata_atapi(device_t dev, int target)
 }
 
 void
-ata_timeout(struct ata_request *request)
+ata_timeout(void *arg)
 {
+   struct ata_request *request;
struct ata_channel *ch;
 
+   request = arg;
ch = device_get_softc(request->parent);
//request->flags |= ATA_R_DEBUG;
ATA_DEBUG_RQ(request, "timeout");

Modified: head/sys/dev/ata/ata-all.h
==
--- head/sys/dev/ata/ata-all.h  Thu Dec  5 16:50:54 2019(r355425)
+++ head/sys/dev/ata/ata-all.h  Thu Dec  5 18:47:29 2019(r355426)
@@ -477,7 +477,7 @@ const char *ata_mode2str(int mode);
 void ata_setmode(device_t dev);
 void ata_print_cable(device_t dev, u_int8_t *who);
 int ata_atapi(device_t dev, int target);
-void ata_timeout(struct ata_request *);
+void ata_timeout(void *);
 
 /* ata-lowlevel.c: */
 void ata_generic_hw(device_t dev);

Modified: head/sys/dev/ata/ata-lowlevel.c
==
--- head/sys/dev/ata/ata-lowlevel.c Thu Dec  5 16:50:54 2019
(r355425)
+++ head/sys/dev/ata/ata-lowlevel.c Thu Dec  5 18:47:29 2019
(r355426)
@@ -237,7 +237,7 @@ begin_finished:
 
 begin_continue:
 callout_reset(>callout, request->timeout * hz,
- (timeout_t*)ata_timeout, request);
+ ata_timeout, request);
 return ATA_OP_CONTINUES;
 }
 

Modified: head/sys/dev/mvs/mvs.c
==
--- head/sys/dev/mvs/mvs.c  Thu Dec  5 16:50:54 2019(r355425)
+++ head/sys/dev/mvs/mvs.c  Thu Dec  5 18:47:29 2019(r355426)
@@ -82,7 +82,7 @@ static void mvs_legacy_intr(device_t dev, int poll);
 static void mvs_crbq_intr(device_t dev);
 static void mvs_begin_transaction(device_t dev, union ccb *ccb);
 static void mvs_legacy_execute_transaction(struct mvs_slot *slot);
-static void mvs_timeout(struct mvs_slot *slot);
+static void mvs_timeout(void *arg);
 static void mvs_dmasetprd(void *arg,

Re: svn commit: r355407 - head/sys/fs/tmpfs

2019-12-05 Thread Ian Lepore
On Thu, 2019-12-05 at 10:05 -0800, Enji Cooper wrote:
> > On Dec 5, 2019, at 05:36, Konstantin Belousov 
> > wrote:
> 
> ...
> 
> > > Could you elaborate on the why/rationale?
> > > 
> > > Is there memory wastage/duplication, bug(s), performance or 
> > > development/maintenance benefit?
> > 
> > Each mount/unmount of tmpfs created and destroyed two zones, as it
> > is
> > easy to see from the patch.
> 
> Commit messages should provide helpful summaries of changes. Having
> to look at and understand the patch requires domain knowledge which
> the reader may or may not have. Kubilay’s request seems valid to me.
> 
> -Enji

I agree.  You read the diff to see the details of what changed.  You
read the commit message to see why.

-- Ian


___
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: r355407 - head/sys/fs/tmpfs

2019-12-05 Thread Enji Cooper

> On Dec 5, 2019, at 05:36, Konstantin Belousov  wrote:

...

>> Could you elaborate on the why/rationale?
>> 
>> Is there memory wastage/duplication, bug(s), performance or 
>> development/maintenance benefit?
> Each mount/unmount of tmpfs created and destroyed two zones, as it is
> easy to see from the patch.

Commit messages should provide helpful summaries of changes. Having to look at 
and understand the patch requires domain knowledge which the reader may or may 
not have. Kubilay’s request seems valid to me.

-Enji
___
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: r355425 - head/sys/netinet6

2019-12-05 Thread Kristof Provost
Author: kp
Date: Thu Dec  5 16:50:54 2019
New Revision: 355425
URL: https://svnweb.freebsd.org/changeset/base/355425

Log:
  Remove useless NULL check
  
  Coverity points out that we've already dereferenced m by the time we check, so
  there's no reason to keep the check. Moreover, it's safe to pass NULL to
  m_freem() anyway.
  
  CID:  1019092

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==
--- head/sys/netinet6/udp6_usrreq.c Thu Dec  5 16:17:56 2019
(r355424)
+++ head/sys/netinet6/udp6_usrreq.c Thu Dec  5 16:50:54 2019
(r355425)
@@ -528,8 +528,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
return (IPPROTO_DONE);
 
 badunlocked:
-   if (m)
-   m_freem(m);
+   m_freem(m);
*mp = NULL;
return (IPPROTO_DONE);
 }
___
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: r354754 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux

2019-12-05 Thread John Baldwin
On 12/5/19 5:28 AM, Mateusz Guzik wrote:
> On 11/16/19, John Baldwin  wrote:
>> Author: jhb
>> Date: Fri Nov 15 23:01:43 2019
>> New Revision: 354754
>> URL: https://svnweb.freebsd.org/changeset/base/354754
>>
>> Log:
>>   Use a sv_copyout_auxargs hook in the Linux ELF ABIs.
>>
> 
> This makes Linux binaries instantly segfault for me on amd64.
> 
> You check: 
> https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64-root.tar.xz
> 
> I unpack this to tmpfs and chroot inside. Works without this commit.

Yes, trasz@ has let me know and the issue is that I'm calculating the
stack alignment wrong (doesn't factor in the variable number of argv
and envv entries).  It works for linux-base-c7 which is why my testing
didn't catch it.

arm64 linuxulator has a similar issue I think, and I actually have
another use case to want to copy auxv later, so my plan is to rework
this change to go back to statically allocating room for auxargs
and invoking this callback at the end of copyout_strings passing in
the address at the end of envv.  I should be able to work on that
today or tomorrow.

-- 
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"


Re: svn commit: r355301 - head/usr.sbin/bhyve

2019-12-05 Thread John Baldwin
On 12/4/19 9:35 PM, Rodney W. Grimes wrote:
>> I see, thanks for the pointers.
>> It looks like cfmakeraw() and tcsetattr() were what I was looking for.
>> A bhyve-specific printf wrapper looks the right solution to me.
>> I can try to sketch a patch for you guys to review, if that's useful.
>>
>> Cheers,
>>   Vincenzo
> 
> Meanwhile could you please revert the commit, and add a note to
> D22552 to the effects that this was not the right solution?

I don't think we have to revert as it isn't that big of a deal.  Just
fixing it going forward is probably fine.

-- 
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: r355424 - in head/release: arm arm64

2019-12-05 Thread Kyle Evans
Author: kevans
Date: Thu Dec  5 16:17:56 2019
New Revision: 355424
URL: https://svnweb.freebsd.org/changeset/base/355424

Log:
  release: chase ports r519089 (rpi-firmware update)
  
  The recent rpi-firmware update renamed "0" to "zero" in the RPi0 DTB
  filename
  
  It also included the components needed to boot the RPi4, so install those
  now -- interested parties can install sysutils/u-boot-rpi4 and copy
  config_rpi4.txt to config.txt on the FAT partition in order to boot the
  board. Do note that we currently don't support ethernet/usb/pci.
  
  Reviewed by:  manu
  MFC after:3 days

Modified:
  head/release/arm/RPI-B.conf
  head/release/arm64/RPI3.conf

Modified: head/release/arm/RPI-B.conf
==
--- head/release/arm/RPI-B.conf Thu Dec  5 15:32:33 2019(r355423)
+++ head/release/arm/RPI-B.conf Thu Dec  5 16:17:56 2019(r355424)
@@ -16,7 +16,7 @@ NODOC=1
 UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi"
 RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware"
 OL_DIR="${RPI_FIRMWARE_DIR}/overlays"
-OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo"
+OVERLAYS="mmc.dtbo disable-bt.dtbo"
 PART_SCHEME="MBR"
 export BOARDNAME="RPI-B"
 
@@ -25,8 +25,8 @@ arm_install_uboot() {
RPI_FIRMWARE_FILES="bootcode.bin config.txt \
fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \
start.elf start_cd.elf start_db.elf start_x.elf \
-   bcm2708-rpi-0-w.dtb bcm2708-rpi-b-plus.dtb bcm2708-rpi-b.dtb \
-   bcm2708-rpi-cm.dtb"
+   bcm2708-rpi-zero-w.dtb bcm2708-rpi-b-plus.dtb \
+   bcm2708-rpi-b.dtb bcm2708-rpi-cm.dtb"
FATMOUNT="${DESTDIR%${KERNEL}}/fat"
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}"
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}

Modified: head/release/arm64/RPI3.conf
==
--- head/release/arm64/RPI3.confThu Dec  5 15:32:33 2019
(r355423)
+++ head/release/arm64/RPI3.confThu Dec  5 16:17:56 2019
(r355424)
@@ -4,7 +4,7 @@
 #
 
 DTB_DIR="/usr/local/share/rpi-firmware"
-DTB="bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb"
+DTB="bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb bcm2711-rpi-4-b.dtb"
 EMBEDDED_TARGET_ARCH="aarch64"
 EMBEDDED_TARGET="arm64"
 EMBEDDEDBUILD=1
@@ -16,14 +16,14 @@ KERNEL="GENERIC"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
 OL_DIR="${DTB_DIR}/overlays"
-OVERLAYS="mmc.dtbo pwm.dtbo pi3-disable-bt.dtbo"
+OVERLAYS="mmc.dtbo pwm.dtbo disable-bt.dtbo"
 PART_SCHEME="MBR"
 export BOARDNAME="RPI3"
 
 arm_install_uboot() {
UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi3"
UBOOT_FILES="README u-boot.bin"
-   DTB_FILES="armstub8.bin bootcode.bin fixup_cd.dat \
+   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}"
FATMOUNT="${DESTDIR%${KERNEL}}fat"
@@ -37,6 +37,8 @@ arm_install_uboot() {
chroot ${CHROOTDIR} cp -p ${DTB_DIR}/${_DF} \
${FATMOUNT}/${_DF}
done
+   chroot ${CHROOTDIR} cp -p ${DTB_DIR}/config_rpi4.txt \
+   ${FATMOUNT}
chroot ${CHROOTDIR} cp -p ${DTB_DIR}/config_rpi3.txt \
${FATMOUNT}/config.txt
chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/overlays
___
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: r355423 - head

2019-12-05 Thread Kyle Evans
On Thu, Dec 5, 2019 at 9:32 AM Kyle Evans  wrote:
>
> Author: kevans
> Date: Thu Dec  5 15:32:33 2019
> New Revision: 355423
> URL: https://svnweb.freebsd.org/changeset/base/355423
>
> Log:
>   UPDATING: Add long-belated note about certs in base
>
>   While the interaction between this and the ETCSYMLINK option of
>   security/ca_root_nss isn't necessarily fatal, one should be aware and
>   attempt to understand the ramifications of mixing the two.
>
>   ports-secteam will be contacted to discuss the default option for branches
>   where certs are being included in base.
>
> Modified:
>   head/UPDATING
>
> Modified: head/UPDATING
> ==
> --- head/UPDATING   Thu Dec  5 15:21:13 2019(r355422)
> +++ head/UPDATING   Thu Dec  5 15:32:33 2019(r355423)
> @@ -26,6 +26,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
> disable the most expensive debugging functionality run
> "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
>
> +20191205:
> +   The root certificates of the Mozilla CA Certificate Store have been
> +   imported into the base system and can be managed with the certctl(8)
> +   utility.  If you have installed the security/ca_root_nss port or 
> package
> +   with the ETCSYMLINK option (the default), be advised that there may be
> +   differences between those included in the port and those included in
> +   base due to differences in nss branch used as well as general update
> +   frequency.  Note also that certctl(8) cannot manage certs in the
> +   format used by the security/ca_root_nss port.
> +
>  20191120:
> The amd(8) automount daemon has been disabled by default, and will be
> removed in the future.  As of FreeBSD 10.1 the autofs(5) is available

CC'ing ports-secteam@ and jbeich@- I think it would make sense and be
A Good Thing(TM?) to go ahead and flip the default of ETCSYMLINK to
"off" for -CURRENT/13.0 now that certs should be effectively managed
in base and updated with etcupdate/mergemaster. Thoughts?

Thanks,

Kyle Evans
___
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: r355423 - head

2019-12-05 Thread Kyle Evans
Author: kevans
Date: Thu Dec  5 15:32:33 2019
New Revision: 355423
URL: https://svnweb.freebsd.org/changeset/base/355423

Log:
  UPDATING: Add long-belated note about certs in base
  
  While the interaction between this and the ETCSYMLINK option of
  security/ca_root_nss isn't necessarily fatal, one should be aware and
  attempt to understand the ramifications of mixing the two.
  
  ports-secteam will be contacted to discuss the default option for branches
  where certs are being included in base.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Thu Dec  5 15:21:13 2019(r355422)
+++ head/UPDATING   Thu Dec  5 15:32:33 2019(r355423)
@@ -26,6 +26,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20191205:
+   The root certificates of the Mozilla CA Certificate Store have been
+   imported into the base system and can be managed with the certctl(8)
+   utility.  If you have installed the security/ca_root_nss port or package
+   with the ETCSYMLINK option (the default), be advised that there may be
+   differences between those included in the port and those included in
+   base due to differences in nss branch used as well as general update
+   frequency.  Note also that certctl(8) cannot manage certs in the
+   format used by the security/ca_root_nss port.
+
 20191120:
The amd(8) automount daemon has been disabled by default, and will be
removed in the future.  As of FreeBSD 10.1 the autofs(5) is available
___
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: r355422 - in head/sys/dev/mlx5: . mlx5_core mlx5_en

2019-12-05 Thread Konstantin Belousov
Author: kib
Date: Thu Dec  5 15:21:13 2019
New Revision: 355422
URL: https://svnweb.freebsd.org/changeset/base/355422

Log:
  mlx5: Do not poke hardware for statistic after teardown is started.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Thu Dec  5 15:16:19 2019(r355421)
+++ head/sys/dev/mlx5/driver.h  Thu Dec  5 15:21:13 2019(r355422)
@@ -640,7 +640,8 @@ enum mlx5_device_state {
 };
 
 enum mlx5_interface_state {
-   MLX5_INTERFACE_STATE_UP,
+   MLX5_INTERFACE_STATE_UP = 0x1,
+   MLX5_INTERFACE_STATE_TEARDOWN = 0x2,
 };
 
 enum mlx5_pci_status {

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Dec  5 15:16:19 2019
(r355421)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Dec  5 15:21:13 2019
(r355422)
@@ -1606,6 +1606,8 @@ static void shutdown_one(struct pci_dev *pdev)
/* enter polling mode */
mlx5_cmd_use_polling(dev);
 
+   set_bit(MLX5_INTERFACE_STATE_TEARDOWN, >intf_state);
+
/* disable all interrupts */
mlx5_disable_interrupts(dev);
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cThu Dec  5 15:16:19 2019
(r355421)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cThu Dec  5 15:21:13 2019
(r355422)
@@ -1038,9 +1038,10 @@ mlx5e_update_stats_work(struct work_struct *work)
 {
struct mlx5e_priv *priv;
 
-   priv  = container_of(work, struct mlx5e_priv, update_stats_work);
+   priv = container_of(work, struct mlx5e_priv, update_stats_work);
PRIV_LOCK(priv);
-   if (test_bit(MLX5E_STATE_OPENED, >state) != 0)
+   if (test_bit(MLX5E_STATE_OPENED, >state) != 0 &&
+   !test_bit(MLX5_INTERFACE_STATE_TEARDOWN, >mdev->intf_state))
mlx5e_update_stats_locked(priv);
PRIV_UNLOCK(priv);
 }
___
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: r355421 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5

2019-12-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec  5 15:16:19 2019
New Revision: 355421
URL: https://svnweb.freebsd.org/changeset/base/355421

Log:
  Add basic support for TCP/IP based hardware TLS offload to mlx5core.
  
  The hardware offload is primarily targeted for TLS v1.2 and v1.3,
  using AES 128/256 bit pre-shared keys. This patch adds all the needed
  hardware structures, capabilites and firmware commands.
  
  Sponsored by: Mellanox Technologies

Added:
  head/sys/dev/mlx5/mlx5_core/mlx5_tls.c   (contents, props changed)
  head/sys/dev/mlx5/tls.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/mlx5/device.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  head/sys/dev/mlx5/mlx5_core/mlx5_fw.c
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_ifc.h
  head/sys/modules/mlx5/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Dec  5 15:07:32 2019(r355420)
+++ head/sys/conf/files Thu Dec  5 15:16:19 2019(r355421)
@@ -4756,6 +4756,8 @@ dev/mlx5/mlx5_core/mlx5_rl.c  
optional mlx5 pci   \
compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_srq.c  optional mlx5 pci   \
compile-with "${OFED_C}"
+dev/mlx5/mlx5_core/mlx5_tls.c  optional mlx5 pci   \
+   compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_transobj.c optional mlx5 pci   \
compile-with "${OFED_C}"
 dev/mlx5/mlx5_core/mlx5_uar.c  optional mlx5 pci   \

Modified: head/sys/dev/mlx5/device.h
==
--- head/sys/dev/mlx5/device.h  Thu Dec  5 15:07:32 2019(r355420)
+++ head/sys/dev/mlx5/device.h  Thu Dec  5 15:16:19 2019(r355421)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2018, Mellanox Technologies, Ltd.  All rights reserved.
+ * Copyright (c) 2013-2019, Mellanox Technologies, Ltd.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -382,6 +382,18 @@ enum {
 };
 
 enum {
+   MLX5_OPCODE_MOD_UMR_UMR = 0x0,
+   MLX5_OPCODE_MOD_UMR_TLS_TIS_STATIC_PARAMS = 0x1,
+   MLX5_OPCODE_MOD_UMR_TLS_TIR_STATIC_PARAMS = 0x2,
+};
+
+enum {
+   MLX5_OPCODE_MOD_PSV_PSV = 0x0,
+   MLX5_OPCODE_MOD_PSV_TLS_TIS_PROGRESS_PARAMS = 0x1,
+   MLX5_OPCODE_MOD_PSV_TLS_TIR_PROGRESS_PARAMS = 0x2,
+};
+
+enum {
MLX5_SET_PORT_RESET_QKEY= 0,
MLX5_SET_PORT_GUID0 = 16,
MLX5_SET_PORT_NODE_GUID = 17,
@@ -919,6 +931,10 @@ enum mlx5_cap_type {
MLX5_CAP_VECTOR_CALC,
MLX5_CAP_QOS,
MLX5_CAP_DEBUG,
+   MLX5_CAP_NVME,
+   MLX5_CAP_DMC,
+   MLX5_CAP_DEC,
+   MLX5_CAP_TLS,
/* NUM OF CAP Types */
MLX5_CAP_NUM
 };
@@ -951,6 +967,9 @@ enum mlx5_mcam_feature_groups {
 #define MLX5_CAP_GEN(mdev, cap) \
MLX5_GET(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap)
 
+#defineMLX5_CAP_GEN_64(mdev, cap)  
\
+   MLX5_GET64(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap)
+
 #define MLX5_CAP_GEN_MAX(mdev, cap) \
MLX5_GET(cmd_hca_cap, mdev->hca_caps_max[MLX5_CAP_GENERAL], cap)
 
@@ -1075,6 +1094,9 @@ enum mlx5_mcam_feature_groups {
 
 #define MLX5_CAP64_FPGA(mdev, cap) \
MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap)
+
+#defineMLX5_CAP_TLS(mdev, cap) \
+   MLX5_GET(tls_capabilities, (mdev)->hca_caps_cur[MLX5_CAP_TLS], cap)
 
 enum {
MLX5_CMD_STAT_OK= 0x0,

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Thu Dec  5 15:07:32 2019
(r355420)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Thu Dec  5 15:16:19 2019
(r355421)
@@ -361,6 +361,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_cor
case MLX5_CMD_OP_MODIFY_FLOW_TABLE:
case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY:
case MLX5_CMD_OP_SET_FLOW_TABLE_ROOT:
+   case MLX5_CMD_OP_DESTROY_GENERAL_OBJ:
return MLX5_CMD_STAT_OK;
 
case MLX5_CMD_OP_QUERY_HCA_CAP:
@@ -459,6 +460,9 @@ static int mlx5_internal_err_ret_value(struct mlx5_cor
case MLX5_CMD_OP_CREATE_FLOW_GROUP:
case MLX5_CMD_OP_QUERY_FLOW_GROUP:
case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY:
+   case MLX5_CMD_OP_CREATE_GENERAL_OBJ:
+   case MLX5_CMD_OP_MODIFY_GENERAL_OBJ:
+   case MLX5_CMD_OP_QUERY_GENERAL_OBJ:
*status = MLX5_DRIVER_STATUS_ABORTED;
*synd = MLX5_DRIVER_SYND;
return -EIO;
@@ -606,6 +610,10 @@ const char *mlx5_command_str(int command)
MLX5_COMMAND_STR_CASE(DELETE_FLOW_TABLE_ENTRY);

svn commit: r355420 - in head/sys/geom: . mirror part

2019-12-05 Thread Alexander Motin
Author: mav
Date: Thu Dec  5 15:07:32 2019
New Revision: 355420
URL: https://svnweb.freebsd.org/changeset/base/355420

Log:
  Remove duplicate g_debugflags declaration.
  
  While there, define G_F_FOOTSHOOTING instead of numeric constants.
  
  MFC after:13 days
  X-MFX-with:   r355412

Modified:
  head/sys/geom/geom.h
  head/sys/geom/geom_int.h
  head/sys/geom/geom_subr.c
  head/sys/geom/mirror/g_mirror_ctl.c
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part_mbr.c
  head/sys/geom/part/g_part_vtoc8.c

Modified: head/sys/geom/geom.h
==
--- head/sys/geom/geom.hThu Dec  5 14:53:46 2019(r355419)
+++ head/sys/geom/geom.hThu Dec  5 15:07:32 2019(r355420)
@@ -256,10 +256,13 @@ struct g_provider *g_dev_getprovider(struct cdev *dev)
 
 /* geom_dump.c */
 void (g_trace)(int level, const char *, ...) __printflike(2, 3);
-#  define G_T_TOPOLOGY 1
-#  define G_T_BIO  2
-#  define G_T_ACCESS   4
+#defineG_T_TOPOLOGY0x01
+#defineG_T_BIO 0x02
+#defineG_T_ACCESS  0x04
 extern int g_debugflags;
+#defineG_F_FOOTSHOOTING0x10
+#defineG_F_DISKIOCTL   0x40
+#defineG_F_CTLDUMP 0x80
 #defineg_trace(level, fmt, ...) do {   \
if (__predict_false(g_debugflags & (level)))\
(g_trace)(level, fmt, ## __VA_ARGS__);  \

Modified: head/sys/geom/geom_int.h
==
--- head/sys/geom/geom_int.hThu Dec  5 14:53:46 2019(r355419)
+++ head/sys/geom/geom_int.hThu Dec  5 15:07:32 2019(r355420)
@@ -44,18 +44,6 @@ extern int g_collectstats;
 #define G_STATS_PROVIDERS  1   /* Collect I/O stats for providers */
 #define G_STATS_CONSUMERS  2   /* Collect I/O stats for consumers */
 
-extern int g_debugflags;
-/*
- * 1   G_T_TOPOLOGY
- * 2   G_T_BIO
- * 4   G_T_ACCESS
- * 8   (unused)
- * 16  Allow footshooting on rank#1 providers
- * 32  G_T_DETAILS
- */
-#define G_F_DISKIOCTL  64
-#define G_F_CTLDUMP128
-
 /* geom_dump.c */
 void g_confxml(void *, int flag);
 void g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, 
struct g_provider *pp, struct g_consumer *cp);

Modified: head/sys/geom/geom_subr.c
==
--- head/sys/geom/geom_subr.c   Thu Dec  5 14:53:46 2019(r355419)
+++ head/sys/geom/geom_subr.c   Thu Dec  5 15:07:32 2019(r355420)
@@ -983,7 +983,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
pp, pp->name);
 
/* If foot-shooting is enabled, any open on rank#1 is OK */
-   if ((g_debugflags & 16) && gp->rank == 1)
+   if ((g_debugflags & G_F_FOOTSHOOTING) && gp->rank == 1)
;
/* If we try exclusive but already write: fail */
else if (dce > 0 && pw > 0)

Modified: head/sys/geom/mirror/g_mirror_ctl.c
==
--- head/sys/geom/mirror/g_mirror_ctl.c Thu Dec  5 14:53:46 2019
(r355419)
+++ head/sys/geom/mirror/g_mirror_ctl.c Thu Dec  5 15:07:32 2019
(r355420)
@@ -853,7 +853,7 @@ g_mirror_ctl_resize(struct gctl_req *req, struct g_cla
return;
}
/* Deny shrinking of an opened provider */
-   if ((g_debugflags & 16) == 0 && sc->sc_provider_open > 0) {
+   if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && sc->sc_provider_open > 0) 
{
if (sc->sc_mediasize > mediasize) {
gctl_error(req, "Device %s is busy.",
sc->sc_provider->name);

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Thu Dec  5 14:53:46 2019(r355419)
+++ head/sys/geom/part/g_part.c Thu Dec  5 15:07:32 2019(r355420)
@@ -1383,7 +1383,7 @@ g_part_ctl_resize(struct gctl_req *req, struct g_part_
}
 
pp = entry->gpe_pp;
-   if ((g_debugflags & 16) == 0 &&
+   if ((g_debugflags & G_F_FOOTSHOOTING) == 0 &&
(pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) {
if (entry->gpe_end - entry->gpe_start + 1 > gpp->gpp_size) {
/* Deny shrinking of an opened partition. */

Modified: head/sys/geom/part/g_part_mbr.c
==
--- head/sys/geom/part/g_part_mbr.c Thu Dec  5 14:53:46 2019
(r355419)
+++ head/sys/geom/part/g_part_mbr.c Thu Dec  5 15:07:32 2019
(r355420)
@@ -381,7 +381,7 @@ g_part_mbr_resize(struct g_part_table *basetable,
return (EINVAL);
/* XXX: prevent unexpected shrinking. */
pp = 

svn commit: r355419 - stable/10/sys/kern

2019-12-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec  5 14:53:46 2019
New Revision: 355419
URL: https://svnweb.freebsd.org/changeset/base/355419

Log:
  MFC r355108 and r355170:
  Fix panic when loading kernel modules before root file system is mounted.
  Make sure the rootvnode is always NULL checked.
  
  Differential Revision:https://reviews.freebsd.org/D22545
  PR:   241639
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/kern/kern_linker.c
  stable/10/sys/kern/subr_firmware.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_linker.c
==
--- stable/10/sys/kern/kern_linker.cThu Dec  5 14:52:06 2019
(r355418)
+++ stable/10/sys/kern/kern_linker.cThu Dec  5 14:53:46 2019
(r355419)
@@ -2000,14 +2000,18 @@ linker_load_module(const char *kldname, const char *mo
 */
KASSERT(verinfo == NULL, ("linker_load_module: verinfo"
" is not NULL"));
+   /* check if root file system is not mounted */
+   if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
+   return (ENXIO);
pathname = linker_search_kld(kldname);
} else {
if (modlist_lookup2(modname, verinfo) != NULL)
return (EEXIST);
+   /* check if root file system is not mounted */
+   if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
+   return (ENXIO);
if (kldname != NULL)
pathname = strdup(kldname, M_LINKER);
-   else if (rootvnode == NULL)
-   pathname = NULL;
else
/*
 * Need to find a KLD with required module

Modified: stable/10/sys/kern/subr_firmware.c
==
--- stable/10/sys/kern/subr_firmware.c  Thu Dec  5 14:52:06 2019
(r355418)
+++ stable/10/sys/kern/subr_firmware.c  Thu Dec  5 14:53:46 2019
(r355419)
@@ -255,7 +255,6 @@ firmware_unregister(const char *imagename)
 static void
 loadimage(void *arg, int npending)
 {
-   struct thread *td = curthread;
char *imagename = arg;
struct priv_fw *fp;
linker_file_t result;
@@ -265,11 +264,6 @@ loadimage(void *arg, int npending)
mtx_lock(_mtx);
mtx_unlock(_mtx);
 
-   if (td->td_proc->p_fd->fd_rdir == NULL) {
-   printf("%s: root not mounted yet, no way to load image\n",
-   imagename);
-   goto done;
-   }
error = linker_reference_module(imagename, NULL, );
if (error != 0) {
printf("%s: could not load firmware image, error %d\n",
___
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: r355418 - stable/11/sys/kern

2019-12-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec  5 14:52:06 2019
New Revision: 355418
URL: https://svnweb.freebsd.org/changeset/base/355418

Log:
  MFC r355108 and r355170:
  Fix panic when loading kernel modules before root file system is mounted.
  Make sure the rootvnode is always NULL checked.
  
  Differential Revision:https://reviews.freebsd.org/D22545
  PR:   241639
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/kern/kern_linker.c
  stable/11/sys/kern/subr_firmware.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_linker.c
==
--- stable/11/sys/kern/kern_linker.cThu Dec  5 14:50:46 2019
(r355417)
+++ stable/11/sys/kern/kern_linker.cThu Dec  5 14:52:06 2019
(r355418)
@@ -2022,14 +2022,18 @@ linker_load_module(const char *kldname, const char *mo
 */
KASSERT(verinfo == NULL, ("linker_load_module: verinfo"
" is not NULL"));
+   /* check if root file system is not mounted */
+   if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
+   return (ENXIO);
pathname = linker_search_kld(kldname);
} else {
if (modlist_lookup2(modname, verinfo) != NULL)
return (EEXIST);
+   /* check if root file system is not mounted */
+   if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
+   return (ENXIO);
if (kldname != NULL)
pathname = strdup(kldname, M_LINKER);
-   else if (rootvnode == NULL)
-   pathname = NULL;
else
/*
 * Need to find a KLD with required module

Modified: stable/11/sys/kern/subr_firmware.c
==
--- stable/11/sys/kern/subr_firmware.c  Thu Dec  5 14:50:46 2019
(r355417)
+++ stable/11/sys/kern/subr_firmware.c  Thu Dec  5 14:52:06 2019
(r355418)
@@ -255,7 +255,6 @@ firmware_unregister(const char *imagename)
 static void
 loadimage(void *arg, int npending)
 {
-   struct thread *td = curthread;
char *imagename = arg;
struct priv_fw *fp;
linker_file_t result;
@@ -265,11 +264,6 @@ loadimage(void *arg, int npending)
mtx_lock(_mtx);
mtx_unlock(_mtx);
 
-   if (td->td_proc->p_fd->fd_rdir == NULL) {
-   printf("%s: root not mounted yet, no way to load image\n",
-   imagename);
-   goto done;
-   }
error = linker_reference_module(imagename, NULL, );
if (error != 0) {
printf("%s: could not load firmware image, error %d\n",
___
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: r355417 - stable/12/sys/kern

2019-12-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec  5 14:50:46 2019
New Revision: 355417
URL: https://svnweb.freebsd.org/changeset/base/355417

Log:
  MFC r355108 and r355170:
  Fix panic when loading kernel modules before root file system is mounted.
  Make sure the rootvnode is always NULL checked.
  
  Differential Revision:https://reviews.freebsd.org/D22545
  PR:   241639
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/kern/kern_linker.c
  stable/12/sys/kern/subr_firmware.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_linker.c
==
--- stable/12/sys/kern/kern_linker.cThu Dec  5 13:43:44 2019
(r355416)
+++ stable/12/sys/kern/kern_linker.cThu Dec  5 14:50:46 2019
(r355417)
@@ -2061,14 +2061,18 @@ linker_load_module(const char *kldname, const char *mo
 */
KASSERT(verinfo == NULL, ("linker_load_module: verinfo"
" is not NULL"));
+   /* check if root file system is not mounted */
+   if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
+   return (ENXIO);
pathname = linker_search_kld(kldname);
} else {
if (modlist_lookup2(modname, verinfo) != NULL)
return (EEXIST);
+   /* check if root file system is not mounted */
+   if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
+   return (ENXIO);
if (kldname != NULL)
pathname = strdup(kldname, M_LINKER);
-   else if (rootvnode == NULL)
-   pathname = NULL;
else
/*
 * Need to find a KLD with required module

Modified: stable/12/sys/kern/subr_firmware.c
==
--- stable/12/sys/kern/subr_firmware.c  Thu Dec  5 13:43:44 2019
(r355416)
+++ stable/12/sys/kern/subr_firmware.c  Thu Dec  5 14:50:46 2019
(r355417)
@@ -257,7 +257,6 @@ firmware_unregister(const char *imagename)
 static void
 loadimage(void *arg, int npending)
 {
-   struct thread *td = curthread;
char *imagename = arg;
struct priv_fw *fp;
linker_file_t result;
@@ -267,11 +266,6 @@ loadimage(void *arg, int npending)
mtx_lock(_mtx);
mtx_unlock(_mtx);
 
-   if (td->td_proc->p_fd->fd_rdir == NULL) {
-   printf("%s: root not mounted yet, no way to load image\n",
-   imagename);
-   goto done;
-   }
error = linker_reference_module(imagename, NULL, );
if (error != 0) {
printf("%s: could not load firmware image, error %d\n",
___
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: r355416 - head/sys/kern

2019-12-05 Thread Mateusz Guzik
Author: mjg
Date: Thu Dec  5 13:43:44 2019
New Revision: 355416
URL: https://svnweb.freebsd.org/changeset/base/355416

Log:
  sx: check for SX_LOCK_SHARED | SX_LOCK_WRITE_SPINNER when exclusive-locking
  
  First, this removes a spurious difference compared to rw locks.
  More importantly though this avoids a trip through sleepq code if the lock
  happens to be caught in this state.

Modified:
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Thu Dec  5 13:41:22 2019(r355415)
+++ head/sys/kern/kern_sx.c Thu Dec  5 13:43:44 2019(r355416)
@@ -661,6 +661,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
lda.spin_cnt++;
 #endif
 #ifdef ADAPTIVE_SX
+   if (x == (SX_LOCK_SHARED | SX_LOCK_WRITE_SPINNER)) {
+   if (atomic_fcmpset_acq_ptr(>sx_lock, , tid))
+   break;
+   continue;
+   }
+
/*
 * If the lock is write locked and the owner is
 * running on another CPU, spin until the owner stops
___
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: r355415 - head/sys/fs/nullfs

2019-12-05 Thread Mateusz Guzik
Author: mjg
Date: Thu Dec  5 13:41:22 2019
New Revision: 355415
URL: https://svnweb.freebsd.org/changeset/base/355415

Log:
  nullfs: locklessly check for entries in null_hashget
  
  During random sampling over poudriere -j 104 over 10% of calls returned NULL.

Modified:
  head/sys/fs/nullfs/null_subr.c

Modified: head/sys/fs/nullfs/null_subr.c
==
--- head/sys/fs/nullfs/null_subr.c  Thu Dec  5 13:40:10 2019
(r355414)
+++ head/sys/fs/nullfs/null_subr.c  Thu Dec  5 13:41:22 2019
(r355415)
@@ -113,6 +113,8 @@ null_hashget(mp, lowervp)
 * reference count (but NOT the lower vnode's VREF counter).
 */
hd = NULL_NHASH(lowervp);
+   if (LIST_EMPTY(hd))
+   return (NULLVP);
rw_rlock(_hash_lock);
LIST_FOREACH(a, hd, null_hash) {
if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) {
___
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: r355414 - head/sys/kern

2019-12-05 Thread Mateusz Guzik
Author: mjg
Date: Thu Dec  5 13:40:10 2019
New Revision: 355414
URL: https://svnweb.freebsd.org/changeset/base/355414

Log:
  vfs: remove 'active' variable from _vdrop
  
  No functional changes.

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cThu Dec  5 13:20:15 2019(r355413)
+++ head/sys/kern/vfs_subr.cThu Dec  5 13:40:10 2019(r355414)
@@ -3154,7 +3154,6 @@ _vdrop(struct vnode *vp, bool locked)
 {
struct bufobj *bo;
struct mount *mp;
-   int active;
 
if (locked)
ASSERT_VI_LOCKED(vp, __func__);
@@ -3185,13 +3184,12 @@ _vdrop(struct vnode *vp, bool locked)
("vnode already free"));
VNASSERT(vp->v_holdcnt == 0, vp,
("vdropl: freeing when we shouldn't"));
-   active = vp->v_iflag & VI_ACTIVE;
if ((vp->v_iflag & VI_OWEINACT) == 0) {
-   vp->v_iflag &= ~VI_ACTIVE;
mp = vp->v_mount;
if (mp != NULL) {
mtx_lock(>mnt_listmtx);
-   if (active) {
+   if (vp->v_iflag & VI_ACTIVE) {
+   vp->v_iflag &= ~VI_ACTIVE;
TAILQ_REMOVE(>mnt_activevnodelist,
vp, v_actfreelist);
mp->mnt_activevnodelistsize--;
@@ -3207,7 +3205,7 @@ _vdrop(struct vnode *vp, bool locked)
vnlru_return_batch_locked(mp);
mtx_unlock(>mnt_listmtx);
} else {
-   VNASSERT(active == 0, vp,
+   VNASSERT((vp->v_iflag & VI_ACTIVE) == 0, vp,
("vdropl: active vnode not on per mount "
"vnode list"));
mtx_lock(_free_list_mtx);
___
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: r355407 - head/sys/fs/tmpfs

2019-12-05 Thread Konstantin Belousov
On Thu, Dec 05, 2019 at 02:38:07PM +1100, Kubilay Kocak wrote:
> On 5/12/2019 11:03 am, Konstantin Belousov wrote:
> > Author: kib
> > Date: Thu Dec  5 00:03:17 2019
> > New Revision: 355407
> > URL: https://svnweb.freebsd.org/changeset/base/355407
> 
> Could you elaborate on the why/rationale?
> 
> Is there memory wastage/duplication, bug(s), performance or 
> development/maintenance benefit?
Each mount/unmount of tmpfs created and destroyed two zones, as it is
easy to see from the patch.

> 
> The review summary doesnt appear to include this information either
> 
> > Log:
> >Stop using per-mount tmpfs zones.
> >
> >Requested and reviewed by:   jeff
> >Sponsored by:The FreeBSD Foundation
> >MFC after:   1 week
> >Differential revision:   https://reviews.freebsd.org/D22643
> > 
> > Modified:
> >head/sys/fs/tmpfs/tmpfs.h
> >head/sys/fs/tmpfs/tmpfs_subr.c
> >head/sys/fs/tmpfs/tmpfs_vfsops.c
> > 
> > Modified: head/sys/fs/tmpfs/tmpfs.h
> > ==
> > --- head/sys/fs/tmpfs/tmpfs.h   Wed Dec  4 23:24:40 2019
> > (r355406)
> > +++ head/sys/fs/tmpfs/tmpfs.h   Thu Dec  5 00:03:17 2019
> > (r355407)
> > @@ -378,10 +378,6 @@ struct tmpfs_mount {
> > /* All node lock to protect the node list and tmp_pages_used. */
> > struct mtx  tm_allnode_lock;
> >   
> > -   /* Zones used to store file system meta data, per tmpfs mount. */
> > -   uma_zone_t  tm_dirent_pool;
> > -   uma_zone_t  tm_node_pool;
> > -
> > /* Read-only status. */
> > booltm_ronly;
> > /* Do not use namecache. */
> > @@ -493,8 +489,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node
> >   #endif
> >   
> >   size_t tmpfs_mem_avail(void);
> > -
> >   size_t tmpfs_pages_used(struct tmpfs_mount *tmp);
> > +void tmpfs_subr_init(void);
> > +void tmpfs_subr_uninit(void);
> >   
> >   #endif
> >   
> > 
> > Modified: head/sys/fs/tmpfs/tmpfs_subr.c
> > ==
> > --- head/sys/fs/tmpfs/tmpfs_subr.c  Wed Dec  4 23:24:40 2019
> > (r355406)
> > +++ head/sys/fs/tmpfs/tmpfs_subr.c  Thu Dec  5 00:03:17 2019
> > (r355407)
> > @@ -72,7 +72,74 @@ SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmp
> >   
> >   static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED;
> >   
> > +static uma_zone_t tmpfs_dirent_pool;
> > +static uma_zone_t tmpfs_node_pool;
> > +
> >   static int
> > +tmpfs_node_ctor(void *mem, int size, void *arg, int flags)
> > +{
> > +   struct tmpfs_node *node;
> > +
> > +   node = mem;
> > +   node->tn_gen++;
> > +   node->tn_size = 0;
> > +   node->tn_status = 0;
> > +   node->tn_flags = 0;
> > +   node->tn_links = 0;
> > +   node->tn_vnode = NULL;
> > +   node->tn_vpstate = 0;
> > +   return (0);
> > +}
> > +
> > +static void
> > +tmpfs_node_dtor(void *mem, int size, void *arg)
> > +{
> > +   struct tmpfs_node *node;
> > +
> > +   node = mem;
> > +   node->tn_type = VNON;
> > +}
> > +
> > +static int
> > +tmpfs_node_init(void *mem, int size, int flags)
> > +{
> > +   struct tmpfs_node *node;
> > +
> > +   node = mem;
> > +   node->tn_id = 0;
> > +   mtx_init(>tn_interlock, "tmpfsni", NULL, MTX_DEF);
> > +   node->tn_gen = arc4random();
> > +   return (0);
> > +}
> > +
> > +static void
> > +tmpfs_node_fini(void *mem, int size)
> > +{
> > +   struct tmpfs_node *node;
> > +
> > +   node = mem;
> > +   mtx_destroy(>tn_interlock);
> > +}
> > +
> > +void
> > +tmpfs_subr_init(void)
> > +{
> > +   tmpfs_dirent_pool = uma_zcreate("TMPFS dirent",
> > +   sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL,
> > +   UMA_ALIGN_PTR, 0);
> > +   tmpfs_node_pool = uma_zcreate("TMPFS node",
> > +   sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor,
> > +   tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0);
> > +}
> > +
> > +void
> > +tmpfs_subr_uninit(void)
> > +{
> > +   uma_zdestroy(tmpfs_node_pool);
> > +   uma_zdestroy(tmpfs_dirent_pool);
> > +}
> > +
> > +static int
> >   sysctl_mem_reserved(SYSCTL_HANDLER_ARGS)
> >   {
> > int error;
> > @@ -219,8 +286,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount
> > if ((mp->mnt_kern_flag & MNT_RDONLY) != 0)
> > return (EROFS);
> >   
> > -   nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp,
> > -   M_WAITOK);
> > +   nnode = uma_zalloc_arg(tmpfs_node_pool, tmp, M_WAITOK);
> >   
> > /* Generic initialization. */
> > nnode->tn_type = type;
> > @@ -367,7 +433,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct
> > panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type);
> > }
> >   
> > -   uma_zfree(tmp->tm_node_pool, node);
> > +   uma_zfree(tmpfs_node_pool, node);
> > TMPFS_LOCK(tmp);
> > tmpfs_free_tmp(tmp);
> > return (true);
> > @@ -434,7 +500,7 @@ tmpfs_alloc_dirent(struct 

Re: svn commit: r354754 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux

2019-12-05 Thread Mateusz Guzik
On 11/16/19, John Baldwin  wrote:
> Author: jhb
> Date: Fri Nov 15 23:01:43 2019
> New Revision: 354754
> URL: https://svnweb.freebsd.org/changeset/base/354754
>
> Log:
>   Use a sv_copyout_auxargs hook in the Linux ELF ABIs.
>

This makes Linux binaries instantly segfault for me on amd64.

You check: 
https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64-root.tar.xz

I unpack this to tmpfs and chroot inside. Works without this commit.

-- 
Mateusz Guzik 
___
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: r355413 - in head: contrib/elftoolchain contrib/elftoolchain/addr2line contrib/elftoolchain/common contrib/elftoolchain/elfcopy contrib/elftoolchain/elfdump contrib/elftoolchain/libdwar...

2019-12-05 Thread Ed Maste
Author: emaste
Date: Thu Dec  5 13:20:15 2019
New Revision: 355413
URL: https://svnweb.freebsd.org/changeset/base/355413

Log:
  Update ELF Tool Chain to upstream r3769
  
  This contains many small bugfixes and documentation improvements.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/contrib/elftoolchain/.cirrus.yml
 - copied unchanged from r349544, vendor/elftoolchain/dist/.cirrus.yml
  head/contrib/elftoolchain/libelf/os.Linux.mk
 - copied unchanged from r349544, 
vendor/elftoolchain/dist/libelf/os.Linux.mk
Modified:
  head/contrib/elftoolchain/README.rst
  head/contrib/elftoolchain/addr2line/addr2line.c
  head/contrib/elftoolchain/common/elfdefinitions.h
  head/contrib/elftoolchain/common/native-elf-format
  head/contrib/elftoolchain/elfcopy/ascii.c
  head/contrib/elftoolchain/elfcopy/binary.c
  head/contrib/elftoolchain/elfcopy/elfcopy.h
  head/contrib/elftoolchain/elfcopy/main.c
  head/contrib/elftoolchain/elfcopy/sections.c
  head/contrib/elftoolchain/elfdump/elfdump.c
  head/contrib/elftoolchain/libdwarf/dwarf.h
  head/contrib/elftoolchain/libdwarf/dwarf_dump.c
  head/contrib/elftoolchain/libdwarf/libdwarf_attr.c
  head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
  head/contrib/elftoolchain/libelf/_libelf.h
  head/contrib/elftoolchain/libelf/_libelf_config.h
  head/contrib/elftoolchain/libelf/elf.3
  head/contrib/elftoolchain/libelf/elf_data.c
  head/contrib/elftoolchain/libelf/elf_end.c
  head/contrib/elftoolchain/libelf/elf_flagdata.3
  head/contrib/elftoolchain/libelf/elf_getdata.3
  head/contrib/elftoolchain/libelf/elf_getident.c
  head/contrib/elftoolchain/libelf/elf_next.3
  head/contrib/elftoolchain/libelf/elf_next.c
  head/contrib/elftoolchain/libelf/elf_open.3
  head/contrib/elftoolchain/libelf/elf_rand.c
  head/contrib/elftoolchain/libelf/elf_rawfile.c
  head/contrib/elftoolchain/libelf/elf_scn.c
  head/contrib/elftoolchain/libelf/elf_update.3
  head/contrib/elftoolchain/libelf/elf_update.c
  head/contrib/elftoolchain/libelf/gelf.3
  head/contrib/elftoolchain/libelf/gelf_cap.c
  head/contrib/elftoolchain/libelf/gelf_dyn.c
  head/contrib/elftoolchain/libelf/gelf_getcap.3
  head/contrib/elftoolchain/libelf/gelf_getdyn.3
  head/contrib/elftoolchain/libelf/gelf_getmove.3
  head/contrib/elftoolchain/libelf/gelf_getrel.3
  head/contrib/elftoolchain/libelf/gelf_getrela.3
  head/contrib/elftoolchain/libelf/gelf_getsym.3
  head/contrib/elftoolchain/libelf/gelf_getsyminfo.3
  head/contrib/elftoolchain/libelf/gelf_getsymshndx.3
  head/contrib/elftoolchain/libelf/gelf_move.c
  head/contrib/elftoolchain/libelf/gelf_newehdr.3
  head/contrib/elftoolchain/libelf/gelf_newphdr.3
  head/contrib/elftoolchain/libelf/gelf_rel.c
  head/contrib/elftoolchain/libelf/gelf_rela.c
  head/contrib/elftoolchain/libelf/gelf_sym.c
  head/contrib/elftoolchain/libelf/gelf_syminfo.c
  head/contrib/elftoolchain/libelf/gelf_symshndx.c
  head/contrib/elftoolchain/libelf/libelf_allocate.c
  head/contrib/elftoolchain/libelf/libelf_ar.c
  head/contrib/elftoolchain/libelf/libelf_convert.m4
  head/contrib/elftoolchain/libelf/libelf_data.c
  head/contrib/elftoolchain/libelf/libelf_ehdr.c
  head/contrib/elftoolchain/libelf/libelf_extended.c
  head/contrib/elftoolchain/libelf/libelf_memory.c
  head/contrib/elftoolchain/libelf/libelf_msize.m4
  head/contrib/elftoolchain/libelf/libelf_phdr.c
  head/contrib/elftoolchain/libelf/libelf_xlate.c
  head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
  head/contrib/elftoolchain/libelftc/elftc_string_table.c
  head/contrib/elftoolchain/libelftc/elftc_string_table_create.3
  head/contrib/elftoolchain/libelftc/libelftc.h
  head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
  head/contrib/elftoolchain/libelftc/make-toolchain-version
  head/contrib/elftoolchain/nm/nm.c
  head/contrib/elftoolchain/readelf/readelf.1
  head/contrib/elftoolchain/readelf/readelf.c
  head/lib/libelftc/elftc_version.c
Directory Properties:
  head/contrib/elftoolchain/   (props changed)
  head/contrib/elftoolchain/elfdump/   (props changed)

Copied: head/contrib/elftoolchain/.cirrus.yml (from r349544, 
vendor/elftoolchain/dist/.cirrus.yml)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/elftoolchain/.cirrus.yml   Thu Dec  5 13:20:15 2019
(r355413, copy of r349544, vendor/elftoolchain/dist/.cirrus.yml)
@@ -0,0 +1,22 @@
+freebsd_11_task:
+  freebsd_instance:
+image: freebsd-11-2-release-amd64
+  install_script: pkg install -y git py27-yaml
+  script:
+- fetch 
http://tetworks.opengroup.org/downloads/38/software/Sources/3.8/tet3.8-src.tar.gz
+- tar -x -C test/tet -f tet3.8-src.tar.gz
+- make
+
+debian_stable_task:
+  container:
+image: debian:stable
+  setup_script:
+- apt-get update
+- apt-get install -y
+  binutils bison bmake curl flex g++ gcc git
+  libarchive-dev libbsd-dev libc6-dev libexpat1-dev lsb-release
+  m4 perl