svn commit: r339212 - head/sys/powerpc/powernv

2018-10-05 Thread Justin Hibbits
Author: jhibbits
Date: Sat Oct  6 03:20:26 2018
New Revision: 339212
URL: https://svnweb.freebsd.org/changeset/base/339212

Log:
  powerpc64/powernv: Don't mask MSIs in OPAL
  
  Summary:
  Discussing with Benjamin Herrenschmidt, MSIs, and edge-triggered
  interrupts in general, must not be masked in XICS and XIVE, else
  subsequent interrupts may be ignored.
  
  Testing locally on my Talos II (single CPU, 18-core POWER9), NVMe now
  works with MSI, improving read throughput by ~70% (900MB/s -> 1.67GB/s,
  with 64MB block size) over INTx interrupts, and snd_hda(4) now will
  actually play music with MSI.  Previously, snd_hda(4) would not receive
  interrupts, timing out, and declaring the channels dead.
  
  This has also been tested by Kevin Bowling, and others, with great
  success.  Kevin reported NVMe unusable on his Talos II prior to this
  patch.
  
  Reviewed by:  nwhitehorn, kbowling
  Approved by:  re(rgrimes)
  Differential Revision: https://reviews.freebsd.org/D17356

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

Modified: head/sys/powerpc/powernv/opal_pci.c
==
--- head/sys/powerpc/powernv/opal_pci.c Sat Oct  6 02:10:32 2018
(r339211)
+++ head/sys/powerpc/powernv/opal_pci.c Sat Oct  6 03:20:26 2018
(r339212)
@@ -95,8 +95,6 @@ static int opalpci_route_interrupt(device_t bus, devic
  */
 static void opalpic_pic_enable(device_t dev, u_int irq, u_int vector);
 static void opalpic_pic_eoi(device_t dev, u_int irq);
-static void opalpic_pic_mask(device_t dev, u_int irq);
-static void opalpic_pic_unmask(device_t dev, u_int irq);
 
 /*
  * Commands
@@ -143,8 +141,6 @@ static device_method_t  opalpci_methods[] = {
/* PIC interface for MSIs */
DEVMETHOD(pic_enable,   opalpic_pic_enable),
DEVMETHOD(pic_eoi,  opalpic_pic_eoi),
-   DEVMETHOD(pic_mask, opalpic_pic_mask),
-   DEVMETHOD(pic_unmask,   opalpic_pic_unmask),
 
DEVMETHOD_END
 };
@@ -650,7 +646,10 @@ opalpci_map_msi(device_t dev, device_t child, int irq,
 static void
 opalpic_pic_enable(device_t dev, u_int irq, u_int vector)
 {
+   struct opalpci_softc *sc = device_get_softc(dev);
+
PIC_ENABLE(root_pic, irq, vector);
+   opal_call(OPAL_PCI_MSI_EOI, sc->phb_id, irq);
 }
 
 static void opalpic_pic_eoi(device_t dev, u_int irq)
@@ -662,21 +661,3 @@ static void opalpic_pic_eoi(device_t dev, u_int irq)
 
PIC_EOI(root_pic, irq);
 }
-
-static void opalpic_pic_mask(device_t dev, u_int irq)
-{
-   PIC_MASK(root_pic, irq);
-}
-
-static void opalpic_pic_unmask(device_t dev, u_int irq)
-{
-   struct opalpci_softc *sc;
-
-   sc = device_get_softc(dev);
-
-   PIC_UNMASK(root_pic, irq);
-
-   opal_call(OPAL_PCI_MSI_EOI, sc->phb_id, irq);
-}
-
-
___
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: r339211 - head/sys/kern

2018-10-05 Thread Jamie Gritton
Author: jamie
Date: Sat Oct  6 02:10:32 2018
New Revision: 339211
URL: https://svnweb.freebsd.org/changeset/base/339211

Log:
  Fix the test prohibiting jails from sharing IP addresses.
  
  It's not supposed to be legal for two jails to contain the same IP address,
  unless both jails contain only that one address.  This is the behavior
  documented in jail(8), and is there to prevent confusion when multiple
  jails are listening on IADDR_ANY.
  
  VIMAGE jails (now the default for GENERIC kernels) test this correctly,
  but non-VIMAGE jails have been performing an incomplete test when nested
  jails are used.
  
  Approved by:  re@ (kib@)
  MFC after:5 days

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Fri Oct  5 21:10:03 2018(r339210)
+++ head/sys/kern/kern_jail.c   Sat Oct  6 02:10:32 2018(r339211)
@@ -1393,11 +1393,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
 * there is a duplicate on a jail with more than one
 * IP stop checking and return error.
 */
-   tppr = ppr;
 #ifdef VIMAGE
-   for (; tppr !=  tppr = tppr->pr_parent)
+   for (tppr = ppr; tppr !=  tppr = tppr->pr_parent)
if (tppr->pr_flags & PR_VNET)
break;
+#else
+   tppr = 
 #endif
FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) {
if (tpr == pr ||
@@ -1460,11 +1461,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
}
}
/* Check for conflicting IP addresses. */
-   tppr = ppr;
 #ifdef VIMAGE
-   for (; tppr !=  tppr = tppr->pr_parent)
+   for (tppr = ppr; tppr !=  tppr = tppr->pr_parent)
if (tppr->pr_flags & PR_VNET)
break;
+#else
+   tppr = 
 #endif
FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) {
if (tpr == pr ||
___
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: r339210 - in stable/11/stand/efi/loader: . arch/i386

2018-10-05 Thread John Baldwin
Author: jhb
Date: Fri Oct  5 21:10:03 2018
New Revision: 339210
URL: https://svnweb.freebsd.org/changeset/base/339210

Log:
  MFC 338022: Fix casts between 64-bit physical addresses and pointers in EFI.
  
  Compiling FreeBSD/i386 with modern GCC triggers warnings for various
  places that convert 64-bit EFI_ADDRs to pointers and vice versa.
  - Cast pointers to uintptr_t rather than to uint64_t when assigning
to a 64-bit integer.
  - Cast 64-bit integers to uintptr_t before a cast to a pointer.

Modified:
  stable/11/stand/efi/loader/arch/i386/efimd.c
  stable/11/stand/efi/loader/bootinfo.c
  stable/11/stand/efi/loader/copy.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/loader/arch/i386/efimd.c
==
--- stable/11/stand/efi/loader/arch/i386/efimd.cFri Oct  5 20:49:54 
2018(r339209)
+++ stable/11/stand/efi/loader/arch/i386/efimd.cFri Oct  5 21:10:03 
2018(r339210)
@@ -70,14 +70,14 @@ ldr_bootinfo(struct bootinfo *bi, uint64_t *bi_addr)
UINTN mmsz, pages, sz;
UINT32 mmver;
 
-   bi->bi_systab = (uint64_t)ST;
-   bi->bi_hcdp = (uint64_t)efi_get_table(_guid);
+   bi->bi_systab = (uintptr_t)ST;
+   bi->bi_hcdp = (uintptr_t)efi_get_table(_guid);
 
sz = sizeof(EFI_HANDLE);
status = BS->LocateHandle(ByProtocol, _guid, 0, , );
if (status == 0)
status = BS->HandleProtocol(handle, _guid, );
-   bi->bi_fpswa = (status == 0) ? (uint64_t)fpswa : 0;
+   bi->bi_fpswa = (status == 0) ? (uintptr_t)fpswa : 0;
 
bisz = (sizeof(struct bootinfo) + 0x0f) & ~0x0f;
 
@@ -109,7 +109,7 @@ ldr_bootinfo(struct bootinfo *bi, uint64_t *bi_addr)
 * aligned).
 */
*bi_addr = addr;
-   mm = (void *)(addr + bisz);
+   mm = (void *)(uintptr_t)(addr + bisz);
sz = (EFI_PAGE_SIZE * pages) - bisz;
status = BS->GetMemoryMap(, mm, , , );
if (EFI_ERROR(status)) {
@@ -117,12 +117,12 @@ ldr_bootinfo(struct bootinfo *bi, uint64_t *bi_addr)
(long)status);
return (EINVAL);
}
-   bi->bi_memmap = (uint64_t)mm;
+   bi->bi_memmap = (uintptr_t)mm;
bi->bi_memmap_size = sz;
bi->bi_memdesc_size = mmsz;
bi->bi_memdesc_version = mmver;
 
-   bcopy(bi, (void *)(*bi_addr), sizeof(*bi));
+   bcopy(bi, (void *)(uintptr_t)(*bi_addr), sizeof(*bi));
return (0);
 }
 

Modified: stable/11/stand/efi/loader/bootinfo.c
==
--- stable/11/stand/efi/loader/bootinfo.c   Fri Oct  5 20:49:54 2018
(r339209)
+++ stable/11/stand/efi/loader/bootinfo.c   Fri Oct  5 21:10:03 2018
(r339210)
@@ -338,7 +338,7 @@ bi_load_efi_data(struct preloaded_file *kfp)
 * memory map on a 16-byte boundary (the bootinfo block is page
 * aligned).
 */
-   efihdr = (struct efi_map_header *)addr;
+   efihdr = (struct efi_map_header *)(uintptr_t)addr;
mm = (void *)((uint8_t *)efihdr + efisz);
sz = (EFI_PAGE_SIZE * pages) - efisz;
 

Modified: stable/11/stand/efi/loader/copy.c
==
--- stable/11/stand/efi/loader/copy.c   Fri Oct  5 20:49:54 2018
(r339209)
+++ stable/11/stand/efi/loader/copy.c   Fri Oct  5 21:10:03 2018
(r339210)
@@ -278,9 +278,9 @@ efi_copy_finish(void)
 {
uint64_t*src, *dst, *last;
 
-   src = (uint64_t *)staging;
-   dst = (uint64_t *)(staging - stage_offset);
-   last = (uint64_t *)staging_end;
+   src = (uint64_t *)(uintptr_t)staging;
+   dst = (uint64_t *)(uintptr_t)(staging - stage_offset);
+   last = (uint64_t *)(uintptr_t)staging_end;
 
while (src < last)
*dst++ = *src++;
___
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: r339208 - head/sbin/init

2018-10-05 Thread Danilo G. Baio
Author: dbaio (ports committer)
Date: Fri Oct  5 20:35:43 2018
New Revision: 339208
URL: https://svnweb.freebsd.org/changeset/base/339208

Log:
  Fix information about $firewall_myservices
  
  After r273201 it is supported "/{udp,tcp,proto}" suffix into
  $firewall_myservices, and in the rc.conf the information is outdated.
  
  Reviewed by:  bcr, rgrimes
  Approved by:  re (gjb), doc (bcr), src (rgrimes)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D17338

Modified:
  head/sbin/init/rc.conf

Modified: head/sbin/init/rc.conf
==
--- head/sbin/init/rc.conf  Fri Oct  5 20:16:20 2018(r339207)
+++ head/sbin/init/rc.conf  Fri Oct  5 20:35:43 2018(r339208)
@@ -163,7 +163,7 @@ firewall_simple_onet="192.0.2.0/28" # Outside network 
# firewall.
 #firewall_simple_onet_ipv6="2001:db8:2:0::/56" # Outside IPv6 network prefix
# for "simple" firewall.
-firewall_myservices="" # List of TCP ports on which this host
+firewall_myservices="" # List of ports/protocols on which this host
# offers services for "workstation" firewall.
 firewall_allowservices=""  # List of IPs which have access to
# $firewall_myservices for "workstation"
___
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: r339207 - head/sys/dev/e1000

2018-10-05 Thread Stephen Hurd
Author: shurd
Date: Fri Oct  5 20:16:20 2018
New Revision: 339207
URL: https://svnweb.freebsd.org/changeset/base/339207

Log:
  Fix igb corrupting checksums with BPF and VLAN
  
  When using a vlan with igb and the vlanhwcsum option, any mbufs which
  already had the TCP, UDP, or SCTP checksum calculated and therefore don't
  have the CSUM_[IP|IP6]_[TCP|UDP|SCTP] bits set in the csum_flags field would
  have the L4 checksum corrupted by the hardware.
  
  This was caused by the driver setting E1000_TXD_POPTS_TXSM any time a
  checksum bit was set OR a vlan tag was present.
  
  The patched driver only sets E1000_TXD_POPTS_TXSM when an offload is
  requested.
  
  PR:   231416
  Reported by:  pi
  Approved by:  re (gjb)
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D17404

Modified:
  head/sys/dev/e1000/igb_txrx.c

Modified: head/sys/dev/e1000/igb_txrx.c
==
--- head/sys/dev/e1000/igb_txrx.c   Fri Oct  5 19:27:42 2018
(r339206)
+++ head/sys/dev/e1000/igb_txrx.c   Fri Oct  5 20:16:20 2018
(r339207)
@@ -152,7 +152,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi
u32 vlan_macip_lens, type_tucmd_mlhl;
u32 mss_l4len_idx;
mss_l4len_idx = vlan_macip_lens = type_tucmd_mlhl = 0;
-   int offload = TRUE; 
 
/* First check if TSO is to be used */
if (pi->ipi_csum_flags & CSUM_TSO)
@@ -186,7 +185,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_IPV6;
break;
default:
-   offload = FALSE;
break;
}
 
@@ -195,24 +193,26 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi
 
switch (pi->ipi_ipproto) {
case IPPROTO_TCP:
-   if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP))
+   if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) {
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP;
+   *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
+   }
break;
case IPPROTO_UDP:
-   if (pi->ipi_csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP))
+   if (pi->ipi_csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP)) {
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP;
+   *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
+   }
break;
case IPPROTO_SCTP:
-   if (pi->ipi_csum_flags & (CSUM_IP_SCTP | CSUM_IP6_SCTP))
+   if (pi->ipi_csum_flags & (CSUM_IP_SCTP | CSUM_IP6_SCTP)) {
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP;
+   *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
+   }
break;
default:
-   offload = FALSE;
break;
}
-
-   if (offload) /* For the TX descriptor setup */
-   *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
 
/* 82575 needs the queue index added */
if (adapter->hw.mac.type == e1000_82575)
___
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: r339206 - head/lib/libc/amd64/string

2018-10-05 Thread Mateusz Guzik
Author: mjg
Date: Fri Oct  5 19:27:42 2018
New Revision: 339206
URL: https://svnweb.freebsd.org/changeset/base/339206

Log:
  amd64: import updated kernel memset to libc
  
  See r339205 for details.
  
  An unused ERMS support is retained in the macro. It will be activated
  after ifunc support lands.
  
  Reviewed by:kib
  Approved by:re (gjb)
  Sponsored by:   The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17405

Modified:
  head/lib/libc/amd64/string/memset.S

Modified: head/lib/libc/amd64/string/memset.S
==
--- head/lib/libc/amd64/string/memset.S Fri Oct  5 19:25:09 2018
(r339205)
+++ head/lib/libc/amd64/string/memset.S Fri Oct  5 19:27:42 2018
(r339206)
@@ -31,7 +31,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-.macro MEMSET bzero
+.macro MEMSET bzero erms
 .if \bzero == 1
movq%rsi,%rcx
movq%rsi,%rdx
@@ -43,21 +43,75 @@ __FBSDID("$FreeBSD$");
movabs  $0x0101010101010101,%rax
imulq   %r8,%rax
 .endif
-   cmpq$15,%rcx
-   jbe 1f
-   shrq$3,%rcx
-   rep
-   stosq
-   movq%rdx,%rcx
-   andq$7,%rcx
-   jne 1f
+
+   cmpq$32,%rcx
+   jb  1016f
+
+   cmpq$256,%rcx
+   ja  1256f
+
+1032:
+   movq%rax,(%rdi)
+   movq%rax,8(%rdi)
+   movq%rax,16(%rdi)
+   movq%rax,24(%rdi)
+   leaq32(%rdi),%rdi
+   subq$32,%rcx
+   cmpq$32,%rcx
+   jae 1032b
+   cmpb$0,%cl
+   je  1000f
+1016:
+   cmpb$16,%cl
+   jl  1008f
+   movq%rax,(%rdi)
+   movq%rax,8(%rdi)
+   subb$16,%cl
+   jz  1000f
+   leaq16(%rdi),%rdi
+1008:
+   cmpb$8,%cl
+   jl  1004f
+   movq%rax,(%rdi)
+   subb$8,%cl
+   jz  1000f
+   leaq8(%rdi),%rdi
+1004:
+   cmpb$4,%cl
+   jl  1002f
+   movl%eax,(%rdi)
+   subb$4,%cl
+   jz  1000f
+   leaq4(%rdi),%rdi
+1002:
+   cmpb$2,%cl
+   jl  1001f
+   movw%ax,(%rdi)
+   subb$2,%cl
+   jz  1000f
+   leaq2(%rdi),%rdi
+1001:
+   cmpb$1,%cl
+   jl  1000f
+   movb%al,(%rdi)
+1000:
 .if \bzero == 0
movq%r9,%rax
 .endif
ret
-1:
+
+1256:
+.if \erms == 1
rep
stosb
+.else
+   shrq$3,%rcx
+   rep
+   stosq
+   movq%rdx,%rcx
+   andb$7,%cl
+   jne 1004b
+.endif
 .if \bzero == 0
movq%r9,%rax
 .endif
@@ -66,11 +120,11 @@ __FBSDID("$FreeBSD$");
 
 #ifndef BZERO
 ENTRY(memset)
-   MEMSET bzero=0
+   MEMSET bzero=0 erms=0
 END(memset)
 #else
 ENTRY(bzero)
-   MEMSET bzero=1
+   MEMSET bzero=1 erms=0
 END(bzero)
 #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: r339205 - head/sys/amd64/amd64

2018-10-05 Thread Mateusz Guzik
Author: mjg
Date: Fri Oct  5 19:25:09 2018
New Revision: 339205
URL: https://svnweb.freebsd.org/changeset/base/339205

Log:
  amd64: make memset less slow with mov
  
  rep stos has a high startup time even on modern microarchitectures like
  Skylake. Intel optimization manuals discuss how for small sizes it is
  beneficial to go for streaming stores. Since those cannot be used without
  extra penalty in the kernel I investigated performance impact of just
  regular movs.
  
  The patch below implements a very simple scheme: a 32-byte loop followed
  by filling in the remainder of at most 31 bytes. It has a 256 breaking
  point on which it falls back to rep stos. It provides a significant win
  over the current primitive on several machines I tested (both Intel and
  AMD). A 64-byte loop did not provide any benefit even for multiple of 64
  sizes.
  
  See the review for benchmark data.
  
  Reviewed by:  kib
  Approved by:  re (gjb)
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17398

Modified:
  head/sys/amd64/amd64/support.S

Modified: head/sys/amd64/amd64/support.S
==
--- head/sys/amd64/amd64/support.S  Fri Oct  5 18:15:44 2018
(r339204)
+++ head/sys/amd64/amd64/support.S  Fri Oct  5 19:25:09 2018
(r339205)
@@ -320,43 +320,92 @@ END(memcpy_erms)
  * memset(dst, c,   len)
  *rdi, rsi, rdx
  */
-ENTRY(memset_std)
+.macro MEMSET erms
PUSH_FRAME_POINTER
movq%rdi,%r9
movq%rdx,%rcx
movzbq  %sil,%r8
movabs  $0x0101010101010101,%rax
imulq   %r8,%rax
-   cmpq$15,%rcx
-   jbe 1f
-   shrq$3,%rcx
-   rep
-   stosq
-   movq%rdx,%rcx
-   andq$7,%rcx
-   jne 1f
+
+   cmpq$32,%rcx
+   jb  1016f
+
+   cmpq$256,%rcx
+   ja  1256f
+
+1032:
+   movq%rax,(%rdi)
+   movq%rax,8(%rdi)
+   movq%rax,16(%rdi)
+   movq%rax,24(%rdi)
+   leaq32(%rdi),%rdi
+   subq$32,%rcx
+   cmpq$32,%rcx
+   jae 1032b
+   cmpb$0,%cl
+   je  1000f
+1016:
+   cmpb$16,%cl
+   jl  1008f
+   movq%rax,(%rdi)
+   movq%rax,8(%rdi)
+   subb$16,%cl
+   jz  1000f
+   leaq16(%rdi),%rdi
+1008:
+   cmpb$8,%cl
+   jl  1004f
+   movq%rax,(%rdi)
+   subb$8,%cl
+   jz  1000f
+   leaq8(%rdi),%rdi
+1004:
+   cmpb$4,%cl
+   jl  1002f
+   movl%eax,(%rdi)
+   subb$4,%cl
+   jz  1000f
+   leaq4(%rdi),%rdi
+1002:
+   cmpb$2,%cl
+   jl  1001f
+   movw%ax,(%rdi)
+   subb$2,%cl
+   jz  1000f
+   leaq2(%rdi),%rdi
+1001:
+   cmpb$1,%cl
+   jl  1000f
+   movb%al,(%rdi)
+1000:
movq%r9,%rax
POP_FRAME_POINTER
ret
ALIGN_TEXT
-1:
+1256:
+.if \erms == 1
rep
stosb
+.else
+   shrq$3,%rcx
+   rep
+   stosq
+   movq%rdx,%rcx
+   andb$7,%cl
+   jne 1004b
+.endif
movq%r9,%rax
POP_FRAME_POINTER
ret
+.endm
+
+ENTRY(memset_std)
+   MEMSET erms=0
 END(memset_std)
 
 ENTRY(memset_erms)
-   PUSH_FRAME_POINTER
-   movq%rdi,%r9
-   movq%rdx,%rcx
-   movb%sil,%al
-   rep
-   stosb
-   movq%r9,%rax
-   POP_FRAME_POINTER
-   ret
+   MEMSET erms=1
 END(memset_erms)
 
 /* fillw(pat, base, cnt) */
___
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: r339204 - stable/11/sys/vm

2018-10-05 Thread Konstantin Belousov
Author: kib
Date: Fri Oct  5 18:15:44 2018
New Revision: 339204
URL: https://svnweb.freebsd.org/changeset/base/339204

Log:
  MFC r338999:
  Correct vm_fault_copy_entry() handling of backing file truncation
  after the file mapping was wired.

Modified:
  stable/11/sys/vm/vm_fault.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_fault.c
==
--- stable/11/sys/vm/vm_fault.c Fri Oct  5 18:14:18 2018(r339203)
+++ stable/11/sys/vm/vm_fault.c Fri Oct  5 18:15:44 2018(r339204)
@@ -1711,6 +1711,13 @@ again:
dst_m = src_m;
if (vm_page_sleep_if_busy(dst_m, "fltupg"))
goto again;
+   if (dst_m->pindex >= dst_object->size)
+   /*
+* We are upgrading.  Index can occur
+* out of bounds if the object type is
+* vnode and the file was truncated.
+*/
+   break;
vm_page_xbusy(dst_m);
KASSERT(dst_m->valid == VM_PAGE_BITS_ALL,
("invalid dst page %p", dst_m));
___
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: r339203 - stable/11/sys/vm

2018-10-05 Thread Konstantin Belousov
Author: kib
Date: Fri Oct  5 18:14:18 2018
New Revision: 339203
URL: https://svnweb.freebsd.org/changeset/base/339203

Log:
  MFC r338998:
  In vm_fault_copy_entry(), we should not assert that entry is charged
  if the dst_object is not of swap type.

Modified:
  stable/11/sys/vm/vm_fault.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_fault.c
==
--- stable/11/sys/vm/vm_fault.c Fri Oct  5 18:12:49 2018(r339202)
+++ stable/11/sys/vm/vm_fault.c Fri Oct  5 18:14:18 2018(r339203)
@@ -1622,7 +1622,9 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map
dst_object->cred = curthread->td_ucred;
crhold(dst_object->cred);
*fork_charge += dst_object->charge;
-   } else if (dst_object->cred == NULL) {
+   } else if ((dst_object->type == OBJT_DEFAULT ||
+   dst_object->type == OBJT_SWAP) &&
+   dst_object->cred == NULL) {
KASSERT(dst_entry->cred != NULL, ("no cred for entry %p",
dst_entry));
dst_object->cred = dst_entry->cred;
___
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: r339202 - stable/11/sys/vm

2018-10-05 Thread Konstantin Belousov
Author: kib
Date: Fri Oct  5 18:12:49 2018
New Revision: 339202
URL: https://svnweb.freebsd.org/changeset/base/339202

Log:
  MFC r338997:
  In vm_fault_copy_entry(), collect the code to initialize a newly
  allocated dst_object in a single place.

Modified:
  stable/11/sys/vm/vm_fault.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_fault.c
==
--- stable/11/sys/vm/vm_fault.c Fri Oct  5 17:53:47 2018(r339201)
+++ stable/11/sys/vm/vm_fault.c Fri Oct  5 18:12:49 2018(r339202)
@@ -1606,6 +1606,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map
dst_object->flags |= OBJ_COLORED;
dst_object->pg_color = atop(dst_entry->start);
 #endif
+   dst_object->charge = dst_entry->end - dst_entry->start;
}
 
VM_OBJECT_WLOCK(dst_object);
@@ -1614,7 +1615,6 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map
if (src_object != dst_object) {
dst_entry->object.vm_object = dst_object;
dst_entry->offset = 0;
-   dst_object->charge = dst_entry->end - dst_entry->start;
}
if (fork_charge != NULL) {
KASSERT(dst_entry->cred == NULL,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339200 - head/stand/lua

2018-10-05 Thread Kyle Evans
Author: kevans
Date: Fri Oct  5 17:07:10 2018
New Revision: 339200
URL: https://svnweb.freebsd.org/changeset/base/339200

Log:
  lualoader: Don't draw loader menu with autoboot_delay=-1
  
  This was mostly a cosmetic issue. autoboot_delay=-1 is documented to bypass
  the loader menu and immediately execute the boot command, but lualoader
  would draw the menu and immediately execute the boot command. No interaction
  was possible with the menu.
  
  The fix lifts autoboot_delay processing out of menu.autoboot, which now
  takes a delay and does nothing if no delay is specified. This lines up with
  my expectations of menu.autoboot's usage from a third party, which may
  want more control over the process than the default behavior.
  
  PR:   231610
  Approved by:  re (gjb)

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Fri Oct  5 16:52:21 2018(r339199)
+++ head/stand/lua/menu.lua Fri Oct  5 17:07:10 2018(r339200)
@@ -401,9 +401,23 @@ function menu.process(menudef, keypress)
 end
 
 function menu.run()
+   local delay = loader.getenv("autoboot_delay")
+
+   if delay ~= nil and delay:lower() == "no" then
+   delay = nil
+   else
+   delay = tonumber(delay) or 10
+   end
+
+   if delay == -1 then
+   core.boot()
+   return
+   end
+
menu.draw(menu.default)
-   local autoboot_key = menu.autoboot()
 
+   local autoboot_key = menu.autoboot(delay)
+
menu.process(menu.default, autoboot_key)
drawn_menu = nil
 
@@ -411,19 +425,15 @@ function menu.run()
print("Exiting menu!")
 end
 
-function menu.autoboot()
-   local ab = loader.getenv("autoboot_delay")
-   if ab ~= nil and ab:lower() == "no" then
+function menu.autoboot(delay)
+   -- If we've specified a nil delay, we can do nothing but assume that
+   -- we aren't supposed to be autobooting.
+   if delay == nil then
return nil
-   elseif tonumber(ab) == -1 then
-   core.boot()
end
-   ab = tonumber(ab) or 10
-
local x = loader.getenv("loader_menu_timeout_x") or 4
local y = loader.getenv("loader_menu_timeout_y") or 23
-
-   local endtime = loader.time() + ab
+   local endtime = loader.time() + delay
local time
local last
repeat
___
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: r339199 - head/contrib/blacklist/bin

2018-10-05 Thread Kurt Lidl
Author: lidl
Date: Fri Oct  5 16:52:21 2018
New Revision: 339199
URL: https://svnweb.freebsd.org/changeset/base/339199

Log:
  Document signal handling in blacklistd(8).
  
  Reviewed by:  bcr@, 0mp@
  Approved by:  re (gjb@)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D17423

Modified:
  head/contrib/blacklist/bin/blacklistd.8

Modified: head/contrib/blacklist/bin/blacklistd.8
==
--- head/contrib/blacklist/bin/blacklistd.8 Fri Oct  5 16:35:24 2018
(r339198)
+++ head/contrib/blacklist/bin/blacklistd.8 Fri Oct  5 16:52:21 2018
(r339199)
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 7, 2016
+.Dd October 5, 2018
 .Dt BLACKLISTD 8
 .Os
 .Sh NAME
@@ -178,7 +178,7 @@ Specify the default rule name for the packet filter ru
 .It Fl r
 Re-read the firewall rules from the internal database, then
 remove and re-add them.
-This helps for packet filters that don't retain state across reboots.
+This helps for packet filters that do not retain state across reboots.
 .It Fl s Ar sockpath
 Add
 .Ar sockpath
@@ -197,6 +197,27 @@ diagnostic messages to
 .Dv stdout
 instead of
 .Xr syslogd 8 .
+.El
+.Sh SIGNAL HANDLING
+.Nm
+deals with the following signals:
+.Bl -tag -width "USR2"
+.It HUP
+Receipt of this signal causes
+.Nm
+to re-read the configuration file.
+.It INT, TERM & QUIT
+These signals tell
+.Nm
+to exit in an orderly fashion.
+.It USR1
+This signal tells
+.Nm
+to increase the internal debugging level by 1.
+.It USR2
+This signal tells
+.Nm
+to decrease the internal debugging level by 1.
 .El
 .Sh FILES
 .Bl -tag -width /usr/libexec/blacklistd-helper -compact
___
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: r339197 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-10-05 Thread Alexander Motin
Author: mav
Date: Fri Oct  5 16:05:59 2018
New Revision: 339197
URL: https://svnweb.freebsd.org/changeset/base/339197

Log:
  Add sysctls for dbuf metadata cache variables added in r336959.
  
  Approved by:  re (gjb)
  MFC after:1 week

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Fri Oct  5 
15:03:40 2018(r339196)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Fri Oct  5 
16:05:59 2018(r339197)
@@ -292,8 +292,15 @@ uint_t dbuf_cache_lowater_pct = 10;
 SYSCTL_DECL(_vfs_zfs);
 SYSCTL_QUAD(_vfs_zfs, OID_AUTO, dbuf_cache_max_bytes, CTLFLAG_RWTUN,
 _cache_max_bytes, 0, "dbuf cache size in bytes");
+SYSCTL_QUAD(_vfs_zfs, OID_AUTO, dbuf_metadata_cache_max_bytes, CTLFLAG_RWTUN,
+_metadata_cache_max_bytes, 0, "dbuf metadata cache size in bytes");
 SYSCTL_INT(_vfs_zfs, OID_AUTO, dbuf_cache_shift, CTLFLAG_RDTUN,
 _cache_shift, 0, "dbuf cache size as log2 fraction of ARC");
+SYSCTL_INT(_vfs_zfs, OID_AUTO, dbuf_metadata_cache_shift, CTLFLAG_RDTUN,
+_metadata_cache_shift, 0,
+"dbuf metadata cache size as log2 fraction of ARC");
+SYSCTL_QUAD(_vfs_zfs, OID_AUTO, dbuf_metadata_cache_overflow, CTLFLAG_RD,
+_metadata_cache_overflow, 0, "dbuf metadata cache overflow");
 SYSCTL_UINT(_vfs_zfs, OID_AUTO, dbuf_cache_hiwater_pct, CTLFLAG_RWTUN,
 _cache_hiwater_pct, 0, "max percents above the dbuf cache size");
 SYSCTL_UINT(_vfs_zfs, OID_AUTO, dbuf_cache_lowater_pct, CTLFLAG_RWTUN,
___
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: r339196 - svnadmin/conf

2018-10-05 Thread George V. Neville-Neil
Author: gnn
Date: Fri Oct  5 15:03:40 2018
New Revision: 339196
URL: https://svnweb.freebsd.org/changeset/base/339196

Log:
  Add myself as co-mentor with hrs@ for Vincenzo Maffione

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Fri Oct  5 12:51:30 2018(r339195)
+++ svnadmin/conf/mentors   Fri Oct  5 15:03:40 2018(r339196)
@@ -37,4 +37,5 @@ sef   mav
 slavashkib Co-mentor: hselasky
 slmken Co-mentor: scottl, ambrisko
 thjjtl
+vmaffione  hrs Co-mentor: gnn
 wosch  cem
___
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: r339195 - head/sys/netinet

2018-10-05 Thread Tom Jones
Author: thj
Date: Fri Oct  5 12:51:30 2018
New Revision: 339195
URL: https://svnweb.freebsd.org/changeset/base/339195

Log:
  Convert UDP length to host byte order
  
  When getting the number of bytes to checksum make sure to convert the UDP
  length to host byte order when the entire header is not in the first mbuf.
  
  Reviewed by: jtl, tuexen, ae
  Approved by: re (gjb), jtl (mentor)
  Differential Revision:  https://reviews.freebsd.org/D17357

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cFri Oct  5 12:08:32 2018
(r339194)
+++ head/sys/netinet/ip_output.cFri Oct  5 12:51:30 2018
(r339195)
@@ -932,10 +932,11 @@ in_delayed_cksum(struct mbuf *m)
 
if (m->m_pkthdr.csum_flags & CSUM_UDP) {
/* if udp header is not in the first mbuf copy udplen */
-   if (offset + sizeof(struct udphdr) > m->m_len)
+   if (offset + sizeof(struct udphdr) > m->m_len) {
m_copydata(m, offset + offsetof(struct udphdr,
uh_ulen), sizeof(cklen), (caddr_t));
-   else {
+   cklen = ntohs(cklen);
+   } else {
uh = (struct udphdr *)mtodo(m, offset);
cklen = ntohs(uh->uh_ulen);
}
___
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: r339194 - head/usr.sbin/nscd

2018-10-05 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Oct  5 12:08:32 2018
New Revision: 339194
URL: https://svnweb.freebsd.org/changeset/base/339194

Log:
  Remove the BUGS section of nscd(8) man page.  According to bushman@'s
  reponse quoted in PR, he no longer maintains it.
  
  PR:   210590
  Approved by:  re (kib)
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.sbin/nscd/nscd.8

Modified: head/usr.sbin/nscd/nscd.8
==
--- head/usr.sbin/nscd/nscd.8   Fri Oct  5 08:17:29 2018(r339193)
+++ head/usr.sbin/nscd/nscd.8   Fri Oct  5 12:08:32 2018(r339194)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 20, 2005
+.Dd October 5, 2018
 .Dt NSCD 8
 .Os
 .Sh NAME
@@ -160,6 +160,3 @@ The default configuration file.
 .Xr nsswitch.conf 5
 .Sh AUTHORS
 .An Michael Bushkov Aq Mt bush...@freebsd.org
-.Sh BUGS
-Please send bug reports and suggestions to
-.Aq Mt bush...@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: r339193 - head/usr.sbin/bsdinstall

2018-10-05 Thread Mateusz Piotrowski
Author: 0mp (ports committer)
Date: Fri Oct  5 08:17:29 2018
New Revision: 339193
URL: https://svnweb.freebsd.org/changeset/base/339193

Log:
  bsdinstall(8): Fix a typo.
  
  Reported by:  Jose Luis Duran
  Reviewed by:  bcr
  Approved by:  re (gjb), krion (mentor, implicit), mat (mentor, implicit)
  Differential Revision:https://reviews.freebsd.org/D17409

Modified:
  head/usr.sbin/bsdinstall/bsdinstall.8

Modified: head/usr.sbin/bsdinstall/bsdinstall.8
==
--- head/usr.sbin/bsdinstall/bsdinstall.8   Fri Oct  5 08:00:45 2018
(r339192)
+++ head/usr.sbin/bsdinstall/bsdinstall.8   Fri Oct  5 08:17:29 2018
(r339193)
@@ -395,7 +395,7 @@ Default:
 .It Ev ZFSBOOT_SWAP_ENCRYPTION
 If set, enables the encryption of the swap partition using
 .Xr geli 8 .
-Defaulf: ""
+Default: ""
 .It Ev ZFSBOOT_SWAP_MIRROR
 If set, enables a swap mirroring using
 .Xr gmirror 8 .
___
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: r339192 - head/share/man/man9

2018-10-05 Thread Mateusz Piotrowski
Author: 0mp (ports committer)
Date: Fri Oct  5 08:00:45 2018
New Revision: 339192
URL: https://svnweb.freebsd.org/changeset/base/339192

Log:
  MODULE_PNP_INFO(9): Fix a grammar mistake.
  
  Reported by:  ak
  Reviewed by:  imp, Yuri Pankov 
  Approved by:  re (gjb), krion (mentor, implicit), mat (mentor, implicit)
  Differential Revision:https://reviews.freebsd.org/D17403

Modified:
  head/share/man/man9/MODULE_PNP_INFO.9

Modified: head/share/man/man9/MODULE_PNP_INFO.9
==
--- head/share/man/man9/MODULE_PNP_INFO.9   Fri Oct  5 07:52:28 2018
(r339191)
+++ head/share/man/man9/MODULE_PNP_INFO.9   Fri Oct  5 08:00:45 2018
(r339192)
@@ -113,7 +113,7 @@ A pointer that should be ignored.
 .It Dq Vt E
 EISA PNP Identifier.
 .It Dq Vt T
-PNP info that is true for the for the whole table.
+PNP info that is true for the whole table.
 The driver code checks for these condition pragmatically before using
 this table to match devices.
 This item must come last in the list.
___
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: r339191 - stable/9/lib/libusb

2018-10-05 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct  5 07:52:28 2018
New Revision: 339191
URL: https://svnweb.freebsd.org/changeset/base/339191

Log:
  MFC r338993:
  When multiple threads are involved receiving completion events in LibUSB
  make sure there is always a master polling thread, by setting the 
"ctx_handler"
  field in the context. Else the reception of completion events can stop.
  This happens if event threads are created and destroyed during runtime.
  
  Found by: Ludovic Rousseau 
  PR:   231742
  Sponsored by: Mellanox Technologies

Modified:
  stable/9/lib/libusb/libusb10_io.c
Directory Properties:
  stable/9/lib/   (props changed)
  stable/9/lib/libusb/   (props changed)

Modified: stable/9/lib/libusb/libusb10_io.c
==
--- stable/9/lib/libusb/libusb10_io.c   Fri Oct  5 07:50:44 2018
(r339190)
+++ stable/9/lib/libusb/libusb10_io.c   Fri Oct  5 07:52:28 2018
(r339191)
@@ -305,6 +305,9 @@ libusb_wait_for_event(libusb_context *ctx, struct time
if (tv == NULL) {
pthread_cond_wait(>ctx_cond,
>ctx_lock);
+   /* try to grab polling of actual events, if any */
+   if (ctx->ctx_handler == NO_THREAD)
+   ctx->ctx_handler = pthread_self();
return (0);
}
err = clock_gettime(CLOCK_MONOTONIC, );
@@ -323,6 +326,9 @@ libusb_wait_for_event(libusb_context *ctx, struct time
}
err = pthread_cond_timedwait(>ctx_cond,
>ctx_lock, );
+   /* try to grab polling of actual events, if any */
+   if (ctx->ctx_handler == NO_THREAD)
+   ctx->ctx_handler = pthread_self();
 
if (err == ETIMEDOUT)
return (1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339190 - stable/10/lib/libusb

2018-10-05 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct  5 07:50:44 2018
New Revision: 339190
URL: https://svnweb.freebsd.org/changeset/base/339190

Log:
  MFC r338993:
  When multiple threads are involved receiving completion events in LibUSB
  make sure there is always a master polling thread, by setting the 
"ctx_handler"
  field in the context. Else the reception of completion events can stop.
  This happens if event threads are created and destroyed during runtime.
  
  Found by: Ludovic Rousseau 
  PR:   231742
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/lib/libusb/libusb10_io.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libusb/libusb10_io.c
==
--- stable/10/lib/libusb/libusb10_io.c  Fri Oct  5 07:49:01 2018
(r339189)
+++ stable/10/lib/libusb/libusb10_io.c  Fri Oct  5 07:50:44 2018
(r339190)
@@ -310,6 +310,9 @@ libusb_wait_for_event(libusb_context *ctx, struct time
if (tv == NULL) {
pthread_cond_wait(>ctx_cond,
>ctx_lock);
+   /* try to grab polling of actual events, if any */
+   if (ctx->ctx_handler == NO_THREAD)
+   ctx->ctx_handler = pthread_self();
return (0);
}
err = clock_gettime(CLOCK_MONOTONIC, );
@@ -328,6 +331,9 @@ libusb_wait_for_event(libusb_context *ctx, struct time
}
err = pthread_cond_timedwait(>ctx_cond,
>ctx_lock, );
+   /* try to grab polling of actual events, if any */
+   if (ctx->ctx_handler == NO_THREAD)
+   ctx->ctx_handler = pthread_self();
 
if (err == ETIMEDOUT)
return (1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339189 - stable/11/lib/libusb

2018-10-05 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct  5 07:49:01 2018
New Revision: 339189
URL: https://svnweb.freebsd.org/changeset/base/339189

Log:
  MFC r338993:
  When multiple threads are involved receiving completion events in LibUSB
  make sure there is always a master polling thread, by setting the 
"ctx_handler"
  field in the context. Else the reception of completion events can stop.
  This happens if event threads are created and destroyed during runtime.
  
  Found by: Ludovic Rousseau 
  PR:   231742
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/lib/libusb/libusb10_io.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libusb/libusb10_io.c
==
--- stable/11/lib/libusb/libusb10_io.c  Fri Oct  5 05:55:56 2018
(r339188)
+++ stable/11/lib/libusb/libusb10_io.c  Fri Oct  5 07:49:01 2018
(r339189)
@@ -310,6 +310,9 @@ libusb_wait_for_event(libusb_context *ctx, struct time
if (tv == NULL) {
pthread_cond_wait(>ctx_cond,
>ctx_lock);
+   /* try to grab polling of actual events, if any */
+   if (ctx->ctx_handler == NO_THREAD)
+   ctx->ctx_handler = pthread_self();
return (0);
}
err = clock_gettime(CLOCK_MONOTONIC, );
@@ -328,6 +331,9 @@ libusb_wait_for_event(libusb_context *ctx, struct time
}
err = pthread_cond_timedwait(>ctx_cond,
>ctx_lock, );
+   /* try to grab polling of actual events, if any */
+   if (ctx->ctx_handler == NO_THREAD)
+   ctx->ctx_handler = pthread_self();
 
if (err == ETIMEDOUT)
return (1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"