svn commit: r364946 - head/sys/kern

2020-08-28 Thread Warner Losh
Author: imp
Date: Sat Aug 29 04:30:12 2020
New Revision: 364946
URL: https://svnweb.freebsd.org/changeset/base/364946

Log:
  Move to using sbuf for some sysctl in newbus
  
  Convert two different sysctl to using sbuf. First, for all the default
  sysctls we implement for each device driver that's attached. This is a
  pure sbuf conversion.
  
  Second, convert sysctl_devices to fill its buffer with sbuf rather
  than a hand-rolled crappy thing I wrote years ago.
  
  Reviewed by: cem, markj
  Differential Revision: https://reviews.freebsd.org/D26206

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cSat Aug 29 04:30:06 2020(r364945)
+++ head/sys/kern/subr_bus.cSat Aug 29 04:30:12 2020(r364946)
@@ -260,36 +260,33 @@ enum {
 static int
 device_sysctl_handler(SYSCTL_HANDLER_ARGS)
 {
+   struct sbuf sb;
device_t dev = (device_t)arg1;
-   const char *value;
-   char *buf;
int error;
 
-   buf = NULL;
+   sbuf_new_for_sysctl(, NULL, 1024, req);
switch (arg2) {
case DEVICE_SYSCTL_DESC:
-   value = dev->desc ? dev->desc : "";
+   sbuf_cpy(, dev->desc ? dev->desc : "");
break;
case DEVICE_SYSCTL_DRIVER:
-   value = dev->driver ? dev->driver->name : "";
+   sbuf_cpy(, dev->driver ? dev->driver->name : "");
break;
case DEVICE_SYSCTL_LOCATION:
-   value = buf = malloc(1024, M_BUS, M_WAITOK | M_ZERO);
-   bus_child_location_str(dev, buf, 1024);
+   bus_child_location_sb(dev, );
break;
case DEVICE_SYSCTL_PNPINFO:
-   value = buf = malloc(1024, M_BUS, M_WAITOK | M_ZERO);
-   bus_child_pnpinfo_str(dev, buf, 1024);
+   bus_child_pnpinfo_sb(dev, );
break;
case DEVICE_SYSCTL_PARENT:
-   value = dev->parent ? dev->parent->nameunit : "";
+   sbuf_cpy(, dev->parent ? dev->parent->nameunit : "");
break;
default:
+   sbuf_delete();
return (EINVAL);
}
-   error = SYSCTL_OUT_STR(req, value);
-   if (buf != NULL)
-   free(buf, M_BUS);
+   error = sbuf_finish();
+   sbuf_delete();
return (error);
 }
 
@@ -5464,13 +5461,13 @@ SYSCTL_PROC(_hw_bus, OID_AUTO, info, CTLTYPE_STRUCT | 
 static int
 sysctl_devices(SYSCTL_HANDLER_ARGS)
 {
+   struct sbuf sb;
int *name = (int *)arg1;
u_int   namelen = arg2;
int index;
device_tdev;
struct u_device *udev;
int error;
-   char*walker, *ep;
 
if (namelen != 2)
return (EINVAL);
@@ -5501,34 +5498,21 @@ sysctl_devices(SYSCTL_HANDLER_ARGS)
udev->dv_devflags = dev->devflags;
udev->dv_flags = dev->flags;
udev->dv_state = dev->state;
-   walker = udev->dv_fields;
-   ep = walker + sizeof(udev->dv_fields);
-#define CP(src)\
-   if ((src) == NULL)  \
-   *walker++ = '\0';   \
-   else {  \
-   strlcpy(walker, (src), ep - walker);\
-   walker += strlen(walker) + 1;   \
-   }   \
-   if (walker >= ep)   \
-   break;
-
-   do {
-   CP(dev->nameunit);
-   CP(dev->desc);
-   CP(dev->driver != NULL ? dev->driver->name : NULL);
-   bus_child_pnpinfo_str(dev, walker, ep - walker);
-   walker += strlen(walker) + 1;
-   if (walker >= ep)
-   break;
-   bus_child_location_str(dev, walker, ep - walker);
-   walker += strlen(walker) + 1;
-   if (walker >= ep)
-   break;
-   *walker++ = '\0';
-   } while (0);
-#undef CP
-   error = SYSCTL_OUT(req, udev, sizeof(*udev));
+   sbuf_new(, udev->dv_fields, sizeof(udev->dv_fields), SBUF_FIXEDLEN);
+   sbuf_cat(, dev->nameunit);
+   sbuf_putc(, '\0');
+   sbuf_cat(, dev->desc);
+   sbuf_putc(, '\0');
+   sbuf_cat(, dev->driver != NULL ? dev->driver->name : '\0');
+   sbuf_putc(, '\0');
+   bus_child_pnpinfo_sb(dev, );
+   sbuf_putc(, '\0');
+   bus_child_location_sb(dev, );
+   sbuf_putc(, '\0');
+   error = sbuf_finish();
+   if (error == 0)
+   error = SYSCTL_OUT(req, udev, sizeof(*udev));
+   sbuf_delete();
free(udev, M_BUS);
return (error);
 }

svn commit: r364944 - head/sys/kern

2020-08-28 Thread Warner Losh
Author: imp
Date: Sat Aug 29 04:29:53 2020
New Revision: 364944
URL: https://svnweb.freebsd.org/changeset/base/364944

Log:
  devctl: move to using a uma zone
  
  Convert the memory management of devctl.  Rewrite if to make better
  use of memory. This eliminates several mallocs (5? worse case) needed
  to send a message. It's now possible to always send a message, though
  if things are really backed up the oldest message will be dropped to
  free up space for the newest.
  
  Add a static bus_child_{location,pnpinfo}_sb to start migrating to
  sbuf instead of buffer + length. Use it in the new code.  Other code
  will be converted later (bus_child_*_str is only used inside of
  subr_bus.c, though implemented in ~100 places in the tree).
  
  Reviewed by: markj@
  Differential Revision: https://reviews.freebsd.org/D26140

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cSat Aug 29 02:46:25 2020(r364943)
+++ head/sys/kern/subr_bus.cSat Aug 29 04:29:53 2020(r364944)
@@ -156,6 +156,8 @@ EVENTHANDLER_LIST_DEFINE(device_attach);
 EVENTHANDLER_LIST_DEFINE(device_detach);
 EVENTHANDLER_LIST_DEFINE(dev_lookup);
 
+static int bus_child_location_sb(device_t child, struct sbuf *sb);
+static int bus_child_pnpinfo_sb(device_t child, struct sbuf *sb);
 static void devctl2_init(void);
 static bool device_frozen;
 
@@ -392,9 +394,10 @@ static struct cdevsw dev_cdevsw = {
.d_name =   "devctl",
 };
 
+#define DEVCTL_BUFFER (1024 - sizeof(void *))
 struct dev_event_info {
-   char *dei_data;
STAILQ_ENTRY(dev_event_info) dei_link;
+   char dei_data[DEVCTL_BUFFER];
 };
 
 STAILQ_HEAD(devq, dev_event_info);
@@ -409,6 +412,7 @@ static struct dev_softc {
struct selinfo  sel;
struct devq devq;
struct sigio*sigio;
+   uma_zone_t  zone;
 } devsoftc;
 
 static voidfilt_devctl_detach(struct knote *kn);
@@ -431,6 +435,11 @@ devinit(void)
cv_init(, "dev cv");
STAILQ_INIT();
knlist_init_mtx(_note, );
+   if (devctl_queue_length > 0) {
+   devsoftc.zone = uma_zcreate("DEVCTL", sizeof(struct 
dev_event_info),
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+   uma_prealloc(devsoftc.zone, devctl_queue_length);
+   }
devctl2_init();
 }
 
@@ -495,8 +504,7 @@ devread(struct cdev *dev, struct uio *uio, int ioflag)
devsoftc.queued--;
mtx_unlock();
rv = uiomove(n1->dei_data, strlen(n1->dei_data), uio);
-   free(n1->dei_data, M_BUS);
-   free(n1, M_BUS);
+   uma_zfree(devsoftc.zone, n1);
return (rv);
 }
 
@@ -585,42 +593,51 @@ devctl_process_running(void)
return (devsoftc.inuse == 1);
 }
 
-/**
- * @brief Queue data to be read from the devctl device
- *
- * Generic interface to queue data to the devctl device.  It is
- * assumed that @p data is properly formatted.  It is further assumed
- * that @p data is allocated using the M_BUS malloc type.
- */
-static void
-devctl_queue_data_f(char *data, int flags)
+static struct dev_event_info *
+devctl_alloc_dei(void)
 {
-   struct dev_event_info *n1 = NULL, *n2 = NULL;
+   struct dev_event_info *dei = NULL;
 
-   if (strlen(data) == 0)
-   goto out;
+   mtx_lock();
if (devctl_queue_length == 0)
goto out;
-   n1 = malloc(sizeof(*n1), M_BUS, flags);
-   if (n1 == NULL)
-   goto out;
-   n1->dei_data = data;
-   mtx_lock();
-   if (devctl_queue_length == 0) {
-   mtx_unlock();
-   free(n1->dei_data, M_BUS);
-   free(n1, M_BUS);
-   return;
-   }
-   /* Leave at least one spot in the queue... */
-   while (devsoftc.queued > devctl_queue_length - 1) {
-   n2 = STAILQ_FIRST();
+   if (devctl_queue_length == devsoftc.queued) {
+   dei = STAILQ_FIRST();
STAILQ_REMOVE_HEAD(, dei_link);
-   free(n2->dei_data, M_BUS);
-   free(n2, M_BUS);
devsoftc.queued--;
+   } else {
+   /* dei can't be NULL -- we know we have at least one in the 
zone */
+   dei = uma_zalloc(devsoftc.zone, M_NOWAIT);
+   MPASS(dei != NULL);
}
-   STAILQ_INSERT_TAIL(, n1, dei_link);
+   *dei->dei_data = '\0';
+out:
+   mtx_unlock();
+   return (dei);
+}
+
+static struct dev_event_info *
+devctl_alloc_dei_sb(struct sbuf *sb)
+{
+   struct dev_event_info *dei;
+
+   dei = devctl_alloc_dei();
+   if (dei != NULL)
+   sbuf_new(sb, dei->dei_data, sizeof(dei->dei_data), 
SBUF_FIXEDLEN);
+   return (dei);
+}
+
+static void
+devctl_free_dei(struct dev_event_info *dei)
+{
+   uma_zfree(devsoftc.zone, dei);
+}
+
+static void
+devctl_queue(struct dev_event_info *dei)
+{

svn commit: r364945 - in head/sys: arm/ti/am335x geom kern sys

2020-08-28 Thread Warner Losh
Author: imp
Date: Sat Aug 29 04:30:06 2020
New Revision: 364945
URL: https://svnweb.freebsd.org/changeset/base/364945

Log:
  Retire devctl_notify_f()
  
  devctl_notify_f isn't needed, so retire it. The flags argument is now
  unused, so rather than keep it around, retire it. Convert all old
  users of it to devctl_notify(). This path no longer sleeps, so is safe
  to call from any context. Since it doesn't sleep, it doesn't need to
  know if it is OK to sleep or not.
  
  Reviewed by: markj@
  Differential Revision: https://reviews.freebsd.org/D26140

Modified:
  head/sys/arm/ti/am335x/am335x_pmic.c
  head/sys/geom/geom_dev.c
  head/sys/kern/kern_conf.c
  head/sys/kern/kern_rctl.c
  head/sys/kern/subr_bus.c
  head/sys/sys/devctl.h

Modified: head/sys/arm/ti/am335x/am335x_pmic.c
==
--- head/sys/arm/ti/am335x/am335x_pmic.cSat Aug 29 04:29:53 2020
(r364944)
+++ head/sys/arm/ti/am335x/am335x_pmic.cSat Aug 29 04:30:06 2020
(r364945)
@@ -113,7 +113,7 @@ am335x_pmic_intr(void *arg)
if (int_reg.aci) {
snprintf(notify_buf, sizeof(notify_buf), "notify=0x%02x",
status_reg.acpwr);
-   devctl_notify_f("ACPI", "ACAD", "power", notify_buf, M_NOWAIT);
+   devctl_notify("ACPI", "ACAD", "power", notify_buf);
}
 }
 

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cSat Aug 29 04:29:53 2020(r364944)
+++ head/sys/geom/geom_dev.cSat Aug 29 04:30:06 2020(r364945)
@@ -213,7 +213,7 @@ g_dev_destroy(void *arg, int flags __unused)
sc = cp->private;
g_trace(G_T_TOPOLOGY, "g_dev_destroy(%p(%s))", cp, gp->name);
snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
-   devctl_notify_f("GEOM", "DEV", "DESTROY", buf, M_WAITOK);
+   devctl_notify("GEOM", "DEV", "DESTROY", buf);
if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
g_access(cp, -cp->acr, -cp->acw, -cp->ace);
g_detach(cp);
@@ -277,13 +277,13 @@ g_dev_set_media(struct g_consumer *cp)
sc = cp->private;
dev = sc->sc_dev;
snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
-   devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK);
-   devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, M_WAITOK);
+   devctl_notify("DEVFS", "CDEV", "MEDIACHANGE", buf);
+   devctl_notify("GEOM", "DEV", "MEDIACHANGE", buf);
dev = sc->sc_alias;
if (dev != NULL) {
snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
-   devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK);
-   devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, M_WAITOK);
+   devctl_notify("DEVFS", "CDEV", "MEDIACHANGE", buf);
+   devctl_notify("GEOM", "DEV", "MEDIACHANGE", buf);
}
 }
 
@@ -308,7 +308,7 @@ g_dev_resize(struct g_consumer *cp)
char buf[SPECNAMELEN + 6];
 
snprintf(buf, sizeof(buf), "cdev=%s", cp->provider->name);
-   devctl_notify_f("GEOM", "DEV", "SIZECHANGE", buf, M_WAITOK);
+   devctl_notify("GEOM", "DEV", "SIZECHANGE", buf);
 }
 
 struct g_provider *
@@ -379,7 +379,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp,
 
g_dev_attrchanged(cp, "GEOM::physpath");
snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
-   devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
+   devctl_notify("GEOM", "DEV", "CREATE", buf);
/*
 * Now add all the aliases for this drive
 */
@@ -392,7 +392,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp,
continue;
}
snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias);
-   devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
+   devctl_notify("GEOM", "DEV", "CREATE", buf);
}
 
return (gp);

Modified: head/sys/kern/kern_conf.c
==
--- head/sys/kern/kern_conf.c   Sat Aug 29 04:29:53 2020(r364944)
+++ head/sys/kern/kern_conf.c   Sat Aug 29 04:30:06 2020(r364945)
@@ -546,7 +546,7 @@ notify(struct cdev *dev, const char *ev, int flags)
return;
memcpy(data, prefix, sizeof(prefix) - 1);
memcpy(data + sizeof(prefix) - 1, dev->si_name, namelen + 1);
-   devctl_notify_f("DEVFS", "CDEV", ev, data, mflags);
+   devctl_notify("DEVFS", "CDEV", ev, data);
free(data, M_TEMP);
 }
 

Modified: head/sys/kern/kern_rctl.c
==
--- head/sys/kern/kern_rctl.c   Sat Aug 29 04:29:53 2020(r364944)
+++ head/sys/kern/kern_rctl.c   Sat Aug 29 04:30:06 2020(r364945)
@@ -591,8 +591,8 @@ rctl_enforce(struct proc *p, int 

svn commit: r364943 - head/secure/caroot/trusted

2020-08-28 Thread Kyle Evans
Author: kevans
Date: Sat Aug 29 02:46:25 2020
New Revision: 364943
URL: https://svnweb.freebsd.org/changeset/base/364943

Log:
  carrot: update bundle
  
  Stats:
  - Seven (7) removed
  - Four (4) added
  
  MFC after:3 days

Added:
  head/secure/caroot/trusted/Microsoft_ECC_Root_Certificate_Authority_2017.pem  
 (contents, props changed)
  head/secure/caroot/trusted/Microsoft_RSA_Root_Certificate_Authority_2017.pem  
 (contents, props changed)
  head/secure/caroot/trusted/certSIGN_Root_CA_G2.pem   (contents, props changed)
  head/secure/caroot/trusted/e-Szigno_Root_CA_2017.pem   (contents, props 
changed)
Deleted:
  head/secure/caroot/trusted/AddTrust_External_Root.pem
  head/secure/caroot/trusted/AddTrust_Low-Value_Services_Root.pem
  head/secure/caroot/trusted/LuxTrust_Global_Root_2.pem
  head/secure/caroot/trusted/Staat_der_Nederlanden_Root_CA_-_G2.pem
  
head/secure/caroot/trusted/Symantec_Class_1_Public_Primary_Certification_Authority_-_G4.pem
  
head/secure/caroot/trusted/Symantec_Class_2_Public_Primary_Certification_Authority_-_G4.pem
  
head/secure/caroot/trusted/Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem

Added: 
head/secure/caroot/trusted/Microsoft_ECC_Root_Certificate_Authority_2017.pem
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/secure/caroot/trusted/Microsoft_ECC_Root_Certificate_Authority_2017.pem
Sat Aug 29 02:46:25 2020(r364943)
@@ -0,0 +1,68 @@
+##
+##  Microsoft ECC Root Certificate Authority 2017
+##
+##  This is a single X.509 certificate for a public Certificate
+##  Authority (CA). It was automatically extracted from Mozilla's
+##  root CA list (the file `certdata.txt' in security/nss).
+##
+##  Extracted from nss
+##  with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 
01:27:50Z kevans $
+##
+##  @generated
+##
+Certificate:
+Data:
+Version: 3 (0x2)
+Serial Number:
+66:f2:3d:af:87:de:8b:b1:4a:ea:0c:57:31:01:c2:ec
+Signature Algorithm: ecdsa-with-SHA384
+Issuer: C = US, O = Microsoft Corporation, CN = Microsoft ECC Root 
Certificate Authority 2017
+Validity
+Not Before: Dec 18 23:06:45 2019 GMT
+Not After : Jul 18 23:16:04 2042 GMT
+Subject: C = US, O = Microsoft Corporation, CN = Microsoft ECC Root 
Certificate Authority 2017
+Subject Public Key Info:
+Public Key Algorithm: id-ecPublicKey
+Public-Key: (384 bit)
+pub:
+04:d4:bc:3d:02:42:75:41:13:23:cd:80:04:86:02:
+51:2f:6a:a8:81:62:0b:65:cc:f6:ca:9d:1e:6f:4a:
+66:51:a2:03:d9:9d:91:fa:b6:16:b1:8c:6e:de:7c:
+cd:db:79:a6:2f:ce:bb:ce:71:2f:e5:a5:ab:28:ec:
+63:04:66:99:f8:fa:f2:93:10:05:e1:81:28:42:e3:
+c6:68:f4:e6:1b:84:60:4a:89:af:ed:79:0f:3b:ce:
+f1:f6:44:f5:01:78:c0
+ASN1 OID: secp384r1
+NIST CURVE: P-384
+X509v3 extensions:
+X509v3 Key Usage: critical
+Digital Signature, Certificate Sign, CRL Sign
+X509v3 Basic Constraints: critical
+CA:TRUE
+X509v3 Subject Key Identifier: 
+C8:CB:99:72:70:52:0C:F8:E6:BE:B2:04:57:29:2A:CF:42:10:ED:35
+1.3.6.1.4.1.311.21.1: 
+...
+Signature Algorithm: ecdsa-with-SHA384
+ 30:65:02:30:58:f2:4d:ea:0c:f9:5f:5e:ee:60:29:cb:3a:f2:
+ db:d6:32:84:19:3f:7c:d5:2f:c2:b1:cc:93:ae:50:bb:09:32:
+ c6:c6:ed:7e:c9:36:94:12:e4:68:85:06:a2:1b:d0:2f:02:31:
+ 00:99:e9:16:b4:0e:fa:56:48:d4:a4:30:16:91:78:db:54:8c:
+ 65:01:8a:e7:50:66:c2:31:b7:39:ba:b8:1a:22:07:4e:fc:6b:
+ 54:16:20:ff:2b:b5:e7:4c:0c:4d:a6:4f:73
+SHA1 Fingerprint=99:9A:64:C3:7F:F4:7D:9F:AB:95:F1:47:69:89:14:60:EE:C4:C3:C5
+-BEGIN CERTIFICATE-
+MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQsw
+CQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYD
+VQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIw
+MTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4MjMxNjA0WjBlMQswCQYDVQQGEwJV
+UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNy
+b3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQBgcq
+hkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZR
+ogPZnZH6thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYb
+hGBKia/teQ87zvH2RPUBeMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8E
+BTADAQH/MB0GA1UdDgQWBBTIy5lycFIM+Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3
+FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlfXu5gKcs68tvWMoQZP3zV
+L8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaReNtUjGUB
+iudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M=
+-END CERTIFICATE-

Added: 
head/secure/caroot/trusted/Microsoft_RSA_Root_Certificate_Authority_2017.pem

Re: svn commit: r364927 - head/sys/arm/allwinner/clkng

2020-08-28 Thread Dave Cottlehuber
On Fri, 28 Aug 2020, at 18:25, Emmanuel Vadot wrote:
> Author: manu
> Date: Fri Aug 28 18:25:45 2020
> New Revision: 364927
> URL: https://svnweb.freebsd.org/changeset/base/364927
> 
> Log:
>   arm: allwinner: clk: Add printfs when we cannot set the correct freq
>   
>   For some unknown reason this seems to fix this function when we printf
>   the best variable. This isn't a delay problem as doing a printf without
>   it doesn't solve this problem.
>   This is way above my pay grade so add some printf that shouldn't be printed
>   in 99% of the case anyway.
>   Fix booting on most Allwinner boards as the mmc IP uses a NM clock.
>   
>   Reported by:Alexander Mishin 
>   MFC after:  3 days
>   X-MFC-With: 363887
> 
> Modified:
>   head/sys/arm/allwinner/clkng/aw_clk_nm.c
> 
> Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
> ==
> --- head/sys/arm/allwinner/clkng/aw_clk_nm.c  Fri Aug 28 17:55:54 2020
> (r364926)
> +++ head/sys/arm/allwinner/clkng/aw_clk_nm.c  Fri Aug 28 18:25:45 2020
> (r364927)
> @@ -221,11 +221,15 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare
>   if ((best < *fout) &&
> ((flags & CLK_SET_ROUND_DOWN) == 0)) {
>   *stop = 1;
> + printf("best freq (%llu) < requested freq(%llu)\n",

Salut Manu,

Fails to build on aarch64 unless this is reverted, or I use

printf("best freq (%lu) < requested freq(%lu)\n",

> + best, *fout);
>   return (ERANGE);
>   }
>   if ((best > *fout) &&
> ((flags & CLK_SET_ROUND_UP) == 0)) {
>   *stop = 1;
> + printf("best freq (%llu) > requested freq(%llu)\n",

& again

printf("best freq (%lu) > requested freq(%lu)\n",

A+
Dave

--
>>> stage 3.1: building everything
--
/usr/src/sys/arm/allwinner/clkng/aw_clk_nm.c:225:7: error: format specifies 
type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned 
long') [-Werror,-Wformat]
best, *fout);
^~~~
/usr/src/sys/arm/allwinner/clkng/aw_clk_nm.c:225:13: error: format specifies 
type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned 
long') [-Werror,-Wformat]
best, *fout);
  ^
/usr/src/sys/arm/allwinner/clkng/aw_clk_nm.c:232:7: error: format specifies 
type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned 
long') [-Werror,-Wformat]
best, *fout);
^~~~
/usr/src/sys/arm/allwinner/clkng/aw_clk_nm.c:232:13: error: format specifies 
type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned 
long') [-Werror,-Wformat]
best, *fout);
  ^
4 errors generated.
--- aw_clk_nm.o ---
*** [aw_clk_nm.o] Error code 1
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364942 - head/sys/net/route

2020-08-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Fri Aug 28 23:01:56 2020
New Revision: 364942
URL: https://svnweb.freebsd.org/changeset/base/364942

Log:
  Move fib_rte_to_nh_flags() from net/route_var.h to net/route/nhop_ctl.c.
  
  No functional changes.
  Initially this function was created to perform runtime flag conversions
   for the previous incarnation of fib lookup functions. As these functions
   got deprecated, move the function to the file with the only remaining
   caller. Lastly, rename it to convert_rt_to_nh_flags() to follow the
   naming notation.

Modified:
  head/sys/net/route/nhop_ctl.c
  head/sys/net/route/route_var.h

Modified: head/sys/net/route/nhop_ctl.c
==
--- head/sys/net/route/nhop_ctl.c   Fri Aug 28 22:50:20 2020
(r364941)
+++ head/sys/net/route/nhop_ctl.c   Fri Aug 28 23:01:56 2020
(r364942)
@@ -244,6 +244,21 @@ set_nhop_gw_from_info(struct nhop_object *nh, struct r
return (0);
 }
 
+static uint16_t
+convert_rt_to_nh_flags(int rt_flags)
+{
+   uint16_t res;
+
+   res = (rt_flags & RTF_REJECT) ? NHF_REJECT : 0;
+   res |= (rt_flags & RTF_HOST) ? NHF_HOST : 0;
+   res |= (rt_flags & RTF_BLACKHOLE) ? NHF_BLACKHOLE : 0;
+   res |= (rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) ? NHF_REDIRECT : 0;
+   res |= (rt_flags & RTF_BROADCAST) ? NHF_BROADCAST : 0;
+   res |= (rt_flags & RTF_GATEWAY) ? NHF_GATEWAY : 0;
+
+   return (res);
+}
+
 static int
 fill_nhop_from_info(struct nhop_priv *nh_priv, struct rt_addrinfo *info)
 {
@@ -258,7 +273,7 @@ fill_nhop_from_info(struct nhop_priv *nh_priv, struct 
nh_priv->nh_family = info->rti_info[RTAX_DST]->sa_family;
nh_priv->nh_type = 0; // hook responsibility to set nhop type
 
-   nh->nh_flags = fib_rte_to_nh_flags(rt_flags);
+   nh->nh_flags = convert_rt_to_nh_flags(rt_flags);
set_nhop_mtu_from_info(nh, info);
nh->nh_ifp = info->rti_ifa->ifa_ifp;
nh->nh_ifa = info->rti_ifa;
@@ -397,7 +412,7 @@ alter_nhop_from_info(struct nhop_object *nh, struct rt
nh->nh_priv->rt_flags |= (RTF_GATEWAY & info->rti_flags);
}
/* Update datapath flags */
-   nh->nh_flags = fib_rte_to_nh_flags(nh->nh_priv->rt_flags);
+   nh->nh_flags = convert_rt_to_nh_flags(nh->nh_priv->rt_flags);
 
if (info->rti_ifa != NULL)
nh->nh_ifa = info->rti_ifa;

Modified: head/sys/net/route/route_var.h
==
--- head/sys/net/route/route_var.h  Fri Aug 28 22:50:20 2020
(r364941)
+++ head/sys/net/route/route_var.h  Fri Aug 28 23:01:56 2020
(r364942)
@@ -212,22 +212,6 @@ struct rtentry {
((!NH_IS_MULTIPATH(_nh)) ? (_nh) : _SELECT_NHOP(_nh, _flowid))
 #defineRT_SELECT_NHOP(_rt, _flowid)_RT_SELECT_NHOP((_rt)->rt_nhop, 
_flowid)
  
-/* rte<>nhop translation */
-static inline uint16_t
-fib_rte_to_nh_flags(int rt_flags)
-{
-   uint16_t res;
-
-   res = (rt_flags & RTF_REJECT) ? NHF_REJECT : 0;
-   res |= (rt_flags & RTF_HOST) ? NHF_HOST : 0;
-   res |= (rt_flags & RTF_BLACKHOLE) ? NHF_BLACKHOLE : 0;
-   res |= (rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) ? NHF_REDIRECT : 0;
-   res |= (rt_flags & RTF_BROADCAST) ? NHF_BROADCAST : 0;
-   res |= (rt_flags & RTF_GATEWAY) ? NHF_GATEWAY : 0;
-
-   return (res);
-}
-
 /* route_temporal.c */
 void tmproutes_update(struct rib_head *rnh, struct rtentry *rt);
 void tmproutes_init(struct rib_head *rh);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364941 - in head/sys: net net/route netinet netinet6

2020-08-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Fri Aug 28 22:50:20 2020
New Revision: 364941
URL: https://svnweb.freebsd.org/changeset/base/364941

Log:
  Move net/route/shared.h definitions to net/route/route_var.h.
  
  No functional changes.
  
  net/route/shared.h was created in the inital phases of nexthop conversion.
  It was intended to serve the same purpose as route_var.h - share definitions
   of functions and structures between the routing subsystem components. At
   that time route_var.h was included by many files external to the routing
   subsystem, which largerly defeats its purpose.
  
  As currently this is not the case anymore and amount of route_var.h includes
   is roughly the same as shared.h, retire the latter in favour of the former.

Deleted:
  head/sys/net/route/shared.h
Modified:
  head/sys/net/radix_mpath.c
  head/sys/net/route.c
  head/sys/net/route/nhop.c
  head/sys/net/route/nhop_ctl.c
  head/sys/net/route/route_ctl.c
  head/sys/net/route/route_helpers.c
  head/sys/net/route/route_var.h
  head/sys/net/rtsock.c
  head/sys/netinet/in_fib.c
  head/sys/netinet/in_rmx.c
  head/sys/netinet6/in6_fib.c
  head/sys/netinet6/in6_rmx.c

Modified: head/sys/net/radix_mpath.c
==
--- head/sys/net/radix_mpath.c  Fri Aug 28 21:59:10 2020(r364940)
+++ head/sys/net/radix_mpath.c  Fri Aug 28 22:50:20 2020(r364941)
@@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cFri Aug 28 21:59:10 2020(r364940)
+++ head/sys/net/route.cFri Aug 28 22:50:20 2020(r364941)
@@ -64,7 +64,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #ifdef RADIX_MPATH

Modified: head/sys/net/route/nhop.c
==
--- head/sys/net/route/nhop.c   Fri Aug 28 21:59:10 2020(r364940)
+++ head/sys/net/route/nhop.c   Fri Aug 28 22:50:20 2020(r364941)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
 /*

Modified: head/sys/net/route/nhop_ctl.c
==
--- head/sys/net/route/nhop_ctl.c   Fri Aug 28 21:59:10 2020
(r364940)
+++ head/sys/net/route/nhop_ctl.c   Fri Aug 28 22:50:20 2020
(r364941)
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
 /*

Modified: head/sys/net/route/route_ctl.c
==
--- head/sys/net/route/route_ctl.c  Fri Aug 28 21:59:10 2020
(r364940)
+++ head/sys/net/route/route_ctl.c  Fri Aug 28 22:50:20 2020
(r364941)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #ifdef RADIX_MPATH

Modified: head/sys/net/route/route_helpers.c
==
--- head/sys/net/route/route_helpers.c  Fri Aug 28 21:59:10 2020
(r364940)
+++ head/sys/net/route/route_helpers.c  Fri Aug 28 22:50:20 2020
(r364941)
@@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #ifdef INET
 #include 
 #endif

Modified: head/sys/net/route/route_var.h
==
--- head/sys/net/route/route_var.h  Fri Aug 28 21:59:10 2020
(r364940)
+++ head/sys/net/route/route_var.h  Fri Aug 28 22:50:20 2020
(r364941)
@@ -39,7 +39,14 @@
 #include 
 #include /* struct sockaddr_in */
 #include 
+#include 
 
+#ifdef RTDEBUG
+#defineDPRINTF(_fmt, ...)  printf("%s: " _fmt "\n", __func__ , ## 
__VA_ARGS__)
+#else
+#defineDPRINTF(_fmt, ...)
+#endif
+
 struct nh_control;
 typedef int rnh_preadd_entry_f_t(u_int fibnum, const struct sockaddr *addr,
const struct sockaddr *mask, struct nhop_object *nh);
@@ -221,6 +228,7 @@ fib_rte_to_nh_flags(int rt_flags)
return (res);
 }
 
+/* route_temporal.c */
 void tmproutes_update(struct rib_head *rnh, struct rtentry *rt);
 void tmproutes_init(struct rib_head *rh);
 void tmproutes_destroy(struct rib_head *rh);
@@ -236,5 +244,33 @@ int change_route_conditional(struct rib_head *rnh, str
 
 void vnet_rtzone_init(void);
 void vnet_rtzone_destroy(void);
+
+/* subscriptions */
+void rib_init_subscriptions(struct rib_head *rnh);
+void rib_destroy_subscriptions(struct rib_head *rnh);
+
+/* Nexhops */
+void nhops_init(void);
+int nhops_init_rib(struct rib_head *rh);
+void nhops_destroy_rib(struct rib_head *rh);
+void nhop_ref_object(struct nhop_object *nh);
+int nhop_try_ref_object(struct nhop_object *nh);
+int nhop_ref_any(struct nhop_object *nh);
+void nhop_free_any(struct 

svn commit: r364940 - head/sys/net/route

2020-08-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Fri Aug 28 21:59:10 2020
New Revision: 364940
URL: https://svnweb.freebsd.org/changeset/base/364940

Log:
  Further split nhop creation and rtable operations.
  
  As nexthops are immutable, some operations such as route attribute changes
   require nexthop fetching, forking, modification and route switching.
  These operations are not atomic, so they may need to be retried multiple
   times in presence of multiple speakers changing the same route.
  
  This change introduces "synchronisation" primitive: 
route_update_conditional(),
   simplifying logic for route changes and upcoming multipath operations.
  
  Differential Revision:https://reviews.freebsd.org/D26216

Modified:
  head/sys/net/route/route_ctl.c
  head/sys/net/route/route_var.h

Modified: head/sys/net/route/route_ctl.c
==
--- head/sys/net/route/route_ctl.c  Fri Aug 28 20:37:57 2020
(r364939)
+++ head/sys/net/route/route_ctl.c  Fri Aug 28 21:59:10 2020
(r364940)
@@ -78,9 +78,15 @@ struct rib_subscription {
 
 static int add_route(struct rib_head *rnh, struct rt_addrinfo *info,
 struct rib_cmd_info *rc);
+static int add_route_nhop(struct rib_head *rnh, struct rtentry *rt,
+struct rt_addrinfo *info, struct route_nhop_data *rnd,
+struct rib_cmd_info *rc);
 static int del_route(struct rib_head *rnh, struct rt_addrinfo *info,
 struct rib_cmd_info *rc);
-static int change_route(struct rib_head *, struct rt_addrinfo *,
+static int change_route(struct rib_head *rnh, struct rt_addrinfo *info,
+struct route_nhop_data *nhd_orig, struct rib_cmd_info *rc);
+static int change_route_nhop(struct rib_head *rnh, struct rtentry *rt,
+struct rt_addrinfo *info, struct route_nhop_data *rnd,
 struct rib_cmd_info *rc);
 static void rib_notify(struct rib_head *rnh, enum rib_subscription_type type,
 struct rib_cmd_info *rc);
@@ -202,14 +208,18 @@ rib_add_route(uint32_t fibnum, struct rt_addrinfo *inf
return (add_route(rnh, info, rc));
 }
 
+/*
+ * Creates rtentry and nexthop based on @info data.
+ * Return 0 and fills in rtentry into @prt on success,
+ * return errno otherwise.
+ */
 static int
-add_route(struct rib_head *rnh, struct rt_addrinfo *info,
-struct rib_cmd_info *rc)
+create_rtentry(struct rib_head *rnh, struct rt_addrinfo *info,
+struct rtentry **prt)
 {
struct sockaddr *dst, *ndst, *gateway, *netmask;
-   struct rtentry *rt, *rt_old;
+   struct rtentry *rt;
struct nhop_object *nh;
-   struct radix_node *rn;
struct ifaddr *ifa;
int error, flags;
 
@@ -276,8 +286,29 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
rt->rt_weight = 1;
 
rt_setmetrics(info, rt);
-   rt_old = NULL;
 
+   *prt = rt;
+   return (0);
+}
+
+static int
+add_route(struct rib_head *rnh, struct rt_addrinfo *info,
+struct rib_cmd_info *rc)
+{
+   struct sockaddr *ndst, *netmask;
+   struct route_nhop_data rnd;
+   struct nhop_object *nh;
+   struct rtentry *rt;
+   int error;
+
+   error = create_rtentry(rnh, info, );
+   if (error != 0)
+   return (error);
+
+   rnd.rnd_nhop = rt->rt_nhop;
+   rnd.rnd_weight = rt->rt_weight;
+   nh = rt->rt_nhop;
+
RIB_WLOCK(rnh);
 #ifdef RADIX_MPATH
/* do not permit exactly the same dst/mask/gw pair */
@@ -290,76 +321,42 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
return (EEXIST);
}
 #endif
+   error = add_route_nhop(rnh, rt, info, , rc);
+   if (error == 0) {
+   rt = NULL;
+   nh = NULL;
+   } else if ((error == EEXIST) && ((info->rti_flags & RTF_PINNED) != 0)) {
+   struct rtentry *rt_orig;
+   struct nhop_object *nh_orig;
+   struct radix_node *rn;
 
-   rn = rnh->rnh_addaddr(ndst, netmask, >head, rt->rt_nodes);
-
-   if (rn != NULL) {
-   /* Most common usecase */
-   if (rt->rt_expire > 0)
-   tmproutes_update(rnh, rt);
-
-   /* Finalize notification */
-   rnh->rnh_gen++;
-
-   rc->rc_rt = rt;
-   rc->rc_nh_new = nh;
-   rc->rc_nh_weight = rt->rt_weight;
-
-   rib_notify(rnh, RIB_NOTIFY_IMMEDIATE, rc);
-   } else if ((info->rti_flags & RTF_PINNED) != 0) {
-
-   /*
-* Force removal and re-try addition
-* TODO: better multipath support
-*/
-   struct sockaddr *info_dst = info->rti_info[RTAX_DST];
-   info->rti_info[RTAX_DST] = ndst;
-   /* Do not delete existing PINNED(interface) routes */
-   info->rti_flags &= ~RTF_PINNED;
-   rt_old = rt_unlinkrte(rnh, info, );
-   info->rti_flags |= RTF_PINNED;
-   info->rti_info[RTAX_DST] = info_dst;
-   

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

2020-08-28 Thread Oleksandr Tymoshenko
Gleb Smirnoff (gleb...@freebsd.org) wrote:
> Author: glebius
> Date: Thu Oct 10 23:42:55 2019
> New Revision: 353419
> URL: https://svnweb.freebsd.org/changeset/base/353419
> 
> Log:
>   Provide new KPI for network drivers to access lists of interface
>   addresses.  The KPI doesn't reveal neither how addresses are stored,
>   how the access to them is synchronized, neither reveal struct ifaddr
>   and struct ifmaddr.
>   
>   Reviewed by:gallatin, erj, hselasky, philip, stevek
>   Differential Revision:  https://reviews.freebsd.org/D21943

Hi Gleb,

Are there any plans to MFC this change and the subsequent API consumer changes?
Lack of this API in 12 makes MFCing unrelated eth driver fixes hard.

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


svn commit: r364937 - head/sys/netinet

2020-08-28 Thread Michael Tuexen
Author: tuexen
Date: Fri Aug 28 20:05:18 2020
New Revision: 364937
URL: https://svnweb.freebsd.org/changeset/base/364937

Log:
  Fix a regression with the explicit EOR mode I introduced in r364268.
  A short MFC time as discussed with the secteam.
  
  Reported by:  Taylor Brandstetter
  MFC after:1 day

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Fri Aug 28 20:03:54 2020
(r364936)
+++ head/sys/netinet/sctp_output.c  Fri Aug 28 20:05:18 2020
(r364937)
@@ -13118,11 +13118,10 @@ skip_preblock:
error = EINVAL;
goto out;
}
-   SCTP_TCB_SEND_UNLOCK(stcb);
-
strm = >asoc.strmout[srcv->sinfo_stream];
if (strm->last_msg_incomplete == 0) {
do_a_copy_in:
+   SCTP_TCB_SEND_UNLOCK(stcb);
sp = sctp_copy_it_in(stcb, asoc, srcv, uio, net, 
max_len, user_marks_eor, );
if (error) {
goto out;
@@ -13151,19 +13150,8 @@ skip_preblock:
sp->processing = 1;
TAILQ_INSERT_TAIL(>outqueue, sp, next);
stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, 
asoc, strm, sp, 1);
-   SCTP_TCB_SEND_UNLOCK(stcb);
} else {
-   SCTP_TCB_SEND_LOCK(stcb);
sp = TAILQ_LAST(>outqueue, sctp_streamhead);
-   if (sp->processing) {
-   SCTP_TCB_SEND_UNLOCK(stcb);
-   SCTP_LTRACE_ERR_RET(inp, stcb, net, 
SCTP_FROM_SCTP_OUTPUT, EINVAL);
-   error = EINVAL;
-   goto out;
-   } else {
-   sp->processing = 1;
-   }
-   SCTP_TCB_SEND_UNLOCK(stcb);
if (sp == NULL) {
/*  Huh ??? last msg is gone */
 #ifdef INVARIANTS
@@ -13175,7 +13163,16 @@ skip_preblock:
goto do_a_copy_in;
 
}
+   if (sp->processing) {
+   SCTP_TCB_SEND_UNLOCK(stcb);
+   SCTP_LTRACE_ERR_RET(inp, stcb, net, 
SCTP_FROM_SCTP_OUTPUT, EINVAL);
+   error = EINVAL;
+   goto out;
+   } else {
+   sp->processing = 1;
+   }
}
+   SCTP_TCB_SEND_UNLOCK(stcb);
while (uio->uio_resid > 0) {
/* How much room do we have? */
struct mbuf *new_tail, *mm;
@@ -13200,6 +13197,11 @@ skip_preblock:
if (mm) {
sctp_m_freem(mm);
}
+   SCTP_TCB_SEND_LOCK(stcb);
+   if (sp != NULL) {
+   sp->processing = 0;
+   }
+   SCTP_TCB_SEND_UNLOCK(stcb);
goto out;
}
/* Update the mbuf and count */
@@ -13215,6 +13217,9 @@ skip_preblock:
SCTP_LTRACE_ERR_RET(NULL, stcb, 
NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET);
error = ECONNRESET;
}
+   if (sp != NULL) {
+   sp->processing = 0;
+   }
SCTP_TCB_SEND_UNLOCK(stcb);
goto out;
}
@@ -13274,6 +13279,11 @@ skip_preblock:
/* wait for space now */
if (non_blocking) {
/* Non-blocking io in place out */
+   SCTP_TCB_SEND_LOCK(stcb);
+   if (sp != NULL) {
+   sp->processing = 0;
+   }
+   SCTP_TCB_SEND_UNLOCK(stcb);
goto skip_out_eof;
}
/* What about the INIT, send it maybe */
@@ -13401,6 +13411,11 @@ skip_preblock:
}
}

svn commit: r364936 - in head: lib lib/libnetmap share/mk

2020-08-28 Thread Vincenzo Maffione
Author: vmaffione
Date: Fri Aug 28 20:03:54 2020
New Revision: 364936
URL: https://svnweb.freebsd.org/changeset/base/364936

Log:
  lib: add libnetmap
  
  This changeset introduces the new libnetmap library for writing
  netmap applications.
  Before libnetmap, applications could either use the kernel API
  directly (e.g. NIOCREGIF/NIOCCTRL) or the simple header-only-library
  netmap_user.h (e.g. nm_open(), nm_close(), nm_mmap() etc.)
  
  The new library offers more functionalities than netmap_user.h:
- Support for complex netmap options, such as external memory
  allocators or per-buffer offsets. This opens the way to future
  extensions.
- More flexibility in the netmap port bind options, such as
  non-numeric names for pipes, or the ability to specify the netmap
  allocator that must be used for a given port.
- Automatic tracking of the netmap memory regions in use across the
  open ports.
  
  At the moment there is no man page, but the libnetmap.h header file
  has in-depth documentation.
  
  Reviewed by:  hrs
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D26171

Added:
  head/lib/libnetmap/
  head/lib/libnetmap/Makefile   (contents, props changed)
  head/lib/libnetmap/libnetmap.h   (contents, props changed)
  head/lib/libnetmap/nmctx-pthreads.c   (contents, props changed)
  head/lib/libnetmap/nmctx.c   (contents, props changed)
  head/lib/libnetmap/nmport.c   (contents, props changed)
  head/lib/libnetmap/nmreq.c   (contents, props changed)
Modified:
  head/lib/Makefile
  head/share/mk/bsd.libnames.mk
  head/share/mk/src.libnames.mk

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Fri Aug 28 19:59:02 2020(r364935)
+++ head/lib/Makefile   Fri Aug 28 20:03:54 2020(r364936)
@@ -71,6 +71,7 @@ SUBDIR=   ${SUBDIR_BOOTSTRAP} \
libmt \
lib80211 \
libnetbsd \
+   libnetmap \
libnv \
libopenbsd \
libopie \

Added: head/lib/libnetmap/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libnetmap/Makefile Fri Aug 28 20:03:54 2020(r364936)
@@ -0,0 +1,16 @@
+#
+# $FreeBSD$
+#
+
+.include 
+
+PACKAGE=   lib${LIB}
+LIB=   netmap
+SRCS=  nmctx.c nmport.c \
+   nmctx-pthreads.c nmreq.c
+INCS=  libnetmap.h
+#MAN=  libnetmap.3
+CFLAGS+=   -I${SRCTOP}/sys/net -I${.CURDIR}
+WARNS?=2
+
+.include 

Added: head/lib/libnetmap/libnetmap.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libnetmap/libnetmap.h  Fri Aug 28 20:03:54 2020
(r364936)
@@ -0,0 +1,660 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (C) 2018 Universita` di Pisa
+ * All rights reserved.
+ *
+ * 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.
+ * $FreeBSD$
+ */
+
+#ifndef LIBNETMAP_H_
+#define LIBNETMAP_H_
+/* if thread-safety is not needed, define LIBNETMAP_NOTHREADSAFE before 
including
+ * this file.
+ */
+
+/* NOTE: we include net/netmap_user.h without defining NETMAP_WITH_LIBS, which
+ * is deprecated. If you still need it, please define NETMAP_WITH_LIBS and
+ * include net/netmap_user.h before including this file.
+ */
+#include 
+
+struct nmctx;
+struct nmport_d;
+struct nmem_d;
+
+/*
+ * A port open specification (portspec for brevity) has the following syntax
+ * (square brackets delimit optional parts):
+ *
+ * 

svn commit: r364935 - head/sys/vm

2020-08-28 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Aug 28 19:59:02 2020
New Revision: 364935
URL: https://svnweb.freebsd.org/changeset/base/364935

Log:
  vm_pageout_scan_active: ensure ps_delta is initialized
  
  Reported by:  Coverity
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26212

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cFri Aug 28 19:52:16 2020(r364934)
+++ head/sys/vm/vm_pageout.cFri Aug 28 19:59:02 2020(r364935)
@@ -1287,8 +1287,10 @@ act_scan:
 * so, discarding any references collected by
 * pmap_ts_referenced().
 */
-   if (__predict_false(_vm_page_queue(old) == PQ_NONE))
+   if (__predict_false(_vm_page_queue(old) == PQ_NONE)) {
+   ps_delta = 0;
break;
+   }
 
/*
 * Advance or decay the act_count based on recent usage.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364933 - in head: lib/libmemstat sys/vm

2020-08-28 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Aug 28 19:50:40 2020
New Revision: 364933
URL: https://svnweb.freebsd.org/changeset/base/364933

Log:
  memstat_kvm_uma: fix reading of uma_zone_domain structures
  
  Coverity flagged the scaling by sizeof(uzd).  That is the type
  of the pointer, so the scaling was already done by pointer arithmetic.
  However, this was also passing a stack frame pointer to kvm_read,
  so it was doubly wrong.
  
  Move ZDOM_GET into the !_KERNEL section and use it in libmemstat.
  
  Reported by:  Coverity
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D26213

Modified:
  head/lib/libmemstat/memstat_uma.c
  head/sys/vm/uma_int.h

Modified: head/lib/libmemstat/memstat_uma.c
==
--- head/lib/libmemstat/memstat_uma.c   Fri Aug 28 19:21:11 2020
(r364932)
+++ head/lib/libmemstat/memstat_uma.c   Fri Aug 28 19:50:40 2020
(r364933)
@@ -455,9 +455,8 @@ skip_percpu:
mtp->mt_byteslimit = mtp->mt_countlimit * mtp->mt_size;
mtp->mt_count = mtp->mt_numallocs - mtp->mt_numfrees;
for (i = 0; i < ndomains; i++) {
-   ret = kread(kvm,
-   _cpu[mp_maxid + 1] + i * sizeof(uzd),
-   , sizeof(uzd), 0);
+   ret = kread(kvm, ZDOM_GET(uzp, i), ,
+   sizeof(uzd), 0);
if (ret != 0)
continue;
for (ubp =

Modified: head/sys/vm/uma_int.h
==
--- head/sys/vm/uma_int.h   Fri Aug 28 19:21:11 2020(r364932)
+++ head/sys/vm/uma_int.h   Fri Aug 28 19:50:40 2020(r364933)
@@ -526,6 +526,10 @@ struct uma_zone {
KASSERT(uma_zone_get_allocs((z)) == 0,  \
("zone %s initialization after use.", (z)->uz_name))
 
+/* Domains are contiguous after the last CPU */
+#defineZDOM_GET(z, n)  
\
+   (&((uma_zone_domain_t)&(z)->uz_cpu[mp_maxid + 1])[n])
+
 #undef UMA_ALIGN
 
 #ifdef _KERNEL
@@ -560,10 +564,6 @@ static __inline uma_slab_t hash_sfind(struct uma_hash 
 #defineKEG_ASSERT_COLD(k)  
\
KASSERT(uma_keg_get_allocs((k)) == 0,   \
("keg %s initialization after use.", (k)->uk_name))
-
-/* Domains are contiguous after the last CPU */
-#defineZDOM_GET(z, n)  
\
-(&((uma_zone_domain_t)&(z)->uz_cpu[mp_maxid + 1])[n])
 
 #defineZDOM_LOCK_INIT(z, zdom, lc) 
\
do {\
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364932 - head/sys/dev/usb

2020-08-28 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Aug 28 19:21:11 2020
New Revision: 364932
URL: https://svnweb.freebsd.org/changeset/base/364932

Log:
  Allow slow USB devices to be given more time to return their USB descriptors,
  like Logitech HD Pro Webcam C920.
  
  PR:   248926
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/usb_request.c

Modified: head/sys/dev/usb/usb_request.c
==
--- head/sys/dev/usb/usb_request.c  Fri Aug 28 19:02:05 2020
(r364931)
+++ head/sys/dev/usb/usb_request.c  Fri Aug 28 19:21:11 2020
(r364932)
@@ -721,7 +721,8 @@ done:
case USB_ERR_CANCELLED:
break;
default:
-   DPRINTF("I/O error - waiting a bit for TT cleanup\n");
+   DPRINTF("error=%s - waiting a bit for TT cleanup\n",
+   usbd_errstr(err));
usb_pause_mtx(mtx, hz / 16);
break;
}
@@ -1010,7 +1011,7 @@ usbd_req_get_desc(struct usb_device *udev,
USETW(req.wLength, min_len);
 
err = usbd_do_request_flags(udev, mtx, ,
-   desc, 0, NULL, 500 /* ms */);
+   desc, 0, NULL, 1000 /* ms */);
 
if (err != 0 && err != USB_ERR_TIMEOUT &&
min_len != max_len) {
@@ -1021,7 +1022,7 @@ usbd_req_get_desc(struct usb_device *udev,
USETW(req.wLength, max_len);
 
err = usbd_do_request_flags(udev, mtx, ,
-   desc, USB_SHORT_XFER_OK, NULL, 500 /* ms */);
+   desc, USB_SHORT_XFER_OK, NULL, 1000 /* ms */);
 
if (err == 0) {
/* verify length */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364931 - head/sys/arm64/conf

2020-08-28 Thread Matt Macy
Author: mmacy
Date: Fri Aug 28 19:02:05 2020
New Revision: 364931
URL: https://svnweb.freebsd.org/changeset/base/364931

Log:
  ZFS: add to arm64 NOTES to minimize potential for missing symbols

Modified:
  head/sys/arm64/conf/NOTES

Modified: head/sys/arm64/conf/NOTES
==
--- head/sys/arm64/conf/NOTES   Fri Aug 28 18:53:45 2020(r364930)
+++ head/sys/arm64/conf/NOTES   Fri Aug 28 19:02:05 2020(r364931)
@@ -231,3 +231,8 @@ nooptions   COMPAT_FREEBSD10
 
 # arm64 supports 32-bit FreeBSD/arm binaries (armv[67] ABIs)
 optionsCOMPAT_FREEBSD32# Compatible with FreeBSD/arm
+
+#
+# ZFS support
+
+optionsZFS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364930 - in head/sys/contrib/openzfs: . cmd/zpool include include/sys/fs lib/libspl/include/os/freebsd/sys lib/libzfs man/man1 man/man5 man/man8 module module/lua/setjmp module/os/linu...

2020-08-28 Thread Matt Macy
Author: mmacy
Date: Fri Aug 28 18:53:45 2020
New Revision: 364930
URL: https://svnweb.freebsd.org/changeset/base/364930

Log:
  ZFS: MFV 2.0-rc1-ga00c61

Added:
  
head/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_new_props.ksh
 - copied unchanged from r364929, 
vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_new_props.ksh
Modified:
  head/sys/contrib/openzfs/META
  head/sys/contrib/openzfs/NEWS
  head/sys/contrib/openzfs/cmd/zpool/zpool_main.c
  head/sys/contrib/openzfs/include/libzfs_impl.h
  head/sys/contrib/openzfs/include/sys/fs/zfs.h
  head/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/mount.h
  head/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c
  head/sys/contrib/openzfs/lib/libzfs/libzfs_util.c
  head/sys/contrib/openzfs/man/man1/arcstat.1
  head/sys/contrib/openzfs/man/man1/cstyle.1
  head/sys/contrib/openzfs/man/man1/raidz_test.1
  head/sys/contrib/openzfs/man/man1/zhack.1
  head/sys/contrib/openzfs/man/man1/ztest.1
  head/sys/contrib/openzfs/man/man5/spl-module-parameters.5
  head/sys/contrib/openzfs/man/man5/vdev_id.conf.5
  head/sys/contrib/openzfs/man/man5/zfs-events.5
  head/sys/contrib/openzfs/man/man5/zfs-module-parameters.5
  head/sys/contrib/openzfs/man/man5/zpool-features.5
  head/sys/contrib/openzfs/man/man8/fsck.zfs.8
  head/sys/contrib/openzfs/man/man8/mount.zfs.8
  head/sys/contrib/openzfs/man/man8/vdev_id.8
  head/sys/contrib/openzfs/man/man8/zed.8.in
  head/sys/contrib/openzfs/man/man8/zfs-mount-generator.8.in
  head/sys/contrib/openzfs/man/man8/zfs.8
  head/sys/contrib/openzfs/man/man8/zinject.8
  head/sys/contrib/openzfs/man/man8/zpool-iostat.8
  head/sys/contrib/openzfs/man/man8/zpool.8
  head/sys/contrib/openzfs/man/man8/zstreamdump.8
  head/sys/contrib/openzfs/module/Makefile.bsd
  head/sys/contrib/openzfs/module/lua/setjmp/setjmp_ppc.S
  head/sys/contrib/openzfs/module/os/linux/zfs/zfs_ctldir.c
  head/sys/contrib/openzfs/module/zcommon/zfs_fletcher.c
  head/sys/contrib/openzfs/module/zfs/arc.c
  head/sys/contrib/openzfs/module/zfs/dmu.c
  head/sys/contrib/openzfs/module/zfs/dnode_sync.c
  head/sys/contrib/openzfs/module/zfs/dsl_dir.c
  head/sys/contrib/openzfs/module/zfs/sa.c
  head/sys/contrib/openzfs/module/zfs/spa.c
  head/sys/contrib/openzfs/module/zfs/vdev_raidz_math.c
  head/sys/contrib/openzfs/module/zstd/Makefile.in
  head/sys/contrib/openzfs/tests/runfiles/common.run
  
head/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am
Directory Properties:
  head/sys/contrib/openzfs/   (props changed)

Modified: head/sys/contrib/openzfs/META
==
--- head/sys/contrib/openzfs/META   Fri Aug 28 18:45:14 2020
(r364929)
+++ head/sys/contrib/openzfs/META   Fri Aug 28 18:53:45 2020
(r364930)
@@ -1,10 +1,10 @@
 Meta:  1
 Name:  zfs
 Branch:1.0
-Version:   0.8.0
-Release:   1
+Version:   2.0.0
+Release:   rc1
 Release-Tags:  relext
 License:   CDDL
-Author:OpenZFS on Linux
-Linux-Maximum: 5.6
+Author:OpenZFS
+Linux-Maximum: 5.8
 Linux-Minimum: 3.10

Modified: head/sys/contrib/openzfs/NEWS
==
--- head/sys/contrib/openzfs/NEWS   Fri Aug 28 18:45:14 2020
(r364929)
+++ head/sys/contrib/openzfs/NEWS   Fri Aug 28 18:53:45 2020
(r364930)
@@ -1,3 +1,3 @@
 Descriptions of all releases can be found on github:
 
-https://github.com/zfsonlinux/zfs/releases
+https://github.com/openzfs/zfs/releases

Modified: head/sys/contrib/openzfs/cmd/zpool/zpool_main.c
==
--- head/sys/contrib/openzfs/cmd/zpool/zpool_main.c Fri Aug 28 18:45:14 
2020(r364929)
+++ head/sys/contrib/openzfs/cmd/zpool/zpool_main.c Fri Aug 28 18:53:45 
2020(r364930)
@@ -2816,7 +2816,8 @@ show_import(nvlist_t *config)
 
if (msgid != NULL) {
(void) printf(gettext(
-   "   see: https://zfsonlinux.org/msg/%s\n;), msgid);
+   "   see: https://openzfs.github.io/openzfs-docs/msg/%s\n;),
+   msgid);
}
 
(void) printf(gettext(" config:\n\n"));
@@ -7804,7 +7805,7 @@ print_dedup_stats(nvlist_t *config)
  *pool: tank
  * status: DEGRADED
  * reason: One or more devices ...
- * see: https://zfsonlinux.org/msg/ZFS--01
+ * see: https://openzfs.github.io/openzfs-docs/msg/ZFS--01
  * config:
  * mirror  DEGRADED
  *c1t0d0   OK
@@ -8193,7 +8194,9 @@ status_callback(zpool_handle_t *zhp, void *data)
if (msgid != NULL) {
printf("   ");
printf_color(ANSI_BOLD, gettext("see:"));
-   printf(gettext(" https://zfsonlinux.org/msg/%s\n;), msgid);
+

svn commit: r364927 - head/sys/arm/allwinner/clkng

2020-08-28 Thread Emmanuel Vadot
Author: manu
Date: Fri Aug 28 18:25:45 2020
New Revision: 364927
URL: https://svnweb.freebsd.org/changeset/base/364927

Log:
  arm: allwinner: clk: Add printfs when we cannot set the correct freq
  
  For some unknown reason this seems to fix this function when we printf
  the best variable. This isn't a delay problem as doing a printf without
  it doesn't solve this problem.
  This is way above my pay grade so add some printf that shouldn't be printed
  in 99% of the case anyway.
  Fix booting on most Allwinner boards as the mmc IP uses a NM clock.
  
  Reported by:  Alexander Mishin 
  MFC after:3 days
  X-MFC-With:   363887

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_nm.c

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_nm.cFri Aug 28 17:55:54 2020
(r364926)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.cFri Aug 28 18:25:45 2020
(r364927)
@@ -221,11 +221,15 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare
if ((best < *fout) &&
  ((flags & CLK_SET_ROUND_DOWN) == 0)) {
*stop = 1;
+   printf("best freq (%llu) < requested freq(%llu)\n",
+   best, *fout);
return (ERANGE);
}
if ((best > *fout) &&
  ((flags & CLK_SET_ROUND_UP) == 0)) {
*stop = 1;
+   printf("best freq (%llu) > requested freq(%llu)\n",
+   best, *fout);
return (ERANGE);
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364926 - head/sys/sys

2020-08-28 Thread Warner Losh
Author: imp
Date: Fri Aug 28 17:55:54 2020
New Revision: 364926
URL: https://svnweb.freebsd.org/changeset/base/364926

Log:
  Treat the boot loader as the same as the kernel for what's visible
  
  The boot loader will be growing some (limited) support for some kernel
  interfaces for some of the timekeeping routines to support zstd code.
  Allow the declarations for them to be visible when compiling for the
  boot loader, rather than treating it like a user-space environment
  (which stand.h already provides to a limited degree).

Modified:
  head/sys/sys/time.h

Modified: head/sys/sys/time.h
==
--- head/sys/sys/time.h Fri Aug 28 17:49:56 2020(r364925)
+++ head/sys/sys/time.h Fri Aug 28 17:55:54 2020(r364926)
@@ -492,7 +492,7 @@ struct clockinfo {
 #defineCPUCLOCK_WHICH_TID  1
 #endif
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 
 /*
  * Kernel to clock driver interface.
@@ -600,7 +600,7 @@ int tvtohz(struct timeval *tv);
(((sbt2) >= sbt_timethreshold) ?\
((*(sbt) = getsbinuptime()), 1) : ((*(sbt) = sbinuptime()), 0))
 
-#else /* !_KERNEL */
+#else /* !_KERNEL && !_STANDALONE */
 #include 
 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364925 - head/sys/sys

2020-08-28 Thread Warner Losh
Author: imp
Date: Fri Aug 28 17:49:56 2020
New Revision: 364925
URL: https://svnweb.freebsd.org/changeset/base/364925

Log:
  Allow the pseudo-errnos to be returned as well in boot loader
  
  Expose the pseudo-errno values in _STANDALONE is defined so that code
  in the boot loader can make use of them. Nothing uses them today, but
  the zstd support that's coming will need them.

Modified:
  head/sys/sys/errno.h

Modified: head/sys/sys/errno.h
==
--- head/sys/sys/errno.hFri Aug 28 17:36:14 2020(r364924)
+++ head/sys/sys/errno.hFri Aug 28 17:49:56 2020(r364925)
@@ -187,7 +187,7 @@ __END_DECLS
 #defineELAST   97  /* Must be equal largest errno 
*/
 #endif /* _POSIX_SOURCE */
 
-#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO)
+#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO) || defined(_STANDALONE)
 /* pseudo-errors returned inside kernel to modify return to process */
 #defineERESTART(-1)/* restart syscall */
 #defineEJUSTRETURN (-2)/* don't modify regs, just 
return */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364924 - head/stand

2020-08-28 Thread Warner Losh
Author: imp
Date: Fri Aug 28 17:36:14 2020
New Revision: 364924
URL: https://svnweb.freebsd.org/changeset/base/364924

Log:
  Create CFLAGS_EARLY.file for boot loader.
  
  Some external code requires a specific set of include paths to work
  properly since it emulates the typical environment the code is used
  in. Enable this by creating a CFLAGS_EARLY.file variable that can be
  used to build this stack. Otherwise the include stack we build for
  stand programs may get in the way. Code that uses this feature has to
  tolerate the normal stack of inclues being last on the list (and
  presumably unused), though.
  
  Generally, it it should only be used for the specific include
  directories. Defines and that sort of thing should be done in the
  normal CFLAGS variable. There is a global CFLAGS_EARY hook as well for
  everything in a Makefile.

Modified:
  head/stand/defs.mk

Modified: head/stand/defs.mk
==
--- head/stand/defs.mk  Fri Aug 28 17:06:35 2020(r364923)
+++ head/stand/defs.mk  Fri Aug 28 17:36:14 2020(r364924)
@@ -55,6 +55,11 @@ LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a
 
 # Standard options:
 CFLAGS+=   -nostdinc
+# Allow CFLAGS_EARLY.file/target so that code that needs specific stack
+# of include paths can set them up before our include paths. Normally
+# the only thing that should be there are -I directives, and as few of
+# those as possible.
+CFLAGS+=   ${CFLAGS_EARLY} ${CFLAGS_EARLY.${.IMPSRC:T}} 
${CFLAGS_EARLY.${.TARGET:T}}
 .if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1
 CFLAGS+=   -I${BOOTOBJ}/libsa32
 .else
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364923 - in head/sys: amd64/conf conf

2020-08-28 Thread Matt Macy
Author: mmacy
Date: Fri Aug 28 17:06:35 2020
New Revision: 364923
URL: https://svnweb.freebsd.org/changeset/base/364923

Log:
  ZFS: clarify dependencies for static linking

Modified:
  head/sys/amd64/conf/NOTES
  head/sys/conf/NOTES

Modified: head/sys/amd64/conf/NOTES
==
--- head/sys/amd64/conf/NOTES   Fri Aug 28 17:05:06 2020(r364922)
+++ head/sys/amd64/conf/NOTES   Fri Aug 28 17:06:35 2020(r364923)
@@ -635,6 +635,7 @@ options LINSYSFS
 #
 # ZFS support
 
+# NB: This depends on crypto, cryptodev and ZSTDIO
 optionsZFS
 
 #

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Fri Aug 28 17:05:06 2020(r364922)
+++ head/sys/conf/NOTES Fri Aug 28 17:06:35 2020(r364923)
@@ -2807,7 +2807,8 @@ options IMAGACT_BINMISC
 optionsGZIO
 
 # zstd support
-# This enables support for Zstd compressed core dumps and GEOM_UZIP images.
+# This enables support for Zstd compressed core dumps, GEOM_UZIP images,
+# and is required by zfs if statically linked.
 optionsZSTDIO
 
 # BHND(4) drivers
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364922 - head/sys/dev/mn

2020-08-28 Thread Warner Losh
Author: imp
Date: Fri Aug 28 17:05:06 2020
New Revision: 364922
URL: https://svnweb.freebsd.org/changeset/base/364922

Log:
  Update outdated comment
  
  There is no splnet anymore, so update the comment to drop references
  to it.

Modified:
  head/sys/dev/mn/if_mn.c

Modified: head/sys/dev/mn/if_mn.c
==
--- head/sys/dev/mn/if_mn.c Fri Aug 28 16:40:38 2020(r364921)
+++ head/sys/dev/mn/if_mn.c Fri Aug 28 17:05:06 2020(r364922)
@@ -743,7 +743,7 @@ ngmn_connect(hook_p hook)
if (!(u & 1))
printf("%s: init chan %d stat %08x\n", sc->name, chan, u);
sc->m32x->stat = 1; 
-   /* probably not at splnet, force outward queueing */
+   /* force outward queueing */
NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook));
 
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364920 - in head/sys: dev/speaker sys

2020-08-28 Thread Warner Losh
Author: imp
Date: Fri Aug 28 16:40:33 2020
New Revision: 364920
URL: https://svnweb.freebsd.org/changeset/base/364920

Log:
  Remove splclock(). It's not useful to keep.
  
  splclock is used in one driver (spkr) to control access to
  timer_spkr_* routines.  However, nothing else does. So it shows no
  useful locking info to someone that would want to lock spkr.
  
  NOTE: I think there's races with timer_spkr_{acquire,release} since
  there's no interlock in those routines, despite there being a spin
  lock to protect the clock. Current other users appear to use no extra
  locking protocol, though they themselves appear to be at least
  attempting to make sure that only a single thread calls these
  routines. I suspect the right answer is to update these routines to
  take/release the clock spin lock since they are short and to the
  point, but that's beyond the scope of this commit.

Modified:
  head/sys/dev/speaker/spkr.c
  head/sys/sys/systm.h

Modified: head/sys/dev/speaker/spkr.c
==
--- head/sys/dev/speaker/spkr.c Fri Aug 28 15:35:45 2020(r364919)
+++ head/sys/dev/speaker/spkr.c Fri Aug 28 16:40:33 2020(r364920)
@@ -65,7 +65,7 @@ static void playstring(char *cp, size_t slen);
 static void
 tone(unsigned int thz, unsigned int centisecs)
 {
-   int sps, timo;
+   int timo;
 
if (thz <= 0)
return;
@@ -75,14 +75,10 @@ tone(unsigned int thz, unsigned int centisecs)
 #endif /* DEBUG */
 
/* set timer to generate clicks at given frequency in Hertz */
-   sps = splclock();
-
if (timer_spkr_acquire()) {
/* enter list of waiting procs ??? */
-   splx(sps);
return;
}
-   splx(sps);
disable_intr();
timer_spkr_setfreq(thz);
enable_intr();
@@ -95,9 +91,7 @@ tone(unsigned int thz, unsigned int centisecs)
timo = centisecs * hz / 100;
if (timo > 0)
tsleep(, SPKRPRI | PCATCH, "spkrtn", timo);
-   sps = splclock();
timer_spkr_release();
-   splx(sps);
 }
 
 /*

Modified: head/sys/sys/systm.h
==
--- head/sys/sys/systm.hFri Aug 28 15:35:45 2020(r364919)
+++ head/sys/sys/systm.hFri Aug 28 16:40:33 2020(r364920)
@@ -497,7 +497,6 @@ voidkern_reboot(int) __dead2;
 void   shutdown_nice(int);
 
 /* Stubs for obsolete functions that used to be for interrupt management */
-static __inline intrmask_t splclock(void)  { return 0; }
 static __inline intrmask_t splhigh(void)   { return 0; }
 static __inline intrmask_t splimp(void){ return 0; }
 static __inline intrmask_t splnet(void){ return 0; }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364863 - head

2020-08-28 Thread Harry Schmalzbauer

Am 28.08.2020 um 17:43 schrieb Ryan Moeller:
…

ld: error: undefined symbol: zfs_zstd_decompress_level
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)
*** Error code 1

According to src/sys/amd64/conf/NOTES, "options ZFS" should still be 
supported.

Unfortunately I have no adhoc idea how to fix. Anybody else?



You need options ZSTDIO, too. NOTES needs to be updated.


Thanks a lot!

May I suggest the following change:
Index: sys/contrib/openzfs/man/man8/zfsprops.8
===
--- sys/contrib/openzfs/man/man8/zfsprops.8 (Revision 364900)
+++ sys/contrib/openzfs/man/man8/zfsprops.8 (Arbeitskopie)
@@ -1049,8 +1049,9 @@
 dataset creation time and it cannot be changed afterwards.
 .Pp
 For more details and caveats about encryption see the
-.Sy Encryption
-section.
+.Em Encryption
+section of
+.Xr zfs-load-key 8 .
 .It Sy keyformat Ns = Ns Sy raw Ns | Ns Sy hex Ns | Ns Sy passphrase
 Controls what format the user's encryption key will be provided as. This
 property is only set when the dataset is encrypted.


Curious about the new OpenZFS bells and whistles, I promptly struggeld 
over finding "the Encryption section".


Some lines above, the man page already mentiones explicitly 
zfs-load-key.8 while referencing the Encryption section, so I just 
copied the macros used there - not much clue about man here…


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


Re: svn commit: r364863 - head

2020-08-28 Thread Ryan Moeller


On 8/28/20 8:51 AM, Harry Schmalzbauer wrote:

Am 27.08.2020 um 15:26 schrieb Ryan Moeller:

Author: freqlabs
Date: Thu Aug 27 13:26:36 2020
New Revision: 364863
URL: https://svnweb.freebsd.org/changeset/base/364863

Log:
   libzfs: Also add the crypto dependency to Makefile.inc1
      Reported by:    kevans
   Discussed with:    kevans
   Sponsored by:    iXsystems, Inc.

Modified:
   head/Makefile.inc1



Hello,

this still doesn't allwo me to compile ZFS into the kernel:
linking kernel.full
ld: error: undefined symbol: zfs_zstd_compress
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)

ld: error: undefined symbol: zfs_zstd_decompress
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)

ld: error: undefined symbol: zfs_zstd_decompress_level
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)
*** Error code 1

According to src/sys/amd64/conf/NOTES, "options ZFS" should still be 
supported.

Unfortunately I have no adhoc idea how to fix. Anybody else?



You need options ZSTDIO, too. NOTES needs to be updated.

-Ryan




Thanks,
-harry

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


svn commit: r364919 - in head/bin/sh: . tests/execution

2020-08-28 Thread Jilles Tjoelker
Author: jilles
Date: Fri Aug 28 15:35:45 2020
New Revision: 364919
URL: https://svnweb.freebsd.org/changeset/base/364919

Log:
  sh: Keep ignored SIGINT/SIGQUIT after set in a background job
  
  If job control is not enabled, a background job (... &) ignores SIGINT and
  SIGQUIT, but this can be reverted using the trap builtin in the same shell
  environment.
  
  Using the set builtin to change options would also revert SIGINT and SIGQUIT
  to their previous dispositions.
  
  This broke due to r317298. Calling setsignal() reverts the effect of
  ignoresig().
  
  Reported by:  bdrewery
  MFC after:1 week

Added:
  head/bin/sh/tests/execution/bg13.0   (contents, props changed)
Modified:
  head/bin/sh/main.c
  head/bin/sh/tests/execution/Makefile
  head/bin/sh/trap.c
  head/bin/sh/trap.h

Modified: head/bin/sh/main.c
==
--- head/bin/sh/main.c  Fri Aug 28 15:09:43 2020(r364918)
+++ head/bin/sh/main.c  Fri Aug 28 15:35:45 2020(r364919)
@@ -134,6 +134,7 @@ main(int argc, char *argv[])
setstackmark();
setstackmark();
procargs(argc, argv);
+   trap_init();
pwd_init(iflag);
INTON;
if (iflag)

Modified: head/bin/sh/tests/execution/Makefile
==
--- head/bin/sh/tests/execution/MakefileFri Aug 28 15:09:43 2020
(r364918)
+++ head/bin/sh/tests/execution/MakefileFri Aug 28 15:35:45 2020
(r364919)
@@ -19,6 +19,7 @@ ${PACKAGE}FILES+= bg9.0
 ${PACKAGE}FILES+=  bg10.0 bg10.0.stdout
 ${PACKAGE}FILES+=  bg11.0
 ${PACKAGE}FILES+=  bg12.0
+${PACKAGE}FILES+=  bg13.0
 ${PACKAGE}FILES+=  env1.0
 ${PACKAGE}FILES+=  fork1.0
 ${PACKAGE}FILES+=  fork2.0

Added: head/bin/sh/tests/execution/bg13.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/execution/bg13.0  Fri Aug 28 15:35:45 2020
(r364919)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.`
+trap 'rm -rf $T' 0
+cd $T || exit 3
+mkfifo fifo1
+# Use a trap, not the default action, since the shell may catch SIGINT and
+# therefore its processing may be delayed.
+{ set -C; trap 'exit 5' TERM; read dummy fifo1
+kill -INT "$!"
+kill -TERM "$!"
+exec 3>&-
+wait "$!"
+r=$?
+[ "$r" = 5 ]

Modified: head/bin/sh/trap.c
==
--- head/bin/sh/trap.c  Fri Aug 28 15:09:43 2020(r364918)
+++ head/bin/sh/trap.c  Fri Aug 28 15:35:45 2020(r364919)
@@ -474,14 +474,20 @@ dotrap(void)
 }
 
 
+void
+trap_init(void)
+{
+   setsignal(SIGINT);
+   setsignal(SIGQUIT);
+}
+
+
 /*
  * Controls whether the shell is interactive or not based on iflag.
  */
 void
 setinteractive(void)
 {
-   setsignal(SIGINT);
-   setsignal(SIGQUIT);
setsignal(SIGTERM);
 }
 

Modified: head/bin/sh/trap.h
==
--- head/bin/sh/trap.h  Fri Aug 28 15:09:43 2020(r364918)
+++ head/bin/sh/trap.h  Fri Aug 28 15:35:45 2020(r364919)
@@ -45,6 +45,7 @@ void ignoresig(int);
 int issigchldtrapped(void);
 void onsig(int);
 void dotrap(void);
+void trap_init(void);
 void setinteractive(void);
 void exitshell(int) __dead2;
 void exitshell_savedstatus(void) __dead2;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364918 - head/sys/sys

2020-08-28 Thread Warner Losh
Author: imp
Date: Fri Aug 28 15:09:43 2020
New Revision: 364918
URL: https://svnweb.freebsd.org/changeset/base/364918

Log:
  remove splbio and splcam
  
  splbio and splcan have been completely removed from the tree. We can
  now remove their definitions here. They've been nops for a long time
  and were only preserved to give hints on how to lock drivers. All
  drivers have been deleted or converted, so they can be deleted now.

Modified:
  head/sys/sys/systm.h

Modified: head/sys/sys/systm.h
==
--- head/sys/sys/systm.hFri Aug 28 13:15:13 2020(r364917)
+++ head/sys/sys/systm.hFri Aug 28 15:09:43 2020(r364918)
@@ -497,8 +497,6 @@ voidkern_reboot(int) __dead2;
 void   shutdown_nice(int);
 
 /* Stubs for obsolete functions that used to be for interrupt management */
-static __inline intrmask_t splbio(void){ return 0; }
-static __inline intrmask_t splcam(void){ return 0; }
 static __inline intrmask_t splclock(void)  { return 0; }
 static __inline intrmask_t splhigh(void)   { return 0; }
 static __inline intrmask_t splimp(void){ return 0; }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364863 - head

2020-08-28 Thread Harry Schmalzbauer

Am 27.08.2020 um 15:26 schrieb Ryan Moeller:

Author: freqlabs
Date: Thu Aug 27 13:26:36 2020
New Revision: 364863
URL: https://svnweb.freebsd.org/changeset/base/364863

Log:
   libzfs: Also add the crypto dependency to Makefile.inc1
   
   Reported by:	kevans

   Discussed with:  kevans
   Sponsored by:iXsystems, Inc.

Modified:
   head/Makefile.inc1



Hello,

this still doesn't allwo me to compile ZFS into the kernel:
linking kernel.full
ld: error: undefined symbol: zfs_zstd_compress
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)

ld: error: undefined symbol: zfs_zstd_decompress
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)

ld: error: undefined symbol: zfs_zstd_decompress_level
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)
*** Error code 1

According to src/sys/amd64/conf/NOTES, "options ZFS" should still be 
supported.

Unfortunately I have no adhoc idea how to fix. Anybody else?

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


Re: svn commit: r364091 - head/lib/libc/gen

2020-08-28 Thread Konstantin Belousov
On Thu, Aug 27, 2020 at 05:28:03PM -0700, Adrian Chadd wrote:
> Hi!
> 
> This breaks when compiling FreeBSD-mips on GCC-9. :(
> 
> In file included from
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:50,
>  from
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir_b.c:29:
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/include/block_abi.h:45:2:
> error: anonymous struct declared inside parameter list will not be visible
> outside of this definition or declarati
>45 |  struct {\
>   |  ^~
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:67:5:
> note: in expansion of macro 'DECLARE_BLOCK'
>67 | DECLARE_BLOCK(int, dcomp, const struct dirent **, const struct
> dirent **))
>   | ^
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/include/block_abi.h:45:2:
> error: anonymous struct declared inside parameter list will not be visible
> outside of this definition or declarati
>45 |  struct {\
>   |  ^~
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:66:5:
> note: in expansion of macro 'DECLARE_BLOCK'
>66 | DECLARE_BLOCK(int, select, const struct dirent *),
>   | ^
> cc1: all warnings being treated as errors
> --- scandir_b.o ---
> *** [scandir_b.o] Error code 1

You did not show the exact command line for your compilation failure.
Since gcc does not support blocks, I think the best route is to add
something like the following to lib/libc/gen/Makefile.inc:
CWARNFLAGS.gcc.scandir_b.c= -Wno-error
(I did not even tried to test it).
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"