Re: svn commit: r341578 - head/sys/dev/mlx5/mlx5_en

2019-12-17 Thread Hans Petter Selasky

On 2019-12-17 18:14, Andrey V. Elsukov wrote:

On 13.12.2019 17:27, Hans Petter Selasky wrote:

On 2019-12-13 14:40, Andrey V. Elsukov wrote:

On 05.12.2018 17:20, Slava Shwartsman wrote:

Author: slavash
Date: Wed Dec  5 14:20:57 2018
New Revision: 341578
URL: https://svnweb.freebsd.org/changeset/base/341578

Log:
    mlx5en: Remove the DRBR and associated logic in the transmit path.
       The hardware queues are deep enough currently and using the
DRBR and associated
    callbacks only leads to more task switching in the TX path. The is
also a race
    setting the queue_state which can lead to hung TX rings.


JFYI. We have compared the same router+firewall workloads on the host
with this change and before, and I can say, that without DRBR on TX now
we constantly have several percents of packets drops due to ENOBUFS
error from mlx5e_xmit().



Have you tried to tune the TX/RX parameters?

Especially the tx_queue_size .


We use the following settings:
% sysctl dev.mce.4.conf. | grep que
dev.mce.4.conf.rx_queue_size: 16384
dev.mce.4.conf.tx_queue_size: 16384
dev.mce.4.conf.rx_queue_size_max: 16384
dev.mce.4.conf.tx_queue_size_max: 16384

Also, previously I have patched MLX5E_SQ_TX_QUEUE_SIZE value up to 16384.


Hi,

What about the other parameters. Did you tune any of those?

At what rate does this happen?

Can you send me the full dev.mce.4 sysctl tree off-list?

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


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

2019-12-17 Thread Conrad Meyer
Author: cem
Date: Wed Dec 18 06:22:28 2019
New Revision: 355876
URL: https://svnweb.freebsd.org/changeset/base/355876

Log:
  acpi(4): Add _CID to PNP info string
  
  While a given ACPI device may have 0-N compatibility IDs, in practice most
  seem to have 0 or 1.  If one is present, emit it as part of the PNP info
  string associated with a device.  This could enable MODULE_PNP_INFO-based
  automatic kldload for ACPI drivers associated with a given _CID (but without
  a good _HID or _UID identifier).
  
  Reviewed by:  imp, jhb
  Differential Revision:https://reviews.freebsd.org/D22846

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

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Wed Dec 18 02:29:27 2019(r355875)
+++ head/sys/dev/acpica/acpi.c  Wed Dec 18 06:22:28 2019(r355876)
@@ -884,11 +884,14 @@ acpi_child_pnpinfo_str_method(device_t cbdev, device_t
return (0);
 }
 
-snprintf(buf, buflen, "_HID=%s _UID=%lu",
+snprintf(buf, buflen, "_HID=%s _UID=%lu _CID=%s",
(adinfo->Valid & ACPI_VALID_HID) ?
adinfo->HardwareId.String : "none",
(adinfo->Valid & ACPI_VALID_UID) ?
-   strtoul(adinfo->UniqueId.String, NULL, 10) : 0UL);
+   strtoul(adinfo->UniqueId.String, NULL, 10) : 0UL,
+   ((adinfo->Valid & ACPI_VALID_CID) &&
+adinfo->CompatibleIdList.Count > 0) ?
+   adinfo->CompatibleIdList.Ids[0].String : "none");
 AcpiOsFree(adinfo);
 
 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"


Re: svn commit: r355828 - head/sys/sys

2019-12-17 Thread Pedro Giffuni



On 17/12/2019 18:07, Brooks Davis wrote:

On Tue, Dec 17, 2019 at 01:28:20PM -0500, Pedro Giffuni wrote:

On 16/12/2019 23:42, Cy Schubert wrote:

In message <201912162355.xbgntuq6078...@repo.freebsd.org>, "Pedro F.
Giffuni" w
rites:

Author: pfg
Date: Mon Dec 16 23:55:30 2019
New Revision: 355828
URL: https://svnweb.freebsd.org/changeset/base/355828

Log:
Double the size of ARG_MAX on LP64 platforms.

As modern software keeps growing in size, we get requests to update the

value of ARG_MAX in order to link the resulting object files. Other OSs
have much higher values but Increasiong ARG_MAX has a multiplied effect on
KVA, so just bumping this value is dangerous in some archs like ARM32 that
can exhaust KVA rather easily.

While it would be better to have a unique value for all archs, other OSs

(Illumos in partidular) can have different ARG_MAX limits depending on the
platform,  For now we want to be really conservative so we are avoidng
the change on ILP32 and in the alternative case we only double it since tha
t
seems to work well enough for recent Code Aster.

I was planning to bump the _FreeBSD_version but it was bumped recently

(r355798) so we can reuse the 1300068 value for this change.

This doesn't seem right. Each bump should be for a distinct change and
documented as such.

TBH, it is just not worth it: this change will currently benefit only
one port (french/aster) and the update won't be committed until after
the MFC is done.

An MFC is a quite long-term solution.  If merged to 11 and 12 then any
workarounds can't be removed until 11.3 and 12.1 are EOL since we'll be
building packages there until that point.


Yes. I am planning to MFC only to 12-stable as 11-stable may not be 
worth bothering.


Pedro.


-- Brooks

___
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: r355875 - head/sys/arm/broadcom/bcm2835

2019-12-17 Thread Kyle Evans
Author: kevans
Date: Wed Dec 18 02:29:27 2019
New Revision: 355875
URL: https://svnweb.freebsd.org/changeset/base/355875

Log:
  bcm2835_vcbus: add legacy compat mappings
  
  I've opted for just duplicating the two entries needed for this, rather than
  writing any other mechanism for maintaining two root compat entries to map
  to one config, for simplicity. We'll eventually declare these legacy DTB
  unsupported, but let's not do that yet while there's no real burden.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c   Wed Dec 18 01:56:38 
2019(r355874)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c   Wed Dec 18 02:29:27 
2019(r355875)
@@ -152,13 +152,27 @@ static struct bcm283x_memory_soc_cfg {
bus_addr_t   busdma_lowaddr;
 } bcm283x_memory_configs[] = {
 #ifdef SOC_BCM2835
+   /* Legacy */
{
.memmap = bcm2835_memmap,
+   .soc_compat = "raspberrypi,model-b",
+   .busdma_lowaddr = BUS_SPACE_MAXADDR_32BIT,
+   },
+   /* Modern */
+   {
+   .memmap = bcm2835_memmap,
.soc_compat = "brcm,bcm2835",
.busdma_lowaddr = BUS_SPACE_MAXADDR_32BIT,
},
 #endif
 #ifdef SOC_BCM2836
+   /* Legacy */
+   {
+   .memmap = bcm2836_memmap,
+   .soc_compat = "brcm,bcm2709",
+   .busdma_lowaddr = BUS_SPACE_MAXADDR_32BIT,
+   },
+   /* Modern */
{
.memmap = bcm2836_memmap,
.soc_compat = "brcm,bcm2836",
___
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: r355874 - head/sys/vm

2019-12-17 Thread Mark Johnston
Author: markj
Date: Wed Dec 18 01:56:38 2019
New Revision: 355874
URL: https://svnweb.freebsd.org/changeset/base/355874

Log:
  Fix the aflag shift on big-endian platforms after r355672.
  
  The structure offset is zero regardless of endianness.
  
  Reported by:  brooks
  Pointy hat:   markj

Modified:
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Wed Dec 18 01:37:00 2019(r355873)
+++ head/sys/vm/vm_page.h   Wed Dec 18 01:56:38 2019(r355874)
@@ -763,7 +763,11 @@ void vm_page_assert_pga_writeable(vm_page_t m, uint16_
 #defineVM_PAGE_ASSERT_PGA_WRITEABLE(m, bits)   (void)0
 #endif
 
-#defineVM_PAGE_AFLAG_SHIFT (__offsetof(vm_page_astate_t, flags) * 
NBBY)
+#if BYTE_ORDER == BIG_ENDIAN
+#defineVM_PAGE_AFLAG_SHIFT 16
+#else
+#defineVM_PAGE_AFLAG_SHIFT 0
+#endif
 
 /*
  * Load a snapshot of a page's 32-bit atomic state.
___
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: r355873 - head/sys/opencrypto

2019-12-17 Thread John Baldwin
Author: jhb
Date: Wed Dec 18 01:37:00 2019
New Revision: 355873
URL: https://svnweb.freebsd.org/changeset/base/355873

Log:
  Add support for TLS 1.3 using AES-GCM to the OCF backend for KTLS.
  
  Reviewed by:  gallatin
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D22802

Modified:
  head/sys/opencrypto/ktls_ocf.c

Modified: head/sys/opencrypto/ktls_ocf.c
==
--- head/sys/opencrypto/ktls_ocf.c  Wed Dec 18 01:33:20 2019
(r355872)
+++ head/sys/opencrypto/ktls_ocf.c  Wed Dec 18 01:37:00 2019
(r355873)
@@ -60,13 +60,21 @@ static MALLOC_DEFINE(M_KTLS_OCF, "ktls_ocf", "OCF KTLS
 SYSCTL_DECL(_kern_ipc_tls);
 SYSCTL_DECL(_kern_ipc_tls_stats);
 
-static counter_u64_t ocf_gcm_crypts;
-SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ocf_gcm_crypts, CTLFLAG_RD,
-_gcm_crypts,
-"Total number of OCF GCM encryption operations");
+static SYSCTL_NODE(_kern_ipc_tls_stats, OID_AUTO, ocf, CTLFLAG_RD, 0,
+"Kernel TLS offload via OCF stats");
 
+static counter_u64_t ocf_tls12_gcm_crypts;
+SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_gcm_crypts,
+CTLFLAG_RD, _tls12_gcm_crypts,
+"Total number of OCF TLS 1.2 GCM encryption operations");
+
+static counter_u64_t ocf_tls13_gcm_crypts;
+SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls13_gcm_crypts,
+CTLFLAG_RD, _tls13_gcm_crypts,
+"Total number of OCF TLS 1.3 GCM encryption operations");
+
 static counter_u64_t ocf_retries;
-SYSCTL_COUNTER_U64(_kern_ipc_tls_stats, OID_AUTO, ocf_retries, CTLFLAG_RD,
+SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, retries, CTLFLAG_RD,
 _retries,
 "Number of OCF encryption operation retries");
 
@@ -84,9 +92,10 @@ ktls_ocf_callback(struct cryptop *crp)
 }
 
 static int
-ktls_ocf_encrypt(struct ktls_session *tls, const struct tls_record_layer *hdr,
-uint8_t *trailer, struct iovec *iniov, struct iovec *outiov, int iovcnt,
-uint64_t seqno, uint8_t record_type __unused)
+ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls,
+const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov,
+struct iovec *outiov, int iovcnt, uint64_t seqno,
+uint8_t record_type __unused)
 {
struct uio uio;
struct tls_aead_data ad;
@@ -127,7 +136,7 @@ ktls_ocf_encrypt(struct ktls_session *tls, const struc
iov[0].iov_base = 
iov[0].iov_len = sizeof(ad);
uio.uio_resid = sizeof(ad);
-   
+
/*
 * OCF always does encryption in place, so copy the data if
 * needed.  Ugh.
@@ -171,7 +180,7 @@ ktls_ocf_encrypt(struct ktls_session *tls, const struc
crde->crd_flags = CRD_F_ENCRYPT | CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT;
memcpy(crde->crd_iv, , sizeof(nd));
 
-   counter_u64_add(ocf_gcm_crypts, 1);
+   counter_u64_add(ocf_tls12_gcm_crypts, 1);
for (;;) {
error = crypto_dispatch(crp);
if (error)
@@ -198,6 +207,118 @@ ktls_ocf_encrypt(struct ktls_session *tls, const struc
return (error);
 }
 
+static int
+ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls,
+const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov,
+struct iovec *outiov, int iovcnt, uint64_t seqno, uint8_t record_type)
+{
+   struct uio uio;
+   struct tls_aead_data_13 ad;
+   char nonce[12];
+   struct cryptodesc *crde, *crda;
+   struct cryptop *crp;
+   struct ocf_session *os;
+   struct ocf_operation *oo;
+   struct iovec *iov;
+   int i, error;
+
+   os = tls->cipher;
+
+   oo = malloc(sizeof(*oo) + (iovcnt + 2) * sizeof(*iov), M_KTLS_OCF,
+   M_WAITOK | M_ZERO);
+   oo->os = os;
+   iov = oo->iov;
+
+   crp = crypto_getreq(2);
+   if (crp == NULL) {
+   free(oo, M_KTLS_OCF);
+   return (ENOMEM);
+   }
+
+   /* Setup the nonce. */
+   memcpy(nonce, tls->params.iv, tls->params.iv_len);
+   *(uint64_t *)(nonce + 4) ^= htobe64(seqno);
+
+   /* Setup the AAD. */
+   ad.type = hdr->tls_type;
+   ad.tls_vmajor = hdr->tls_vmajor;
+   ad.tls_vminor = hdr->tls_vminor;
+   ad.tls_length = hdr->tls_length;
+   iov[0].iov_base = 
+   iov[0].iov_len = sizeof(ad);
+   uio.uio_resid = sizeof(ad);
+
+   /*
+* OCF always does encryption in place, so copy the data if
+* needed.  Ugh.
+*/
+   for (i = 0; i < iovcnt; i++) {
+   iov[i + 1] = outiov[i];
+   if (iniov[i].iov_base != outiov[i].iov_base)
+   memcpy(outiov[i].iov_base, iniov[i].iov_base,
+   outiov[i].iov_len);
+   uio.uio_resid += outiov[i].iov_len;
+   }
+
+   trailer[0] = record_type;
+   iov[iovcnt + 1].iov_base = trailer;
+   iov[iovcnt + 1].iov_len = AES_GMAC_HASH_LEN + 1;
+   uio.uio_resid += AES_GMAC_HASH_LEN + 

svn commit: r355872 - head/sys/sys

2019-12-17 Thread John Baldwin
Author: jhb
Date: Wed Dec 18 01:33:20 2019
New Revision: 355872
URL: https://svnweb.freebsd.org/changeset/base/355872

Log:
  Add a structure for the AAD used in TLS 1.3.
  
  While here, add RFC numbers to comments about nonce and AAD data
  for TLS 1.2.
  
  Reviewed by:  gallatin
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D22801

Modified:
  head/sys/sys/ktls.h

Modified: head/sys/sys/ktls.h
==
--- head/sys/sys/ktls.h Wed Dec 18 01:27:49 2019(r355871)
+++ head/sys/sys/ktls.h Wed Dec 18 01:33:20 2019(r355872)
@@ -50,7 +50,7 @@ struct tls_record_layer {
 #defineTLS_RLTYPE_APP  23
 
 /*
- * Nonce for GCM.
+ * Nonce for GCM for TLS 1.2 per RFC 5288.
  */
 struct tls_nonce_data {
uint8_t fixed[TLS_AEAD_GCM_LEN];
@@ -58,7 +58,7 @@ struct tls_nonce_data {
 } __packed; 
 
 /*
- * AEAD additional data format per RFC.
+ * AEAD additional data format for TLS 1.2 per RFC 5246.
  */
 struct tls_aead_data {
uint64_t seq;   /* In network order */
@@ -66,6 +66,16 @@ struct tls_aead_data {
uint8_t tls_vmajor;
uint8_t tls_vminor;
uint16_t tls_length;
+} __packed;
+
+/*
+ * AEAD additional data format for TLS 1.3 per RFC 8446.
+ */
+struct tls_aead_data_13 {
+   uint8_t type;
+   uint8_t tls_vmajor;
+   uint8_t tls_vminor;
+   uint16_t tls_length;
 } __packed;
 
 /*
___
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: r355871 - in head/share/man: man4 man9

2019-12-17 Thread John Baldwin
Author: jhb
Date: Wed Dec 18 01:27:49 2019
New Revision: 355871
URL: https://svnweb.freebsd.org/changeset/base/355871

Log:
  Bump Dd for changes in r355866.
  
  Pointy hat to:jhb
  MFC after:2 weeks

Modified:
  head/share/man/man4/crypto.4
  head/share/man/man9/crypto.9

Modified: head/share/man/man4/crypto.4
==
--- head/share/man/man4/crypto.4Wed Dec 18 00:12:30 2019
(r355870)
+++ head/share/man/man4/crypto.4Wed Dec 18 01:27:49 2019
(r355871)
@@ -60,7 +60,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 21, 2017
+.Dd December 17, 2019
 .Dt CRYPTO 4
 .Os
 .Sh NAME

Modified: head/share/man/man9/crypto.9
==
--- head/share/man/man9/crypto.9Wed Dec 18 00:12:30 2019
(r355870)
+++ head/share/man/man9/crypto.9Wed Dec 18 01:27:49 2019
(r355871)
@@ -17,7 +17,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 17, 2018
+.Dd December 17, 2019
 .Dt CRYPTO 9
 .Os
 .Sh NAME
___
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: r355870 - in stable/12/sys: contrib/ipfilter/netinet netinet netinet6

2019-12-17 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Dec 18 00:12:30 2019
New Revision: 355870
URL: https://svnweb.freebsd.org/changeset/base/355870

Log:
  MFC r350531:
IPv6 cleanup: kernel
  
Finish what was started a few years ago and harmonize IPv6 and IPv4
kernel names.  We are down to very few places now that it is feasible
to do the change for everything remaining with causing too much disturbance.
  
Remove "aliases" for IPv6 names which confusingly could indicate
that we are talking about a different data structure or field or
have two fields, one for each address family.
Try to follow common conventions used in FreeBSD.
  
* Rename sin6p to sin6 as that is how it is spelt in most places.
* Remove "aliases" (#defines) for:
  - in6pcb which really is an inpcb and nothing separate
  - sotoin6pcb which is sotoinpcb (as per above)
  - in6p_sp which is inp_sp
  - in6p_flowinfo which is inp_flow
* Try to use ia6 for in6_addr rather than in6p.
* With all these gone  also rename the in6p variables to inp as
  that is what we call it in most of the network stack including
  parts of netinet6.
  
The reasons behind this cleanup are that we try to further
unify netinet and netinet6 code where possible and that people
will less ignore one or the other protocol family when doing
code changes as they may not have spotted places due to different
names for the same thing.
  
No functional changes inteded.
  
Sponsored by:   Netflix
  
Do not MFC the in_pcb.h changes for the stable branch.
This MFC is mostly only done in order to be able to MFC other changes
with less conflicts.

Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
  stable/12/sys/netinet/sctp_asconf.c
  stable/12/sys/netinet/sctp_os_bsd.h
  stable/12/sys/netinet/sctp_output.c
  stable/12/sys/netinet/sctp_pcb.c
  stable/12/sys/netinet/sctp_pcb.h
  stable/12/sys/netinet/sctp_usrreq.c
  stable/12/sys/netinet/tcp_usrreq.c
  stable/12/sys/netinet6/icmp6.c
  stable/12/sys/netinet6/in6_mcast.c
  stable/12/sys/netinet6/in6_pcb.c
  stable/12/sys/netinet6/in6_pcb.h
  stable/12/sys/netinet6/in6_src.c
  stable/12/sys/netinet6/ip6_input.c
  stable/12/sys/netinet6/ip6_output.c
  stable/12/sys/netinet6/raw_ip6.c
  stable/12/sys/netinet6/sctp6_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Tue Dec 17 
23:45:50 2019(r355869)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Wed Dec 18 
00:12:30 2019(r355870)
@@ -979,7 +979,7 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
i6addr_t *inp, *inpmask;
 {
 #ifdef USE_INET6
-   struct in6_addr *inp6 = NULL;
+   struct in6_addr *ia6 = NULL;
 #endif
struct sockaddr *sock, *mask;
struct sockaddr_in *sin;
@@ -1007,9 +1007,9 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
break;
 #ifdef USE_INET6
if ((v == 6) && (sin->sin_family == AF_INET6)) {
-   inp6 = &((struct sockaddr_in6 *)sin)->sin6_addr;
-   if (!IN6_IS_ADDR_LINKLOCAL(inp6) &&
-   !IN6_IS_ADDR_LOOPBACK(inp6))
+   ia6 = &((struct sockaddr_in6 *)sin)->sin6_addr;
+   if (!IN6_IS_ADDR_LINKLOCAL(ia6) &&
+   !IN6_IS_ADDR_LOOPBACK(ia6))
break;
}
 #endif

Modified: stable/12/sys/netinet/sctp_asconf.c
==
--- stable/12/sys/netinet/sctp_asconf.c Tue Dec 17 23:45:50 2019
(r355869)
+++ stable/12/sys/netinet/sctp_asconf.c Wed Dec 18 00:12:30 2019
(r355870)
@@ -1979,12 +1979,10 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sc
case AF_INET:
{
struct sockaddr_in *sin;
-   struct in6pcb *inp6;
 
-   inp6 = (struct in6pcb *)>ip_inp.inp;
/* invalid if we are a v6 only endpoint */
if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-   SCTP_IPV6_V6ONLY(inp6))
+   SCTP_IPV6_V6ONLY(>ip_inp.inp))
return;
 
sin = >address.sin;
@@ -2057,11 +2055,9 @@ sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *
case AF_INET:
{
/* invalid if we are a v6 only endpoint */
-   struct in6pcb *inp6;
 
-   inp6 = (struct in6pcb *)>ip_inp.inp;
if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) 
&&
-

svn commit: r355868 - stable/12/usr.bin/netstat

2019-12-17 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Dec 17 23:45:34 2019
New Revision: 355868
URL: https://svnweb.freebsd.org/changeset/base/355868

Log:
  MFC r350522:
  
IPv6 cleanup: netstat
  
Rename the variable for the in6_addr from in6p to ia6 to follow the
convention generally used in FreeBSD.
  
No functional changes.
  
Sponsored by:   Netflix

Modified:
  stable/12/usr.bin/netstat/inet6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/netstat/inet6.c
==
--- stable/12/usr.bin/netstat/inet6.c   Tue Dec 17 23:01:37 2019
(r355867)
+++ stable/12/usr.bin/netstat/inet6.c   Tue Dec 17 23:45:34 2019
(r355868)
@@ -1308,7 +1308,7 @@ inet6print(const char *container, struct in6_addr *in6
  */
 
 char *
-inet6name(struct in6_addr *in6p)
+inet6name(struct in6_addr *ia6)
 {
struct sockaddr_in6 sin6;
char hbuf[NI_MAXHOST], *cp;
@@ -1317,7 +1317,7 @@ inet6name(struct in6_addr *in6p)
static int first = 1;
int flags, error;
 
-   if (IN6_IS_ADDR_UNSPECIFIED(in6p)) {
+   if (IN6_IS_ADDR_UNSPECIFIED(ia6)) {
strcpy(line, "*");
return (line);
}
@@ -1330,9 +1330,9 @@ inet6name(struct in6_addr *in6p)
domain[0] = 0;
}
memset(, 0, sizeof(sin6));
-   memcpy(_addr, in6p, sizeof(*in6p));
+   memcpy(_addr, ia6, sizeof(*ia6));
sin6.sin6_family = AF_INET6;
-   /* XXX: in6p.s6_addr[2] can contain scopeid. */
+   /* XXX: ia6.s6_addr[2] can contain scopeid. */
in6_fillscopeid();
flags = (numeric_addr) ? NI_NUMERICHOST : 0;
error = getnameinfo((struct sockaddr *), sizeof(sin6), hbuf,
___
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: r355869 - stable/11/usr.bin/netstat

2019-12-17 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Dec 17 23:45:50 2019
New Revision: 355869
URL: https://svnweb.freebsd.org/changeset/base/355869

Log:
  MFC r350522:
  
IPv6 cleanup: netstat
  
Rename the variable for the in6_addr from in6p to ia6 to follow the
convention generally used in FreeBSD.
  
No functional changes.
  
Sponsored by: Netflix

Modified:
  stable/11/usr.bin/netstat/inet6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/netstat/inet6.c
==
--- stable/11/usr.bin/netstat/inet6.c   Tue Dec 17 23:45:34 2019
(r355868)
+++ stable/11/usr.bin/netstat/inet6.c   Tue Dec 17 23:45:50 2019
(r355869)
@@ -1306,7 +1306,7 @@ inet6print(const char *container, struct in6_addr *in6
  */
 
 char *
-inet6name(struct in6_addr *in6p)
+inet6name(struct in6_addr *ia6)
 {
struct sockaddr_in6 sin6;
char hbuf[NI_MAXHOST], *cp;
@@ -1315,7 +1315,7 @@ inet6name(struct in6_addr *in6p)
static int first = 1;
int flags, error;
 
-   if (IN6_IS_ADDR_UNSPECIFIED(in6p)) {
+   if (IN6_IS_ADDR_UNSPECIFIED(ia6)) {
strcpy(line, "*");
return (line);
}
@@ -1328,9 +1328,9 @@ inet6name(struct in6_addr *in6p)
domain[0] = 0;
}
memset(, 0, sizeof(sin6));
-   memcpy(_addr, in6p, sizeof(*in6p));
+   memcpy(_addr, ia6, sizeof(*ia6));
sin6.sin6_family = AF_INET6;
-   /* XXX: in6p.s6_addr[2] can contain scopeid. */
+   /* XXX: ia6.s6_addr[2] can contain scopeid. */
in6_fillscopeid();
flags = (numeric_addr) ? NI_NUMERICHOST : 0;
error = getnameinfo((struct sockaddr *), sizeof(sin6), hbuf,
___
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: r355828 - head/sys/sys

2019-12-17 Thread Brooks Davis
On Tue, Dec 17, 2019 at 01:28:20PM -0500, Pedro Giffuni wrote:
> On 16/12/2019 23:42, Cy Schubert wrote:
> > In message <201912162355.xbgntuq6078...@repo.freebsd.org>, "Pedro F.
> > Giffuni" w
> > rites:
> >> Author: pfg
> >> Date: Mon Dec 16 23:55:30 2019
> >> New Revision: 355828
> >> URL: https://svnweb.freebsd.org/changeset/base/355828
> >>
> >> Log:
> >>Double the size of ARG_MAX on LP64 platforms.
> >>
> >>As modern software keeps growing in size, we get requests to update the
> >>value of ARG_MAX in order to link the resulting object files. Other OSs
> >>have much higher values but Increasiong ARG_MAX has a multiplied effect 
> >> on
> >>KVA, so just bumping this value is dangerous in some archs like ARM32 
> >> that
> >>can exhaust KVA rather easily.
> >>
> >>While it would be better to have a unique value for all archs, other OSs
> >>(Illumos in partidular) can have different ARG_MAX limits depending on 
> >> the
> >>platform,  For now we want to be really conservative so we are avoidng
> >>the change on ILP32 and in the alternative case we only double it since 
> >> tha
> >> t
> >>seems to work well enough for recent Code Aster.
> >>
> >>I was planning to bump the _FreeBSD_version but it was bumped recently
> >>(r355798) so we can reuse the 1300068 value for this change.
> > This doesn't seem right. Each bump should be for a distinct change and
> > documented as such.
> 
> TBH, it is just not worth it: this change will currently benefit only 
> one port (french/aster) and the update won't be committed until after 
> the MFC is done.

An MFC is a quite long-term solution.  If merged to 11 and 12 then any
workarounds can't be removed until 11.3 and 12.1 are EOL since we'll be
building packages there until that point.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r355867 - in head/sys: arm/broadcom/bcm2835 arm/conf conf

2019-12-17 Thread Kyle Evans
Author: kevans
Date: Tue Dec 17 23:01:37 2019
New Revision: 355867
URL: https://svnweb.freebsd.org/changeset/base/355867

Log:
  arm: add SOC_BRCM_BCM2837 option, include it in GENERIC
  
  We use armv7/GENERIC for the RPI2 images. The original RPI2 is actually a
  32-bit BCM2836, but v1.2 was upgraded to the 64-bit BCM2837. The project
  continues to provide the RPI2 image as armv7, as it's the lowest common
  denominator of the two. Historically, we've just kind of implicitly
  acknowledged this by including some bcm2837 bits on a SOC_BCM2836 kernel
  config -- this worked until r354875 added code that actually cared.
  
  Acknowledge formally that BCM2837 is valid in arm32.
  
  This name is inconsistent with the other BCM* SOC on !arm64 for two reasons:
  
  1. It's a pre-existing option on arm64, and
  2. the naming convention on arm/ should've arguably changed to include BRCM
  
  #1 seems to be a convincing enough argument to maintain the existing name
  for it.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/conf/GENERIC
  head/sys/conf/options.arm

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Tue Dec 17 22:58:07 
2019(r355866)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Tue Dec 17 23:01:37 
2019(r355867)
@@ -139,7 +139,7 @@ FDT_PLATFORM_DEF2(bcm2835, bcm2835_legacy, "bcm2835 (l
 FDT_PLATFORM_DEF2(bcm2835, bcm2835, "bcm2835", 0, "brcm,bcm2835", 100);
 #endif
 
-#ifdef SOC_BCM2836
+#if defined(SOC_BCM2836) || defined(SOC_BRCM_BCM2837)
 static platform_method_t bcm2836_methods[] = {
PLATFORMMETHOD(platform_devmap_init,bcm2836_devmap_init),
PLATFORMMETHOD(platform_late_init,  bcm2835_late_init),
@@ -155,4 +155,4 @@ static platform_method_t bcm2836_methods[] = {
 FDT_PLATFORM_DEF2(bcm2836, bcm2836_legacy, "bcm2836 (legacy)", 0, 
"brcm,bcm2709", 100);
 FDT_PLATFORM_DEF2(bcm2836, bcm2836, "bcm2836", 0, "brcm,bcm2836", 100);
 FDT_PLATFORM_DEF2(bcm2836, bcm2837, "bcm2837", 0, "brcm,bcm2837", 100);
-#endif
+#endif /* defined(SOC_BCM2836) || defined(SOC_BRCM_BCM2837) */

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Tue Dec 17 22:58:07 2019(r355866)
+++ head/sys/arm/conf/GENERIC   Tue Dec 17 23:01:37 2019(r355867)
@@ -57,6 +57,7 @@ options   SOC_ALLWINNER_A83T
 optionsSOC_ALLWINNER_H2PLUS
 optionsSOC_ALLWINNER_H3
 optionsSOC_BCM2836
+optionsSOC_BRCM_BCM2837
 optionsSOC_MV_ARMADA38X
 optionsSOC_MV_ARMADAXP
 optionsSOC_TI_AM335X

Modified: head/sys/conf/options.arm
==
--- head/sys/conf/options.arm   Tue Dec 17 22:58:07 2019(r355866)
+++ head/sys/conf/options.arm   Tue Dec 17 23:01:37 2019(r355867)
@@ -47,6 +47,7 @@ SOC_ALTERA_ARRIA10opt_global.h
 SOC_ALTERA_CYCLONE5opt_global.h
 SOC_BCM2835opt_global.h
 SOC_BCM2836opt_global.h
+SOC_BRCM_BCM2837   opt_global.h
 SOC_IMX51  opt_global.h
 SOC_IMX53  opt_global.h
 SOC_IMX6   opt_global.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355866 - in head/share/man: man4 man9

2019-12-17 Thread John Baldwin
Author: jhb
Date: Tue Dec 17 22:58:07 2019
New Revision: 355866
URL: https://svnweb.freebsd.org/changeset/base/355866

Log:
  Update the crypto(4) and crypto(9) manpages.
  
  There are probably bits that are still wrong, but this fixes some
  things at least:
  - Add named arguments to the functions in crypto(9).
  - Add missing algorithms.
  - Don't mention arguments that don't exist in crypto_register.
  - Add CIOGSESSION2.
  - Remove CIOCNFSESSION.
  - Clarify some stale language that assumed an fd had only one sesson.
  - Note that you have to use CRIOGET and add a note in BUGS lamenting
that one has to use CRIOGET.
  - Various other cleanups.
  
  Reviewed by:  cem (earlier version)
  MFC after:2 weeks
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D22784

Modified:
  head/share/man/man4/crypto.4
  head/share/man/man9/crypto.9

Modified: head/share/man/man4/crypto.4
==
--- head/share/man/man4/crypto.4Tue Dec 17 21:53:22 2019
(r355865)
+++ head/share/man/man4/crypto.4Tue Dec 17 22:58:07 2019
(r355866)
@@ -78,7 +78,7 @@
 The
 .Nm
 driver gives user-mode applications access to hardware-accelerated
-cryptographic transforms, as implemented by the
+cryptographic transforms as implemented by the
 .Xr crypto 9
 in-kernel interface.
 .Pp
@@ -87,15 +87,15 @@ The
 special device provides an
 .Xr ioctl 2
 based interface.
-User-mode applications should open the special device,
+User-mode applications open the special device and
 then issue
 .Xr ioctl 2
 calls on the descriptor.
 User-mode access to
 .Pa /dev/crypto
-is controlled by three
+is controlled by two
 .Xr sysctl 8
-variables,
+variables:
 .Ic kern.userasymcrypto
 and
 .Ic kern.cryptodevallowsoft .
@@ -103,8 +103,8 @@ and
 The
 .Nm
 device provides two distinct modes of operation: one mode for
-symmetric-keyed cryptographic requests, and a second mode for
-both asymmetric-key (public-key/private-key) requests, and for
+symmetric-keyed cryptographic requests and digests, and a second mode for
+both asymmetric-key (public-key/private-key) requests and
 modular arithmetic (for Diffie-Hellman key exchange and other
 cryptographic protocols).
 The two modes are described separately below.
@@ -113,12 +113,22 @@ Regardless of whether symmetric-key or asymmetric-key 
 to be performed, use of the device requires a basic series of steps:
 .Bl -enum
 .It
-Open a file descriptor for the device.
-See
-.Xr open 2 .
+Open the
+.Pa /dev/crypto
+device.
 .It
-If any symmetric operation will be performed,
-create one session, with
+Create a new cryptography file descriptor via
+.Dv CRIOGET
+to use for all subsequent
+.Xr ioctl 2
+commands.
+.It
+Close the
+.Pa /dev/crypto
+device.
+.It
+If any symmetric-keyed cryptographic or digest operations will be performed,
+create a session with
 .Dv CIOCGSESSION .
 Most applications will require at least one symmetric session.
 Since cipher and MAC keys are tied to sessions, many
@@ -134,11 +144,13 @@ or
 .Dv CIOCKEY
 (asymmetric).
 .It
-Destroy one session with
+Optionally destroy a session with
 .Dv CIOCFSESSION .
 .It
-Close the device with
+Close the cryptography file descriptor with
 .Xr close 2 .
+This will automatically close any remaining sessions associated with the
+file desriptor.
 .El
 .Sh SYMMETRIC-KEY OPERATION
 The symmetric-key operation mode provides a context-based API
@@ -196,9 +208,9 @@ struct session_op {
 u_int32_t mac; /* e.g. CRYPTO_MD5_HMAC */
 
 u_int32_t keylen;  /* cipher key */
-void * key;
+const void *key;
 int mackeylen; /* mac key */
-void * mackey;
+const void *mackey;
 
 u_int32_t ses; /* returns: ses # */
 };
@@ -241,12 +253,36 @@ and the key value in the octets addressed by
 .Fa sessp-\*[Gt]mackeylen .
 .\"
 .Pp
-Support for a specific combination of fused privacy  and
+Support for a specific combination of fused privacy and
 integrity-check algorithms depends on whether the underlying
 hardware supports that combination.
 Not all combinations are supported
 by all hardware, even if the hardware supports each operation as a
 stand-alone non-fused operation.
+.It Dv CIOCGSESSION2 Fa struct session2_op *sessp
+.Bd -literal
+struct session2_op {
+u_int32_t cipher;  /* e.g. CRYPTO_DES_CBC */
+u_int32_t mac; /* e.g. CRYPTO_MD5_HMAC */
+
+u_int32_t keylen;  /* cipher key */
+const void *key;
+int mackeylen; /* mac key */
+const void *mackey;
+
+u_int32_t ses; /* returns: ses # */
+intcrid;   /* driver id + flags (rw) */
+intpad[4]; /* for future expansion */
+};
+
+.Ed
+This request is similar to CIOGSESSION except that
+.Fa sessp-\*[Gt]crid
+requests either a specific crypto device or a class of devices (software vs
+hardware).
+The
+.Fa sessp-\*[Gt]pad
+field must be initialized to zero.
 .It Dv CIOCCRYPT Fa 

svn commit: r355865 - head/sys/cam

2019-12-17 Thread Warner Losh
Author: imp
Date: Tue Dec 17 21:53:22 2019
New Revision: 355865
URL: https://svnweb.freebsd.org/changeset/base/355865

Log:
  Revert r355833
  
  While it works on nda, it fails on ada and/or da for at least zfs with a 
modify
  after free issue on a trim BIO. Revert while I rework it to fix those devices.

Modified:
  head/sys/cam/cam_iosched.c

Modified: head/sys/cam/cam_iosched.c
==
--- head/sys/cam/cam_iosched.c  Tue Dec 17 21:34:38 2019(r355864)
+++ head/sys/cam/cam_iosched.c  Tue Dec 17 21:53:22 2019(r355865)
@@ -281,8 +281,6 @@ struct cam_iosched_softc {
int trim_ticks; /* Max ticks to hold trims */
int last_trim_tick; /* Last 'tick' time ld a trim */
int queued_trims;   /* Number of trims in the queue 
*/
-   int max_trims;  /* Maximum number of trims 
pending at once */
-   int pend_trims; /* Number of pending trims now 
*/
 #ifdef CAM_IOSCHED_DYNAMIC
int read_bias;  /* Read bias setting */
int current_read_bias;  /* Current read bias state */
@@ -709,6 +707,11 @@ cam_iosched_cl_maybe_steer(struct control_loop *clp)
 }
 #endif
 
+/*
+ * Trim or similar currently pending completion. Should only be set for
+ * those drivers wishing only one Trim active at a time.
+ */
+#define CAM_IOSCHED_FLAG_TRIM_ACTIVE   (1ul << 0)
/* Callout active, and needs to be torn down */
 #define CAM_IOSCHED_FLAG_CALLOUT_ACTIVE (1ul << 1)
 
@@ -781,7 +784,8 @@ cam_iosched_has_more_trim(struct cam_iosched_softc *is
return false;
}
 
-   return isc->pend_trims <= isc->max_trims && bp != NULL;
+   /* NB: Should perhaps have a max trim active independent of I/O 
limiters */
+   return !(isc->flags & CAM_IOSCHED_FLAG_TRIM_ACTIVE) && bp != NULL;
 }
 
 #define cam_iosched_sort_queue(isc)((isc)->sort_io_queue >= 0 ?\
@@ -1105,7 +1109,6 @@ cam_iosched_init(struct cam_iosched_softc **iscp, stru
(*iscp)->sort_io_queue = -1;
bioq_init(&(*iscp)->bio_queue);
bioq_init(&(*iscp)->trim_queue);
-   (*iscp)->max_trims = 1;
 #ifdef CAM_IOSCHED_DYNAMIC
if (do_dynamic_iosched) {
bioq_init(&(*iscp)->write_queue);
@@ -1641,7 +1644,7 @@ void
 cam_iosched_trim_done(struct cam_iosched_softc *isc)
 {
 
-   isc->pend_trims--;
+   isc->flags &= ~CAM_IOSCHED_FLAG_TRIM_ACTIVE;
 }
 
 /*
@@ -1709,7 +1712,7 @@ void
 cam_iosched_submit_trim(struct cam_iosched_softc *isc)
 {
 
-   isc->pend_trims++;
+   isc->flags |= CAM_IOSCHED_FLAG_TRIM_ACTIVE;
 }
 
 /*
@@ -1954,8 +1957,8 @@ DB_SHOW_COMMAND(iosched, cam_iosched_db_show)
db_printf("Trim Q len %d\n", biolen(>trim_queue));
db_printf("read_bias: %d\n", isc->read_bias);
db_printf("current_read_bias: %d\n", isc->current_read_bias);
-   db_printf("Trims active   %d\n", isc->pend_trims);
-   db_printf("Max trims active   %d\n", isc->max_trims);
+   db_printf("Trim active?   %s\n",
+   (isc->flags & CAM_IOSCHED_FLAG_TRIM_ACTIVE) ? "yes" : "no");
 }
 #endif
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355864 - head/sys/dev/an

2019-12-17 Thread Mark Johnston
Author: markj
Date: Tue Dec 17 21:34:38 2019
New Revision: 355864
URL: https://svnweb.freebsd.org/changeset/base/355864

Log:
  an(4): Require privileges for all SIOCGAIRONET requests.
  
  SIOCGAIRONET allows userspace to query an(4) for various device
  properties and configuration, which appears to potentially include
  sensitive information such as WEP keys (an(4) seems to predate WPA).
  
  Also avoid races by copying in the request structure to a temporary
  buffer before locking and modifying the device softc.
  
  Reported by:  Ilja Van Sprundel 
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/an/if_an.c

Modified: head/sys/dev/an/if_an.c
==
--- head/sys/dev/an/if_an.c Tue Dec 17 20:30:32 2019(r355863)
+++ head/sys/dev/an/if_an.c Tue Dec 17 21:34:38 2019(r355864)
@@ -1875,6 +1875,7 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
int len;
int i, max;
struct an_softc *sc;
+   struct an_req   *areq;
struct ifreq*ifr;
struct thread   *td = curthread;
struct ieee80211req *ireq;
@@ -1934,17 +1935,21 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
error = 0;
break;
case SIOCGAIRONET:
-   error = copyin(ifr_data_get_ptr(ifr), >areq,
-   sizeof(sc->areq));
-   if (error != 0)
+   error = priv_check(td, PRIV_DRIVER);
+   if (error)
break;
+   areq = malloc(sizeof(*areq), M_TEMP, M_WAITOK);
+   error = copyin(ifr_data_get_ptr(ifr), areq, sizeof(*areq));
+   if (error != 0) {
+   free(areq, M_TEMP);
+   break;
+   }
AN_LOCK(sc);
+   memcpy(>areq, areq, sizeof(sc->areq));
 #ifdef ANCACHE
if (sc->areq.an_type == AN_RID_ZERO_CACHE) {
-   error = priv_check(td, PRIV_DRIVER);
-   if (error)
-   break;
sc->an_sigitems = sc->an_nextitem = 0;
+   free(areq, M_TEMP);
break;
} else if (sc->areq.an_type == AN_RID_READ_CACHE) {
char *pt = (char *)>areq.an_val;
@@ -1960,12 +1965,14 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t da
 #endif
if (an_read_record(sc, (struct an_ltv_gen *)>areq)) {
AN_UNLOCK(sc);
+   free(areq, M_TEMP);
error = EINVAL;
break;
}
+   memcpy(areq, >areq, sizeof(*areq));
AN_UNLOCK(sc);
-   error = copyout(>areq, ifr_data_get_ptr(ifr),
-   sizeof(sc->areq));
+   error = copyout(areq, ifr_data_get_ptr(ifr), sizeof(*areq));
+   free(areq, M_TEMP);
break;
case SIOCSAIRONET:
if ((error = priv_check(td, PRIV_DRIVER)))
___
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: r355863 - stable/11/sys/cam/scsi

2019-12-17 Thread Kenneth D. Merry
Author: ken
Date: Tue Dec 17 20:30:32 2019
New Revision: 355863
URL: https://svnweb.freebsd.org/changeset/base/355863

Log:
  MFC r355299:
  

r355299 | ken | 2019-12-02 14:57:39 -0500 (Mon, 02 Dec 2019) | 52 lines
  
Fix a hang introduced in r351599.
  
My changes in 351599 (kindly committed by avg) made the cd(4) media check
asynchronous to avoid a sleep while holding a mutex.
  
There was a difficult to reproduce bug with those changes that caused a
hang on boot on some single processor machines/VMs.  Leandro Lupori
managed to reproduce the bug, diagnose it, and supplied a patch!  Here is
his analysis, from the PR:
  
==
I was able to reproduce the problem described in comment#14.
  
Actually, I wasn't trying to reproduce it, I just started seeing it a few
weeks ago, in CURRENT.
  
I can reproduce it consistently, by using QEMU to run a PowerPC64 VM with a
single core/thread (-smp 1).
  
It happens only when there is no media in the emulated CD-ROM, a device
that QEMU adds by default, unless -nodefaults is specified in command line.
  
I've debugged it and this is what I've found:
  
1- After the CD probe is successful, GEOM will try to open the device,
which will end up calling cdcheckmedia(), that sets CD state to
CD_STATE_MEDIA_PREVENT.
2- Next, scsi_prevent() is executed and succeeds, the CD_FLAG_DISC_LOCKED
flag is set and CD state moves to CD_STATE_MEDIA_SIZE.
3- Next, scsi_read_capacity() is executed and fails, state is set to
CD_STATE_MEDIA_ALLOW, cdmediaprobedone() is called and wakes up
cdcheckmedia().
4- Then, when cdstart() is invoked to process CD_STATE_MEDIA_ALLOW, it
first checks if CD_FLAG_DISC_LOCKED is set, and if so skips directly to
CD_STATE_MEDIA_SIZE state. This will repeat the steps of bullet 3, entering
an infinite MEDIA_SIZE command loop.
  
When there is a least another core/thread, the GEOM thread that performed
the initial cdopen() will get scheduled again, closing the CD device, that
will call cdprevent(PR_ALLOW) that clears the CD_FLAG_DISC_LOCKED flag and
breaks the loop.
  
So, apparently, the problem is CD_STATE_MEDIA_ALLOW being skipped when
CD_FLAG_DISC_LOCKED is set. If I understand correctly, in this case, the
state should be advanced to CD_STATE_MEDIA size only when the current state
is CD_STATE_MEDIA_PREVENT.
=

  
  PR:   kern/219857
  Submitted by: Leandro Lupori 

Modified:
  stable/11/sys/cam/scsi/scsi_cd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_cd.c
==
--- stable/11/sys/cam/scsi/scsi_cd.cTue Dec 17 20:29:47 2019
(r355862)
+++ stable/11/sys/cam/scsi/scsi_cd.cTue Dec 17 20:30:32 2019
(r355863)
@@ -1009,7 +1009,8 @@ cdstart(struct cam_periph *periph, union ccb *start_cc
 * If the CD is already locked, we don't need to do this.
 * Move on to the capacity check.
 */
-   if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
+   if (softc->state == CD_STATE_MEDIA_PREVENT
+&& (softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
softc->state = CD_STATE_MEDIA_SIZE;
xpt_release_ccb(start_ccb);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
___
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: r355862 - stable/12/sys/cam/scsi

2019-12-17 Thread Kenneth D. Merry
Author: ken
Date: Tue Dec 17 20:29:47 2019
New Revision: 355862
URL: https://svnweb.freebsd.org/changeset/base/355862

Log:
  MFC r355299:
  

r355299 | ken | 2019-12-02 14:57:39 -0500 (Mon, 02 Dec 2019) | 52 lines
  
Fix a hang introduced in r351599.
  
My changes in 351599 (kindly committed by avg) made the cd(4) media check
asynchronous to avoid a sleep while holding a mutex.
  
There was a difficult to reproduce bug with those changes that caused a
hang on boot on some single processor machines/VMs.  Leandro Lupori
managed to reproduce the bug, diagnose it, and supplied a patch!  Here is
his analysis, from the PR:
  
==
I was able to reproduce the problem described in comment#14.
  
Actually, I wasn't trying to reproduce it, I just started seeing it a few
weeks ago, in CURRENT.
  
I can reproduce it consistently, by using QEMU to run a PowerPC64 VM with a
single core/thread (-smp 1).
  
It happens only when there is no media in the emulated CD-ROM, a device
that QEMU adds by default, unless -nodefaults is specified in command line.
  
I've debugged it and this is what I've found:
  
1- After the CD probe is successful, GEOM will try to open the device,
which will end up calling cdcheckmedia(), that sets CD state to
CD_STATE_MEDIA_PREVENT.
2- Next, scsi_prevent() is executed and succeeds, the CD_FLAG_DISC_LOCKED
flag is set and CD state moves to CD_STATE_MEDIA_SIZE.
3- Next, scsi_read_capacity() is executed and fails, state is set to
CD_STATE_MEDIA_ALLOW, cdmediaprobedone() is called and wakes up
cdcheckmedia().
4- Then, when cdstart() is invoked to process CD_STATE_MEDIA_ALLOW, it
first checks if CD_FLAG_DISC_LOCKED is set, and if so skips directly to
CD_STATE_MEDIA_SIZE state. This will repeat the steps of bullet 3, entering
an infinite MEDIA_SIZE command loop.
  
When there is a least another core/thread, the GEOM thread that performed
the initial cdopen() will get scheduled again, closing the CD device, that
will call cdprevent(PR_ALLOW) that clears the CD_FLAG_DISC_LOCKED flag and
breaks the loop.
  
So, apparently, the problem is CD_STATE_MEDIA_ALLOW being skipped when
CD_FLAG_DISC_LOCKED is set. If I understand correctly, in this case, the
state should be advanced to CD_STATE_MEDIA size only when the current state
is CD_STATE_MEDIA_PREVENT.
=

  
  PR:   kern/219857
  Submitted by: Leandro Lupori 

Modified:
  stable/12/sys/cam/scsi/scsi_cd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_cd.c
==
--- stable/12/sys/cam/scsi/scsi_cd.cTue Dec 17 19:01:09 2019
(r355861)
+++ stable/12/sys/cam/scsi/scsi_cd.cTue Dec 17 20:29:47 2019
(r355862)
@@ -1030,7 +1030,8 @@ cdstart(struct cam_periph *periph, union ccb *start_cc
 * If the CD is already locked, we don't need to do this.
 * Move on to the capacity check.
 */
-   if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
+   if (softc->state == CD_STATE_MEDIA_PREVENT
+&& (softc->flags & CD_FLAG_DISC_LOCKED) != 0) {
softc->state = CD_STATE_MEDIA_SIZE;
xpt_release_ccb(start_ccb);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
___
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: r355861 - head/tests/sys/geom/class/multipath

2019-12-17 Thread Li-Wen Hsu
Author: lwhsu
Date: Tue Dec 17 19:01:09 2019
New Revision: 355861
URL: https://svnweb.freebsd.org/changeset/base/355861

Log:
  Temporarily skip failing sys.geom.class.multipath.failloop.failloop on i386 CI
  
  PR:   242689
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/geom/class/multipath/failloop.sh

Modified: head/tests/sys/geom/class/multipath/failloop.sh
==
--- head/tests/sys/geom/class/multipath/failloop.sh Tue Dec 17 17:03:03 
2019(r355860)
+++ head/tests/sys/geom/class/multipath/failloop.sh Tue Dec 17 19:01:09 
2019(r355861)
@@ -36,6 +36,11 @@ failloop_head()
 }
 failloop_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ] && \
+   [ "$(uname -p)" = "i386" ]; then
+   atf_skip "https://bugs.freebsd.org/242689;
+   fi
+
sysctl -n kern.geom.notaste > kern.geom.notaste.txt
load_gnop
load_gmultipath
___
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: r355828 - head/sys/sys

2019-12-17 Thread Pedro Giffuni

On 16/12/2019 23:42, Cy Schubert wrote:

In message <201912162355.xbgntuq6078...@repo.freebsd.org>, "Pedro F.
Giffuni" w
rites:

Author: pfg
Date: Mon Dec 16 23:55:30 2019
New Revision: 355828
URL: https://svnweb.freebsd.org/changeset/base/355828

Log:
   Double the size of ARG_MAX on LP64 platforms.
   
   As modern software keeps growing in size, we get requests to update the

   value of ARG_MAX in order to link the resulting object files. Other OSs
   have much higher values but Increasiong ARG_MAX has a multiplied effect on
   KVA, so just bumping this value is dangerous in some archs like ARM32 that
   can exhaust KVA rather easily.
   
   While it would be better to have a unique value for all archs, other OSs

   (Illumos in partidular) can have different ARG_MAX limits depending on the
   platform,  For now we want to be really conservative so we are avoidng
   the change on ILP32 and in the alternative case we only double it since tha
t
   seems to work well enough for recent Code Aster.
   
   I was planning to bump the _FreeBSD_version but it was bumped recently

   (r355798) so we can reuse the 1300068 value for this change.

This doesn't seem right. Each bump should be for a distinct change and
documented as such.


TBH, it is just not worth it: this change will currently benefit only 
one port (french/aster) and the update won't be committed until after 
the MFC is done.


It is rather more painful that the change only fixes the case for some 
platforms.


Pedro.


Also, it's not like we're saving any build time anyway. sys/syslimits.h
will cause a substantial portion to be rebuilt anyway.

   
   PR:		241710

   MFC after:   5 days

Modified:
   head/sys/sys/syslimits.h

Modified: head/sys/sys/syslimits.h
=
=
--- head/sys/sys/syslimits.hMon Dec 16 23:08:09 2019(r355827)
+++ head/sys/sys/syslimits.hMon Dec 16 23:55:30 2019(r355828)
@@ -48,7 +48,11 @@
   * Do not add any new variables here.  (See the comment at the end of
   * the file for why.)
   */
-#defineARG_MAX 262144  /* max bytes for an exec functi
on */
+#ifndef __ILP32__
+#defineARG_MAX   (2 * 256 * 1024)  /* max bytes for an exec functi
on */
+#else
+#defineARG_MAX   (256 * 1024)  /* max bytes for KVA-starved ar
chs */
+#endif
  #ifndef CHILD_MAX
  #define   CHILD_MAX  40   /* max simultaneous processes *
/
  #endif




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


Re: svn commit: r355818 - in head: share/man/man4 sys/amd64/linux sys/amd64/linux32 sys/arm64/linux sys/compat/linux sys/i386/linux

2019-12-17 Thread Edward Napierala
On Mon, 16 Dec 2019 at 20:59, Enji Cooper  wrote:
>
>
> > On Dec 16, 2019, at 12:07, Edward Tomasz Napierala  
> > wrote:
> >
> > Author: trasz
> > Date: Mon Dec 16 20:07:04 2019
> > New Revision: 355818
> > URL: https://svnweb.freebsd.org/changeset/base/355818
> >
> > Log:
> >  Add compat.linux.emul_path, so it can be set to something other
> >  than "/compat/linux".  Useful when you have several compat directories
> >  with different Linux versions and you don't want to clash with files
> >  installed by linux-c7 packages.
>
> Hi Edward!
> Great feature :).. i was wondering if it made sense to implement this 
> sysctl as a per-jail setting so one jail could have one setting and another 
> have another setting? Arguably, one could just leave the default, but it’s a 
> just thought I had when reading your commit message.

Thanks!  Yes, eventually this could be turned into a per-jail
parameter.  In most cases it just doesn't matter within a jail, though
- for Linux jails you probably want to have a usual Linux root
filesystem, without /compat/linux; thus, linuxulator path translation
will be a nop.
___
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: r341578 - head/sys/dev/mlx5/mlx5_en

2019-12-17 Thread Andrey V. Elsukov
On 13.12.2019 17:27, Hans Petter Selasky wrote:
> On 2019-12-13 14:40, Andrey V. Elsukov wrote:
>> On 05.12.2018 17:20, Slava Shwartsman wrote:
>>> Author: slavash
>>> Date: Wed Dec  5 14:20:57 2018
>>> New Revision: 341578
>>> URL: https://svnweb.freebsd.org/changeset/base/341578
>>>
>>> Log:
>>>    mlx5en: Remove the DRBR and associated logic in the transmit path.
>>>       The hardware queues are deep enough currently and using the
>>> DRBR and associated
>>>    callbacks only leads to more task switching in the TX path. The is
>>> also a race
>>>    setting the queue_state which can lead to hung TX rings.
>>
>> JFYI. We have compared the same router+firewall workloads on the host
>> with this change and before, and I can say, that without DRBR on TX now
>> we constantly have several percents of packets drops due to ENOBUFS
>> error from mlx5e_xmit().
>>
> 
> Have you tried to tune the TX/RX parameters?
> 
> Especially the tx_queue_size .

We use the following settings:
% sysctl dev.mce.4.conf. | grep que
dev.mce.4.conf.rx_queue_size: 16384
dev.mce.4.conf.tx_queue_size: 16384
dev.mce.4.conf.rx_queue_size_max: 16384
dev.mce.4.conf.tx_queue_size_max: 16384

Also, previously I have patched MLX5E_SQ_TX_QUEUE_SIZE value up to 16384.

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


svn commit: r355860 - in head/sys: arm/freescale/imx arm64/rockchip

2019-12-17 Thread Ian Lepore
Author: ian
Date: Tue Dec 17 17:03:03 2019
New Revision: 355860
URL: https://svnweb.freebsd.org/changeset/base/355860

Log:
  Remove unnecessary MODULE_DEPEND() from imx_i2c.c, and also from rk_i2c
  where it got copied to.

Modified:
  head/sys/arm/freescale/imx/imx_i2c.c
  head/sys/arm64/rockchip/rk_i2c.c

Modified: head/sys/arm/freescale/imx/imx_i2c.c
==
--- head/sys/arm/freescale/imx/imx_i2c.cTue Dec 17 16:08:07 2019
(r355859)
+++ head/sys/arm/freescale/imx/imx_i2c.cTue Dec 17 17:03:03 2019
(r355860)
@@ -193,7 +193,6 @@ static devclass_t  i2c_devclass;
 DRIVER_MODULE(imx_i2c, simplebus, i2c_driver, i2c_devclass, 0, 0);
 DRIVER_MODULE(ofw_iicbus, imx_i2c, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 
0);
 MODULE_DEPEND(imx_i2c, iicbus, 1, 1, 1);
-MODULE_DEPEND(imx_i2c, ofw_iicbus, 1, 1, 1);
 SIMPLEBUS_PNP_INFO(compat_data);
 
 static phandle_t

Modified: head/sys/arm64/rockchip/rk_i2c.c
==
--- head/sys/arm64/rockchip/rk_i2c.cTue Dec 17 16:08:07 2019
(r355859)
+++ head/sys/arm64/rockchip/rk_i2c.cTue Dec 17 17:03:03 2019
(r355860)
@@ -699,5 +699,4 @@ EARLY_DRIVER_MODULE(rk_i2c, simplebus, rk_i2c_driver, 
 EARLY_DRIVER_MODULE(ofw_iicbus, rk_i2c, ofw_iicbus_driver, ofw_iicbus_devclass,
 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
 MODULE_DEPEND(rk_i2c, iicbus, 1, 1, 1);
-MODULE_DEPEND(rk_i2c, ofw_iicbus, 1, 1, 1);
 MODULE_VERSION(rk_i2c, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r355859 - in head/sys/netinet: . tcp_stacks

2019-12-17 Thread Randall Stewart
Author: rrs
Date: Tue Dec 17 16:08:07 2019
New Revision: 355859
URL: https://svnweb.freebsd.org/changeset/base/355859

Log:
  This commit is a bit of a re-arrange of deck chairs. It
  gets both rack and bbr ready for the completion of the STATs
  framework in FreeBSD. For now if you don't have both NF_stats and
  stats on it disables them. As soon as the rest of the stats framework
  lands we can remove that restriction and then just uses stats when
  defined.
  
  Sponsored by: Netflix Inc.
  Differential Revision:https://reviews.freebsd.org/D22479

Modified:
  head/sys/netinet/tcp_stacks/bbr.c
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_stacks/rack_bbr_common.c
  head/sys/netinet/tcp_stacks/rack_bbr_common.h
  head/sys/netinet/tcp_stacks/sack_filter.c
  head/sys/netinet/tcp_stacks/tcp_bbr.h
  head/sys/netinet/tcp_stacks/tcp_rack.h
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_stacks/bbr.c
==
--- head/sys/netinet/tcp_stacks/bbr.c   Tue Dec 17 15:56:48 2019
(r355858)
+++ head/sys/netinet/tcp_stacks/bbr.c   Tue Dec 17 16:08:07 2019
(r355859)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2016-2019
+ * Copyright (c) 2016-9
  * Netflix Inc.
  *  All rights reserved.
  *
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_ratelimit.h"
 #include "opt_kern_tls.h"
 #include 
+#include 
 #include 
 #include 
 #ifdef TCP_HHOOK
@@ -57,9 +58,9 @@ __FBSDID("$FreeBSD$");
 #endif
 #include 
 #include 
+#ifdef STATS
 #include 
 #include 
-#ifdef NETFLIX_STATS
 #include  /* Must come after qmath.h and tree.h */
 #endif
 #include 
@@ -161,9 +162,8 @@ static int32_t bbr_num_pktepo_for_del_limit = BBR_NUM_
 static int32_t bbr_hardware_pacing_limit = 8000;
 static int32_t bbr_quanta = 3; /* How much extra quanta do we get? */
 static int32_t bbr_no_retran = 0;
-static int32_t bbr_tcp_map_entries_limit = 1500;
-static int32_t bbr_tcp_map_split_limit = 256;
 
+
 static int32_t bbr_error_base_paceout = 1; /* usec to pace */
 static int32_t bbr_max_net_error_cnt = 10;
 /* Should the following be dynamic too -- loss wise */
@@ -3381,8 +3381,8 @@ bbr_alloc(struct tcp_bbr *bbr)
 static struct bbr_sendmap *
 bbr_alloc_full_limit(struct tcp_bbr *bbr)
 {
-   if ((bbr_tcp_map_entries_limit > 0) &&
-   (bbr->r_ctl.rc_num_maps_alloced >= bbr_tcp_map_entries_limit)) {
+   if ((V_tcp_map_entries_limit > 0) &&
+   (bbr->r_ctl.rc_num_maps_alloced >= V_tcp_map_entries_limit)) {
BBR_STAT_INC(bbr_alloc_limited);
if (!bbr->alloc_limit_reported) {
bbr->alloc_limit_reported = 1;
@@ -3402,8 +3402,8 @@ bbr_alloc_limit(struct tcp_bbr *bbr, uint8_t limit_typ
 
if (limit_type) {
/* currently there is only one limit type */
-   if (bbr_tcp_map_split_limit > 0 &&
-   bbr->r_ctl.rc_num_split_allocs >= bbr_tcp_map_split_limit) {
+   if (V_tcp_map_split_limit > 0 &&
+   bbr->r_ctl.rc_num_split_allocs >= V_tcp_map_split_limit) {
BBR_STAT_INC(bbr_split_limited);
if (!bbr->alloc_limit_reported) {
bbr->alloc_limit_reported = 1;
@@ -3685,7 +3685,7 @@ bbr_ack_received(struct tcpcb *tp, struct tcp_bbr *bbr
uint32_t cwnd, target_cwnd, saved_bytes, maxseg;
int32_t meth;
 
-#ifdef NETFLIX_STATS
+#ifdef STATS
if ((tp->t_flags & TF_GPUTINPROG) &&
SEQ_GEQ(th->th_ack, tp->gput_ack)) {
/*
@@ -6510,7 +6510,7 @@ tcp_bbr_xmit_timer_commit(struct tcp_bbr *bbr, struct 
}
TCPSTAT_INC(tcps_rttupdated);
tp->t_rttupdated++;
-#ifdef NETFLIX_STATS
+#ifdef STATS
stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RTT, imax(0, rtt_ticks));
 #endif
/*
@@ -8490,6 +8490,7 @@ dodata:   /* XXX */
return (0);
}
}
+
 #endif
if (DELAY_ACK(tp, bbr, nsegs) || tfo_syn) {
bbr->bbr_segs_rcvd += max(1, nsegs);
@@ -8698,6 +8699,7 @@ bbr_do_fastnewdata(struct mbuf *m, struct tcphdr *th, 
 * reassembly queue and we have enough buffer space to take it.
 */
nsegs = max(1, m->m_pkthdr.lro_nsegs);
+
 #ifdef NETFLIX_SB_LIMITS
if (so->so_rcv.sb_shlim) {
mcnt = m_memcnt(m);
@@ -8746,6 +8748,7 @@ bbr_do_fastnewdata(struct mbuf *m, struct tcphdr *th, 
newsize, so, NULL))
so->so_rcv.sb_flags &= ~SB_AUTOSIZE;
m_adj(m, drop_hdrlen);  /* delayed header drop */
+
 #ifdef NETFLIX_SB_LIMITS
appended =
 #endif
@@ -11561,7 +11564,7 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr 
 * the scale is zero.
  

svn commit: r355858 - head/sys/dev/ow

2019-12-17 Thread Ian Lepore
Author: ian
Date: Tue Dec 17 15:56:48 2019
New Revision: 355858
URL: https://svnweb.freebsd.org/changeset/base/355858

Log:
  Update owc_gpiobus (one-wire over gpio) to the modern gpio_pin interface.
  
  It used to be required that a device be a child of gpiobus(4) to manipulate
  gpio pins. That requirement didn't work well for FDT-based systems with many
  cross-hierarchy users of gpio, so a more modern framework was created that
  removed the old hierarchy requirement.
  
  These changes adapt the owc_gpiobus driver to use the newer gpio_pin_*
  functions to acquire, release, and manipulate gpio pins. This allows a
  single driver to work for both hinted-attachment and fdt-based systems, and
  removes the requirement that any one-wire fdt nodes must appear at the root
  of the devicetree.
  
  Differential Revision:https://reviews.freebsd.org/D22710

Modified:
  head/sys/dev/ow/owc_gpiobus.c

Modified: head/sys/dev/ow/owc_gpiobus.c
==
--- head/sys/dev/ow/owc_gpiobus.c   Tue Dec 17 15:03:51 2019
(r355857)
+++ head/sys/dev/ow/owc_gpiobus.c   Tue Dec 17 15:56:48 2019
(r355858)
@@ -38,17 +38,21 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+
 #ifdef FDT
-#include 
 #include 
 #include 
-#endif
 
-#include 
-#include "gpiobus_if.h"
+static struct ofw_compat_data compat_data[] = {
+   {"w1-gpio",  true},
+   {NULL,   false}
+};
+OFWBUS_PNP_INFO(compat_data);
+SIMPLEBUS_PNP_INFO(compat_data);
+#endif /* FDT */
 
-#include 
-
 #defineOW_PIN  0
 
 #define OWC_GPIOBUS_LOCK(_sc)  mtx_lock(&(_sc)->sc_mtx)
@@ -61,7 +65,7 @@ __FBSDID("$FreeBSD$");
 struct owc_gpiobus_softc 
 {
device_tsc_dev;
-   device_tsc_busdev;
+   gpio_pin_t  sc_pin;
struct mtx  sc_mtx;
 };
 
@@ -69,68 +73,69 @@ static int owc_gpiobus_probe(device_t);
 static int owc_gpiobus_attach(device_t);
 static int owc_gpiobus_detach(device_t);
 
-#ifdef FDT
-static void
-owc_gpiobus_identify(driver_t *driver, device_t bus)
+static int
+owc_gpiobus_probe(device_t dev)
 {
-   phandle_t w1, root;
+   int rv;
 
/*
-* Find all the 1-wire bus pseudo-nodes that are
-* at the top level of the FDT. Would be nice to
-* somehow preserve the node name of these busses,
-* but there's no good place to put it. The driver's
-* name is used for the device name, and the 1-wire
-* bus overwrites the description.
+* By default we only bid to attach if specifically added by our parent
+* (usually via hint.owc_gpiobus.#.at=busname).  On FDT systems we bid
+* as the default driver based on being configured in the FDT data.
 */
-   root = OF_finddevice("/");
-   if (root == -1)
-   return;
-   for (w1 = OF_child(root); w1 != 0; w1 = OF_peer(w1)) {
-   if (!fdt_is_compatible_strict(w1, "w1-gpio"))
-   continue;
-   if (!OF_hasprop(w1, "gpios"))
-   continue;
-   ofw_gpiobus_add_fdt_child(bus, driver->name, w1);
-   }
-}
-#endif
+   rv = BUS_PROBE_NOWILDCARD;
 
-static int
-owc_gpiobus_probe(device_t dev)
-{
 #ifdef FDT
-   if (!ofw_bus_status_okay(dev))
-   return (ENXIO);
+   if (ofw_bus_status_okay(dev) &&
+   ofw_bus_search_compatible(dev, compat_data)->ocd_data)
+   rv = BUS_PROBE_DEFAULT;
+#endif
 
-   if (ofw_bus_is_compatible(dev, "w1-gpio")) {
-   device_set_desc(dev, "FDT GPIO attached one-wire bus");
-   return (BUS_PROBE_DEFAULT);
-   }
+   device_set_desc(dev, "GPIO one-wire bus");
 
-   return (ENXIO);
-#else
-   device_set_desc(dev, "GPIO attached one-wire bus");
-   return 0;
-#endif
+   return (rv);
 }
 
 static int
 owc_gpiobus_attach(device_t dev)
 {
struct owc_gpiobus_softc *sc;
-   device_t *kids;
-   int nkid;
+   int err;
 
sc = device_get_softc(dev);
sc->sc_dev = dev;
-   sc->sc_busdev = device_get_parent(dev);
+
+#ifdef FDT
+   /* Try to configure our pin from fdt data on fdt-based systems. */
+   err = gpio_pin_get_by_ofw_idx(dev, ofw_bus_get_node(dev), OW_PIN,
+   >sc_pin);
+#else
+   err = ENOENT;
+#endif
+   /*
+* If we didn't get configured by fdt data and our parent is gpiobus,
+* see if we can be configured by the bus (allows hinted attachment even
+* on fdt-based systems).
+*/
+   if (err != 0 &&
+   strcmp("gpiobus", device_get_name(device_get_parent(dev))) == 0)
+   err = gpio_pin_get_by_child_index(dev, OW_PIN, >sc_pin);
+
+   /* If we didn't get configured by either method, whine and punt. */
+   if (err != 0) {
+   device_printf(sc->sc_dev,
+   "cannot acquire gpio pin (config 

Re: svn commit: r355585 - head/share/vt/keymaps

2019-12-17 Thread Ed Maste
On Tue, 10 Dec 2019 at 15:01, Stefan Eßer  wrote:
>
> I might restart that effort, if there is interest (important keymaps
> missing in FreeBSD, but available for Linux).

As someone who really only deals with US layout keyboards I don't have
a good handle on what might be missing. It would be good to get
feedback (beyond what's in PRs) about keymap issues.
___
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: r355857 - stable/11/share/vt/keymaps

2019-12-17 Thread Ed Maste
Author: emaste
Date: Tue Dec 17 15:03:51 2019
New Revision: 355857
URL: https://svnweb.freebsd.org/changeset/base/355857

Log:
  MFC r355575: Add missing language specifier for Hebrew il.kbd description
  
  PR:   235094 (related)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/share/vt/keymaps/INDEX.keymaps
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/vt/keymaps/INDEX.keymaps
==
--- stable/11/share/vt/keymaps/INDEX.keymapsTue Dec 17 15:02:29 2019
(r355856)
+++ stable/11/share/vt/keymaps/INDEX.keymapsTue Dec 17 15:03:51 2019
(r355857)
@@ -248,7 +248,7 @@ gr.101.acc.kbd:el:Ελληνικό (101 πλήκτρω
 il.kbd:en:Hebrew
 il.kbd:de:Hebräisch
 il.kbd:fr:Hébreu
-il.kbd::תירבע
+il.kbd:he:תירבע
 
 hr.kbd:en:Croatian
 hr.kbd:de:Kroatisch
___
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: r355856 - stable/12/share/vt/keymaps

2019-12-17 Thread Ed Maste
Author: emaste
Date: Tue Dec 17 15:02:29 2019
New Revision: 355856
URL: https://svnweb.freebsd.org/changeset/base/355856

Log:
  MFC r355575: Add missing language specifier for Hebrew il.kbd description
  
  PR:   235094 (related)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/share/vt/keymaps/INDEX.keymaps
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/vt/keymaps/INDEX.keymaps
==
--- stable/12/share/vt/keymaps/INDEX.keymapsTue Dec 17 14:53:55 2019
(r355855)
+++ stable/12/share/vt/keymaps/INDEX.keymapsTue Dec 17 15:02:29 2019
(r355856)
@@ -248,7 +248,7 @@ gr.101.acc.kbd:el:Ελληνικό (101 πλήκτρω
 il.kbd:en:Hebrew
 il.kbd:de:Hebräisch
 il.kbd:fr:Hébreu
-il.kbd::תירבע
+il.kbd:he:תירבע
 
 hr.kbd:en:Croatian
 hr.kbd:de:Kroatisch
___
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: r355855 - head/sys/sys

2019-12-17 Thread Mateusz Guzik
Author: mjg
Date: Tue Dec 17 14:53:55 2019
New Revision: 355855
URL: https://svnweb.freebsd.org/changeset/base/355855

Log:
  Convert zpcpu_* inlines to macros and add zpcpu_replace.
  
  This allows them to do basic type casting internally, effectively relieving
  consumers from having to cast on their own.

Modified:
  head/sys/sys/pcpu.h

Modified: head/sys/sys/pcpu.h
==
--- head/sys/sys/pcpu.h Tue Dec 17 11:03:32 2019(r355854)
+++ head/sys/sys/pcpu.h Tue Dec 17 14:53:55 2019(r355855)
@@ -228,28 +228,30 @@ extern struct pcpu *cpuid_to_pcpu[];
 #definecurproc (curthread->td_proc)
 
 /* Accessor to elements allocated via UMA_ZONE_PCPU zone. */
-static inline void *
-zpcpu_get(void *base)
-{
+#define zpcpu_get(base) ({ 
\
+   __typeof(base) _ptr = (void *)((char *)(base) + UMA_PCPU_ALLOC_SIZE * 
curcpu);  \
+   _ptr;   
\
+})
 
-   return ((char *)(base) + UMA_PCPU_ALLOC_SIZE * curcpu);
-}
+#define zpcpu_get_cpu(base, cpu) ({
\
+   __typeof(base) _ptr = (void *)((char *)(base) + UMA_PCPU_ALLOC_SIZE * 
cpu); \
+   _ptr;   
\
+})
 
-static inline void *
-zpcpu_get_cpu(void *base, int cpu)
-{
-
-   return ((char *)(base) + UMA_PCPU_ALLOC_SIZE * cpu);
-}
-
 /*
  * This operation is NOT atomic and does not post any barriers.
  * If you use this the assumption is that the target CPU will not
  * be modifying this variable.
  * If you need atomicity use xchg.
  * */
+#define zpcpu_replace(base, val) ({\
+   __typeof(val) _old = *(__typeof(base))zpcpu_get(base);  \
+   *(__typeof(val) *)zpcpu_get(base) = val;\
+   _old;   \
+})
+
 #define zpcpu_replace_cpu(base, val, cpu) ({   \
-   __typeof(val) _old = *(__typeof(val) *)zpcpu_get_cpu(base, cpu);\
+   __typeof(val) _old = *(__typeof(base))zpcpu_get_cpu(base, cpu); \
*(__typeof(val) *)zpcpu_get_cpu(base, cpu) = val;   \
_old;   \
 })
___
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: r355737 - head/share/man/man9

2019-12-17 Thread Warner Losh
On Tue, Dec 17, 2019 at 2:39 AM Rodney W. Grimes 
wrote:

> > On Sun, Dec 15, 2019, 11:51 AM Rodney W. Grimes <
> free...@gndrsh.dnsmgr.net>
> > wrote:
> >
> > > > Author: imp
> > > > Date: Fri Dec 13 22:32:05 2019
> > > > New Revision: 355737
> > > > URL: https://svnweb.freebsd.org/changeset/base/355737
> > > >
> > > > Log:
> > > >   Better copyright advice
> > > >
> > > >   Document the common practices around copyrights with "all rights
> > > reserved" in
> > > >   them as new copyright notices get added.
> > > >
> > > >   It's an open question qhether to point people at the fact that
> since
> > > the Berne
> > > >   convention was ratified, All rights reserved is largely obsolete.
> > > >   https://en.wikipedia.org/wiki/All_rights_reserved#Obsolescence
> has the
> > > >   details. The committer's guide will be revised shortly, and it's
> > > likely that's a
> > > >   better place for this discussion. If not, I'll add a blurb here.
> > > >
> > > >   Reviewed by: jhb@, brooks@
> > > >   Differential Review: https://reviews.freebsd.org/D22800
> > >
> > > I object to the a review that specifically invites people to it,
> > > is authored and committed in anything short of 24 hours and more
> > > reasonable to actually ALLOW people time to repond of 72 hours.
> > >
> >
> > The project has no fixed policies around reviews and giving time. Several
> > people did look at it and approve it before I committed it.
>
> Then I'll be blunt, if your going to manually add me to a review
> do not commit it until you have given me 72 hours to respond, if
> you can not have that respect for my time to response DO NOT MANUALLY
> INVITE ME TO YOUR REVIEW.
>

Sure, I'll respect your wishes, but I don't have to worry about that with
anybody else. They just give the feedback when they get a chance to do so...

Warner


> > Having said that, this isn't like you've lost your ability to say
> something
> > forever now that this is in the tree. If you have suggestions to
> > improvement, I'm all ears.
> >
> > I like your notion around (c) being noise, but I'll address that in the
> > review.
> >
> > Warner
> >
> >
> > Regards,
> > > Rod
> > >
> > >
> > > Better copyright advice
> > > AcceptedPublic
> > > Authored by imp on Fri, Dec 13, 12:33.
> > >
> > > > Modified:
> > > >   head/share/man/man9/style.9
> > > >
> > > > Modified: head/share/man/man9/style.9
> > > >
> > >
> ==
> > > > --- head/share/man/man9/style.9   Fri Dec 13 22:04:13 2019
> > > (r355736)
> > > > +++ head/share/man/man9/style.9   Fri Dec 13 22:32:05 2019
> > > (r355737)
> > > > @@ -1,6 +1,5 @@
> > > >  .\"-
> > > > -.\" Copyright (c) 1995-2005 The FreeBSD Project
> > > > -.\" All rights reserved.
> > > > +.\" Copyright (c) 1995-2019 The FreeBSD Project
> > > >  .\"
> > > >  .\" Redistribution and use in source and binary forms, with or
> without
> > > >  .\" modification, are permitted provided that the following
> conditions
> > > > @@ -26,7 +25,7 @@
> > > >  .\"  From: @(#)style 1.14 (Berkeley) 4/28/95
> > > >  .\" $FreeBSD$
> > > >  .\"
> > > > -.Dd June 3, 2019
> > > > +.Dd December 13, 2019
> > > >  .Dt STYLE 9
> > > >  .Os
> > > >  .Sh NAME
> > > > @@ -84,8 +83,32 @@ comments.
> > > >  Comments starting in columns other than the first are never
> > > >  considered license statements.
> > > >  Use the appropriate SPDX-License-Identifier line before the
> copyright.
> > > > +If the copyright assertion contains the phrase
> > > > +.Dq Li "All Rights Reserved"
> > > > +that should be on the same line as the word
> > > > +.Dq Li "Copyright" .
> > > > +You should not insert a new copyright line between an old
> > > > +copyright line and this phrase.
> > > > +Instead, you should insert a new copyright phrase after
> > > > +a pre-existing
> > > > +.Dq Li "All Rights Reserved"
> > > > +line.
> > > > +When making changes, it is acceptable to fold an
> > > > +.Dq Li "All Rights Reserved"
> > > > +line with each of the
> > > > +.Dq Li "Copyright"
> > > > +lines.
> > > > +For files that have the
> > > > +.Dq Li "All Rights Reserved"
> > > > +line on the same line(s) as the word
> > > > +.Dq Li "Copyright" ,
> > > > +new copyright assertions should be added last.
> > > > +New
> > > > +.Dq Li "Copyright"
> > > > +lines should only be added when making substantial changes to the
> file,
> > > > +not for trivial changes.
> > > >  .Pp
> > > > -After any copyright header, there is a blank line, and the
> > > > +After any copyright and license comment, there is a blank line, and
> the
> > > >  .Li $\$
> > > >  for non C/C++ language source files.
> > > >  Version control system ID tags should only exist once in a file
> > > >
> > >
> > > --
> > > Rod Grimes
> > > rgri...@freebsd.org
> > >
>
> --
> Rod Grimes
> rgri...@freebsd.org
>

On Tue, Dec 17, 2019 at 2:39 AM Rodney W. Grimes 
wrote:

> > On Sun, Dec 15, 2019, 11:51 AM Rodney W. Grimes <
> free...@gndrsh.dnsmgr.net>
> > wrote:
> >
> > > 

svn commit: r355854 - head/usr.bin/diff3

2019-12-17 Thread Baptiste Daroussin
Author: bapt
Date: Tue Dec 17 11:03:32 2019
New Revision: 355854
URL: https://svnweb.freebsd.org/changeset/base/355854

Log:
  Replace homemade getline(3) by actual getline(3)

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

Modified: head/usr.bin/diff3/diff3.c
==
--- head/usr.bin/diff3/diff3.c  Tue Dec 17 10:57:31 2019(r355853)
+++ head/usr.bin/diff3/diff3.c  Tue Dec 17 11:03:32 2019(r355854)
@@ -257,28 +257,16 @@ getchange(FILE *b)
 static char *
 get_line(FILE *b, size_t *n)
 {
-   char *cp;
-   size_t len;
-   static char *buf;
-   static size_t bufsize;
+   ssize_t len;
+   static char *buf = NULL;
+   static size_t bufsize = 0;
 
-   if ((cp = fgetln(b, )) == NULL)
+   if ((len = getline(, , b)) < 0)
return (NULL);
 
-   if (cp[len - 1] != '\n')
-   len++;
-   if (len + 1 > bufsize) {
-   do {
-   bufsize += 1024;
-   } while (len + 1 > bufsize);
-   if ((buf = realloc(buf, bufsize)) == NULL)
-   err(EXIT_FAILURE, NULL);
-   }
-   memcpy(buf, cp, len - 1);
-   buf[len - 1] = '\n';
-   buf[len] = '\0';
if (n != NULL)
*n = len;
+
return (buf);
 }
 
___
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: r355853 - head/sys/arm64/rockchip

2019-12-17 Thread Emmanuel Vadot
Author: manu
Date: Tue Dec 17 10:57:31 2019
New Revision: 355853
URL: https://svnweb.freebsd.org/changeset/base/355853

Log:
  arm64: rockchip: rk_gpio: Fix pin number
  
  The maxpin counter starts at 0, fix one by one error.
  This is still not totally correct for some banks in some SoC that have
  fewer pins but this will be dealt with in another commit.
  
  MFC after:3 days

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

Modified: head/sys/arm64/rockchip/rk_gpio.c
==
--- head/sys/arm64/rockchip/rk_gpio.c   Tue Dec 17 10:55:28 2019
(r355852)
+++ head/sys/arm64/rockchip/rk_gpio.c   Tue Dec 17 10:57:31 2019
(r355853)
@@ -194,7 +194,7 @@ rk_gpio_pin_max(device_t dev, int *maxpin)
 
/* Each bank have always 32 pins */
/* XXX not true*/
-   *maxpin = 32;
+   *maxpin = 31;
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: r355852 - head/sys/arm64/rockchip

2019-12-17 Thread Emmanuel Vadot
Author: manu
Date: Tue Dec 17 10:55:28 2019
New Revision: 355852
URL: https://svnweb.freebsd.org/changeset/base/355852

Log:
  arm64: rockchip: rk_pinctrl: Fix clear bits in SYSCON_MODIFY
  
  r351187 change the SYSCON_WRITE to SYSCON_MODIFY but didn't changed the
  mask variable that used to hold the bitmask in the upper 16 bits of the
  register that control which bits are changed. So we ended up clearing
  bit from the upper 16bits half which are always 0 after a read.
  Use the correct bit mask for bits that we want to clear.
  
  MFC after:3 days

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

Modified: head/sys/arm64/rockchip/rk_pinctrl.c
==
--- head/sys/arm64/rockchip/rk_pinctrl.cTue Dec 17 10:26:44 2019
(r355851)
+++ head/sys/arm64/rockchip/rk_pinctrl.cTue Dec 17 10:55:28 2019
(r355852)
@@ -882,7 +882,7 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, 
 
reg += bank * 0x10 + ((pin / 8) * 0x4);
bit = (pin % 8) * 2;
-   mask = (0x3 << bit) << 16;
+   mask = (0x3 << bit);
SYSCON_MODIFY_4(syscon, reg, mask, bias << bit | (mask << 16));
}
 
@@ -890,7 +890,7 @@ rk_pinctrl_configure_pin(struct rk_pinctrl_softc *sc, 
rv = rk_pinctrl_parse_drive(sc, pin_conf, bank, subbank, , );
if (rv == 0) {
bit = (pin % 8) * 2;
-   mask = (0x3 << bit) << 16;
+   mask = (0x3 << bit);
SYSCON_MODIFY_4(syscon, reg, mask, drive << bit | (mask << 16));
}
 
___
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: r355851 - stable/11/sys/netpfil/ipfw

2019-12-17 Thread Andrey V. Elsukov
Author: ae
Date: Tue Dec 17 10:26:44 2019
New Revision: 355851
URL: https://svnweb.freebsd.org/changeset/base/355851

Log:
  MFC r355581:
Avoid access to stale ip pointer and call UPDATE_POINTERS() after
PULLUP_LEN_LOCKED().
  
PULLUP_LEN_LOCKED() could update mbuf and thus we need to update related
pointers that can be used in next opcodes.
  
Reported by:Maxime Villard 
  
  NOTE: this commit also adds UPDATE_POINTERS() stub macro, that originally
  is part of r345166 commit that was not merged.

Modified:
  stable/11/sys/netpfil/ipfw/ip_fw2.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw2.c Tue Dec 17 10:23:08 2019
(r355850)
+++ stable/11/sys/netpfil/ipfw/ip_fw2.c Tue Dec 17 10:26:44 2019
(r355851)
@@ -1441,7 +1441,15 @@ do { 
\
 
 #definePULLUP_LEN(_len, p, T)  _PULLUP_LOCKED(_len, p, T, )
 #definePULLUP_LEN_LOCKED(_len, p, T)   \
-_PULLUP_LOCKED(_len, p, T, IPFW_PF_RUNLOCK(chain));
+_PULLUP_LOCKED(_len, p, T, IPFW_PF_RUNLOCK(chain));\
+UPDATE_POINTERS()
+/*
+ * In case pointers got stale after pullups, update them.
+ */
+#defineUPDATE_POINTERS()   \
+do {   \
+   ip = mtod(m, struct ip *);  \
+} while (0)
 
/*
 * if we have an ether header,
___
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: r355850 - stable/11/sys/netpfil/ipfw

2019-12-17 Thread Andrey V. Elsukov
Author: ae
Date: Tue Dec 17 10:23:08 2019
New Revision: 355850
URL: https://svnweb.freebsd.org/changeset/base/355850

Log:
  MFC r350413:
Avoid possible lock leaking.
  
After r343619 ipfw uses own locking for packets flow. PULLUP_LEN() macro
is used in ipfw_chk() to make m_pullup(). When m_pullup() fails, it just
returns via `goto pullup_failed`. There are two places where PULLUP_LEN()
is called with IPFW_PF_RLOCK() held.
  
Add PULLUP_LEN_LOCKED() macro to use in these places to be able release
the lock, when m_pullup() fails.
  
Sponsored by:   Yandex LLC
  
  NOTE: since r343619 was not merged, this commit is mostly NOP, but
  it is needed to reduce code difference between stable and head/.

Modified:
  stable/11/sys/netpfil/ipfw/ip_fw2.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw2.c Tue Dec 17 10:00:19 2019
(r355849)
+++ stable/11/sys/netpfil/ipfw/ip_fw2.c Tue Dec 17 10:23:08 2019
(r355850)
@@ -1426,17 +1426,23 @@ ipfw_chk(struct ip_fw_args *args)
  * this way).
  */
 #define PULLUP_TO(_len, p, T)  PULLUP_LEN(_len, p, sizeof(T))
-#define PULLUP_LEN(_len, p, T) \
+#define_PULLUP_LOCKED(_len, p, T, unlock)  \
 do {   \
int x = (_len) + T; \
if ((m)->m_len < x) {   \
args->m = m = m_pullup(m, x);   \
-   if (m == NULL)  \
+   if (m == NULL) {\
+   unlock; \
goto pullup_failed; \
+   }   \
}   \
p = (mtod(m, char *) + (_len)); \
 } while (0)
 
+#definePULLUP_LEN(_len, p, T)  _PULLUP_LOCKED(_len, p, T, )
+#definePULLUP_LEN_LOCKED(_len, p, T)   \
+_PULLUP_LOCKED(_len, p, T, IPFW_PF_RUNLOCK(chain));
+
/*
 * if we have an ether header,
 */
@@ -2267,7 +2273,7 @@ do {  
\
 
case O_TCPOPTS:
if (proto == IPPROTO_TCP && offset == 0 && ulp){
-   PULLUP_LEN(hlen, ulp,
+   PULLUP_LEN_LOCKED(hlen, ulp,
(TCP(ulp)->th_off << 2));
match = tcpopts_match(TCP(ulp), cmd);
}
@@ -2292,7 +2298,7 @@ do {  
\
uint16_t mss, *p;
int i;
 
-   PULLUP_LEN(hlen, ulp,
+   PULLUP_LEN_LOCKED(hlen, ulp,
(TCP(ulp)->th_off << 2));
if ((tcpopts_parse(TCP(ulp), ) &
IP_FW_TCPOPT_MSS) == 0)
@@ -3143,6 +3149,7 @@ do {  
\
 
}   /* end of inner loop, scan opcodes */
 #undef PULLUP_LEN
+#undef PULLUP_LEN_LOCKED
 
if (done)
break;
___
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: r355849 - stable/12/sys/netpfil/ipfw

2019-12-17 Thread Andrey V. Elsukov
Author: ae
Date: Tue Dec 17 10:00:19 2019
New Revision: 355849
URL: https://svnweb.freebsd.org/changeset/base/355849

Log:
  MFC r355581:
Avoid access to stale ip pointer and call UPDATE_POINTERS() after
PULLUP_LEN_LOCKED().
  
PULLUP_LEN_LOCKED() could update mbuf and thus we need to update related
pointers that can be used in next opcodes.
  
Reported by:Maxime Villard 
  
  NOTE: this commit also adds UPDATE_POINTERS() stub macro, that originally
  is part of r345166 commit that was not merged.

Modified:
  stable/12/sys/netpfil/ipfw/ip_fw2.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/12/sys/netpfil/ipfw/ip_fw2.c Tue Dec 17 09:46:00 2019
(r355848)
+++ stable/12/sys/netpfil/ipfw/ip_fw2.c Tue Dec 17 10:00:19 2019
(r355849)
@@ -1443,7 +1443,15 @@ do { 
\
 
 #definePULLUP_LEN(_len, p, T)  _PULLUP_LOCKED(_len, p, T, )
 #definePULLUP_LEN_LOCKED(_len, p, T)   \
-_PULLUP_LOCKED(_len, p, T, IPFW_PF_RUNLOCK(chain))
+_PULLUP_LOCKED(_len, p, T, IPFW_PF_RUNLOCK(chain));\
+UPDATE_POINTERS()
+/*
+ * In case pointers got stale after pullups, update them.
+ */
+#defineUPDATE_POINTERS()   \
+do {   \
+   ip = mtod(m, struct ip *);  \
+} while (0)
 
/*
 * if we have an ether header,
___
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: r355848 - stable/12/sys/netpfil/ipfw

2019-12-17 Thread Andrey V. Elsukov
Author: ae
Date: Tue Dec 17 09:46:00 2019
New Revision: 355848
URL: https://svnweb.freebsd.org/changeset/base/355848

Log:
  MFC r350413:
Avoid possible lock leaking.
  
After r343619 ipfw uses own locking for packets flow. PULLUP_LEN() macro
is used in ipfw_chk() to make m_pullup(). When m_pullup() fails, it just
returns via `goto pullup_failed`. There are two places where PULLUP_LEN()
is called with IPFW_PF_RLOCK() held.
  
Add PULLUP_LEN_LOCKED() macro to use in these places to be able release
the lock, when m_pullup() fails.
  
Sponsored by:   Yandex LLC
  
NOTE: since r343619 was not merged, this commit is mostly NOP, but
it is needed to reduce code difference between stable and head/.

Modified:
  stable/12/sys/netpfil/ipfw/ip_fw2.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/12/sys/netpfil/ipfw/ip_fw2.c Tue Dec 17 09:13:48 2019
(r355847)
+++ stable/12/sys/netpfil/ipfw/ip_fw2.c Tue Dec 17 09:46:00 2019
(r355848)
@@ -1427,18 +1427,24 @@ ipfw_chk(struct ip_fw_args *args)
  * pointer might become stale after other pullups (but we never use it
  * this way).
  */
-#define PULLUP_TO(_len, p, T)  PULLUP_LEN(_len, p, sizeof(T))
-#define PULLUP_LEN(_len, p, T) \
+#definePULLUP_TO(_len, p, T)   PULLUP_LEN(_len, p, sizeof(T))
+#define_PULLUP_LOCKED(_len, p, T, unlock)  \
 do {   \
int x = (_len) + T; \
if ((m)->m_len < x) {   \
args->m = m = m_pullup(m, x);   \
-   if (m == NULL)  \
+   if (m == NULL) {\
+   unlock; \
goto pullup_failed; \
+   }   \
}   \
p = (mtod(m, char *) + (_len)); \
 } while (0)
 
+#definePULLUP_LEN(_len, p, T)  _PULLUP_LOCKED(_len, p, T, )
+#definePULLUP_LEN_LOCKED(_len, p, T)   \
+_PULLUP_LOCKED(_len, p, T, IPFW_PF_RUNLOCK(chain))
+
/*
 * if we have an ether header,
 */
@@ -2269,7 +2275,7 @@ do {  
\
 
case O_TCPOPTS:
if (proto == IPPROTO_TCP && offset == 0 && ulp){
-   PULLUP_LEN(hlen, ulp,
+   PULLUP_LEN_LOCKED(hlen, ulp,
(TCP(ulp)->th_off << 2));
match = tcpopts_match(TCP(ulp), cmd);
}
@@ -2294,7 +2300,7 @@ do {  
\
uint16_t mss, *p;
int i;
 
-   PULLUP_LEN(hlen, ulp,
+   PULLUP_LEN_LOCKED(hlen, ulp,
(TCP(ulp)->th_off << 2));
if ((tcpopts_parse(TCP(ulp), ) &
IP_FW_TCPOPT_MSS) == 0)
@@ -3145,6 +3151,7 @@ do {  
\
 
}   /* end of inner loop, scan opcodes */
 #undef PULLUP_LEN
+#undef PULLUP_LEN_LOCKED
 
if (done)
break;
___
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: r355737 - head/share/man/man9

2019-12-17 Thread Rodney W. Grimes
> On Sun, Dec 15, 2019, 11:51 AM Rodney W. Grimes 
> wrote:
> 
> > > Author: imp
> > > Date: Fri Dec 13 22:32:05 2019
> > > New Revision: 355737
> > > URL: https://svnweb.freebsd.org/changeset/base/355737
> > >
> > > Log:
> > >   Better copyright advice
> > >
> > >   Document the common practices around copyrights with "all rights
> > reserved" in
> > >   them as new copyright notices get added.
> > >
> > >   It's an open question qhether to point people at the fact that since
> > the Berne
> > >   convention was ratified, All rights reserved is largely obsolete.
> > >   https://en.wikipedia.org/wiki/All_rights_reserved#Obsolescence has the
> > >   details. The committer's guide will be revised shortly, and it's
> > likely that's a
> > >   better place for this discussion. If not, I'll add a blurb here.
> > >
> > >   Reviewed by: jhb@, brooks@
> > >   Differential Review: https://reviews.freebsd.org/D22800
> >
> > I object to the a review that specifically invites people to it,
> > is authored and committed in anything short of 24 hours and more
> > reasonable to actually ALLOW people time to repond of 72 hours.
> >
> 
> The project has no fixed policies around reviews and giving time. Several
> people did look at it and approve it before I committed it.

Then I'll be blunt, if your going to manually add me to a review
do not commit it until you have given me 72 hours to respond, if
you can not have that respect for my time to response DO NOT MANUALLY
INVITE ME TO YOUR REVIEW.


> Having said that, this isn't like you've lost your ability to say something
> forever now that this is in the tree. If you have suggestions to
> improvement, I'm all ears.
> 
> I like your notion around (c) being noise, but I'll address that in the
> review.
> 
> Warner
> 
> 
> Regards,
> > Rod
> >
> >
> > Better copyright advice
> > AcceptedPublic
> > Authored by imp on Fri, Dec 13, 12:33.
> >
> > > Modified:
> > >   head/share/man/man9/style.9
> > >
> > > Modified: head/share/man/man9/style.9
> > >
> > ==
> > > --- head/share/man/man9/style.9   Fri Dec 13 22:04:13 2019
> > (r355736)
> > > +++ head/share/man/man9/style.9   Fri Dec 13 22:32:05 2019
> > (r355737)
> > > @@ -1,6 +1,5 @@
> > >  .\"-
> > > -.\" Copyright (c) 1995-2005 The FreeBSD Project
> > > -.\" All rights reserved.
> > > +.\" Copyright (c) 1995-2019 The FreeBSD Project
> > >  .\"
> > >  .\" Redistribution and use in source and binary forms, with or without
> > >  .\" modification, are permitted provided that the following conditions
> > > @@ -26,7 +25,7 @@
> > >  .\"  From: @(#)style 1.14 (Berkeley) 4/28/95
> > >  .\" $FreeBSD$
> > >  .\"
> > > -.Dd June 3, 2019
> > > +.Dd December 13, 2019
> > >  .Dt STYLE 9
> > >  .Os
> > >  .Sh NAME
> > > @@ -84,8 +83,32 @@ comments.
> > >  Comments starting in columns other than the first are never
> > >  considered license statements.
> > >  Use the appropriate SPDX-License-Identifier line before the copyright.
> > > +If the copyright assertion contains the phrase
> > > +.Dq Li "All Rights Reserved"
> > > +that should be on the same line as the word
> > > +.Dq Li "Copyright" .
> > > +You should not insert a new copyright line between an old
> > > +copyright line and this phrase.
> > > +Instead, you should insert a new copyright phrase after
> > > +a pre-existing
> > > +.Dq Li "All Rights Reserved"
> > > +line.
> > > +When making changes, it is acceptable to fold an
> > > +.Dq Li "All Rights Reserved"
> > > +line with each of the
> > > +.Dq Li "Copyright"
> > > +lines.
> > > +For files that have the
> > > +.Dq Li "All Rights Reserved"
> > > +line on the same line(s) as the word
> > > +.Dq Li "Copyright" ,
> > > +new copyright assertions should be added last.
> > > +New
> > > +.Dq Li "Copyright"
> > > +lines should only be added when making substantial changes to the file,
> > > +not for trivial changes.
> > >  .Pp
> > > -After any copyright header, there is a blank line, and the
> > > +After any copyright and license comment, there is a blank line, and the
> > >  .Li $\$
> > >  for non C/C++ language source files.
> > >  Version control system ID tags should only exist once in a file
> > >
> >
> > --
> > Rod Grimes
> > rgri...@freebsd.org
> >

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


svn commit: r355847 - head/usr.bin/diff3

2019-12-17 Thread Baptiste Daroussin
Author: bapt
Date: Tue Dec 17 09:13:48 2019
New Revision: 355847
URL: https://svnweb.freebsd.org/changeset/base/355847

Log:
  Use strtoimax.
  
  Use existing strtoimax instead of reinventing it

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

Modified: head/usr.bin/diff3/diff3.c
==
--- head/usr.bin/diff3/diff3.c  Tue Dec 17 08:57:01 2019(r355846)
+++ head/usr.bin/diff3/diff3.c  Tue Dec 17 09:13:48 2019(r355847)
@@ -84,6 +84,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -132,7 +134,6 @@ static bool duplicate(struct range *, struct range *);
 static int edit(struct diff *, bool, int);
 static char *getchange(FILE *);
 static char *get_line(FILE *, size_t *);
-static int number(char **);
 static int readin(int fd, struct diff **);
 static int skip(int, int, const char *);
 static void change(int, struct range *, bool);
@@ -188,16 +189,16 @@ readin(int fd, struct diff **dd)
for (i=0; (p = getchange(f)); i++) {
if (i >= szchanges - 1)
increase();
-   a = b = number();
+   a = b = (int)strtoimax(p, , 10);
if (*p == ',') {
p++;
-   b = number();
+   b = (int)strtoimax(p, , 10);
}
kind = *p++;
-   c = d = number();
+   c = d = (int)strtoimax(p, , 10);
if (*p==',') {
p++;
-   d = number();
+   d = (int)strtoimax(p, , 10);
}
if (kind == 'a')
a++;
@@ -238,17 +239,6 @@ diffexec(const char *diffprog, char **diffargv, int fd
}
close(fd[1]);
return (pd);
-}
-
-static int
-number(char **lc)
-{
-   int nn;
-
-   nn = 0;
-   while (isdigit((unsigned char)(**lc)))
-   nn = nn*10 + *(*lc)++ - '0';
-   return (nn);
 }
 
 static char *
___
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: r355844 - head/stand/efi/libefi

2019-12-17 Thread Toomas Soome
Author: tsoome
Date: Tue Dec 17 08:30:11 2019
New Revision: 355844
URL: https://svnweb.freebsd.org/changeset/base/355844

Log:
  loader.efi: efi_readkey_ex needs to key despite the shift status or toggle 
status
  
  From UEFI specification 2.8, page 434:
  "It should also be noted that certain input devices may not be able to produce
  shift or toggle state information, and in those cases the high order bit in
  the respective Toggle and Shift state fields should not be active."
  
  But we still need to check for ScanCode and UnicodeChar.
  
  PR:   242660
  Reported by:  Trond Endrestol
  MFC after:1 week

Modified:
  head/stand/efi/libefi/efi_console.c

Modified: head/stand/efi/libefi/efi_console.c
==
--- head/stand/efi/libefi/efi_console.c Tue Dec 17 04:21:35 2019
(r355843)
+++ head/stand/efi/libefi/efi_console.c Tue Dec 17 08:30:11 2019
(r355844)
@@ -1126,11 +1126,15 @@ efi_readkey_ex(void)
kp->UnicodeChar++;
}
}
-   if (kp->ScanCode == 0 && kp->UnicodeChar == 0)
-   return (false);
-   keybuf_inschar(kp);
-   return (true);
}
+   /*
+* The shift state and/or toggle state may not be valid,
+* but we still can have ScanCode or UnicodeChar.
+*/
+   if (kp->ScanCode == 0 && kp->UnicodeChar == 0)
+   return (false);
+   keybuf_inschar(kp);
+   return (true);
}
return (false);
 }
___
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"