svn commit: r362005 - head/usr.sbin/bluetooth/hccontrol

2020-06-09 Thread Takanori Watanabe
Author: takawata
Date: Wed Jun 10 05:01:00 2020
New Revision: 362005
URL: https://svnweb.freebsd.org/changeset/base/362005

Log:
  Add le_read_channel_map and le_read_remote_features command
  
  PR: 247051
  Submitted by:   Marc Veldman marc at bumblingdork.com

Modified:
  head/usr.sbin/bluetooth/hccontrol/hccontrol.8
  head/usr.sbin/bluetooth/hccontrol/hccontrol.h
  head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
  head/usr.sbin/bluetooth/hccontrol/le.c
  head/usr.sbin/bluetooth/hccontrol/util.c

Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8
==
--- head/usr.sbin/bluetooth/hccontrol/hccontrol.8   Wed Jun 10 04:54:02 
2020(r362004)
+++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8   Wed Jun 10 05:01:00 
2020(r362005)
@@ -162,6 +162,8 @@ are:
 .It Cm LE_Add_Device_To_White_List
 .It Cm LE_Remove_Device_From_White_List
 .It Cm LE_Connect
+.It Cm LE_Read_Channel_Map
+.It Cm LE_Read_Remote_Features
 .El
 .Pp
 The currently supported node commands in

Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.h
==
--- head/usr.sbin/bluetooth/hccontrol/hccontrol.h   Wed Jun 10 04:54:02 
2020(r362004)
+++ head/usr.sbin/bluetooth/hccontrol/hccontrol.h   Wed Jun 10 05:01:00 
2020(r362005)
@@ -82,6 +82,7 @@ char const *  hci_bdaddr2str  (bdaddr_t const *);
 char const *   hci_addrtype2str(int type);
 char const *hci_role2str(int role);
 char const *hci_mc_accuracy2str (int accuracy);
+char const *   hci_le_chanmap2str  (uint8_t *, char *, int);
 
 void dump_adv_data(int len, uint8_t* advdata);
 void print_adv_data(int len, uint8_t* advdata);

Modified: head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
==
--- head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.cWed Jun 
10 04:54:02 2020(r362004)
+++ head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.cWed Jun 
10 05:01:00 2020(r362005)
@@ -1526,14 +1526,14 @@ hci_write_le_host_support(int s, int argc, char **argv
switch (argc) {
case 2:
if (sscanf(argv[1], "%d", &n) != 1 || (n != 0 && n != 1)){
-   printf("ARGC2: %d\n", n);
+   printf("-ARGC2: %d\n", n);
return (USAGE);
}
cp.simultaneous_le_host = (n &1);

case 1:
if (sscanf(argv[0], "%d", &n) != 1 || (n != 0 && n != 1)){
-   printf("ARGC1: %d\n", n);
+   printf("+ARGC1: %d\n", n);
return (USAGE);
}
 

Modified: head/usr.sbin/bluetooth/hccontrol/le.c
==
--- head/usr.sbin/bluetooth/hccontrol/le.c  Wed Jun 10 04:54:02 2020
(r362004)
+++ head/usr.sbin/bluetooth/hccontrol/le.c  Wed Jun 10 05:01:00 2020
(r362005)
@@ -69,6 +69,8 @@ static int le_add_device_to_white_list(int s, int argc
 static int le_remove_device_from_white_list(int s, int argc, char *argv[]);
 static int le_connect(int s, int argc, char *argv[]);
 static void handle_le_connection_event(ng_hci_event_pkt_t* e, bool verbose);
+static int le_read_channel_map(int s, int argc, char *argv[]);
+static void handle_le_remote_features_event(ng_hci_event_pkt_t* e);
 
 static int
 le_set_scan_param(int s, int argc, char *argv[])
@@ -1086,6 +1088,131 @@ static void handle_le_connection_event(ng_hci_event_pk
return;
 }
 
+static int
+le_read_channel_map(int s, int argc, char *argv[])
+{
+   ng_hci_le_read_channel_map_cp   cp;
+   ng_hci_le_read_channel_map_rp   rp;
+   int n;
+   charbuffer[2048];
+
+   /* parse command parameters */
+   switch (argc) {
+   case 1:
+   /* connection handle */
+   if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
+   return (USAGE);
+
+   cp.connection_handle = (uint16_t) (n & 0x0fff);
+   cp.connection_handle = htole16(cp.connection_handle);
+   break;
+
+   default:
+   return (USAGE);
+   }
+
+   n = sizeof(rp);
+   if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE,
+   NG_HCI_OCF_LE_READ_CHANNEL_MAP), 
+   (void *)&cp, sizeof(cp), (void *)&rp, &n) == ERROR)
+   return (ERROR);
+
+   if (rp.status != 0x00) {
+   fprintf(stdout,
+   "Read channel map failed. Status: %s [%#02x]\n", 
+   hci_status2str(rp.status), rp.status);
+   return (FAILED);
+   }
+
+   fprintf(stdout, "Connection handle: %d\n",
+

svn commit: r362004 - head/sys/netgraph/bluetooth/include

2020-06-09 Thread Takanori Watanabe
Author: takawata
Date: Wed Jun 10 04:54:02 2020
New Revision: 362004
URL: https://svnweb.freebsd.org/changeset/base/362004

Log:
  Add LE events:
  READ_REMOTE_FEATURES_COMPL
  LONG_TERM_KEY_REQUEST
  REMOTE_CONN_PARAM_REQUEST
  DATA_LENGTH_CHANGE
  READ_LOCAL_P256_PK_COMPL
  GEN_DHKEY_COMPL
  ENH_CONN_COMPL
  
  PR: 247050
  Submitted by: Marc Veldman marc at bumblingdork.com

Modified:
  head/sys/netgraph/bluetooth/include/ng_hci.h

Modified: head/sys/netgraph/bluetooth/include/ng_hci.h
==
--- head/sys/netgraph/bluetooth/include/ng_hci.hWed Jun 10 04:08:16 
2020(r362003)
+++ head/sys/netgraph/bluetooth/include/ng_hci.hWed Jun 10 04:54:02 
2020(r362004)
@@ -1992,11 +1992,65 @@ typedef struct {
u_int16_t conn_latency;
u_int16_t supervision_timeout;
 }__attribute__((packed)) ng_hci_connection_update_complete_ep;
+
 #define NG_HCI_LEEV_READ_REMOTE_FEATURES_COMPL 0x04
-//TBD
+typedef struct {
+   u_int8_tstatus;
+   u_int16_t   connection_handle;
+   u_int8_tfeatures[NG_HCI_FEATURES_SIZE];
+}__attribute__((packed)) ng_hci_le_read_remote_features_ep;
+
 #define NG_HCI_LEEV_LONG_TERM_KEY_REQUEST 0x05
-//TBD
+typedef struct {
+   u_int16_t   connection_handle;
+   u_int64_t   random_number;
+   u_int16_t   encrypted_diversifier;
+}__attribute__((packed)) ng_hci_le_long_term_key_request_ep;
 
+#define NG_HCI_LEEV_REMOTE_CONN_PARAM_REQUEST 0x06
+typedef struct {
+   u_int16_t   connection_handle;
+   u_int16_t   interval_min;
+   u_int16_t   interval_max;
+   u_int16_t   latency;
+   u_int16_t   timeout;
+}__attribute__((packed)) ng_hci_le_remote_conn_param_ep;
+
+#define NG_HCI_LEEV_DATA_LENGTH_CHANGE 0x07
+typedef struct {
+   u_int16_t   connection_handle;
+   u_int16_t   min_tx_octets;
+   u_int16_t   max_tx_time;
+   u_int16_t   max_rx_octets;
+   u_int16_t   max_rx_time;
+}__attribute__((packed)) ng_hci_le_data_length_change_ep;
+
+#define NG_HCI_LEEV_READ_LOCAL_P256_PK_COMPL 0x08
+typedef struct {
+   u_int8_tstatus;
+   u_int8_tlocal_p256_pk[64];
+}__attribute__((packed)) ng_hci_le_read_local_p256_pk_compl_ep;
+
+#define NG_HCI_LEEV_GEN_DHKEY_COMPL 0x09
+typedef struct {
+   u_int8_tstatus;
+   u_int8_tdh_key[32];
+}__attribute__((packed)) ng_hci_le_gen_dhkey_compl_ep;
+
+#define NG_HCI_LEEV_ENH_CONN_COMPL 0x0a
+typedef struct {
+   u_int8_tstatus;
+   u_int16_t   connection_handle;
+   u_int8_trole;
+   u_int8_tpeer_addr_type;
+   bdaddr_tpeer_addr;
+   bdaddr_tlocal_res_private_addr;
+   bdaddr_tpeer_res_private_addr;
+   u_int16_t   conn_interval;
+   u_int16_t   conn_latency;
+   u_int16_t   supervision_timeout;
+   u_int8_tmaster_clock_accuracy;
+}__attribute__((packed)) ng_hci_le_enh_conn_compl_ep;
 
 #define NG_HCI_EVENT_BT_LOGO   0xfe
 
___
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: r362003 - head/sys/powerpc/powernv

2020-06-09 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jun 10 04:08:16 2020
New Revision: 362003
URL: https://svnweb.freebsd.org/changeset/base/362003

Log:
  powerpc/powernv: Don't use the vmem quantum cache for OPAL PCI MSI allocations
  
  vmem quantum cache is only needed when doing a lot of concurrent allocations,
  which doesn't happen when allocating MSIs.  This wastes memory for the cache
  zones.  Avoid this waste and don't use the quantum cache.
  
  Reported by:  markj

Modified:
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal_pci.c
==
--- head/sys/powerpc/powernv/opal_pci.c Wed Jun 10 04:04:59 2020
(r362002)
+++ head/sys/powerpc/powernv/opal_pci.c Wed Jun 10 04:08:16 2020
(r362003)
@@ -427,7 +427,7 @@ opalpci_attach(device_t dev)
sc->msi_base = msi_ranges[0];
 
sc->msi_vmem = vmem_create("OPAL MSI", msi_ranges[0],
-   msi_ranges[1], 1, 16, M_BESTFIT | M_WAITOK);
+   msi_ranges[1], 1, 0, M_BESTFIT | M_WAITOK);
 
sc->base_msi_irq = powerpc_register_pic(dev,
OF_xref_from_node(node),
___
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: r362002 - head/sys/powerpc/mpc85xx

2020-06-09 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jun 10 04:04:59 2020
New Revision: 362002
URL: https://svnweb.freebsd.org/changeset/base/362002

Log:
  powerpc/mpc85xx: Don't use the quantum cache in vmem for MPIC MSIs
  
  The qcache is unnecessary for this purpose, it's only needed when there are
  lots of concurrent allocations.
  
  Reported by:  markj

Modified:
  head/sys/powerpc/mpc85xx/pci_mpc85xx.c

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Wed Jun 10 03:57:10 2020
(r362001)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Wed Jun 10 04:04:59 2020
(r362002)
@@ -896,7 +896,7 @@ fsl_msi_attach(device_t dev)
sc = device_get_softc(dev);
 
if (msi_vmem == NULL)
-   msi_vmem = vmem_create("MPIC MSI", 0, 0, 1, 1, M_BESTFIT | 
M_WAITOK);
+   msi_vmem = vmem_create("MPIC MSI", 0, 0, 1, 0, M_BESTFIT | 
M_WAITOK);
 
/* Manually play with resource entries. */
sc->sc_base = bus_get_resource_start(dev, SYS_RES_MEMORY, 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362001 - in stable/12/sys: fs/tmpfs sys

2020-06-09 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jun 10 03:57:10 2020
New Revision: 362001
URL: https://svnweb.freebsd.org/changeset/base/362001

Log:
  MFC r361748:
  
  tmpfs: Preserve alignment of struct fid fields
  
  On 64-bit platforms, the two short fields in `struct tmpfs_fid` are padded to
  the 64-bit alignment of the long field.  This pushes the offsets of the
  subsequent fields by 4 bytes and makes `struct tmpfs_fid` bigger than
  `struct fid`.  `tmpfs_vptofh()` casts a `struct fid *` to `struct tmpfs_fid 
*`,
  causing 4 bytes of adjacent memory to be overwritten when the struct fields 
are
  set.  Through several layers of indirection and embedded structs, the adjacent
  memory for one particular call to `tmpfs_vptofh()` happens to be the stack
  canary for `nfsrvd_compound()`.  Half of the canary ends up being clobbered,
  going unnoticed until eventually the stack check fails when 
`nfsrvd_compound()`
  returns and a panic is triggered.
  
  Instead of duplicating fields of `struct fid` in `struct tmpfs_fid`, narrow 
the
  struct to cover only the unique fields for tmpfs and assert at compile time
  that the struct fits in the allotted space.  This way we don't have to
  replicate the offsets of `struct fid` fields, we just use them directly.
  
  Reviewed by:kib, mav, rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25077

Modified:
  stable/12/sys/fs/tmpfs/tmpfs.h
  stable/12/sys/fs/tmpfs/tmpfs_vfsops.c
  stable/12/sys/fs/tmpfs/tmpfs_vnops.c
  stable/12/sys/sys/mount.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/tmpfs/tmpfs.h
==
--- stable/12/sys/fs/tmpfs/tmpfs.h  Wed Jun 10 03:36:17 2020
(r362000)
+++ stable/12/sys/fs/tmpfs/tmpfs.h  Wed Jun 10 03:57:10 2020
(r362001)
@@ -37,6 +37,7 @@
 #ifndef _FS_TMPFS_TMPFS_H_
 #define _FS_TMPFS_TMPFS_H_
 
+#include 
 #include 
 #include 
 
@@ -391,12 +392,12 @@ struct tmpfs_mount {
  * This structure maps a file identifier to a tmpfs node.  Used by the
  * NFS code.
  */
-struct tmpfs_fid {
-   uint16_ttf_len;
-   uint16_ttf_pad;
-   ino_t   tf_id;
-   unsigned long   tf_gen;
+struct tmpfs_fid_data {
+   ino_t   tfd_id;
+   unsigned long   tfd_gen;
 };
+_Static_assert(sizeof(struct tmpfs_fid_data) <= MAXFIDSZ,
+"(struct tmpfs_fid_data) is larger than (struct fid).fid_data");
 
 struct tmpfs_dir_cursor {
struct tmpfs_dirent *tdc_current;

Modified: stable/12/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- stable/12/sys/fs/tmpfs/tmpfs_vfsops.c   Wed Jun 10 03:36:17 2020
(r362000)
+++ stable/12/sys/fs/tmpfs/tmpfs_vfsops.c   Wed Jun 10 03:57:10 2020
(r362001)
@@ -560,24 +560,29 @@ static int
 tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
 struct vnode **vpp)
 {
-   struct tmpfs_fid *tfhp;
+   struct tmpfs_fid_data tfd;
struct tmpfs_mount *tmp;
struct tmpfs_node *node;
int error;
 
+   if (fhp->fid_len != sizeof(tfd))
+   return (EINVAL);
+
+   /*
+* Copy from fid_data onto the stack to avoid unaligned pointer use.
+* See the comment in sys/mount.h on struct fid for details.
+*/
+   memcpy(&tfd, fhp->fid_data, fhp->fid_len);
+
tmp = VFS_TO_TMPFS(mp);
 
-   tfhp = (struct tmpfs_fid *)fhp;
-   if (tfhp->tf_len != sizeof(struct tmpfs_fid))
+   if (tfd.tfd_id >= tmp->tm_nodes_max)
return (EINVAL);
 
-   if (tfhp->tf_id >= tmp->tm_nodes_max)
-   return (EINVAL);
-
TMPFS_LOCK(tmp);
LIST_FOREACH(node, &tmp->tm_nodes_used, tn_entries) {
-   if (node->tn_id == tfhp->tf_id &&
-   node->tn_gen == tfhp->tf_gen) {
+   if (node->tn_id == tfd.tfd_id &&
+   node->tn_gen == tfd.tfd_gen) {
tmpfs_ref_node(node);
break;
}

Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c
==
--- stable/12/sys/fs/tmpfs/tmpfs_vnops.cWed Jun 10 03:36:17 2020
(r362000)
+++ stable/12/sys/fs/tmpfs/tmpfs_vnops.cWed Jun 10 03:57:10 2020
(r362001)
@@ -1410,16 +1410,28 @@ tmpfs_pathconf(struct vop_pathconf_args *v)
 
 static int
 tmpfs_vptofh(struct vop_vptofh_args *ap)
+/*
+vop_vptofh {
+   IN struct vnode *a_vp;
+   IN struct fid *a_fhp;
+};
+*/
 {
-   struct tmpfs_fid *tfhp;
+   struct tmpfs_fid_data tfd;
struct tmpfs_node *node;
+   struct fid *fhp;
 
-   tfhp = (struct tmpfs_fid *)ap->a_fhp;
node = VP_TO_TMPFS_NODE(ap->a_vp);
+   fhp = ap->a_fhp;
+   fhp->fid_len = si

svn commit: r362000 - head/sys/sys

2020-06-09 Thread Doug Moore
Author: dougm
Date: Wed Jun 10 03:36:17 2020
New Revision: 362000
URL: https://svnweb.freebsd.org/changeset/base/362000

Log:
  Fixup r361997 by balancing parens.  Duh.

Modified:
  head/sys/sys/tree.h

Modified: head/sys/sys/tree.h
==
--- head/sys/sys/tree.h Wed Jun 10 03:04:36 2020(r361999)
+++ head/sys/sys/tree.h Wed Jun 10 03:36:17 2020(r362000)
@@ -337,7 +337,7 @@ struct {
\
 #define RB_COLOR(elm, field)   (RB_PARENT(elm, field) == NULL ? 
RB_FALSE : \
RB_LEFT(RB_PARENT(elm, field), 
field) == elm ? \
RB_RED_LF(RB_PARENT(elm, field), 
field) : \
-   RB_RED_RT(RB_PARENT(elm, field), 
field)
+   RB_RED_RT(RB_PARENT(elm, field), 
field))
 
 /*
  * Something to be invoked in a loop at the root of every modified subtree,
___
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: r361997 - head/sys/sys

2020-06-09 Thread Ravi Pokala
Hi Doug,

Shoot, it's still failing, but in a different way:


/usr/home/rpokala/freebsd/dev/base/head/sys/kern/subr_stats.c:3385:14: error: 
expected ')'
qstr);
 ^
/usr/home/rpokala/freebsd/dev/base/head/sys/kern/subr_stats.c:3375:11: note: to 
match this '('
printf(" RB ctd=%3d p=%3d l=%3d r=%3d c=%2d "
  ^
1 error generated.
--- subr_stats.o ---


Thanks,

Ravi (rpokala@)

-Original Message-
From:  on behalf of Doug Moore 

Date: 2020-06-09, Tuesday at 19:50
To: , , 

Subject: svn commit: r361997 - head/sys/sys

Author: dougm
Date: Wed Jun 10 02:50:25 2020
New Revision: 361997
URL: https://svnweb.freebsd.org/changeset/base/361997

Log:
  Restore an RB_COLOR macro, for the benefit of a bit of DIAGNOSTIC code
  that depends on it.

  Reported by:  rpokala, mjguzik
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D25204

Modified:
  head/sys/sys/tree.h

Modified: head/sys/sys/tree.h

==
--- head/sys/sys/tree.h Wed Jun 10 01:32:13 2020(r361996)
+++ head/sys/sys/tree.h Wed Jun 10 02:50:25 2020(r361997)
@@ -333,6 +333,12 @@ struct {   
\
 #define RB_TRUE1
 #define RB_FALSE   0

+/* For debugging support */
+#define RB_COLOR(elm, field)   (RB_PARENT(elm, field) == NULL 
? RB_FALSE : \
+   RB_LEFT(RB_PARENT(elm, field), 
field) == elm ? \
+   RB_RED_LF(RB_PARENT(elm, field), 
field) : \
+   RB_RED_RT(RB_PARENT(elm, field), 
field)
+
 /*
  * Something to be invoked in a loop at the root of every modified subtree,
  * from the bottom up to the root, to update augmented node data.


___
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: r361999 - head/lib/libc/tests/gen

2020-06-09 Thread Kyle Evans
Author: kevans
Date: Wed Jun 10 03:04:36 2020
New Revision: 361999
URL: https://svnweb.freebsd.org/changeset/base/361999

Log:
  Add missing shell script from r361995
  
  Pointy hat:   kevans
  Reported by:  rpokala
  X-MFC-With:   r361995

Added:
  head/lib/libc/tests/gen/spawnp_enoexec.sh   (contents, props changed)

Added: head/lib/libc/tests/gen/spawnp_enoexec.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/tests/gen/spawnp_enoexec.sh   Wed Jun 10 03:04:36 2020
(r361999)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+# Intentionally no interpreter
+
+exit 42
___
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: r361998 - in head/sys: kern sys

2020-06-09 Thread Rick Macklem
Author: rmacklem
Date: Wed Jun 10 02:51:39 2020
New Revision: 361998
URL: https://svnweb.freebsd.org/changeset/base/361998

Log:
  Add two functions that create M_EXTPG mbufs with anonymous pages.
  
  These two functions are needed by nfs-over-tls, but could also be
  useful for other purposes.
  mb_alloc_ext_plus_pages() - Allocates a M_EXTPG mbuf and enough anonymous
pages to store "len" data bytes.
  mb_mapped_to_unmapped() - Copies the data from a list of mapped (non-M_EXTPG)
mbufs into a list of M_EXTPG mbufs allocated with anonymous pages.
This is roughly the inverse of mb_unmapped_to_ext().
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D25182

Modified:
  head/sys/kern/kern_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Wed Jun 10 02:50:25 2020(r361997)
+++ head/sys/kern/kern_mbuf.c   Wed Jun 10 02:51:39 2020(r361998)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1536,4 +1537,105 @@ m_snd_tag_destroy(struct m_snd_tag *mst)
ifp->if_snd_tag_free(mst);
if_rele(ifp);
counter_u64_add(snd_tag_count, -1);
+}
+
+/*
+ * Allocate an mbuf with anonymous external pages.
+ */
+struct mbuf *
+mb_alloc_ext_plus_pages(int len, int how)
+{
+   struct mbuf *m;
+   vm_page_t pg;
+   int i, npgs;
+
+   m = mb_alloc_ext_pgs(how, mb_free_mext_pgs);
+   if (m == NULL)
+   return (NULL);
+   m->m_epg_flags |= EPG_FLAG_ANON;
+   npgs = howmany(len, PAGE_SIZE);
+   for (i = 0; i < npgs; i++) {
+   do {
+   pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL |
+   VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | VM_ALLOC_WIRED);
+   if (pg == NULL) {
+   if (how == M_NOWAIT) {
+   m->m_epg_npgs = i;
+   m_free(m);
+   return (NULL);
+   }
+   vm_wait(NULL);
+   }
+   } while (pg == NULL);
+   m->m_epg_pa[i] = VM_PAGE_TO_PHYS(pg);
+   }
+   m->m_epg_npgs = npgs;
+   return (m);
+}
+
+/*
+ * Copy the data in the mbuf chain to a chain of mbufs with anonymous external
+ * unmapped pages.
+ * len is the length of data in the input mbuf chain.
+ * mlen is the maximum number of bytes put into each ext_page mbuf.
+ */
+struct mbuf *
+mb_mapped_to_unmapped(struct mbuf *mp, int len, int mlen, int how,
+struct mbuf **mlast)
+{
+   struct mbuf *m, *mout;
+   char *pgpos, *mbpos;
+   int i, mblen, mbufsiz, pglen, xfer;
+
+   if (len == 0)
+   return (NULL);
+   mbufsiz = min(mlen, len);
+   m = mout = mb_alloc_ext_plus_pages(mbufsiz, how);
+   if (m == NULL)
+   return (m);
+   pgpos = (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[0]);
+   pglen = PAGE_SIZE;
+   mblen = 0;
+   i = 0;
+   do {
+   if (pglen == 0) {
+   if (++i == m->m_epg_npgs) {
+   m->m_epg_last_len = PAGE_SIZE;
+   mbufsiz = min(mlen, len);
+   m->m_next = mb_alloc_ext_plus_pages(mbufsiz,
+   how);
+   m = m->m_next;
+   if (m == NULL) {
+   m_freem(mout);
+   return (m);
+   }
+   i = 0;
+   }
+   pgpos = (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[i]);
+   pglen = PAGE_SIZE;
+   }
+   while (mblen == 0) {
+   if (mp == NULL) {
+   m_freem(mout);
+   return (NULL);
+   }
+   KASSERT((mp->m_flags & M_EXTPG) == 0,
+   ("mb_copym_ext_pgs: ext_pgs input mbuf"));
+   mbpos = mtod(mp, char *);
+   mblen = mp->m_len;
+   mp = mp->m_next;
+   }
+   xfer = min(mblen, pglen);
+   memcpy(pgpos, mbpos, xfer);
+   pgpos += xfer;
+   mbpos += xfer;
+   pglen -= xfer;
+   mblen -= xfer;
+   len -= xfer;
+   m->m_len += xfer;
+   } while (len > 0);
+   m->m_epg_last_len = PAGE_SIZE - pglen;
+   if (mlast != NULL)
+   *mlast = m;
+   return (mout);
 }

Modified: head/sys/sys/mbuf.h
==

svn commit: r361997 - head/sys/sys

2020-06-09 Thread Doug Moore
Author: dougm
Date: Wed Jun 10 02:50:25 2020
New Revision: 361997
URL: https://svnweb.freebsd.org/changeset/base/361997

Log:
  Restore an RB_COLOR macro, for the benefit of a bit of DIAGNOSTIC code
  that depends on it.
  
  Reported by:  rpokala, mjguzik
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D25204

Modified:
  head/sys/sys/tree.h

Modified: head/sys/sys/tree.h
==
--- head/sys/sys/tree.h Wed Jun 10 01:32:13 2020(r361996)
+++ head/sys/sys/tree.h Wed Jun 10 02:50:25 2020(r361997)
@@ -333,6 +333,12 @@ struct {   
\
 #define RB_TRUE1
 #define RB_FALSE   0
 
+/* For debugging support */
+#define RB_COLOR(elm, field)   (RB_PARENT(elm, field) == NULL ? 
RB_FALSE : \
+   RB_LEFT(RB_PARENT(elm, field), 
field) == elm ? \
+   RB_RED_LF(RB_PARENT(elm, field), 
field) : \
+   RB_RED_RT(RB_PARENT(elm, field), 
field)
+
 /*
  * Something to be invoked in a loop at the root of every modified subtree,
  * from the bottom up to the root, to update augmented node data.
___
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: r361996 - head/lib/libc/gen

2020-06-09 Thread Kyle Evans
Author: kevans
Date: Wed Jun 10 01:32:13 2020
New Revision: 361996
URL: https://svnweb.freebsd.org/changeset/base/361996

Log:
  execvPe: obviate the need for potentially large stack allocations
  
  Some environments in which execvPe may be called have a limited amount of
  stack available. Currently, it avoidably allocates a segment on the stack
  large enough to hold PATH so that it may be mutated and use strsep() for
  easy parsing. This logic is now rewritten to just operate on the immutable
  string passed in and do the necessary math to extract individual paths,
  since it will be copying out those segments to another buffer anyways and
  piecing them together with the name for a full path.
  
  Additional size is also needed for the stack in posix_spawnp(), because it
  may need to push all of argv to the stack and rebuild the command with sh in
  front of it. We'll make sure it's properly aligned for the new thread, but
  future work should likely make rfork_thread a little easier to use by
  ensuring proper alignment.
  
  Some trivial cleanup has been done with a couple of error writes, moving
  strings into char arrays for use with the less fragile sizeof().
  
  Reported by:  Andrew Gierth 
  Reviewed by:  jilles, kib, Andrew Gierth
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25038

Modified:
  head/lib/libc/gen/exec.c
  head/lib/libc/gen/posix_spawn.c

Modified: head/lib/libc/gen/exec.c
==
--- head/lib/libc/gen/exec.cWed Jun 10 01:30:37 2020(r361995)
+++ head/lib/libc/gen/exec.cWed Jun 10 01:32:13 2020(r361996)
@@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$");
 
 extern char **environ;
 
+static const char execvPe_err_preamble[] = "execvP: ";
+static const char execvPe_err_trailer[] = ": path too long\n";
+
 int
 execl(const char *name, const char *arg, ...)
 {
@@ -149,8 +152,8 @@ execvPe(const char *name, const char *path, char * con
const char **memp;
size_t cnt, lp, ln;
int eacces, save_errno;
-   char *cur, buf[MAXPATHLEN];
-   const char *p, *bp;
+   char buf[MAXPATHLEN];
+   const char *bp, *np, *op, *p;
struct stat sb;
 
eacces = 0;
@@ -158,7 +161,7 @@ execvPe(const char *name, const char *path, char * con
/* If it's an absolute or relative path name, it's easy. */
if (strchr(name, '/')) {
bp = name;
-   cur = NULL;
+   op = NULL;
goto retry;
}
bp = buf;
@@ -169,34 +172,42 @@ execvPe(const char *name, const char *path, char * con
return (-1);
}
 
-   cur = alloca(strlen(path) + 1);
-   if (cur == NULL) {
-   errno = ENOMEM;
-   return (-1);
-   }
-   strcpy(cur, path);
-   while ((p = strsep(&cur, ":")) != NULL) {
+   op = path;
+   ln = strlen(name);
+   while (op != NULL) {
+   np = strchrnul(op, ':');
+
/*
 * It's a SHELL path -- double, leading and trailing colons
 * mean the current directory.
 */
-   if (*p == '\0') {
+   if (np == op) {
+   /* Empty component. */
p = ".";
lp = 1;
-   } else
-   lp = strlen(p);
-   ln = strlen(name);
+   } else {
+   /* Non-empty component. */
+   p = op;
+   lp = np - op;
+   }
 
+   /* Advance to the next component or terminate after this. */
+   if (*np == '\0')
+   op = NULL;
+   else
+   op = np + 1;
+
/*
 * If the path is too long complain.  This is a possible
 * security issue; given a way to make the path too long
 * the user may execute the wrong program.
 */
if (lp + ln + 2 > sizeof(buf)) {
-   (void)_write(STDERR_FILENO, "execvP: ", 8);
+   (void)_write(STDERR_FILENO, execvPe_err_preamble,
+   sizeof(execvPe_err_preamble) - 1);
(void)_write(STDERR_FILENO, p, lp);
-   (void)_write(STDERR_FILENO, ": path too long\n",
-   16);
+   (void)_write(STDERR_FILENO, execvPe_err_trailer,
+   sizeof(execvPe_err_trailer) - 1);
continue;
}
bcopy(p, buf, lp);

Modified: head/lib/libc/gen/posix_spawn.c
==
--- head/lib/libc/gen/posix_spawn.c Wed Jun 10 01:30:37 2020
(r361995)
+++ head/lib/libc/gen/posix_spawn.c Wed Jun 10 01:32:

svn commit: r361995 - in head/lib/libc: gen tests/gen

2020-06-09 Thread Kyle Evans
Author: kevans
Date: Wed Jun 10 01:30:37 2020
New Revision: 361995
URL: https://svnweb.freebsd.org/changeset/base/361995

Log:
  execvp: fix up the ENOEXEC fallback
  
  If execve fails with ENOEXEC, execvp is expected to rebuild the command
  with /bin/sh instead and try again.
  
  The previous version did this, but overlooked two details:
  
  argv[0] can conceivably be NULL, in which case memp would never get
  terminated.  We must allocate no less than three * sizeof(char *) so we can
  properly terminate at all times. For the non-NULL argv standard case, we
  count all the non-NULL elements and actually skip the first argument, so we
  end up capturing the NULL terminator in our bcopy().
  
  The second detail is that the spec is actually worded such that we should
  have been preserving argv[0] as passed to execvp:
  
  "[...] executed command shall be as if the process invoked the sh utility
  using execl() as follows:
  
  execl(, arg0, file, arg1, ..., (char *)0);
  
  where  is an unspecified pathname for the sh utility, file is
  the process image file, and for execvp(), where arg0, arg1, and so on
  correspond to the values passed to execvp() in argv[0], argv[1], and so on."
  
  So we make this change at this time as well, while we're already touching
  it. We decidedly can't preserve a NULL argv[0] as this would be incredibly,
  incredibly fragile, so we retain our legacy behavior of using "sh" for
  argv[] in this specific instance.
  
  Some light tests are added to try and detect some components of handling the
  ENOEXEC fallback; posix_spawnp_enoexec_fallback_null_argv0 is likely not
  100% reliable, but it at least won't raise false-alarms and it did result in
  useful failures with pre-change libc on my machine.
  
  This is a secondary change in D25038.
  
  Reported by:  Andrew Gierth 
  Reviewed by:  jilles, kib, Andrew Gierth
  MFC after:1 week

Modified:
  head/lib/libc/gen/exec.c
  head/lib/libc/tests/gen/Makefile
  head/lib/libc/tests/gen/posix_spawn_test.c

Modified: head/lib/libc/gen/exec.c
==
--- head/lib/libc/gen/exec.cWed Jun 10 00:09:31 2020(r361994)
+++ head/lib/libc/gen/exec.cWed Jun 10 01:30:37 2020(r361995)
@@ -215,14 +215,28 @@ retry:(void)_execve(bp, argv, envp);
case ENOEXEC:
for (cnt = 0; argv[cnt]; ++cnt)
;
-   memp = alloca((cnt + 2) * sizeof(char *));
+
+   /*
+* cnt may be 0 above; always allocate at least
+* 3 entries so that we can at least fit "sh", bp, and
+* the NULL terminator.  We can rely on cnt to take into
+* account the NULL terminator in all other scenarios,
+* as we drop argv[0].
+*/
+   memp = alloca(MAX(3, cnt + 2) * sizeof(char *));
if (memp == NULL) {
/* errno = ENOMEM; XXX override ENOEXEC? */
goto done;
}
-   memp[0] = "sh";
-   memp[1] = bp;
-   bcopy(argv + 1, memp + 2, cnt * sizeof(char *));
+   if (cnt > 0) {
+   memp[0] = argv[0];
+   memp[1] = bp;
+   bcopy(argv + 1, memp + 2, cnt * sizeof(char *));
+   } else {
+   memp[0] = "sh";
+   memp[1] = bp;
+   memp[2] = NULL;
+   }
(void)_execve(_PATH_BSHELL,
__DECONST(char **, memp), envp);
goto done;

Modified: head/lib/libc/tests/gen/Makefile
==
--- head/lib/libc/tests/gen/MakefileWed Jun 10 00:09:31 2020
(r361994)
+++ head/lib/libc/tests/gen/MakefileWed Jun 10 01:30:37 2020
(r361995)
@@ -24,6 +24,15 @@ ATF_TESTS_C+=wordexp_test
 # TODO: t_siginfo (fixes require further inspection)
 # TODO: t_sethostname_test (consistently screws up the hostname)
 
+FILESGROUPS+=  posix_spawn_test_FILES
+
+posix_spawn_test_FILES=spawnp_enoexec.sh
+posix_spawn_test_FILESDIR= ${TESTSDIR}
+posix_spawn_test_FILESMODE= 0755
+posix_spawn_test_FILESOWN= root
+posix_spawn_test_FILESGRP= wheel
+posix_spawn_test_FILESPACKAGE= ${PACKAGE}
+
 CFLAGS+=   -DTEST_LONG_DOUBLE
 
 # Not sure why this isn't defined for all architectures, since most

Modified: head/lib/libc/tests/gen/posix_spawn_test.c
==
--- head/lib/libc/tests/gen/posix_spawn_test.c  Wed Jun 10 0

Re: svn commit: r361994 - in head/sys/mips: cavium/cryptocteon nlm/dev/sec

2020-06-09 Thread Kyle Evans
On Tue, Jun 9, 2020 at 7:09 PM John Baldwin  wrote:
>
> Author: jhb
> Date: Wed Jun 10 00:09:31 2020
> New Revision: 361994
> URL: https://svnweb.freebsd.org/changeset/base/361994
>
> Log:
>   Add some default cases for unreachable code to silence compiler warnings.
>
>   This was caused by r361481 when the buffer type was changed from an
>   int to an enum.
>
>   Reported by:  mjg, rpokala
>   Sponsored by: Chelsio Communications
>
> Modified:
>   head/sys/mips/cavium/cryptocteon/cryptocteon.c
>   head/sys/mips/nlm/dev/sec/nlmseclib.c
>
> Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c
> ==
> --- head/sys/mips/cavium/cryptocteon/cryptocteon.c  Tue Jun  9 23:03:48 
> 2020(r361993)
> +++ head/sys/mips/cavium/cryptocteon/cryptocteon.c  Wed Jun 10 00:09:31 
> 2020(r361994)
> @@ -323,6 +323,8 @@ cryptocteon_process(device_t dev, struct cryptop *crp,
> goto done;
> }
> break;
> +   default:
> +   break;
> }
>
> if (csp->csp_cipher_alg != 0) {
>

This one could kind of looks like it should also be an
__assert_unreachable(), and perhaps this bit not too long later:

case CRYPTO_BUF_CONTIG:
iovlen = crp->crp_buf.cb_buf_len;
od->octo_iov[0].iov_base = crp->crp_buf.cb_buf;
od->octo_iov[0].iov_len = crp->crp_buf.cb_buf_len
iovcnt = 1;
break;
default:
-panic("can't happen");
+__assert_unreachable();
   }
___
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: r361994 - in head/sys/mips: cavium/cryptocteon nlm/dev/sec

2020-06-09 Thread John Baldwin
Author: jhb
Date: Wed Jun 10 00:09:31 2020
New Revision: 361994
URL: https://svnweb.freebsd.org/changeset/base/361994

Log:
  Add some default cases for unreachable code to silence compiler warnings.
  
  This was caused by r361481 when the buffer type was changed from an
  int to an enum.
  
  Reported by:  mjg, rpokala
  Sponsored by: Chelsio Communications

Modified:
  head/sys/mips/cavium/cryptocteon/cryptocteon.c
  head/sys/mips/nlm/dev/sec/nlmseclib.c

Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c
==
--- head/sys/mips/cavium/cryptocteon/cryptocteon.c  Tue Jun  9 23:03:48 
2020(r361993)
+++ head/sys/mips/cavium/cryptocteon/cryptocteon.c  Wed Jun 10 00:09:31 
2020(r361994)
@@ -323,6 +323,8 @@ cryptocteon_process(device_t dev, struct cryptop *crp,
goto done;
}
break;
+   default:
+   break;
}
 
if (csp->csp_cipher_alg != 0) {

Modified: head/sys/mips/nlm/dev/sec/nlmseclib.c
==
--- head/sys/mips/nlm/dev/sec/nlmseclib.c   Tue Jun  9 23:03:48 2020
(r361993)
+++ head/sys/mips/nlm/dev/sec/nlmseclib.c   Wed Jun 10 00:09:31 2020
(r361994)
@@ -157,6 +157,8 @@ nlm_crypto_form_srcdst_segs(struct xlp_sec_command *cm
crp->crp_buf.cb_buf, crp->crp_buf.cb_buf_len);
}
break;
+   default:
+   __assert_unreachable();
}
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2020-06-09 Thread Mateusz Guzik
Author: mjg
Date: Tue Jun  9 23:03:48 2020
New Revision: 361993
URL: https://svnweb.freebsd.org/changeset/base/361993

Log:
  cred: distribute reference count per thread
  
  This avoids dirtying creds in the common case, see the comment in kern_prot.c
  for details.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D24007

Modified:
  head/sys/kern/init_main.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_prot.c
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h
  head/sys/sys/ucred.h

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Tue Jun  9 22:42:54 2020(r361992)
+++ head/sys/kern/init_main.c   Tue Jun  9 23:03:48 2020(r361993)
@@ -541,7 +541,10 @@ proc0_init(void *dummy __unused)
/* End hack. creds get properly set later with thread_cow_get_proc */
curthread->td_ucred = NULL;
newcred->cr_prison = &prison0;
+   newcred->cr_users++; /* avoid assertion failure */
proc_set_cred_init(p, newcred);
+   newcred->cr_users--;
+   crfree(newcred);
 #ifdef AUDIT
audit_cred_kproc0(newcred);
 #endif
@@ -810,8 +813,9 @@ create_init(const void *udata __unused)
 #endif
proc_set_cred(initproc, newcred);
td = FIRST_THREAD_IN_PROC(initproc);
-   crfree(td->td_ucred);
-   td->td_ucred = crhold(initproc->p_ucred);
+   crcowfree(td);
+   td->td_realucred = crcowget(initproc->p_ucred);
+   td->td_ucred = td->td_realucred;
PROC_UNLOCK(initproc);
sx_xunlock(&proctree_lock);
crfree(oldcred);

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Tue Jun  9 22:42:54 2020(r361992)
+++ head/sys/kern/kern_fork.c   Tue Jun  9 23:03:48 2020(r361993)
@@ -961,7 +961,7 @@ fork1(struct thread *td, struct fork_req *fr)
 * XXX: This is ugly; when we copy resource usage, we need to bump
 *  per-cred resource counters.
 */
-   proc_set_cred_init(newproc, crhold(td->td_ucred));
+   proc_set_cred_init(newproc, td->td_ucred);
 
/*
 * Initialize resource accounting for the child process.
@@ -998,8 +998,7 @@ fail0:
 #endif
racct_proc_exit(newproc);
 fail1:
-   crfree(newproc->p_ucred);
-   newproc->p_ucred = NULL;
+   proc_unset_cred(newproc);
 fail2:
if (vm2 != NULL)
vmspace_free(vm2);

Modified: head/sys/kern/kern_prot.c
==
--- head/sys/kern/kern_prot.c   Tue Jun  9 22:42:54 2020(r361992)
+++ head/sys/kern/kern_prot.c   Tue Jun  9 23:03:48 2020(r361993)
@@ -1841,6 +1841,98 @@ p_canwait(struct thread *td, struct proc *p)
 }
 
 /*
+ * Credential management.
+ *
+ * struct ucred objects are rarely allocated but gain and lose references all
+ * the time (e.g., on struct file alloc/dealloc) turning refcount updates into
+ * a significant source of cache-line ping ponging. Common cases are worked
+ * around by modifying thread-local counter instead if the cred to operate on
+ * matches td_realucred.
+ *
+ * The counter is split into 2 parts:
+ * - cr_users -- total count of all struct proc and struct thread objects
+ *   which have given cred in p_ucred and td_ucred respectively
+ * - cr_ref -- the actual ref count, only valid if cr_users == 0
+ *
+ * If users == 0 then cr_ref behaves similarly to refcount(9), in particular if
+ * the count reaches 0 the object is freeable.
+ * If users > 0 and curthread->td_realucred == cred, then updates are performed
+ * against td_ucredref.
+ * In other cases updates are performed against cr_ref.
+ *
+ * Changing td_realucred into something else decrements cr_users and transfers
+ * accumulated updates.
+ */
+struct ucred *
+crcowget(struct ucred *cr)
+{
+
+   mtx_lock(&cr->cr_mtx);
+   KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p",
+   __func__, cr->cr_users, cr));
+   cr->cr_users++;
+   cr->cr_ref++;
+   mtx_unlock(&cr->cr_mtx);
+   return (cr);
+}
+
+static struct ucred *
+crunuse(struct thread *td)
+{
+   struct ucred *cr, *crold;
+
+   cr = td->td_ucred;
+   mtx_lock(&cr->cr_mtx);
+   cr->cr_ref += td->td_ucredref;
+   td->td_ucredref = 0;
+   KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p",
+   __func__, cr->cr_users, cr));
+   cr->cr_users--;
+   if (cr->cr_users == 0) {
+   KASSERT(cr->cr_ref > 0, ("%s: ref %d not > 0 on cred %p",
+   __func__, cr->cr_ref, cr));
+   crold = cr;
+   } else {
+   cr->cr_ref--;
+   crold = NULL;
+   }
+   mtx_unlock(&cr->cr_mtx);
+   return (crold);
+}
+
+void
+crcowfree(struct thread *td)
+{
+   struct ucred *cr;
+
+   cr = crunuse(td);
+

Re: svn commit: r361984 - in head/sys: compat/linuxkpi/common/include/linux sys

2020-06-09 Thread Mateusz Guzik
This broke lint kernels as they define DIAGNOSTIC and fail in kern/subr_stat.c:

/usr/src/sys/kern/subr_stats.c:3384:9: error: implicit declaration of
function 'RB_COLOR' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
RB_COLOR(rbctd64, rblnk),
^
/usr/src/sys/kern/subr_stats.c:3384:27: error: use of undeclared
identifier 'rblnk'
RB_COLOR(rbctd64, rblnk),


On 6/9/20, Doug Moore  wrote:
> Author: dougm
> Date: Tue Jun  9 20:19:11 2020
> New Revision: 361984
> URL: https://svnweb.freebsd.org/changeset/base/361984
>
> Log:
>   To reduce the size of an rb_node, drop the color field. Set the least
>   significant bit in the pointer to the node from its parent to indicate
>   that the node is red. Have the tree rotation macros leave the
>   old-parent/new-child node red and the new-parent/old-child node black.
>
>   This change makes RB_LEFT and RB_RIGHT no longer assignable, and
>   RB_COLOR no longer defined. Any code that modifies the tree or
>   examines a node color would have to be modified after this change.
>
>   Reviewed by:markj
>   Tested by:  pho
>   Differential Revision:  https://reviews.freebsd.org/D25105
>
> Modified:
>   head/sys/compat/linuxkpi/common/include/linux/rbtree.h
>   head/sys/sys/tree.h
>
> Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h
> ==
> --- head/sys/compat/linuxkpi/common/include/linux/rbtree.hTue Jun  9
> 19:16:49 2020 (r361983)
> +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.hTue Jun  9
> 20:19:11 2020 (r361984)
> @@ -57,11 +57,7 @@ RB_HEAD(linux_root, rb_node);
>  RB_PROTOTYPE(linux_root, rb_node, __entry, panic_cmp);
>
>  #define  rb_parent(r)RB_PARENT(r, __entry)
> -#define  rb_color(r) RB_COLOR(r, __entry)
> -#define  rb_is_red(r)(rb_color(r) == RB_RED)
> -#define  rb_is_black(r)  (rb_color(r) == RB_BLACK)
>  #define  rb_set_parent(r, p) rb_parent((r)) = (p)
> -#define  rb_set_color(r, c)  rb_color((r)) = (c)
>  #define  rb_entry(ptr, type, member) container_of(ptr, type, member)
>
>  #define RB_EMPTY_ROOT(root) RB_EMPTY((struct linux_root *)root)
> @@ -82,7 +78,6 @@ rb_link_node(struct rb_node *node, struct rb_node *par
>  struct rb_node **rb_link)
>  {
>   rb_set_parent(node, parent);
> - rb_set_color(node, RB_RED);
>   node->__entry.rbe_left = node->__entry.rbe_right = NULL;
>   *rb_link = node;
>  }
>
> Modified: head/sys/sys/tree.h
> ==
> --- head/sys/sys/tree.h   Tue Jun  9 19:16:49 2020(r361983)
> +++ head/sys/sys/tree.h   Tue Jun  9 20:19:11 2020(r361984)
> @@ -307,35 +307,32 @@ struct name {   
> \
>   (root)->rbh_root = NULL;\
>  } while (/*CONSTCOND*/ 0)
>
> -#define RB_BLACK 0
> -#define RB_RED   1
>  #define RB_ENTRY(type)   
> \
>  struct { \
>   struct type *rbe_left;  /* left element */  \
>   struct type *rbe_right; /* right element */ \
>   struct type *rbe_parent;/* parent element */\
> - int rbe_color;  /* node color */\
>  }
>
> -#define RB_LEFT(elm, field)  (elm)->field.rbe_left
> -#define RB_RIGHT(elm, field) (elm)->field.rbe_right
> +#define RB_LF(elm, field)(elm)->field.rbe_left
> +#define RB_RT(elm, field)(elm)->field.rbe_right
> +#define RB_FLIP(elm) (*(__uintptr_t *)&(elm) ^= 1)
> +#define RB_FLIP_LF(elm, field)   RB_FLIP(RB_LF(elm, field))
> +#define RB_FLIP_RT(elm, field)   RB_FLIP(RB_RT(elm, field))
> +#define RB_ISRED(elm)((*(__uintptr_t *)&(elm) & 1) 
> != 0)
> +#define RB_RED_LF(elm, field)RB_ISRED(RB_LF(elm, field))
> +#define RB_RED_RT(elm, field)RB_ISRED(RB_RT(elm, field))
> +#define RB_PTR(elm, field)   ((__typeof(elm->field.rbe_parent)) \
> +  ((__uintptr_t)(elm) & ~(__uintptr_t)1))
> +#define RB_LEFT(elm, field)  RB_PTR(RB_LF(elm, field), field)
> +#define RB_RIGHT(elm, field) RB_PTR(RB_RT(elm, field), field)
>  #define RB_PARENT(elm, field)(elm)->field.rbe_parent
> -#define RB_COLOR(elm, field) (elm)->field.rbe_color
> -#define RB_ISRED(elm, field) ((elm) != NULL && RB_COLOR(elm, field) 
> ==
> RB_RED)
>  #define RB_ROOT(head)(head)->rbh_root
>  #define RB_EMPTY(head)   (RB_ROOT(head) == NULL)
> +#define RB_BOOL  

svn commit: r361992 - in head/sys: conf dev/ixl modules/ixl

2020-06-09 Thread Eric Joyner
Author: erj
Date: Tue Jun  9 22:42:54 2020
New Revision: 361992
URL: https://svnweb.freebsd.org/changeset/base/361992

Log:
  ixl(4): Add FW recovery mode support and other things
  
  Update the iflib version of ixl driver based on the OOT version ixl-1.11.29.
  
  Major changes:
  
  - Extract iflib specific functions from ixl_pf_main.c to ixl_pf_iflib.c
to simplify code sharing between legacy and iflib version of driver
  
  - Add support for most recent FW API version (1.10), which extends FW
LLDP Agent control by user to X722 devices
  
  - Improve handling of device global reset
  
  - Add support for the FW recovery mode
  
  - Use virtchnl function to validate virtual channel messages instead of
using separate checks
  
  - Fix MAC/VLAN filters accounting
  
  Submitted by: Krzysztof Galazka 
  Reviewed by:  erj@
  Tested by:Jeffrey Pieper 
  MFC after:1 week
  Relnotes: yes
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D24564

Added:
  head/sys/dev/ixl/ixl_pf_iflib.c   (contents, props changed)
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.powerpc
  head/sys/dev/ixl/i40e_adminq.c
  head/sys/dev/ixl/i40e_adminq_cmd.h
  head/sys/dev/ixl/i40e_common.c
  head/sys/dev/ixl/i40e_dcb.c
  head/sys/dev/ixl/i40e_dcb.h
  head/sys/dev/ixl/i40e_devids.h
  head/sys/dev/ixl/i40e_lan_hmc.c
  head/sys/dev/ixl/i40e_nvm.c
  head/sys/dev/ixl/i40e_osdep.c
  head/sys/dev/ixl/i40e_prototype.h
  head/sys/dev/ixl/i40e_register.h
  head/sys/dev/ixl/i40e_type.h
  head/sys/dev/ixl/if_iavf.c
  head/sys/dev/ixl/if_ixl.c
  head/sys/dev/ixl/ixl.h
  head/sys/dev/ixl/ixl_pf.h
  head/sys/dev/ixl/ixl_pf_i2c.c
  head/sys/dev/ixl/ixl_pf_iov.c
  head/sys/dev/ixl/ixl_pf_main.c
  head/sys/dev/ixl/ixl_txrx.c
  head/sys/modules/ixl/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Jun  9 22:26:07 2020(r361991)
+++ head/sys/conf/files.amd64   Tue Jun  9 22:42:54 2020(r361992)
@@ -196,6 +196,8 @@ dev/ixl/if_ixl.coptionalixl pci \
compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/ixl_pf_main.c  optionalixl pci \
compile-with "${NORMAL_C} -I$S/dev/ixl"
+dev/ixl/ixl_pf_iflib.c optionalixl pci \
+   compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/ixl_pf_qmgr.c  optionalixl pci \
compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/ixl_pf_iov.c   optionalixl pci  pci_iov \

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Tue Jun  9 22:26:07 2020(r361991)
+++ head/sys/conf/files.powerpc Tue Jun  9 22:42:54 2020(r361992)
@@ -41,6 +41,8 @@ dev/ixl/if_ixl.c  optionalixl pci 
powerpc64 \
compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/ixl_pf_main.c  optionalixl pci powerpc64 \
compile-with "${NORMAL_C} -I$S/dev/ixl"
+dev/ixl/ixl_pf_iflib.c optionalixl pci powerpc64 \
+   compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/ixl_pf_qmgr.c  optionalixl pci powerpc64 \
compile-with "${NORMAL_C} -I$S/dev/ixl"
 dev/ixl/ixl_pf_iov.c   optionalixl pci pci_iov powerpc64 \

Modified: head/sys/dev/ixl/i40e_adminq.c
==
--- head/sys/dev/ixl/i40e_adminq.c  Tue Jun  9 22:26:07 2020
(r361991)
+++ head/sys/dev/ixl/i40e_adminq.c  Tue Jun  9 22:42:54 2020
(r361992)
@@ -125,6 +125,7 @@ enum i40e_status_code i40e_alloc_adminq_arq_ring(struc
  **/
 void i40e_free_adminq_asq(struct i40e_hw *hw)
 {
+   i40e_free_virt_mem(hw, &hw->aq.asq.cmd_buf);
i40e_free_dma_mem(hw, &hw->aq.asq.desc_buf);
 }
 
@@ -404,7 +405,7 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw
/* initialize base registers */
ret_code = i40e_config_asq_regs(hw);
if (ret_code != I40E_SUCCESS)
-   goto init_adminq_free_rings;
+   goto init_config_regs;
 
/* success! */
hw->aq.asq.count = hw->aq.num_asq_entries;
@@ -412,7 +413,11 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw
 
 init_adminq_free_rings:
i40e_free_adminq_asq(hw);
+   return ret_code;
 
+init_config_regs:
+   i40e_free_asq_bufs(hw);
+
 init_adminq_exit:
return ret_code;
 }
@@ -563,6 +568,70 @@ static void i40e_resume_aq(struct i40e_hw *hw)
 }
 
 /**
+ *  i40e_set_hw_flags - set HW flags
+ *  @hw: pointer to the hardware structure
+ **/
+static void i40e_set_hw_flags(struct i40e_hw *hw)
+{
+   struct i40e_adminq_info *aq = &hw->aq;
+
+   hw->flags = 0;
+
+   switch (hw->mac.type) {
+   case I40E_MAC_XL710:
+   if (aq->api_maj_ver > 1 ||
+   (aq->api_maj_v

svn commit: r361991 - in head: share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/via sys/geom/eli sys/mips/cavium/cryptocteon sys/opencrypto

2020-06-09 Thread John Baldwin
Author: jhb
Date: Tue Jun  9 22:26:07 2020
New Revision: 361991
URL: https://svnweb.freebsd.org/changeset/base/361991

Log:
  Add a crypto capability flag for accelerated software drivers.
  
  Use this in GELI to print out a different message when accelerated
  software such as AESNI is used vs plain software crypto.
  
  While here, simplify the logic in GELI a bit for determing which type
  of crypto driver was chosen the first time by examining the
  capabilities of the matched driver after a single call to
  crypto_newsession rather than making separate calls with different
  flags.
  
  Reviewed by:  delphij
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25126

Modified:
  head/share/man/man9/crypto_driver.9
  head/sys/crypto/aesni/aesni.c
  head/sys/crypto/armv8/armv8_crypto.c
  head/sys/crypto/blake2/blake2_cryptodev.c
  head/sys/crypto/via/padlock.c
  head/sys/geom/eli/g_eli.c
  head/sys/geom/eli/g_eli.h
  head/sys/mips/cavium/cryptocteon/cryptocteon.c
  head/sys/opencrypto/cryptodev.h

Modified: head/share/man/man9/crypto_driver.9
==
--- head/share/man/man9/crypto_driver.9 Tue Jun  9 22:19:36 2020
(r361990)
+++ head/share/man/man9/crypto_driver.9 Tue Jun  9 22:26:07 2020
(r361991)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 25, 2020
+.Dd June 9, 2020
 .Dt CRYPTO_DRIVER 9
 .Os
 .Sh NAME
@@ -113,6 +113,8 @@ should be used for drivers which process requests on s
 .Dv CRYPTOCAP_F_SYNC
 should be set for drivers which process requests synchronously in
 .Fn CRYPTODEV_PROCESS .
+.Dv CRYPTOCAP_F_ACCEL_SOFTWARE
+should be set for software drivers which use accelerated CPU instructions.
 .Fn crypto_get_driverid
 returns an opaque driver id.
 .Pp

Modified: head/sys/crypto/aesni/aesni.c
==
--- head/sys/crypto/aesni/aesni.c   Tue Jun  9 22:19:36 2020
(r361990)
+++ head/sys/crypto/aesni/aesni.c   Tue Jun  9 22:26:07 2020
(r361991)
@@ -167,7 +167,8 @@ aesni_attach(device_t dev)
sc = device_get_softc(dev);
 
sc->cid = crypto_get_driverid(dev, sizeof(struct aesni_session),
-   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC);
+   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC |
+   CRYPTOCAP_F_ACCEL_SOFTWARE);
if (sc->cid < 0) {
device_printf(dev, "Could not get crypto driver id.\n");
return (ENOMEM);

Modified: head/sys/crypto/armv8/armv8_crypto.c
==
--- head/sys/crypto/armv8/armv8_crypto.cTue Jun  9 22:19:36 2020
(r361990)
+++ head/sys/crypto/armv8/armv8_crypto.cTue Jun  9 22:26:07 2020
(r361991)
@@ -131,7 +131,7 @@ armv8_crypto_attach(device_t dev)
sc->dieing = 0;
 
sc->cid = crypto_get_driverid(dev, sizeof(struct armv8_crypto_session),
-   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC);
+   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | 
CRYPTOCAP_F_ACCEL_SOFTWARE);
if (sc->cid < 0) {
device_printf(dev, "Could not get crypto driver id.\n");
return (ENOMEM);

Modified: head/sys/crypto/blake2/blake2_cryptodev.c
==
--- head/sys/crypto/blake2/blake2_cryptodev.c   Tue Jun  9 22:19:36 2020
(r361990)
+++ head/sys/crypto/blake2/blake2_cryptodev.c   Tue Jun  9 22:26:07 2020
(r361991)
@@ -129,7 +129,8 @@ blake2_attach(device_t dev)
sc->dying = false;
 
sc->cid = crypto_get_driverid(dev, sizeof(struct blake2_session),
-   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC);
+   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC |
+   CRYPTOCAP_F_ACCEL_SOFTWARE);
if (sc->cid < 0) {
device_printf(dev, "Could not get crypto driver id.\n");
return (ENOMEM);

Modified: head/sys/crypto/via/padlock.c
==
--- head/sys/crypto/via/padlock.c   Tue Jun  9 22:19:36 2020
(r361990)
+++ head/sys/crypto/via/padlock.c   Tue Jun  9 22:26:07 2020
(r361991)
@@ -119,7 +119,8 @@ padlock_attach(device_t dev)
struct padlock_softc *sc = device_get_softc(dev);
 
sc->sc_cid = crypto_get_driverid(dev, sizeof(struct padlock_session),
-   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC);
+   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC |
+   CRYPTOCAP_F_ACCEL_SOFTWARE);
if (sc->sc_cid < 0) {
device_printf(dev, "Could not get crypto driver id.\n");
return (ENOMEM);

Modified: head/sys/geom/eli/g_eli.c
==
--- head/sys/geom/eli/g_eli.c   Tue Jun  9 22:19:36 2020(r361990)
+++ head/sy

svn commit: r361990 - in head/sys: crypto/via mips/cavium/cryptocteon

2020-06-09 Thread John Baldwin
Author: jhb
Date: Tue Jun  9 22:19:36 2020
New Revision: 361990
URL: https://svnweb.freebsd.org/changeset/base/361990

Log:
  Mark padlock(4) and cryptocteon(4) as software drivers.
  
  Both already return the accelerated software priority from
  cryptodev_probesession.
  
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25125

Modified:
  head/sys/crypto/via/padlock.c
  head/sys/mips/cavium/cryptocteon/cryptocteon.c

Modified: head/sys/crypto/via/padlock.c
==
--- head/sys/crypto/via/padlock.c   Tue Jun  9 22:15:45 2020
(r361989)
+++ head/sys/crypto/via/padlock.c   Tue Jun  9 22:19:36 2020
(r361990)
@@ -119,7 +119,7 @@ padlock_attach(device_t dev)
struct padlock_softc *sc = device_get_softc(dev);
 
sc->sc_cid = crypto_get_driverid(dev, sizeof(struct padlock_session),
-   CRYPTOCAP_F_HARDWARE);
+   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC);
if (sc->sc_cid < 0) {
device_printf(dev, "Could not get crypto driver id.\n");
return (ENOMEM);

Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c
==
--- head/sys/mips/cavium/cryptocteon/cryptocteon.c  Tue Jun  9 22:15:45 
2020(r361989)
+++ head/sys/mips/cavium/cryptocteon/cryptocteon.c  Tue Jun  9 22:19:36 
2020(r361990)
@@ -86,7 +86,7 @@ cryptocteon_attach(device_t dev)
sc = device_get_softc(dev);
 
sc->sc_cid = crypto_get_driverid(dev, sizeof(struct octo_sess),
-   CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SYNC);
+   CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC);
if (sc->sc_cid < 0) {
device_printf(dev, "crypto_get_driverid ret %d\n", sc->sc_cid);
return (ENXIO);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361989 - stable/9/sys/dev/usb

2020-06-09 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun  9 22:15:45 2020
New Revision: 361989
URL: https://svnweb.freebsd.org/changeset/base/361989

Log:
  Adapt merge of r361581 to 9-stable to unbreak kernel compilation.
  
  This is a direct commit.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/9/sys/dev/usb/usb_transfer.c

Modified: stable/9/sys/dev/usb/usb_transfer.c
==
--- stable/9/sys/dev/usb/usb_transfer.c Tue Jun  9 21:59:13 2020
(r361988)
+++ stable/9/sys/dev/usb/usb_transfer.c Tue Jun  9 22:15:45 2020
(r361989)
@@ -354,8 +354,7 @@ usbd_get_max_frame_length(const struct usb_endpoint_de
if (ecomp != NULL) {
uint8_t mult;
 
-   mult = UE_GET_SS_ISO_MULT(
-   ecomp->bmAttributes) + 1;
+   mult = (ecomp->bmAttributes & 3) + 1;
if (mult > 3)
mult = 3;
 
___
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: r361988 - head/sys/powerpc/booke

2020-06-09 Thread Justin Hibbits
Author: jhibbits
Date: Tue Jun  9 21:59:13 2020
New Revision: 361988
URL: https://svnweb.freebsd.org/changeset/base/361988

Log:
  powerpc/pmap: Fix wired memory leak in booke64 page directories
  
  Properly handle reference counts in the 64-bit pmap page directories.
  Otherwise all page table pages would leak due to over-referencing.  This
  would cause a quick enter to swap on a desktop system (AmigaOne X5000) when
  quitting and rerunning applications, or just building world.
  
  Add an INVARIANTS check to validate no leakage at pmap release time.

Modified:
  head/sys/powerpc/booke/pmap_64.c

Modified: head/sys/powerpc/booke/pmap_64.c
==
--- head/sys/powerpc/booke/pmap_64.cTue Jun  9 21:07:58 2020
(r361987)
+++ head/sys/powerpc/booke/pmap_64.cTue Jun  9 21:59:13 2020
(r361988)
@@ -251,9 +251,7 @@ static bool
 unhold_free_page(pmap_t pmap, vm_page_t m)
 {
 
-   m->ref_count--;
-   if (m->ref_count == 0) {
-   vm_wire_sub(1);
+   if (vm_page_unwire_noq(m)) {
vm_page_free_zero(m);
return (true);
}
@@ -262,8 +260,8 @@ unhold_free_page(pmap_t pmap, vm_page_t m)
 }
 
 static vm_offset_t
-alloc_or_hold_page(pmap_t pmap, vm_offset_t *ptr_tbl, uint32_t index,
-bool nosleep, bool hold, bool *isnew)
+get_pgtbl_page(pmap_t pmap, vm_offset_t *ptr_tbl, uint32_t index,
+bool nosleep, bool hold_parent, bool *isnew)
 {
vm_offset_t page;
vm_page_t   m;
@@ -276,18 +274,18 @@ alloc_or_hold_page(pmap_t pmap, vm_offset_t *ptr_tbl, 
if (ptr_tbl[index] == 0) {
*isnew = true;
ptr_tbl[index] = page;
+   if (hold_parent) {
+   m = 
PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)ptr_tbl));
+   m->ref_count++;
+   }
return (page);
}
m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS(page));
page = ptr_tbl[index];
-   vm_wire_sub(1);
+   vm_page_unwire_noq(m);
vm_page_free_zero(m);
}
 
-   if (hold) {
-   m = PHYS_TO_VM_PAGE(pmap_kextract(page));
-   m->ref_count++;
-   }
*isnew = false;
 
return (page);
@@ -301,19 +299,18 @@ ptbl_alloc(pmap_t pmap, vm_offset_t va, bool nosleep, 
unsigned intpdir_l1_idx = PDIR_L1_IDX(va);
unsigned intpdir_idx = PDIR_IDX(va);
vm_offset_t pdir_l1, pdir, ptbl;
-   boolhold_page;
 
-   hold_page = (pmap != kernel_pmap);
-   pdir_l1 = alloc_or_hold_page(pmap, (vm_offset_t *)pmap->pm_root,
-   pg_root_idx, nosleep, hold_page, is_new);
+   /* When holding a parent, no need to hold the root index pages. */
+   pdir_l1 = get_pgtbl_page(pmap, (vm_offset_t *)pmap->pm_root,
+   pg_root_idx, nosleep, false, is_new);
if (pdir_l1 == 0)
return (NULL);
-   pdir = alloc_or_hold_page(pmap, (vm_offset_t *)pdir_l1, pdir_l1_idx,
-   nosleep, hold_page, is_new);
+   pdir = get_pgtbl_page(pmap, (vm_offset_t *)pdir_l1, pdir_l1_idx,
+   nosleep, !*is_new, is_new);
if (pdir == 0)
return (NULL);
-   ptbl = alloc_or_hold_page(pmap, (vm_offset_t *)pdir, pdir_idx,
-   nosleep, false, is_new);
+   ptbl = get_pgtbl_page(pmap, (vm_offset_t *)pdir, pdir_idx,
+   nosleep, !*is_new, is_new);
 
return ((pte_t *)ptbl);
 }
@@ -629,6 +626,15 @@ mmu_booke_release(pmap_t pmap)
KASSERT(pmap->pm_stats.resident_count == 0,
("pmap_release: pmap resident count %ld != 0",
pmap->pm_stats.resident_count));
+#ifdef INVARIANTS
+   /*
+* Verify that all page directories are gone.
+* Protects against reference count leakage.
+*/
+   for (int i = 0; i < PG_ROOT_NENTRIES; i++)
+   KASSERT(pmap->pm_root[i] == 0,
+   ("Index %d on root page %p is non-zero!\n", i, 
pmap->pm_root));
+#endif
uma_zfree(ptbl_root_zone, pmap->pm_root);
 }
 
___
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: r361987 - head/sys/netinet/cc

2020-06-09 Thread Richard Scheffenegger
Author: rscheff
Date: Tue Jun  9 21:07:58 2020
New Revision: 361987
URL: https://svnweb.freebsd.org/changeset/base/361987

Log:
  Prevent TCP Cubic to abruptly increase cwnd after slow-start
  
  Introducing flags to track the initial Wmax dragging and exit
  from slow-start in TCP Cubic. This prevents sudden jumps in the
  caluclated cwnd by cubic, especially when the flow is application
  limited during slow start (cwnd can not grow as fast as expected).
  The downside is that cubic may remain slightly longer in the
  concave region before starting the convex region beyond Wmax again.
  
  Reviewed by:  chengc_netapp.com, tuexen (mentor)
  Approved by:  tuexen (mentor), rgrimes (mentor, blanket)
  MFC after:3 weeks
  Sponsored by: NetApp, Inc.
  Differential Revision:https://reviews.freebsd.org/D23655

Modified:
  head/sys/netinet/cc/cc_cubic.c

Modified: head/sys/netinet/cc/cc_cubic.c
==
--- head/sys/netinet/cc/cc_cubic.c  Tue Jun  9 20:52:35 2020
(r361986)
+++ head/sys/netinet/cc/cc_cubic.c  Tue Jun  9 21:07:58 2020
(r361987)
@@ -90,8 +90,10 @@ struct cubic {
unsigned long   max_cwnd;
/* cwnd at the previous congestion event. */
unsigned long   prev_max_cwnd;
-   /* Number of congestion events. */
-   uint32_tnum_cong_events;
+   /* various flags */
+   uint32_tflags;
+#define CUBICFLAG_CONG_EVENT   0x0001  /* congestion experienced */
+#define CUBICFLAG_IN_SLOWSTART 0x0002  /* in slow start */
/* Minimum observed rtt in ticks. */
int min_rtt_ticks;
/* Mean observed rtt between congestion epochs. */
@@ -138,9 +140,10 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
(V_tcp_do_rfc3465 && ccv->flags & CCF_ABC_SENTAWND))) {
 /* Use the logic in NewReno ack_received() for slow start. */
if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) ||
-   cubic_data->min_rtt_ticks == TCPTV_SRTTBASE)
+   cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) {
+   cubic_data->flags |= CUBICFLAG_IN_SLOWSTART;
newreno_cc_algo.ack_received(ccv, type);
-   else {
+   } else {
if ((ticks_since_cong =
ticks - cubic_data->t_last_cong) < 0) {
/*
@@ -150,6 +153,11 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
cubic_data->t_last_cong = ticks - INT_MAX;
}
 
+   if (cubic_data->flags & CUBICFLAG_IN_SLOWSTART) {
+   cubic_data->flags &= ~CUBICFLAG_IN_SLOWSTART;
+   cubic_data->t_last_cong = ticks;
+   cubic_data->K = 0;
+   }
/*
 * The mean RTT is used to best reflect the equations in
 * the I-D. Using min_rtt in the tf_cwnd calculation
@@ -199,7 +207,7 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
 * keep updating our current estimate of the
 * max_cwnd.
 */
-   if (cubic_data->num_cong_events == 0 &&
+   if (((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) &&
cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) {
cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
cubic_data->K = cubic_k(cubic_data->max_cwnd /
@@ -270,9 +278,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
cubic_ssthresh_update(ccv);
-   cubic_data->num_cong_events++;
+   cubic_data->flags |= CUBICFLAG_CONG_EVENT;
cubic_data->prev_max_cwnd = 
cubic_data->max_cwnd;
cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
+   cubic_data->K = cubic_k(cubic_data->max_cwnd / 
CCV(ccv, t_maxseg));
}
ENTER_RECOVERY(CCV(ccv, t_flags));
}
@@ -281,10 +290,11 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
case CC_ECN:
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
cubic_ssthresh_update(ccv);
-   cubic_data->num_cong_events++;
+   cubic_data->flags |= CUBICFLAG_CONG_EVENT;
cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
cubi

svn commit: r361986 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake

2020-06-09 Thread Simon J. Gerraty
Author: sjg
Date: Tue Jun  9 20:52:35 2020
New Revision: 361986
URL: https://svnweb.freebsd.org/changeset/base/361986

Log:
  Merge bmake-20200606
  
  Relevant items from ChangeLog:
  
o dir.c: cached_stats - don't confuse stat and lstat results.
o var.c: add :Or for reverse sort.

Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/VERSION
  head/contrib/bmake/bmake.1
  head/contrib/bmake/bmake.cat1
  head/contrib/bmake/configure
  head/contrib/bmake/configure.in
  head/contrib/bmake/dir.c
  head/contrib/bmake/dirname.c
  head/contrib/bmake/make.1
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/dirdeps-targets.mk
  head/contrib/bmake/mk/init.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/meta2deps.py
  head/contrib/bmake/var.c
  head/usr.bin/bmake/Makefile
  head/usr.bin/bmake/Makefile.config
  head/usr.bin/bmake/config.h
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==
--- head/contrib/bmake/ChangeLogTue Jun  9 20:27:35 2020
(r361985)
+++ head/contrib/bmake/ChangeLogTue Jun  9 20:52:35 2020
(r361986)
@@ -1,3 +1,25 @@
+2020-06-06  Simon J Gerraty  
+
+   * VERSION (_MAKE_VERSION): 20200606
+   Merge with NetBSD make, pick up
+   o make.1: cleanup
+
+   * Makefile: fix depends for main.o which broke MAKE_VERSION
+
+2020-06-05  Simon J Gerraty  
+
+   * VERSION (_MAKE_VERSION): 20200605
+   Merge with NetBSD make, pick up
+   o dir.c: cached_stats - don't confuse stat and lstat results.
+   o var.c: add :Or for reverse sort.
+
+2020-05-24  Simon J Gerraty  
+
+   * configure.in: add AC_PROG_CC_C99 for mipspro compiler
+   also if --with-filemon= specifies path to filemon.h
+   set use_filemon=dev
+   * dirname.c: remove include of namespace.h
+
 2020-05-17  Simon J Gerraty  
 
* VERSION (_MAKE_VERSION): 20200517

Modified: head/contrib/bmake/Makefile
==
--- head/contrib/bmake/Makefile Tue Jun  9 20:27:35 2020(r361985)
+++ head/contrib/bmake/Makefile Tue Jun  9 20:52:35 2020(r361986)
@@ -1,4 +1,4 @@
-#  $Id: Makefile,v 1.104 2020/02/06 01:33:54 sjg Exp $
+#  $Id: Makefile,v 1.107 2020/06/07 21:18:46 sjg Exp $
 
 PROG=  bmake
 
@@ -82,7 +82,7 @@ COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
 # should be set by now
 USE_FILEMON ?= no
 .if ${USE_FILEMON:tl} != "no"
-.PATH: ${.CURDIR}/filemon
+.PATH: ${srcdir}/filemon
 SRCS+= filemon_${USE_FILEMON}.c
 COPTS.meta.c+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu}
 COPTS.job.c+= ${COPTS.meta.c}
@@ -158,7 +158,7 @@ MAN1= ${MAN}
 .if (${PROG} != "make")
 CLEANFILES+= my.history
 .if make(${MAN}) || !exists(${srcdir}/${MAN})
-my.history: ${MAKEFILE}
+my.history:
@(echo ".Nm"; \
echo "is derived from NetBSD"; \
echo ".Xr make 1 ."; \
@@ -207,7 +207,7 @@ ${OBJS}: config.h
 # start-delete2 for bsd.after-import.mk
 
 # make sure that MAKE_VERSION gets updated.
-main.o: ${SRCS} ${.CURDIR}/VERSION
+main.o: ${srcdir}/VERSION
 
 .if ${MK_AUTOCONF_MK} == "yes"
 CONFIGURE_DEPS += ${.CURDIR}/VERSION

Modified: head/contrib/bmake/VERSION
==
--- head/contrib/bmake/VERSION  Tue Jun  9 20:27:35 2020(r361985)
+++ head/contrib/bmake/VERSION  Tue Jun  9 20:52:35 2020(r361986)
@@ -1,2 +1,2 @@
 # keep this compatible with sh and make
-_MAKE_VERSION=20200517
+_MAKE_VERSION=20200606

Modified: head/contrib/bmake/bmake.1
==
--- head/contrib/bmake/bmake.1  Tue Jun  9 20:27:35 2020(r361985)
+++ head/contrib/bmake/bmake.1  Tue Jun  9 20:52:35 2020(r361986)
@@ -1,4 +1,4 @@
-.\"$NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $
+.\"$NetBSD: make.1,v 1.282 2020/06/06 20:28:42 wiz Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"from: @(#)make.18.4 (Berkeley) 3/19/94
 .\"
-.Dd May 26, 2018
+.Dd June 5, 2020
 .Dt BMAKE 1
 .Os
 .Sh NAME
@@ -272,7 +272,7 @@ that do not depend on the target whose creation caused
 .It Fl m Ar directory
 Specify a directory in which to search for sys.mk and makefiles included
 via the
-.Ao Ar file Ac Ns -style
+.Li \&< Ns Ar file Ns Li \&> Ns -style
 include statement.
 The
 .Fl m
@@ -280,7 +280,7 @@ option can be used multiple times to form a search pat
 This path will override the default system include path: /usr/share/mk.
 Furthermore the system include path will be appended to the search path used
 for
-.Qo Ar file Qc Ns -style
+.Li \*q Ns Ar file Ns Li \*q Ns -style
 include statements (see the
 .Fl I
 option).
@@ -1196,10 +1196,8 @@ but s

svn commit: r361985 - head/sys/arm/freescale/imx

2020-06-09 Thread Andreas Tobler
Author: andreast
Date: Tue Jun  9 20:27:35 2020
New Revision: 361985
URL: https://svnweb.freebsd.org/changeset/base/361985

Log:
  Fix boot of wandquad after DTS update
  
  In the recent dts sync the name of the aips-bus@ changed to bus@. Reflect
  this change and add an additional OF_finddevice in fix_fdt_interrupt_data()
  and in fix_fdt_iomuxc_data() with bus@ only. Iow, keep the old naming for
  compatibility.
  
  Discussed with:   ian@

Modified:
  head/sys/arm/freescale/imx/imx6_machdep.c

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==
--- head/sys/arm/freescale/imx/imx6_machdep.c   Tue Jun  9 20:19:11 2020
(r361984)
+++ head/sys/arm/freescale/imx/imx6_machdep.c   Tue Jun  9 20:27:35 2020
(r361985)
@@ -134,6 +134,8 @@ fix_fdt_interrupt_data(void)
if (gpcnode == -1)
gpcnode = OF_finddevice("/soc/aips-bus@200/gpc@20dc000");
if (gpcnode == -1)
+   gpcnode = OF_finddevice("/soc/bus@200/gpc@20dc000");
+   if (gpcnode == -1)
return;
result = OF_getencprop(gpcnode, "interrupt-parent", &gpcipar,
sizeof(gpcipar));
@@ -172,6 +174,8 @@ fix_fdt_iomuxc_data(void)
 * uses for register access.
 */
node = OF_finddevice("/soc/aips-bus@200/iomuxc-gpr@20e");
+   if (node == -1)
+   node = OF_finddevice("/soc/bus@200/iomuxc-gpr@20e");
if (node != -1)
OF_setprop(node, "status", "disabled", sizeof("disabled"));
 }
___
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: r361984 - in head/sys: compat/linuxkpi/common/include/linux sys

2020-06-09 Thread Doug Moore
Author: dougm
Date: Tue Jun  9 20:19:11 2020
New Revision: 361984
URL: https://svnweb.freebsd.org/changeset/base/361984

Log:
  To reduce the size of an rb_node, drop the color field. Set the least
  significant bit in the pointer to the node from its parent to indicate
  that the node is red. Have the tree rotation macros leave the
  old-parent/new-child node red and the new-parent/old-child node black.
  
  This change makes RB_LEFT and RB_RIGHT no longer assignable, and
  RB_COLOR no longer defined. Any code that modifies the tree or
  examines a node color would have to be modified after this change.
  
  Reviewed by:  markj
  Tested by:pho
  Differential Revision:https://reviews.freebsd.org/D25105

Modified:
  head/sys/compat/linuxkpi/common/include/linux/rbtree.h
  head/sys/sys/tree.h

Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h
==
--- head/sys/compat/linuxkpi/common/include/linux/rbtree.h  Tue Jun  9 
19:16:49 2020(r361983)
+++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h  Tue Jun  9 
20:19:11 2020(r361984)
@@ -57,11 +57,7 @@ RB_HEAD(linux_root, rb_node);
 RB_PROTOTYPE(linux_root, rb_node, __entry, panic_cmp);
 
 #definerb_parent(r)RB_PARENT(r, __entry)
-#definerb_color(r) RB_COLOR(r, __entry)
-#definerb_is_red(r)(rb_color(r) == RB_RED)
-#definerb_is_black(r)  (rb_color(r) == RB_BLACK)
 #definerb_set_parent(r, p) rb_parent((r)) = (p)
-#definerb_set_color(r, c)  rb_color((r)) = (c)
 #definerb_entry(ptr, type, member) container_of(ptr, type, member)
 
 #define RB_EMPTY_ROOT(root) RB_EMPTY((struct linux_root *)root)
@@ -82,7 +78,6 @@ rb_link_node(struct rb_node *node, struct rb_node *par
 struct rb_node **rb_link)
 {
rb_set_parent(node, parent);
-   rb_set_color(node, RB_RED);
node->__entry.rbe_left = node->__entry.rbe_right = NULL;
*rb_link = node;
 }

Modified: head/sys/sys/tree.h
==
--- head/sys/sys/tree.h Tue Jun  9 19:16:49 2020(r361983)
+++ head/sys/sys/tree.h Tue Jun  9 20:19:11 2020(r361984)
@@ -307,35 +307,32 @@ struct name { 
\
(root)->rbh_root = NULL;\
 } while (/*CONSTCOND*/ 0)
 
-#define RB_BLACK   0
-#define RB_RED 1
 #define RB_ENTRY(type) \
 struct {   \
struct type *rbe_left;  /* left element */  \
struct type *rbe_right; /* right element */ \
struct type *rbe_parent;/* parent element */\
-   int rbe_color;  /* node color */\
 }
 
-#define RB_LEFT(elm, field)(elm)->field.rbe_left
-#define RB_RIGHT(elm, field)   (elm)->field.rbe_right
+#define RB_LF(elm, field)  (elm)->field.rbe_left
+#define RB_RT(elm, field)  (elm)->field.rbe_right
+#define RB_FLIP(elm)   (*(__uintptr_t *)&(elm) ^= 1)
+#define RB_FLIP_LF(elm, field) RB_FLIP(RB_LF(elm, field))
+#define RB_FLIP_RT(elm, field) RB_FLIP(RB_RT(elm, field))
+#define RB_ISRED(elm)  ((*(__uintptr_t *)&(elm) & 1) != 0)
+#define RB_RED_LF(elm, field)  RB_ISRED(RB_LF(elm, field))
+#define RB_RED_RT(elm, field)  RB_ISRED(RB_RT(elm, field))
+#define RB_PTR(elm, field) ((__typeof(elm->field.rbe_parent)) \
+((__uintptr_t)(elm) & ~(__uintptr_t)1))
+#define RB_LEFT(elm, field)RB_PTR(RB_LF(elm, field), field)
+#define RB_RIGHT(elm, field)   RB_PTR(RB_RT(elm, field), field)
 #define RB_PARENT(elm, field)  (elm)->field.rbe_parent
-#define RB_COLOR(elm, field)   (elm)->field.rbe_color
-#define RB_ISRED(elm, field)   ((elm) != NULL && RB_COLOR(elm, field) 
== RB_RED)
 #define RB_ROOT(head)  (head)->rbh_root
 #define RB_EMPTY(head) (RB_ROOT(head) == NULL)
+#define RB_BOOLint
+#define RB_TRUE1
+#define RB_FALSE   0
 
-#define RB_SET(elm, parent, field) do {
\
-   RB_PARENT(elm, field) = parent; \
-   RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL;  \
-   RB_COLOR(elm, field) = RB_RED;  \
-} while (/*CONSTCOND*/ 0)
-
-#define RB_SET_BLACKRED(black, red, field) do {
\
-   RB_COLOR(black, field) = RB_BLACK;  \
-   RB_COLOR(red, field) = RB_RED;

svn commit: r361983 - stable/11/libexec/rtld-elf

2020-06-09 Thread Konstantin Belousov
Author: kib
Date: Tue Jun  9 19:16:49 2020
New Revision: 361983
URL: https://svnweb.freebsd.org/changeset/base/361983

Log:
  MFC r361725, r361728:
  Do not allow to load ET_DYN object with DF_1_PIE flag set.

Modified:
  stable/11/libexec/rtld-elf/rtld.c
  stable/11/libexec/rtld-elf/rtld.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/rtld-elf/rtld.c
==
--- stable/11/libexec/rtld-elf/rtld.c   Tue Jun  9 19:15:43 2020
(r361982)
+++ stable/11/libexec/rtld-elf/rtld.c   Tue Jun  9 19:16:49 2020
(r361983)
@@ -1313,6 +1313,8 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_D
obj->z_interpose = true;
if (dynp->d_un.d_val & DF_1_NODEFLIB)
obj->z_nodeflib = true;
+   if (dynp->d_un.d_val & DF_1_PIE)
+   obj->z_pie = true;
break;
 
default:
@@ -2510,6 +2512,10 @@ do_load_object(int fd, const char *name, char *path, s
 obj->path = path;
 if (!digest_dynamic(obj, 0))
goto errp;
+if (obj->z_pie) {
+   _rtld_error("Cannot load PIE binary %s as DSO", obj->path);
+   goto errp;
+}
 dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d", obj->path,
obj->valid_hash_sysv, obj->valid_hash_gnu, obj->dynsymcount);
 if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) ==

Modified: stable/11/libexec/rtld-elf/rtld.h
==
--- stable/11/libexec/rtld-elf/rtld.h   Tue Jun  9 19:15:43 2020
(r361982)
+++ stable/11/libexec/rtld-elf/rtld.h   Tue Jun  9 19:16:49 2020
(r361983)
@@ -253,6 +253,7 @@ typedef struct Struct_Obj_Entry {
 bool z_interpose : 1;  /* Interpose all objects but main */
 bool z_nodeflib : 1;   /* Don't search default library path */
 bool z_global : 1; /* Make the object global */
+bool z_pie : 1;/* Object proclaimed itself PIE executable */
 bool static_tls : 1;   /* Needs static TLS allocation */
 bool static_tls_copied : 1;/* Needs static TLS copying */
 bool ref_nodel : 1;/* Refcount increased to prevent 
dlclose */
___
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: r361982 - head/sys/net

2020-06-09 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Jun  9 19:15:43 2020
New Revision: 361982
URL: https://svnweb.freebsd.org/changeset/base/361982

Log:
  iflib: netmap: honor netmap_irx_irq return values
  
  In the receive interrupt routine, always call netmap_rx_irq().
  The latter function will return != NM_IRQ_PASS if netmap is not
  active on that specific receive queue, so that the driver can go
  on with iflib_rxeof(). Note that netmap supports partial opening,
  where only a subset of the RX or TX rings can be open in netmap mode.
  Checking the IFCAP_NETMAP flag is not enough to make sure that the
  queue is indeed in netmap mode.
  Moreover, in case netmap_rx_irq() returns NM_IRQ_RESCHED, it means
  that netmap expects the driver to call netmap_rx_irq() again as soon
  as possible. Currently, this may happen when the device is attached
  to a VALE switch.
  
  Reviewed by:  gallatin
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25167

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cTue Jun  9 19:07:44 2020(r361981)
+++ head/sys/net/iflib.cTue Jun  9 19:15:43 2020(r361982)
@@ -3790,6 +3790,10 @@ _task_fn_rx(void *context)
if_ctx_t ctx = rxq->ifr_ctx;
uint8_t more;
uint16_t budget;
+#ifdef DEV_NETMAP
+   u_int work = 0;
+   int nmirq;
+#endif
 
 #ifdef IFLIB_DIAGNOSTICS
rxq->ifr_cpu_exec_count[curcpu]++;
@@ -3798,12 +3802,10 @@ _task_fn_rx(void *context)
if (__predict_false(!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)))
return;
 #ifdef DEV_NETMAP
-   if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP) {
-   u_int work = 0;
-   if (netmap_rx_irq(ctx->ifc_ifp, rxq->ifr_id, &work)) {
-   more = 0;
-   goto skip_rxeof;
-   }
+   nmirq = netmap_rx_irq(ctx->ifc_ifp, rxq->ifr_id, &work);
+   if (nmirq != NM_IRQ_PASS) {
+   more = (nmirq == NM_IRQ_RESCHED) ? IFLIB_RXEOF_MORE : 0;
+   goto skip_rxeof;
}
 #endif
budget = ctx->ifc_sysctl_rx_budget;
___
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: r361981 - releng/11.4/release/doc/share/xml stable/11/release/doc/share/xml

2020-06-09 Thread Glen Barber
Author: gjb
Date: Tue Jun  9 19:07:44 2020
New Revision: 361981
URL: https://svnweb.freebsd.org/changeset/base/361981

Log:
  Fix a typo.
  
  Submitted by: yuripv
  Approved by:  re (implicit)
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  releng/11.4/release/doc/share/xml/security.xml

Changes in other areas also in this revision:
Modified:
  stable/11/release/doc/share/xml/security.xml

Modified: releng/11.4/release/doc/share/xml/security.xml
==
--- releng/11.4/release/doc/share/xml/security.xml  Tue Jun  9 18:13:52 
2020(r361980)
+++ releng/11.4/release/doc/share/xml/security.xml  Tue Jun  9 19:07:44 
2020(r361981)
@@ -205,7 +205,7 @@
FreeBSD-SA-20:17.usb
9 June 2020
-   HID descripter parsing
+   HID descriptor parsing
  error
   
 
___
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: r361981 - releng/11.4/release/doc/share/xml stable/11/release/doc/share/xml

2020-06-09 Thread Glen Barber
Author: gjb
Date: Tue Jun  9 19:07:44 2020
New Revision: 361981
URL: https://svnweb.freebsd.org/changeset/base/361981

Log:
  Fix a typo.
  
  Submitted by: yuripv
  Approved by:  re (implicit)
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  stable/11/release/doc/share/xml/security.xml

Changes in other areas also in this revision:
Modified:
  releng/11.4/release/doc/share/xml/security.xml

Modified: stable/11/release/doc/share/xml/security.xml
==
--- stable/11/release/doc/share/xml/security.xmlTue Jun  9 18:13:52 
2020(r361980)
+++ stable/11/release/doc/share/xml/security.xmlTue Jun  9 19:07:44 
2020(r361981)
@@ -220,7 +220,7 @@
FreeBSD-SA-20:17.usb
9 June 2020
-   HID descripter parsing
+   HID descriptor parsing
  error
   
 
___
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: r361980 - head/release

2020-06-09 Thread Emmanuel Vadot
Author: manu
Date: Tue Jun  9 18:13:52 2020
New Revision: 361980
URL: https://svnweb.freebsd.org/changeset/base/361980

Log:
  release: amd64 efi boot name is bootx64
  
  efi_boot_name is just used for arm image so no harm done.
  
  Reported by:  gonzo
  MFC after:3 days

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Tue Jun  9 17:35:14 2020(r361979)
+++ head/release/release.sh Tue Jun  9 18:13:52 2020(r361980)
@@ -368,7 +368,7 @@ efi_boot_name()
echo "bootaa64.efi"
;;
amd64)
-   echo "bootx86.efi"
+   echo "bootx64.efi"
;;
esac
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361979 - releng/11.4/release/doc/share/xml

2020-06-09 Thread Glen Barber
Author: gjb
Date: Tue Jun  9 17:35:14 2020
New Revision: 361979
URL: https://svnweb.freebsd.org/changeset/base/361979

Log:
  Document SA-20:17.
  
  Approved by:  re (implicit)
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  releng/11.4/release/doc/share/xml/security.xml

Modified: releng/11.4/release/doc/share/xml/security.xml
==
--- releng/11.4/release/doc/share/xml/security.xml  Tue Jun  9 17:34:29 
2020(r361978)
+++ releng/11.4/release/doc/share/xml/security.xml  Tue Jun  9 17:35:14 
2020(r361979)
@@ -200,6 +200,14 @@
12 May 2020
Memory disclosure vulnerability
   
+
+  
+   FreeBSD-SA-20:17.usb
+   9 June 2020
+   HID descripter parsing
+ error
+  
 
   
 
___
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: r361978 - stable/11/release/doc/share/xml

2020-06-09 Thread Glen Barber
Author: gjb
Date: Tue Jun  9 17:34:29 2020
New Revision: 361978
URL: https://svnweb.freebsd.org/changeset/base/361978

Log:
  Document SA-20:17, EN-20:11, EN-20:12.
  Fix a copy/paste error while here.
  
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  stable/11/release/doc/share/xml/security.xml

Modified: stable/11/release/doc/share/xml/security.xml
==
--- stable/11/release/doc/share/xml/security.xmlTue Jun  9 17:17:43 
2020(r361977)
+++ stable/11/release/doc/share/xml/security.xmlTue Jun  9 17:34:29 
2020(r361978)
@@ -211,9 +211,17 @@
 
   
FreeBSD-SA-20:14.cryptodev
+   
xlink:href="&security.url;/FreeBSD-SA-20:15.cryptodev.asc">FreeBSD-SA-20:15.cryptodev
12 May 2020
Use-after-free condition
+  
+
+  
+   FreeBSD-SA-20:17.usb
+   9 June 2020
+   HID descripter parsing
+ error
   
 
   
___
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: r361977 - head/lib/libusb

2020-06-09 Thread Kyle Evans
Author: kevans
Date: Tue Jun  9 17:17:43 2020
New Revision: 361977
URL: https://svnweb.freebsd.org/changeset/base/361977

Log:
  libusb: improve compatibility
  
  Specifically, add LIBUSB_CLASS_PHYSICAL and the libusb_has_capability API.
  Descriptions and functionality for these derived from the
  documentation at [0].  The current set of capabilities are all supported by
  libusb.
  
  These were detected as missing after updating net/freerdp to 2.1.1, which
  attempted to use both.
  
  [0] http://libusb.sourceforge.net/api-1.0/group__libusb__misc.html
  
  Reviewed by:  hselasky
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25194

Modified:
  head/lib/libusb/Makefile
  head/lib/libusb/libusb.3
  head/lib/libusb/libusb.h
  head/lib/libusb/libusb10.c

Modified: head/lib/libusb/Makefile
==
--- head/lib/libusb/MakefileTue Jun  9 17:07:42 2020(r361976)
+++ head/lib/libusb/MakefileTue Jun  9 17:17:43 2020(r361977)
@@ -68,6 +68,7 @@ CFLAGS+=  -I ../../sys
 MLINKS += libusb.3 libusb_get_version.3
 MLINKS += libusb.3 libusb_init.3
 MLINKS += libusb.3 libusb_exit.3
+MLINKS += libusb.3 libusb_has_capability.3
 MLINKS += libusb.3 libusb_strerror.3
 MLINKS += libusb.3 libusb_error_name.3
 MLINKS += libusb.3 libusb_set_debug.3

Modified: head/lib/libusb/libusb.3
==
--- head/lib/libusb/libusb.3Tue Jun  9 17:07:42 2020(r361976)
+++ head/lib/libusb/libusb.3Tue Jun  9 17:17:43 2020(r361977)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 11, 2018
+.Dd June 9, 2020
 .Dt LIBUSB 3
 .Os
 .Sh NAME
@@ -60,6 +60,33 @@ failure.
 Deinitialise libusb.
 Must be called at the end of the application.
 Other libusb routines may not be called after this function.
+.Pp
+.Ft int
+.Fn libusb_has_capability "uint32_t capability"
+This function checks the runtime capabilities of
+.Nm .
+This function will return non-zero if the given
+.Fa capability
+is supported, 0 if it is not supported.
+The valid values for
+.Fa capability
+are:
+.Bl -tag -width LIBUSB_CAP -offset indent
+.It Va LIBUSB_CAP_HAS_CAPABILITY
+.Nm
+supports
+.Fn libusb_has_capability .
+.It Va LIBUSB_CAP_HAS_HOTPLUG
+.Nm
+supports hotplug notifications.
+.It Va LIBUSB_CAP_HAS_HID_ACCESS
+.Nm
+can access HID devices without requiring user intervention.
+.It Va LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER
+.Nm
+supports detaching of the default USB driver with
+.Fn libusb_detach_kernel_driver .
+.El
 .Pp
 .Ft const char *
 .Fn libusb_strerror "int code"

Modified: head/lib/libusb/libusb.h
==
--- head/lib/libusb/libusb.hTue Jun  9 17:07:42 2020(r361976)
+++ head/lib/libusb/libusb.hTue Jun  9 17:17:43 2020(r361977)
@@ -54,6 +54,7 @@ enum libusb_class_code {
LIBUSB_CLASS_AUDIO = 1,
LIBUSB_CLASS_COMM = 2,
LIBUSB_CLASS_HID = 3,
+   LIBUSB_CLASS_PHYSICAL = 5,
LIBUSB_CLASS_PTP = 6,
LIBUSB_CLASS_IMAGE = 6,
LIBUSB_CLASS_PRINTER = 7,
@@ -178,6 +179,21 @@ enum libusb_bos_type {
LIBUSB_BT_CONTAINER_ID = 4,
 };
 
+enum libusb_capability {
+   /* libusb supports libusb_has_capability(). */
+   LIBUSB_CAP_HAS_CAPABILITY = 0,
+   /* Hotplug support is available. */
+   LIBUSB_CAP_HAS_HOTPLUG,
+   /* Can access HID devices without requiring user intervention. */
+   LIBUSB_CAP_HAS_HID_ACCESS,
+
+   /*
+* Supports detaching of the default USB driver with
+* libusb_detach_kernel_driver().
+*/
+   LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER,
+};
+
 enum libusb_error {
LIBUSB_SUCCESS = 0,
LIBUSB_ERROR_IO = -1,
@@ -450,6 +466,7 @@ const char *libusb_strerror(int code);
 const char *libusb_error_name(int code);
 intlibusb_init(libusb_context ** context);
 void   libusb_exit(struct libusb_context *ctx);
+intlibusb_has_capability(uint32_t capability);
 
 /* Device handling and enumeration */
 

Modified: head/lib/libusb/libusb10.c
==
--- head/lib/libusb/libusb10.c  Tue Jun  9 17:07:42 2020(r361976)
+++ head/lib/libusb/libusb10.c  Tue Jun  9 17:17:43 2020(r361977)
@@ -1716,3 +1716,18 @@ libusb_error_name(int code)
return ("LIBUSB_ERROR_UNKNOWN");
}
 }
+
+int
+libusb_has_capability(uint32_t capability)
+{
+
+   switch (capability) {
+   case LIBUSB_CAP_HAS_CAPABILITY:
+   case LIBUSB_CAP_HAS_HOTPLUG:
+   case LIBUSB_CAP_HAS_HID_ACCESS:
+   case LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER:
+   return (1);
+   default:
+   return (0);
+   }
+}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinf

svn commit: r361976 - head/sys/dev/acpica

2020-06-09 Thread Ruslan Bukin
Author: br
Date: Tue Jun  9 17:07:42 2020
New Revision: 361976
URL: https://svnweb.freebsd.org/changeset/base/361976

Log:
  Similar to UART on ThunderX2, the ARM Coresight (ETM component)
  set ResourceProducer on memory resources: ignore it.
  
  Tested on ARM N1SDP board.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/acpica/acpi_resource.c

Modified: head/sys/dev/acpica/acpi_resource.c
==
--- head/sys/dev/acpica/acpi_resource.c Tue Jun  9 16:43:23 2020
(r361975)
+++ head/sys/dev/acpica/acpi_resource.c Tue Jun  9 17:07:42 2020
(r361976)
@@ -484,6 +484,10 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
 if (acpi_MatchHid(handle, "ARMH0011") != ACPI_MATCHHID_NOMATCH)
arc.ignore_producer_flag = true;
 
+/* ARM Coresight on N1SDP set ResourceProducer on memory resources. */
+if (acpi_MatchHid(handle, "ARMHC500") != ACPI_MATCHHID_NOMATCH)
+   arc.ignore_producer_flag = true;
+
 status = AcpiWalkResources(handle, "_CRS", acpi_parse_resource, &arc);
 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
printf("can't fetch resources for %s - %s\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: r361975 - in head/sys: compat/freebsd32 kern

2020-06-09 Thread John Baldwin
Author: jhb
Date: Tue Jun  9 16:43:23 2020
New Revision: 361975
URL: https://svnweb.freebsd.org/changeset/base/361975

Log:
  Refactor ptrace() ABI compatibility.
  
  Add a freebsd32_ptrace() and move as many freebsd32 shims as possible
  to freebsd32_ptrace().  Aside from register sets, freebsd32 passes
  pointers to native structures to kern_ptrace() and converts to/from
  native/32-bit structure formats in freebsd32_ptrace() outside of
  kern_ptrace().
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25195

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/sys_process.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Tue Jun  9 16:43:16 2020
(r361974)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Tue Jun  9 16:43:23 2020
(r361975)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -121,6 +122,31 @@ __FBSDID("$FreeBSD$");
 
 FEATURE(compat_freebsd_32bit, "Compatible with 32-bit FreeBSD");
 
+struct ptrace_io_desc32 {
+   int piod_op;
+   uint32_tpiod_offs;
+   uint32_tpiod_addr;
+   uint32_tpiod_len;
+};
+
+struct ptrace_sc_ret32 {
+   uint32_tsr_retval[2];
+   int sr_error;
+};
+
+struct ptrace_vm_entry32 {
+   int pve_entry;
+   int pve_timestamp;
+   uint32_tpve_start;
+   uint32_tpve_end;
+   uint32_tpve_offset;
+   u_int   pve_prot;
+   u_int   pve_pathlen;
+   int32_t pve_fileid;
+   u_int   pve_fsid;
+   uint32_tpve_path;
+};
+
 #ifdef __amd64__
 CTASSERT(sizeof(struct timeval32) == 8);
 CTASSERT(sizeof(struct timespec32) == 8);
@@ -853,6 +879,192 @@ freebsd32_getrusage(struct thread *td, struct freebsd3
freebsd32_rusage_out(&s, &s32);
error = copyout(&s32, uap->rusage, sizeof(s32));
}
+   return (error);
+}
+
+static void
+ptrace_lwpinfo_to32(const struct ptrace_lwpinfo *pl,
+struct ptrace_lwpinfo32 *pl32)
+{
+
+   bzero(pl32, sizeof(*pl32));
+   pl32->pl_lwpid = pl->pl_lwpid;
+   pl32->pl_event = pl->pl_event;
+   pl32->pl_flags = pl->pl_flags;
+   pl32->pl_sigmask = pl->pl_sigmask;
+   pl32->pl_siglist = pl->pl_siglist;
+   siginfo_to_siginfo32(&pl->pl_siginfo, &pl32->pl_siginfo);
+   strcpy(pl32->pl_tdname, pl->pl_tdname);
+   pl32->pl_child_pid = pl->pl_child_pid;
+   pl32->pl_syscall_code = pl->pl_syscall_code;
+   pl32->pl_syscall_narg = pl->pl_syscall_narg;
+}
+
+static void
+ptrace_sc_ret_to32(const struct ptrace_sc_ret *psr,
+struct ptrace_sc_ret32 *psr32)
+{
+
+   bzero(psr32, sizeof(*psr32));
+   psr32->sr_retval[0] = psr->sr_retval[0];
+   psr32->sr_retval[1] = psr->sr_retval[1];
+   psr32->sr_error = psr->sr_error;
+}
+
+int
+freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap)
+{
+   union {
+   struct ptrace_io_desc piod;
+   struct ptrace_lwpinfo pl;
+   struct ptrace_vm_entry pve;
+   struct dbreg32 dbreg;
+   struct fpreg32 fpreg;
+   struct reg32 reg;
+   register_t args[nitems(td->td_sa.args)];
+   struct ptrace_sc_ret psr;
+   int ptevents;
+   } r;
+   union {
+   struct ptrace_io_desc32 piod;
+   struct ptrace_lwpinfo32 pl;
+   struct ptrace_vm_entry32 pve;
+   uint32_t args[nitems(td->td_sa.args)];
+   struct ptrace_sc_ret32 psr;
+   } r32;
+   void *addr;
+   int data, error = 0, i;
+
+   AUDIT_ARG_PID(uap->pid);
+   AUDIT_ARG_CMD(uap->req);
+   AUDIT_ARG_VALUE(uap->data);
+   addr = &r;
+   data = uap->data;
+   switch (uap->req) {
+   case PT_GET_EVENT_MASK:
+   case PT_GET_SC_ARGS:
+   case PT_GET_SC_RET:
+   break;
+   case PT_LWPINFO:
+   if (uap->data > sizeof(r32.pl))
+   return (EINVAL);
+
+   /*
+* Pass size of native structure in 'data'.  Truncate
+* if necessary to avoid siginfo.
+*/
+   data = sizeof(r.pl);
+   if (uap->data < offsetof(struct ptrace_lwpinfo32, pl_siginfo) +
+   sizeof(struct siginfo32))
+   data = offsetof(struct p

svn commit: r361974 - in head/sys: arm64/coresight conf

2020-06-09 Thread Ruslan Bukin
Author: br
Date: Tue Jun  9 16:43:16 2020
New Revision: 361974
URL: https://svnweb.freebsd.org/changeset/base/361974

Log:
  ARM Embedded Trace Macrocell v4.x driver:
  o Split-out FDT attachment to a separate file;
  o Add ACPI attachment.
  
  Sponsored by: DARPA, AFRL

Added:
  head/sys/arm64/coresight/coresight_etm4x_acpi.c   (contents, props changed)
  head/sys/arm64/coresight/coresight_etm4x_fdt.c   (contents, props changed)
Modified:
  head/sys/arm64/coresight/coresight_etm4x.c
  head/sys/arm64/coresight/coresight_etm4x.h
  head/sys/conf/files.arm64

Modified: head/sys/arm64/coresight/coresight_etm4x.c
==
--- head/sys/arm64/coresight/coresight_etm4x.c  Tue Jun  9 16:15:07 2020
(r361973)
+++ head/sys/arm64/coresight/coresight_etm4x.c  Tue Jun  9 16:43:16 2020
(r361974)
@@ -40,9 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -66,16 +63,6 @@ __FBSDID("$FreeBSD$");
  * CPU3 -> ETM3 -> funnel1 -^
  */
 
-static struct ofw_compat_data compat_data[] = {
-   { "arm,coresight-etm4x",1 },
-   { NULL, 0 }
-};
-
-struct etm_softc {
-   struct resource *res;
-   struct coresight_platform_data  *pdata;
-};
-
 static struct resource_spec etm_spec[] = {
{ SYS_RES_MEMORY,   0,  RF_ACTIVE },
{ -1, 0 }
@@ -248,20 +235,6 @@ etm_disable(device_t dev, struct endpoint *endp,
 }
 
 static int
-etm_probe(device_t dev)
-{
-   if (!ofw_bus_status_okay(dev))
-   return (ENXIO);
-
-   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
-   return (ENXIO);
-
-   device_set_desc(dev, "AArch64 Embedded Trace Macrocell");
-
-   return (BUS_PROBE_DEFAULT);
-}
-
-static int
 etm_attach(device_t dev)
 {
struct coresight_desc desc;
@@ -285,7 +258,6 @@ etm_attach(device_t dev)
 
 static device_method_t etm_methods[] = {
/* Device interface */
-   DEVMETHOD(device_probe, etm_probe),
DEVMETHOD(device_attach,etm_attach),
 
/* Coresight interface */
@@ -295,13 +267,4 @@ static device_method_t etm_methods[] = {
DEVMETHOD_END
 };
 
-static driver_t etm_driver = {
-   "etm",
-   etm_methods,
-   sizeof(struct etm_softc),
-};
-
-static devclass_t etm_devclass;
-
-DRIVER_MODULE(etm, simplebus, etm_driver, etm_devclass, 0, 0);
-MODULE_VERSION(etm, 1);
+DEFINE_CLASS_0(etm, etm_driver, etm_methods, sizeof(struct etm_softc));

Modified: head/sys/arm64/coresight/coresight_etm4x.h
==
--- head/sys/arm64/coresight/coresight_etm4x.h  Tue Jun  9 16:15:07 2020
(r361973)
+++ head/sys/arm64/coresight/coresight_etm4x.h  Tue Jun  9 16:43:16 2020
(r361974)
@@ -34,6 +34,13 @@
 #ifndef_ARM64_CORESIGHT_ETM4X_H_
 #define_ARM64_CORESIGHT_ETM4X_H_
 
+DECLARE_CLASS(etm_driver);
+
+struct etm_softc {
+   struct resource *res;
+   struct coresight_platform_data  *pdata;
+};
+
 #defineTRCPRGCTLR  0x004 /* Trace Programming Control 
Register */
 #define TRCPRGCTLR_EN  (1 << 0) /* Trace unit enable bit */
 #defineTRCPROCSELR 0x008 /* Trace PE Select Control 
Register */

Added: head/sys/arm64/coresight/coresight_etm4x_acpi.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/coresight/coresight_etm4x_acpi.c Tue Jun  9 16:43:16 
2020(r361974)
@@ -0,0 +1,79 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020 Ruslan Bukin 
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE

svn commit: r361973 - in releng: 11.3 11.3/sys/conf 11.4 11.4/sys/conf 12.1 12.1/sys/conf

2020-06-09 Thread Gordon Tetlow
Author: gordon
Date: Tue Jun  9 16:15:07 2020
New Revision: 361973
URL: https://svnweb.freebsd.org/changeset/base/361973

Log:
  Add UPDATING entries and bump version.
  
  Approved by:  so
  Approved by:  re (implicit)

Modified:
  releng/11.3/UPDATING
  releng/11.3/sys/conf/newvers.sh
  releng/11.4/UPDATING
  releng/11.4/sys/conf/newvers.sh
  releng/12.1/UPDATING
  releng/12.1/sys/conf/newvers.sh

Modified: releng/11.3/UPDATING
==
--- releng/11.3/UPDATINGTue Jun  9 16:13:54 2020(r361972)
+++ releng/11.3/UPDATINGTue Jun  9 16:15:07 2020(r361973)
@@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20200609   p10 FreeBSD-SA-20:17.usb
+
+Fix USB HID descriptor parsing error. [SA-20:17.usb]
+
 20200512   p9  FreeBSD-EN-20:08.tzdata
FreeBSD-EN-20:10.build
FreeBSD-SA-20:12.libalias

Modified: releng/11.3/sys/conf/newvers.sh
==
--- releng/11.3/sys/conf/newvers.sh Tue Jun  9 16:13:54 2020
(r361972)
+++ releng/11.3/sys/conf/newvers.sh Tue Jun  9 16:15:07 2020
(r361973)
@@ -44,7 +44,7 @@
 
 TYPE="FreeBSD"
 REVISION="11.3"
-BRANCH="RELEASE-p9"
+BRANCH="RELEASE-p10"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: releng/11.4/UPDATING
==
--- releng/11.4/UPDATINGTue Jun  9 16:13:54 2020(r361972)
+++ releng/11.4/UPDATINGTue Jun  9 16:15:07 2020(r361973)
@@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20200609: 11.4-RC2-p1  FreeBSD-SA-20:17.usb
+
+Fix USB HID descriptor parsing error. [SA-20:17.usb]
+
 20200512: 11.4-BETA1-p1FreeBSD-SA-20:12.libalias
FreeBSD-SA-20:13.libalias
 

Modified: releng/11.4/sys/conf/newvers.sh
==
--- releng/11.4/sys/conf/newvers.sh Tue Jun  9 16:13:54 2020
(r361972)
+++ releng/11.4/sys/conf/newvers.sh Tue Jun  9 16:15:07 2020
(r361973)
@@ -44,7 +44,7 @@
 
 TYPE="FreeBSD"
 REVISION="11.4"
-BRANCH="RC2"
+BRANCH="RC2-p1"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: releng/12.1/UPDATING
==
--- releng/12.1/UPDATINGTue Jun  9 16:13:54 2020(r361972)
+++ releng/12.1/UPDATINGTue Jun  9 16:15:07 2020(r361973)
@@ -16,6 +16,16 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20200609   p6  FreeBSD-EN-20:11.ena
+   FreeBSD-EN-20:12.iflib
+   FreeBSD-SA-20:17.usb
+
+Fix stability issues in ena(4) driver. [EN-20:11.ena]
+
+Fix iflib watchdog timeout resetting idle queues. [EN-20:12.iflib]
+
+Fix USB HID descriptor parsing error. [SA-20:17.usb]
+
 20200512   p5  FreeBSD-EN-20:08.tzdata
FreeBSD-EN-20:09.igb
FreeBSD-EN-20:10.build

Modified: releng/12.1/sys/conf/newvers.sh
==
--- releng/12.1/sys/conf/newvers.sh Tue Jun  9 16:13:54 2020
(r361972)
+++ releng/12.1/sys/conf/newvers.sh Tue Jun  9 16:15:07 2020
(r361973)
@@ -46,7 +46,7 @@
 
 TYPE="FreeBSD"
 REVISION="12.1"
-BRANCH="RELEASE-p5"
+BRANCH="RELEASE-p6"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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: r361972 - in releng: 11.3/lib/libusbhid 11.3/sys/dev/usb 11.4/lib/libusbhid 11.4/sys/dev/usb 12.1/lib/libusbhid 12.1/sys/dev/usb

2020-06-09 Thread Gordon Tetlow
Author: gordon
Date: Tue Jun  9 16:13:54 2020
New Revision: 361972
URL: https://svnweb.freebsd.org/changeset/base/361972

Log:
  Fix USB HID descriptor parsing error.
  
  Approved by:  so
  Approved by:  re (implicit)
  Security: FreeBSD-SA-20:17.usb
  Security: CVE-2020-7456

Modified:
  releng/11.3/lib/libusbhid/parse.c
  releng/11.3/sys/dev/usb/usb_hid.c
  releng/11.4/lib/libusbhid/parse.c
  releng/11.4/sys/dev/usb/usb_hid.c
  releng/12.1/lib/libusbhid/parse.c
  releng/12.1/sys/dev/usb/usb_hid.c

Modified: releng/11.3/lib/libusbhid/parse.c
==
--- releng/11.3/lib/libusbhid/parse.c   Tue Jun  9 16:11:54 2020
(r361971)
+++ releng/11.3/lib/libusbhid/parse.c   Tue Jun  9 16:13:54 2020
(r361972)
@@ -401,26 +401,28 @@ hid_get_item_raw(hid_data_t s, hid_item_t *h)
s->loc_count = dval & mask;
break;
case 10:/* Push */
+   /* stop parsing, if invalid push level */
+   if ((s->pushlevel + 1) >= MAXPUSH)
+   return (0);
s->pushlevel ++;
-   if (s->pushlevel < MAXPUSH) {
-   s->cur[s->pushlevel] = *c;
-   /* store size and count */
-   c->report_size = s->loc_size;
-   c->report_count = s->loc_count;
-   /* update current item pointer */
-   c = &s->cur[s->pushlevel];
-   }
+   s->cur[s->pushlevel] = *c;
+   /* store size and count */
+   c->report_size = s->loc_size;
+   c->report_count = s->loc_count;
+   /* update current item pointer */
+   c = &s->cur[s->pushlevel];
break;
case 11:/* Pop */
+   /* stop parsing, if invalid push level */
+   if (s->pushlevel == 0)
+   return (0);
s->pushlevel --;
-   if (s->pushlevel < MAXPUSH) {
-   c = &s->cur[s->pushlevel];
-   /* restore size and count */
-   s->loc_size = c->report_size;
-   s->loc_count = c->report_count;
-   c->report_size = 0;
-   c->report_count = 0;
-   }
+   c = &s->cur[s->pushlevel];
+   /* restore size and count */
+   s->loc_size = c->report_size;
+   s->loc_count = c->report_count;
+   c->report_size = 0;
+   c->report_count = 0;
break;
default:
break;

Modified: releng/11.3/sys/dev/usb/usb_hid.c
==
--- releng/11.3/sys/dev/usb/usb_hid.c   Tue Jun  9 16:11:54 2020
(r361971)
+++ releng/11.3/sys/dev/usb/usb_hid.c   Tue Jun  9 16:13:54 2020
(r361972)
@@ -434,36 +434,36 @@ hid_get_item(struct hid_data *s, struct hid_item *h)
s->loc_count = dval & mask;
break;
case 10:/* Push */
-   s->pushlevel ++;
-   if (s->pushlevel < MAXPUSH) {
-   s->cur[s->pushlevel] = *c;
-   /* store size and count */
-   c->loc.size = s->loc_size;
-   c->loc.count = s->loc_count;
-   /* update current item pointer */
-   c = &s->cur[s->pushlevel];
-   } else {
-   DPRINTFN(0, "Cannot push "
-   "item @ %d\n", s->pushlevel);
+   /* stop parsing, if invalid push level */
+   if ((s->pushlevel + 1) >= MAXPUSH) {
+   DPRINTFN(0, "Cannot push item @ %d\n", 
s->pushlevel);
+   return (0);
}
+   s->

svn commit: r361971 - releng/12.1/sys/net

2020-06-09 Thread Gordon Tetlow
Author: gordon
Date: Tue Jun  9 16:11:54 2020
New Revision: 361971
URL: https://svnweb.freebsd.org/changeset/base/361971

Log:
  Fix iflib watchdog timeout resetting idle queues.
  
  Approved by:  so
  Security: FreeBSD-EN-20:12.iflib

Modified:
  releng/12.1/sys/net/iflib.c

Modified: releng/12.1/sys/net/iflib.c
==
--- releng/12.1/sys/net/iflib.c Tue Jun  9 16:10:57 2020(r361970)
+++ releng/12.1/sys/net/iflib.c Tue Jun  9 16:11:54 2020(r361971)
@@ -2294,8 +2294,11 @@ iflib_timer(void *arg)
 (sctx->isc_pause_frames == 0)))
goto hung;
 
-   if (ifmp_ring_is_stalled(txq->ift_br))
+   if (txq->ift_qstatus != IFLIB_QUEUE_IDLE &&
+   ifmp_ring_is_stalled(txq->ift_br)) {
+   KASSERT(ctx->ifc_link_state == LINK_STATE_UP, ("queue 
can't be marked as hung if interface is down"));
txq->ift_qstatus = IFLIB_QUEUE_HUNG;
+   }
txq->ift_cleaned_prev = txq->ift_cleaned;
}
 #ifdef DEV_NETMAP
___
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: r361970 - releng/12.1/sys/dev/ena

2020-06-09 Thread Gordon Tetlow
Author: gordon
Date: Tue Jun  9 16:10:57 2020
New Revision: 361970
URL: https://svnweb.freebsd.org/changeset/base/361970

Log:
  Fix stability issues in ena(4) driver.
  
  Approved by:  so
  Security: FreeBSD-EN-20:11.ena

Modified:
  releng/12.1/sys/dev/ena/ena.c
  releng/12.1/sys/dev/ena/ena.h

Modified: releng/12.1/sys/dev/ena/ena.c
==
--- releng/12.1/sys/dev/ena/ena.c   Tue Jun  9 16:06:10 2020
(r361969)
+++ releng/12.1/sys/dev/ena/ena.c   Tue Jun  9 16:10:57 2020
(r361970)
@@ -200,6 +200,19 @@ int ena_log_level = ENA_ALERT | ENA_WARNING;
 SYSCTL_INT(_hw_ena, OID_AUTO, log_level, CTLFLAG_RWTUN,
 &ena_log_level, 0, "Logging level indicating verbosity of the logs");
 
+/*
+ * Use 9k mbufs for the Rx buffers. Default to 0 (use page size mbufs instead).
+ * Using 9k mbufs in low memory conditions might cause allocation to take a lot
+ * of time and lead to the OS instability as it needs to look for the 
contiguous
+ * pages.
+ * However, page size mbufs has a bit smaller throughput than 9k mbufs, so if
+ * the network performance is the priority, the 9k mbufs can be used.
+ */
+int ena_enable_9k_mbufs = 0;
+SYSCTL_INT(_hw_ena, OID_AUTO, enable_9k_mbufs, CTLFLAG_RDTUN,
+&ena_enable_9k_mbufs, 0, "Use 9 kB mbufs for Rx descriptors");
+#define ena_mbuf_sz (ena_enable_9k_mbufs ? MJUM9BYTES : MJUMPAGESIZE)
+
 static ena_vendor_info_t ena_vendor_info_array[] = {
 { PCI_VENDOR_ID_AMAZON, PCI_DEV_ID_ENA_PF, 0},
 { PCI_VENDOR_ID_AMAZON, PCI_DEV_ID_ENA_LLQ_PF, 0},
@@ -470,6 +483,7 @@ ena_init_io_rings(struct ena_adapter *adapter)
rxr->que = que;
 
rxr->empty_rx_queue = 0;
+   rxr->rx_mbuf_sz = ena_mbuf_sz;
}
 }
 
@@ -548,9 +562,9 @@ ena_setup_rx_dma_tag(struct ena_adapter *adapter)
ENA_DMA_BIT_MASK(adapter->dma_width), /* lowaddr of excl window  */
BUS_SPACE_MAXADDR,/* highaddr of excl window */
NULL, NULL,   /* filter, filterarg   */
-   MJUM16BYTES,  /* maxsize */
+   ena_mbuf_sz,  /* maxsize */
adapter->max_rx_sgl_size, /* nsegments   */
-   MJUM16BYTES,  /* maxsegsize  */
+   ena_mbuf_sz,  /* maxsegsize  */
0,/* flags   */
NULL, /* lockfunc*/
NULL, /* lockarg */
@@ -957,7 +971,8 @@ ena_alloc_rx_mbuf(struct ena_adapter *adapter,
return (0);
 
/* Get mbuf using UMA allocator */
-   rx_info->mbuf = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM16BYTES);
+   rx_info->mbuf = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR,
+   rx_ring->rx_mbuf_sz);
 
if (unlikely(rx_info->mbuf == NULL)) {
counter_u64_add(rx_ring->rx_stats.mjum_alloc_fail, 1);
@@ -968,7 +983,7 @@ ena_alloc_rx_mbuf(struct ena_adapter *adapter,
}
mlen = MCLBYTES;
} else {
-   mlen = MJUM16BYTES;
+   mlen = rx_ring->rx_mbuf_sz;
}
/* Set mbuf length*/
rx_info->mbuf->m_pkthdr.len = rx_info->mbuf->m_len = mlen;

Modified: releng/12.1/sys/dev/ena/ena.h
==
--- releng/12.1/sys/dev/ena/ena.h   Tue Jun  9 16:06:10 2020
(r361969)
+++ releng/12.1/sys/dev/ena/ena.h   Tue Jun  9 16:10:57 2020
(r361970)
@@ -41,7 +41,7 @@
 
 #define DRV_MODULE_VER_MAJOR   0
 #define DRV_MODULE_VER_MINOR   8
-#define DRV_MODULE_VER_SUBMINOR 4
+#define DRV_MODULE_VER_SUBMINOR 5
 
 #define DRV_MODULE_NAME"ena"
 
@@ -238,8 +238,12 @@ struct ena_ring {
 
/* Determines if device will use LLQ or normal mode for TX */
enum ena_admin_placement_policy_type tx_mem_queue_type;
-   /* The maximum length the driver can push to the device (For LLQ) */
-   uint8_t tx_max_header_size;
+   union {
+   /* The maximum length the driver can push to the device (For 
LLQ) */
+   uint8_t tx_max_header_size;
+   /* The maximum (and default) mbuf size for the Rx descriptor. */
+   uint16_t rx_mbuf_sz;
+   };
 
struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS];
 
___
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: r361969 - head/sys/arm64/coresight

2020-06-09 Thread Ruslan Bukin
Author: br
Date: Tue Jun  9 16:06:10 2020
New Revision: 361969
URL: https://svnweb.freebsd.org/changeset/base/361969

Log:
  Fix style: wrap long lines.
  
  Sponsored by: DARPA, AFRL

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

Modified: head/sys/arm64/coresight/coresight.c
==
--- head/sys/arm64/coresight/coresight.cTue Jun  9 15:56:41 2020
(r361968)
+++ head/sys/arm64/coresight/coresight.cTue Jun  9 16:06:10 2020
(r361969)
@@ -78,30 +78,33 @@ coresight_get_ports(phandle_t dev_node,
strncasecmp(name, "port@", 6)) {
 
port_reg = -1;
-   OF_getencprop(child, "reg", (void *)&port_reg, 
sizeof(port_reg));
+   OF_getencprop(child, "reg", (void *)&port_reg,
+   sizeof(port_reg));
 
endpoint_child = ofw_bus_find_child(child, "endpoint");
if (endpoint_child) {
-   if (OF_getencprop(endpoint_child, 
"remote-endpoint", &xref,
+   if (OF_getencprop(endpoint_child,
+   "remote-endpoint", &xref,
sizeof(xref)) == -1) {
printf("failed\n");
continue;
}
-   endp = malloc(sizeof(struct endpoint), 
M_CORESIGHT,
-   M_WAITOK | M_ZERO);
+   endp = malloc(sizeof(struct endpoint),
+   M_CORESIGHT, M_WAITOK | M_ZERO);
endp->my_node = endpoint_child;
endp->their_node = OF_node_from_xref(xref);
endp->dev_node = dev_node;
endp->reg = port_reg;
-   if (OF_getproplen(endpoint_child, "slave-mode") 
>= 0) {
+   if (OF_getproplen(endpoint_child,
+   "slave-mode") >= 0) {
pdata->in_ports++;
endp->slave = 1;
-   } else {
+   } else
pdata->out_ports++;
-   }
 
mtx_lock(&pdata->mtx_lock);
-   TAILQ_INSERT_TAIL(&pdata->endpoints, endp, 
link);
+   TAILQ_INSERT_TAIL(&pdata->endpoints,
+   endp, link);
mtx_unlock(&pdata->mtx_lock);
}
}
___
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: r361968 - in head/sys: arm64/coresight conf

2020-06-09 Thread Ruslan Bukin
Author: br
Date: Tue Jun  9 15:56:41 2020
New Revision: 361968
URL: https://svnweb.freebsd.org/changeset/base/361968

Log:
  Rename coresight drivers: use underscores in filenames.
  
  Sponsored by: DARPA, AFRL

Added:
  head/sys/arm64/coresight/coresight_cmd.c
 - copied unchanged from r361967, head/sys/arm64/coresight/coresight-cmd.c
  head/sys/arm64/coresight/coresight_cpu_debug.c
 - copied unchanged from r361967, 
head/sys/arm64/coresight/coresight-cpu-debug.c
  head/sys/arm64/coresight/coresight_dynamic_replicator.c
 - copied unchanged from r361967, 
head/sys/arm64/coresight/coresight-dynamic-replicator.c
  head/sys/arm64/coresight/coresight_etm4x.c
 - copied, changed from r361967, head/sys/arm64/coresight/coresight-etm4x.c
  head/sys/arm64/coresight/coresight_etm4x.h
 - copied unchanged from r361967, head/sys/arm64/coresight/coresight-etm4x.h
  head/sys/arm64/coresight/coresight_funnel.c
 - copied, changed from r361967, head/sys/arm64/coresight/coresight-funnel.c
  head/sys/arm64/coresight/coresight_funnel.h
 - copied unchanged from r361967, 
head/sys/arm64/coresight/coresight-funnel.h
  head/sys/arm64/coresight/coresight_tmc.c
 - copied, changed from r361967, head/sys/arm64/coresight/coresight-tmc.c
  head/sys/arm64/coresight/coresight_tmc.h
 - copied unchanged from r361967, head/sys/arm64/coresight/coresight-tmc.h
Deleted:
  head/sys/arm64/coresight/coresight-cmd.c
  head/sys/arm64/coresight/coresight-cpu-debug.c
  head/sys/arm64/coresight/coresight-dynamic-replicator.c
  head/sys/arm64/coresight/coresight-etm4x.c
  head/sys/arm64/coresight/coresight-etm4x.h
  head/sys/arm64/coresight/coresight-funnel.c
  head/sys/arm64/coresight/coresight-funnel.h
  head/sys/arm64/coresight/coresight-tmc.c
  head/sys/arm64/coresight/coresight-tmc.h
Modified:
  head/sys/conf/files.arm64

Copied: head/sys/arm64/coresight/coresight_cmd.c (from r361967, 
head/sys/arm64/coresight/coresight-cmd.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/coresight/coresight_cmd.cTue Jun  9 15:56:41 2020
(r361968, copy of r361967, head/sys/arm64/coresight/coresight-cmd.c)
@@ -0,0 +1,156 @@
+/*-
+ * Copyright (c) 2018 Ruslan Bukin 
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "coresight_if.h"
+
+extern struct coresight_device_list cs_devs;
+
+static struct coresight_device *
+coresight_next_device(struct coresight_device *cs_dev,
+struct coresight_event *event)
+{
+   struct coresight_device *out;
+   struct endpoint *out_endp;
+   struct endpoint *endp;
+
+   TAILQ_FOREACH(endp, &cs_dev->pdata->endpoints, link) {
+   if (endp->slave != 0)
+   continue;
+
+   out = coresight_get_output_device(endp, &out_endp);
+   if (out != NULL) {
+   if (LIST_EMPTY(&event->endplist)) {
+   /* Add source device */
+   endp->cs_dev = cs_dev;
+   LIST_INSERT_HEAD(&event->endplist, endp,
+   endplink);
+   }
+
+   /* Add output device */
+   out_endp->cs_dev = out;
+   LIST_INSER

svn commit: r361967 - head/sys/kern

2020-06-09 Thread Mateusz Guzik
Author: mjg
Date: Tue Jun  9 15:17:23 2020
New Revision: 361967
URL: https://svnweb.freebsd.org/changeset/base/361967

Log:
  Assert on pg_jobc state.
  
  Stolen from NetBSD.

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Tue Jun  9 14:20:16 2020(r361966)
+++ head/sys/kern/kern_proc.c   Tue Jun  9 15:17:23 2020(r361967)
@@ -751,9 +751,11 @@ pgadjustjobc(struct pgrp *pgrp, int entering)
 {
 
PGRP_LOCK(pgrp);
-   if (entering)
+   if (entering) {
+   MPASS(pgrp->pg_jobc >= 0);
pgrp->pg_jobc++;
-   else {
+   } else {
+   MPASS(pgrp->pg_jobc > 0);
--pgrp->pg_jobc;
if (pgrp->pg_jobc == 0)
orphanpg(pgrp);
___
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: r361885 - head/sys/net80211

2020-06-09 Thread Mateusz Guzik
On 6/7/20, Adrian Chadd  wrote:
> Author: adrian
> Date: Sun Jun  7 04:57:48 2020
> New Revision: 361885
> URL: https://svnweb.freebsd.org/changeset/base/361885
>
> Log:
>   [net80211] Add a method to return the vap's ifname.
>
>   This removes the requirement to know what's in the ifp.
>
>   (If someone wants a quick clean-up task, it'd be nice to convert
> instances
>   of ifp dereferencing for if_xname over to this method.)
>
> Modified:
>   head/sys/net80211/ieee80211_freebsd.c
>   head/sys/net80211/ieee80211_freebsd.h
>
> Modified: head/sys/net80211/ieee80211_freebsd.c
> ==
> --- head/sys/net80211/ieee80211_freebsd.c Sun Jun  7 04:32:38
> 2020  (r361884)
> +++ head/sys/net80211/ieee80211_freebsd.c Sun Jun  7 04:57:48
> 2020  (r361885)
> @@ -1034,6 +1034,20 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp)
>  }
>
>  /*
> + * Fetch the VAP name.
> + *
> + * This returns a const char pointer suitable for debugging,
> + * but don't expect it to stick around for much longer.
> + */
> +const char *
> +ieee80211_get_vap_ifname(struct ieee80211vap *vap)
> +{
> + if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))
> + return "(none)";
> + return vap->iv_ifp->if_xname;
> +}
> +

This gives me:

/usr/src/sys/net80211/ieee80211_freebsd.c:1045:45: warning: comparison
of array 'vap->iv_ifp->if_xname' equal to a null pointer is always
false [-Wtautological-pointer-compare]
if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))

-- 
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: r361966 - stable/11/sys/sys

2020-06-09 Thread Ed Maste
Author: emaste
Date: Tue Jun  9 14:20:16 2020
New Revision: 361966
URL: https://svnweb.freebsd.org/changeset/base/361966

Log:
  MFC r361657: elf_common.h: define DF_1_PIE
  
  DF_1_PIE indicates that the object is a position-independent executable.
  
  Reference:
  https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/sys/elf_common.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/elf_common.h
==
--- stable/11/sys/sys/elf_common.h  Tue Jun  9 14:16:18 2020
(r361965)
+++ stable/11/sys/sys/elf_common.h  Tue Jun  9 14:20:16 2020
(r361966)
@@ -732,6 +732,7 @@ typedef struct {
 #defineDF_1_ORIGIN 0x0080  /* Process $ORIGIN */
 #defineDF_1_INTERPOSE  0x0400  /* Interpose all objects but 
main */
 #defineDF_1_NODEFLIB   0x0800  /* Do not search default paths 
*/
+#defineDF_1_PIE0x0800  /* Is position-independent 
executable */
 
 /* Values for l_flags. */
 #defineLL_NONE 0x0 /* no flags */
___
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: r361965 - head/sys/vm

2020-06-09 Thread Mateusz Guzik
Author: mjg
Date: Tue Jun  9 14:16:18 2020
New Revision: 361965
URL: https://svnweb.freebsd.org/changeset/base/361965

Log:
  vm: rework swap_pager_status to execute in constant time
  
  The lock-protected iteration is trivially avoidable.
  
  This removes a serialisation point from Linux binaries (which end up calling
  here from the sysinfo syscall).

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cTue Jun  9 09:42:39 2020(r361964)
+++ head/sys/vm/swap_pager.cTue Jun  9 14:16:18 2020(r361965)
@@ -2541,16 +2541,10 @@ swapoff_all(void)
 void
 swap_pager_status(int *total, int *used)
 {
-   struct swdevt *sp;
 
-   *total = 0;
-   *used = 0;
-   mtx_lock(&sw_dev_mtx);
-   TAILQ_FOREACH(sp, &swtailq, sw_list) {
-   *total += sp->sw_nblks;
-   *used += sp->sw_used;
-   }
-   mtx_unlock(&sw_dev_mtx);
+   *total = swap_total;
+   *used = swap_total - swap_pager_avail -
+   nswapdev * howmany(BBSIZE, PAGE_SIZE);
 }
 
 int
___
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: r361964 - head/sys/dev/cpufreq

2020-06-09 Thread Emmanuel Vadot
Author: manu
Date: Tue Jun  9 09:42:39 2020
New Revision: 361964
URL: https://svnweb.freebsd.org/changeset/base/361964

Log:
  coufreq_dt: Rename DEBUG to DPRINTF
  
  DEBUG is a kernel configuration flag and if used cpufreq_dt.c will fail the
  build of kernel.
  
  PR:   246867
  Submitted by: Oskar Holmund (oskar.holml...@ohdata.se)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25080

Modified:
  head/sys/dev/cpufreq/cpufreq_dt.c

Modified: head/sys/dev/cpufreq/cpufreq_dt.c
==
--- head/sys/dev/cpufreq/cpufreq_dt.c   Tue Jun  9 09:04:57 2020
(r361963)
+++ head/sys/dev/cpufreq/cpufreq_dt.c   Tue Jun  9 09:42:39 2020
(r361964)
@@ -52,9 +52,9 @@ __FBSDID("$FreeBSD$");
 #include "cpufreq_if.h"
 
 #if 0
-#define DEBUG(dev, msg...) device_printf(dev, "cpufreq_dt: " msg);
+#define DPRINTF(dev, msg...) device_printf(dev, "cpufreq_dt: " msg);
 #else
-#define DEBUG(dev, msg...)
+#define DPRINTF(dev, msg...)
 #endif
 
 enum opp_version {
@@ -110,12 +110,12 @@ cpufreq_dt_find_opp(device_t dev, uint64_t freq)
 
sc = device_get_softc(dev);
 
-   DEBUG(dev, "Looking for freq %ju\n", freq);
+   DPRINTF(dev, "Looking for freq %ju\n", freq);
for (n = 0; n < sc->nopp; n++)
if (CPUFREQ_CMP(sc->opp[n].freq, freq))
return (&sc->opp[n]);
 
-   DEBUG(dev, "Couldn't find one\n");
+   DPRINTF(dev, "Couldn't find one\n");
return (NULL);
 }
 
@@ -144,7 +144,7 @@ cpufreq_dt_get(device_t dev, struct cf_setting *set)
 
sc = device_get_softc(dev);
 
-   DEBUG(dev, "cpufreq_dt_get\n");
+   DPRINTF(dev, "cpufreq_dt_get\n");
if (clk_get_freq(sc->clk, &freq) != 0)
return (ENXIO);
 
@@ -156,7 +156,7 @@ cpufreq_dt_get(device_t dev, struct cf_setting *set)
 
cpufreq_dt_opp_to_setting(dev, opp, set);
 
-   DEBUG(dev, "Current freq %dMhz\n", set->freq);
+   DPRINTF(dev, "Current freq %dMhz\n", set->freq);
return (0);
 }
 
@@ -170,10 +170,10 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *
 
sc = device_get_softc(dev);
 
-   DEBUG(dev, "Working on cpu %d\n", sc->cpu);
-   DEBUG(dev, "We have %d cpu on this dev\n", CPU_COUNT(&sc->cpus));
+   DPRINTF(dev, "Working on cpu %d\n", sc->cpu);
+   DPRINTF(dev, "We have %d cpu on this dev\n", CPU_COUNT(&sc->cpus));
if (!CPU_ISSET(sc->cpu, &sc->cpus)) {
-   DEBUG(dev, "Not for this CPU\n");
+   DPRINTF(dev, "Not for this CPU\n");
return (0);
}
 
@@ -205,26 +205,26 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *
device_printf(dev, "Couldn't find an opp for this freq\n");
return (EINVAL);
}
-   DEBUG(sc->dev, "Current freq %ju, uvolt: %d\n", freq, uvolt);
-   DEBUG(sc->dev, "Target freq %ju, , uvolt: %d\n",
+   DPRINTF(sc->dev, "Current freq %ju, uvolt: %d\n", freq, uvolt);
+   DPRINTF(sc->dev, "Target freq %ju, , uvolt: %d\n",
opp->freq, opp->uvolt_target);
 
if (uvolt < opp->uvolt_target) {
-   DEBUG(dev, "Changing regulator from %u to %u\n",
+   DPRINTF(dev, "Changing regulator from %u to %u\n",
uvolt, opp->uvolt_target);
error = regulator_set_voltage(sc->reg,
opp->uvolt_min,
opp->uvolt_max);
if (error != 0) {
-   DEBUG(dev, "Failed, backout\n");
+   DPRINTF(dev, "Failed, backout\n");
return (ENXIO);
}
}
 
-   DEBUG(dev, "Setting clk to %ju\n", opp->freq);
+   DPRINTF(dev, "Setting clk to %ju\n", opp->freq);
error = clk_set_freq(sc->clk, opp->freq, CLK_SET_ROUND_DOWN);
if (error != 0) {
-   DEBUG(dev, "Failed, backout\n");
+   DPRINTF(dev, "Failed, backout\n");
/* Restore previous voltage (best effort) */
error = regulator_set_voltage(sc->reg,
copp->uvolt_min,
@@ -233,13 +233,13 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *
}
 
if (uvolt > opp->uvolt_target) {
-   DEBUG(dev, "Changing regulator from %u to %u\n",
+   DPRINTF(dev, "Changing regulator from %u to %u\n",
uvolt, opp->uvolt_target);
error = regulator_set_voltage(sc->reg,
opp->uvolt_min,
opp->uvolt_max);
if (error != 0) {
-   DEBUG(dev, "Failed to switch regulator to %d\n",
+   DPRINTF(dev, "Failed to switch regulator to %d\n",
opp->uvolt_target);
/* Restore previous CPU frequency (best effort) */
(void)clk_set_freq(sc->clk, copp->freq, 0);
@@ 

svn commit: r361963 - stable/12/libexec/rtld-elf

2020-06-09 Thread Konstantin Belousov
Author: kib
Date: Tue Jun  9 09:04:57 2020
New Revision: 361963
URL: https://svnweb.freebsd.org/changeset/base/361963

Log:
  MFC r361725, r361728:
  Do not allow to load ET_DYN object with DF_1_PIE flag set.

Modified:
  stable/12/libexec/rtld-elf/rtld.c
  stable/12/libexec/rtld-elf/rtld.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/rtld-elf/rtld.c
==
--- stable/12/libexec/rtld-elf/rtld.c   Tue Jun  9 07:07:29 2020
(r361962)
+++ stable/12/libexec/rtld-elf/rtld.c   Tue Jun  9 09:04:57 2020
(r361963)
@@ -1321,6 +1321,8 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_D
obj->z_interpose = true;
if (dynp->d_un.d_val & DF_1_NODEFLIB)
obj->z_nodeflib = true;
+   if (dynp->d_un.d_val & DF_1_PIE)
+   obj->z_pie = true;
break;
 
default:
@@ -2533,6 +2535,10 @@ do_load_object(int fd, const char *name, char *path, s
 obj->path = path;
 if (!digest_dynamic(obj, 0))
goto errp;
+if (obj->z_pie) {
+   _rtld_error("Cannot load PIE binary %s as DSO", obj->path);
+   goto errp;
+}
 dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d", obj->path,
obj->valid_hash_sysv, obj->valid_hash_gnu, obj->dynsymcount);
 if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) ==

Modified: stable/12/libexec/rtld-elf/rtld.h
==
--- stable/12/libexec/rtld-elf/rtld.h   Tue Jun  9 07:07:29 2020
(r361962)
+++ stable/12/libexec/rtld-elf/rtld.h   Tue Jun  9 09:04:57 2020
(r361963)
@@ -258,6 +258,7 @@ typedef struct Struct_Obj_Entry {
 bool z_interpose : 1;  /* Interpose all objects but main */
 bool z_nodeflib : 1;   /* Don't search default library path */
 bool z_global : 1; /* Make the object global */
+bool z_pie : 1;/* Object proclaimed itself PIE executable */
 bool static_tls : 1;   /* Needs static TLS allocation */
 bool static_tls_copied : 1;/* Needs static TLS copying */
 bool ref_nodel : 1;/* Refcount increased to prevent 
dlclose */
___
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: r361962 - head/bin/ps

2020-06-09 Thread Yuri Pankov
Author: yuripv
Date: Tue Jun  9 07:07:29 2020
New Revision: 361962
URL: https://svnweb.freebsd.org/changeset/base/361962

Log:
  ps: remove xo_no_setlocale() call
  
  Apparently libxo was fixed to do the right thing on FreeBSD,
  and calling xo_no_setlocale() is no longer needed.
  
  Reported by:  phil

Modified:
  head/bin/ps/ps.c

Modified: head/bin/ps/ps.c
==
--- head/bin/ps/ps.cTue Jun  9 06:48:25 2020(r361961)
+++ head/bin/ps/ps.cTue Jun  9 07:07:29 2020(r361962)
@@ -192,7 +192,6 @@ main(int argc, char *argv[])
char fmtbuf[_POSIX2_LINE_MAX];
 
(void) setlocale(LC_ALL, "");
-   xo_no_setlocale();
time(&now); /* Used by routines in print.c. */
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"