svn commit: r353716 - stable/12/sys/kern

2019-10-17 Thread Kristof Provost
Author: kp
Date: Fri Oct 18 03:38:01 2019
New Revision: 353716
URL: https://svnweb.freebsd.org/changeset/base/353716

Log:
  MFC r353443
  
  mountroot: run statfs after mounting devfs
  
  The usual flow for mounting a file system is to VFS_MOUNT() and then
  immediately VFS_STATFS().
  
  That's not done in vfs_mountroot_devfs(), which means the
  mp->mnt_stat.f_iosize field is not correctly populated, which in turn
  causes us to mark valid aio operations as unsafe (because the io size is
  set to 0), ultimately causing the aio_test:md_waitcomplete test to fail.
  
  Sponsored by: Axiado

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

Modified: stable/12/sys/kern/vfs_mountroot.c
==
--- stable/12/sys/kern/vfs_mountroot.c  Fri Oct 18 03:36:26 2019
(r353715)
+++ stable/12/sys/kern/vfs_mountroot.c  Fri Oct 18 03:38:01 2019
(r353716)
@@ -262,6 +262,11 @@ vfs_mountroot_devfs(struct thread *td, struct mount **
if (error)
return (error);
 
+   error = VFS_STATFS(mp, >mnt_stat);
+   KASSERT(error == 0, ("VFS_STATFS(devfs) failed %d", error));
+   if (error)
+   return (error);
+
opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK);
TAILQ_INIT(opts);
mp->mnt_opt = opts;
___
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: r353717 - stable/11/sys/kern

2019-10-17 Thread Kristof Provost
Author: kp
Date: Fri Oct 18 03:38:02 2019
New Revision: 353717
URL: https://svnweb.freebsd.org/changeset/base/353717

Log:
  MFC r353443
  
  mountroot: run statfs after mounting devfs
  
  The usual flow for mounting a file system is to VFS_MOUNT() and then
  immediately VFS_STATFS().
  
  That's not done in vfs_mountroot_devfs(), which means the
  mp->mnt_stat.f_iosize field is not correctly populated, which in turn
  causes us to mark valid aio operations as unsafe (because the io size is
  set to 0), ultimately causing the aio_test:md_waitcomplete test to fail.
  
  Sponsored by: Axiado

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

Modified: stable/11/sys/kern/vfs_mountroot.c
==
--- stable/11/sys/kern/vfs_mountroot.c  Fri Oct 18 03:38:01 2019
(r353716)
+++ stable/11/sys/kern/vfs_mountroot.c  Fri Oct 18 03:38:02 2019
(r353717)
@@ -258,6 +258,11 @@ vfs_mountroot_devfs(struct thread *td, struct mount **
if (error)
return (error);
 
+   error = VFS_STATFS(mp, >mnt_stat);
+   KASSERT(error == 0, ("VFS_STATFS(devfs) failed %d", error));
+   if (error)
+   return (error);
+
opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK);
TAILQ_INIT(opts);
mp->mnt_opt = opts;
___
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: r353715 - head/sys/netpfil/pf

2019-10-17 Thread Kristof Provost
Author: kp
Date: Fri Oct 18 03:36:26 2019
New Revision: 353715
URL: https://svnweb.freebsd.org/changeset/base/353715

Log:
  pf: Must be in NET_EPOCH to call icmp_error
  
  icmp_reflect(), called through icmp_error() requires us to be in NET_EPOCH.
  Failure to hold it leads to the following panic (with INVARIANTS):
  
panic: Assertion in_epoch(net_epoch_preempt) failed at 
/usr/src/sys/netinet/ip_icmp.c:742
cpuid = 2
time = 1571233273
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe00e0977920
vpanic() at vpanic+0x17e/frame 0xfe00e0977980
panic() at panic+0x43/frame 0xfe00e09779e0
icmp_reflect() at icmp_reflect+0x625/frame 0xfe00e0977aa0
icmp_error() at icmp_error+0x720/frame 0xfe00e0977b10
pf_intr() at pf_intr+0xd5/frame 0xfe00e0977b50
ithread_loop() at ithread_loop+0x1c6/frame 0xfe00e0977bb0
fork_exit() at fork_exit+0x80/frame 0xfe00e0977bf0
fork_trampoline() at fork_trampoline+0xe/frame 0xfe00e0977bf0
  
  Note that we now enter NET_EPOCH twice if we enter ip_output() from pf_intr(),
  but ip_output() will soon be converted to a function that requires epoch, so
  entering NET_EPOCH directly from pf_intr() makes more sense.
  
  Discussed with:   glebius@

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cFri Oct 18 03:01:21 2019(r353714)
+++ head/sys/netpfil/pf/pf.cFri Oct 18 03:36:26 2019(r353715)
@@ -1428,6 +1428,7 @@ pf_send(struct pf_send_entry *pfse)
 void
 pf_intr(void *v)
 {
+   struct epoch_tracker et;
struct pf_send_head queue;
struct pf_send_entry *pfse, *next;
 
@@ -1438,6 +1439,8 @@ pf_intr(void *v)
STAILQ_INIT(_pf_sendqueue);
PF_SENDQ_UNLOCK();
 
+   NET_EPOCH_ENTER(et);
+
STAILQ_FOREACH_SAFE(pfse, , pfse_next, next) {
switch (pfse->pfse_type) {
 #ifdef INET
@@ -1464,6 +1467,7 @@ pf_intr(void *v)
}
free(pfse, M_PFTEMP);
}
+   NET_EPOCH_EXIT(et);
CURVNET_RESTORE();
 }
 
___
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: r353714 - head/sys/dev/nvdimm

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Fri Oct 18 03:01:21 2019
New Revision: 353714
URL: https://svnweb.freebsd.org/changeset/base/353714

Log:
  nvdimm_e820: Fix braino in size=all SPA hint
  
  The sentinel value for "use the rest of the region," -1, isn't zero modulo
  PAGE_SIZE.  Relax the check to permit the intended special value.
  
  X-MFC-With:   r353110
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/nvdimm/nvdimm_e820.c

Modified: head/sys/dev/nvdimm/nvdimm_e820.c
==
--- head/sys/dev/nvdimm/nvdimm_e820.c   Fri Oct 18 02:25:30 2019
(r353713)
+++ head/sys/dev/nvdimm/nvdimm_e820.c   Fri Oct 18 03:01:21 2019
(r353714)
@@ -138,8 +138,8 @@ nvdimm_e820_create_spas(device_t dev)
 
hintaddr = (vm_paddr_t)hintaddrl;
hintsize = (vm_size_t)hintsizel;
-   if ((hintaddr & PAGE_MASK) != 0 || (hintsize & PAGE_MASK) != 0)
-   {
+   if ((hintaddr & PAGE_MASK) != 0 ||
+   ((hintsize & PAGE_MASK) != 0 && hintsize != HINT_ALL)) {
device_printf(dev, "hint.nvdimm_spa.%u addr or size "
"not page aligned\n", i);
continue;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353713 - head/sys/x86/x86

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Fri Oct 18 02:25:30 2019
New Revision: 353713
URL: https://svnweb.freebsd.org/changeset/base/353713

Log:
  x86: Remove unused variable from r353712
  
  It was in my git tree (uncommitted) and didn't get carried over to SVN in
  r353712.
  
  X-MFC-With:   r353712

Modified:
  head/sys/x86/x86/tsc.c

Modified: head/sys/x86/x86/tsc.c
==
--- head/sys/x86/x86/tsc.c  Fri Oct 18 02:18:17 2019(r353712)
+++ head/sys/x86/x86/tsc.c  Fri Oct 18 02:25:30 2019(r353713)
@@ -228,7 +228,6 @@ tsc_freq_intel(void)
 static void
 probe_tsc_freq(void)
 {
-   u_int regs[4];
uint64_t tsc1, tsc2;
uint16_t bootflags;
 
___
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: r353712 - in head/sys/x86: include x86

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Fri Oct 18 02:18:17 2019
New Revision: 353712
URL: https://svnweb.freebsd.org/changeset/base/353712

Log:
  x86: Fetch and save standard CPUID leaf 6 in identcpu
  
  Rather than a few scattered places in the tree.  Organize flag names in a
  contiguous region of specialreg.h.
  
  While here, delete deprecated PCOMMIT from leaf 7.
  
  No functional change.

Modified:
  head/sys/x86/include/specialreg.h
  head/sys/x86/include/x86_var.h
  head/sys/x86/x86/identcpu.c
  head/sys/x86/x86/local_apic.c
  head/sys/x86/x86/tsc.c

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Fri Oct 18 01:46:38 2019
(r353711)
+++ head/sys/x86/include/specialreg.h   Fri Oct 18 02:18:17 2019
(r353712)
@@ -183,21 +183,6 @@
 #defineCPUID2_RDRAND   0x4000
 #defineCPUID2_HV   0x8000
 
-/*
- * Important bits in the Thermal and Power Management flags
- * CPUID.6 EAX and ECX.
- */
-#defineCPUTPM1_SENSOR  0x0001
-#defineCPUTPM1_TURBO   0x0002
-#defineCPUTPM1_ARAT0x0004
-#defineCPUTPM1_HWP 0x0080
-#defineCPUTPM1_HWP_NOTIFICATION0x0100
-#defineCPUTPM1_HWP_ACTIVITY_WINDOW 0x0200
-#defineCPUTPM1_HWP_PERF_PREF   0x0400
-#defineCPUTPM1_HWP_PKG 0x0800
-#defineCPUTPM1_HWP_FLEXIBLE0x0002
-#defineCPUTPM2_EFFREQ  0x0001
-
 /* Intel Processor Trace CPUID. */
 
 /* Leaf 0 ebx. */
@@ -326,11 +311,35 @@
 #defineMWAIT_INTRBREAK 0x0001
 
 /*
- * CPUID instruction 6 ecx info
+ * CPUID leaf 6: Thermal and Power management.
  */
-#defineCPUID_PERF_STAT 0x0001
-#defineCPUID_PERF_BIAS 0x0008
+/* Eax. */
+#defineCPUTPM1_SENSOR  0x0001
+#defineCPUTPM1_TURBO   0x0002
+#defineCPUTPM1_ARAT0x0004
+#defineCPUTPM1_PLN 0x0010
+#defineCPUTPM1_ECMD0x0020
+#defineCPUTPM1_PTM 0x0040
+#defineCPUTPM1_HWP 0x0080
+#defineCPUTPM1_HWP_NOTIFICATION0x0100
+#defineCPUTPM1_HWP_ACTIVITY_WINDOW 0x0200
+#defineCPUTPM1_HWP_PERF_PREF   0x0400
+#defineCPUTPM1_HWP_PKG 0x0800
+#defineCPUTPM1_HDC 0x2000
+#defineCPUTPM1_TURBO30 0x4000
+#defineCPUTPM1_HWP_CAPABILITIES0x8000
+#defineCPUTPM1_HWP_PECI_OVR0x0001
+#defineCPUTPM1_HWP_FLEXIBLE0x0002
+#defineCPUTPM1_HWP_FAST_MSR0x0004
+#defineCPUTPM1_HWP_IGN_IDLE0x0010
 
+/* Ebx. */
+#defineCPUTPM_B_NSENSINTTHRESH 0x000f
+
+/* Ecx. */
+#defineCPUID_PERF_STAT 0x0001
+#defineCPUID_PERF_BIAS 0x0008
+
 /* 
  * CPUID instruction 0xb ebx info.
  */
@@ -419,7 +428,7 @@
 #defineCPUID_STDEXT_ADX0x0008
 #defineCPUID_STDEXT_SMAP   0x0010
 #defineCPUID_STDEXT_AVX512IFMA 0x0020
-#defineCPUID_STDEXT_PCOMMIT0x0040
+/* Formerly PCOMMIT */
 #defineCPUID_STDEXT_CLFLUSHOPT 0x0080
 #defineCPUID_STDEXT_CLWB   0x0100
 #defineCPUID_STDEXT_PROCTRACE  0x0200

Modified: head/sys/x86/include/x86_var.h
==
--- head/sys/x86/include/x86_var.h  Fri Oct 18 01:46:38 2019
(r353711)
+++ head/sys/x86/include/x86_var.h  Fri Oct 18 02:18:17 2019
(r353712)
@@ -67,6 +67,10 @@ extern   u_int   cpu_mon_mwait_flags;
 extern u_int   cpu_mon_min_size;
 extern u_int   cpu_mon_max_size;
 extern u_int   cpu_maxphyaddr;
+extern u_int   cpu_power_eax;
+extern u_int   cpu_power_ebx;
+extern u_int   cpu_power_ecx;
+extern u_int   cpu_power_edx;
 extern charctx_switch_xsave[];
 extern u_int   hv_base;
 extern u_int   hv_high;

Modified: head/sys/x86/x86/identcpu.c
==
--- head/sys/x86/x86/identcpu.c Fri Oct 18 01:46:38 2019(r353711)
+++ head/sys/x86/x86/identcpu.c Fri Oct 18 02:18:17 2019(r353712)
@@ -118,6 +118,10 @@ u_int  cpu_mon_mwait_flags;/* MONITOR/MWAIT flags 
(CPU
 u_int  cpu_mon_min_size;   /* MONITOR minimum range size, bytes */
 u_int  cpu_mon_max_size;   /* MONITOR minimum range size, bytes */
 u_int  cpu_maxphyaddr; /* Max phys addr width in bits */
+u_int  cpu_power_eax;  /* 06H: Power management leaf, %eax */
+u_int  cpu_power_ebx;  /* 06H: Power management leaf, %eax */
+u_int  cpu_power_ecx;  /* 06H: Power management leaf, 

svn commit: r353711 - head/lib/clang/libllvm

2019-10-17 Thread Mitchell Horne
Author: mhorne
Date: Fri Oct 18 01:46:38 2019
New Revision: 353711
URL: https://svnweb.freebsd.org/changeset/base/353711

Log:
  Fix build of LLVM RISC-V backend
  
  Reviewed by:  dim
  MFC with: r353358
  Differential Revision:https://reviews.freebsd.org/D21963

Modified:
  head/lib/clang/libllvm/Makefile

Modified: head/lib/clang/libllvm/Makefile
==
--- head/lib/clang/libllvm/Makefile Fri Oct 18 00:19:45 2019
(r353710)
+++ head/lib/clang/libllvm/Makefile Fri Oct 18 01:46:38 2019
(r353711)
@@ -1185,6 +1185,7 @@ SRCS_MIN+=Target/RISCV/RISCVRegisterInfo.cpp
 SRCS_MIN+= Target/RISCV/RISCVSubtarget.cpp
 SRCS_MIN+= Target/RISCV/RISCVTargetMachine.cpp
 SRCS_MIN+= Target/RISCV/RISCVTargetObjectFile.cpp
+SRCS_MIN+= Target/RISCV/RISCVTargetTransformInfo.cpp
 SRCS_MIN+= Target/RISCV/TargetInfo/RISCVTargetInfo.cpp
 SRCS_MIN+= Target/RISCV/Utils/RISCVBaseInfo.cpp
 SRCS_MIN+= Target/RISCV/Utils/RISCVMatInt.cpp
___
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: r353708 - in releng/12.1: release/pkg_repos sys/conf

2019-10-17 Thread Glen Barber
Author: gjb
Date: Fri Oct 18 00:00:11 2019
New Revision: 353708
URL: https://svnweb.freebsd.org/changeset/base/353708

Log:
  - Update releng/12.1 from RC1 to RC2 as part of the 12.1-RELEASE
cycle.
  - Update the dvd1.iso pkg(8) configuration to use the release_1
package set to populate the dvd.
  
  Approved by:  re (implicit)
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  releng/12.1/release/pkg_repos/release-dvd.conf
  releng/12.1/sys/conf/newvers.sh

Modified: releng/12.1/release/pkg_repos/release-dvd.conf
==
--- releng/12.1/release/pkg_repos/release-dvd.conf  Thu Oct 17 23:48:29 
2019(r353707)
+++ releng/12.1/release/pkg_repos/release-dvd.conf  Fri Oct 18 00:00:11 
2019(r353708)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 release: {
-  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_1;,
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",

Modified: releng/12.1/sys/conf/newvers.sh
==
--- releng/12.1/sys/conf/newvers.sh Thu Oct 17 23:48:29 2019
(r353707)
+++ releng/12.1/sys/conf/newvers.sh Fri Oct 18 00:00:11 2019
(r353708)
@@ -46,7 +46,7 @@
 
 TYPE="FreeBSD"
 REVISION="12.1"
-BRANCH="RC1"
+BRANCH="RC2"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353709 - head/lib/libz

2019-10-17 Thread Brooks Davis
Author: brooks
Date: Fri Oct 18 00:00:17 2019
New Revision: 353709
URL: https://svnweb.freebsd.org/changeset/base/353709

Log:
  Remove obsolete, non-use of CLANG_NO_IAS.
  
  CLANG_NO_IAS was removed in r351661.

Modified:
  head/lib/libz/Makefile

Modified: head/lib/libz/Makefile
==
--- head/lib/libz/Makefile  Fri Oct 18 00:00:11 2019(r353708)
+++ head/lib/libz/Makefile  Fri Oct 18 00:00:17 2019(r353709)
@@ -68,6 +68,3 @@ FILES=zlib.pc
 FILESDIR=  ${LIBDATADIR}/pkgconfig
 
 .include 
-
-## XXX: clang integrated-as doesn't grok .intel_syntax directives yet
-#ACFLAGS.gvmat64.S=${CLANG_NO_IAS}
___
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: r353707 - stable/12/usr.sbin/bhyve

2019-10-17 Thread John Baldwin
Author: jhb
Date: Thu Oct 17 23:48:29 2019
New Revision: 353707
URL: https://svnweb.freebsd.org/changeset/base/353707

Log:
  MFC 348472: Whitespace cleanups, no functional change.

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

Modified: stable/12/usr.sbin/bhyve/pci_emul.c
==
--- stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:29:52 2019
(r353706)
+++ stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:48:29 2019
(r353707)
@@ -56,8 +56,8 @@ __FBSDID("$FreeBSD$");
 #include "pci_irq.h"
 #include "pci_lpc.h"
 
-#define CONF1_ADDR_PORT0x0cf8
-#define CONF1_DATA_PORT0x0cfc
+#define CONF1_ADDR_PORT   0x0cf8
+#define CONF1_DATA_PORT   0x0cfc
 
 #define CONF1_ENABLE  0x8000ul
 
@@ -479,7 +479,7 @@ modify_bar_registration(struct pci_devinst *pi, int id
iop.handler = pci_emul_io_handler;
iop.arg = pi;
error = register_inout();
-   } else 
+   } else
error = unregister_inout();
break;
case PCIBAR_MEM32:
@@ -547,7 +547,7 @@ memen(struct pci_devinst *pi)
  * the address range decoded by the BAR register.
  */
 static void
-update_bar_address(struct  pci_devinst *pi, uint64_t addr, int idx, int type)
+update_bar_address(struct pci_devinst *pi, uint64_t addr, int idx, int type)
 {
int decode;
 
@@ -673,7 +673,7 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, 
pdi->pi_bar[idx + 1].type = PCIBAR_MEMHI64;
pci_set_cfgdata32(pdi, PCIR_BAR(idx + 1), bar >> 32);
}
-   
+
cmd = pci_get_cfgdata16(pdi, PCIR_COMMAND);
if ((cmd & enbit) != enbit)
pci_set_cfgdata16(pdi, PCIR_COMMAND, cmd | enbit);
@@ -848,7 +848,7 @@ pci_emul_add_msixcap(struct pci_devinst *pi, int msgnu
 
assert(msgnum >= 1 && msgnum <= MAX_MSIX_TABLE_ENTRIES);
assert(barnum >= 0 && barnum <= PCIR_MAX_BAR_0);
-   
+
tab_size = msgnum * MSIX_TABLE_ENTRY_SIZE;
 
/* Align table size to nearest 4K */
@@ -1106,7 +1106,7 @@ init_pci(struct vmctx *ctx)
for (bus = 0; bus < MAXBUSES; bus++) {
if ((bi = pci_businfo[bus]) == NULL)
continue;
-   /* 
+   /*
 * Keep track of the i/o and memory resources allocated to
 * this bus.
 */
@@ -1726,9 +1726,9 @@ pci_emul_cmd_changed(struct pci_devinst *pi, uint16_t 
else
unregister_bar(pi, i);
}
-   break; 
+   break;
default:
-   assert(0); 
+   assert(0);
}
}
 
@@ -1970,7 +1970,7 @@ INOUT_PORT(pci_cfgdata, CONF1_DATA_PORT+3, IOPORT_F_IN
 #define DIOSZ  8
 #define DMEMSZ 4096
 struct pci_emul_dsoftc {
-   uint8_t   ioregs[DIOSZ];
+   uint8_t   ioregs[DIOSZ];
uint8_t   memregs[2][DMEMSZ];
 };
 
@@ -2062,7 +2062,7 @@ pci_emul_diow(struct vmctx *ctx, int vcpu, struct pci_
} else {
printf("diow: memw unknown size %d\n", size);
}
-   
+
/*
 * magic interrupt ??
 */
@@ -2087,7 +2087,7 @@ pci_emul_dior(struct vmctx *ctx, int vcpu, struct pci_
   offset, size);
return (0);
}
-   
+
value = 0;
if (size == 1) {
value = sc->ioregs[offset];
@@ -2106,7 +2106,7 @@ pci_emul_dior(struct vmctx *ctx, int vcpu, struct pci_
   offset, size);
return (0);
}
-   
+
i = baridx - 1; /* 'memregs' index */
 
if (size == 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"


Re: svn commit: r353635 - in head/sys: netinet netinet6

2019-10-17 Thread Hans Petter Selasky

On 2019-10-17 17:08, Gleb Smirnoff wrote:

On Wed, Oct 16, 2019 at 10:46:44PM +0200, Hans Petter Selasky wrote:
H> > as far as I remember I was against this changeset and I had
H> > several other developers agreed that this should be fixed in
H> > different way. Why did you proceed with checking it in? :(
H>
H> Hi Gleb,
H>
H> This issue has been discussed in-depth at various transport meetings and
H> we have agreed on a solution.

Is the list of people who agreed longer than "Reviewed by" list?


Yes.



H> Are you seeing something broken as of this patch?

As I already explained, first, we are dropping absolutely legitimate
packets. At the time of arrival there were nothing wrong about them.
This is idelogically wrong from viewpoint of abstract network stack.


No packets are dropped. This was the initial version of my patch. Please 
re-read the history of the differential revision.



Second, the problem should be fixed in a different way: when we put
packets on the queue, we should take all important values out of the
ifnet and store them on queue entry.


No, this won't work. Sometimes you need to send an ICMP error message 
back, but to which interface? You cannot use unit-numbers (risking the 
packet goes to wrong interface) nor pointers, which then can point to 
freed memory.


--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: r353706 - stable/12/usr.sbin/bhyve

2019-10-17 Thread John Baldwin
Author: jhb
Date: Thu Oct 17 23:29:52 2019
New Revision: 353706
URL: https://svnweb.freebsd.org/changeset/base/353706

Log:
  MFC 348779:
  Keep the shadow PCIR_COMMAND synced with the real one for pass through.
  
  This ensures that bhyve properly recognizes when decoding is disabled
  for BARs on passthru devices.  To properly handle writes to the
  register, export a pci_emul_cmd_changed function from pci_emul.c that
  the pass through device model invokes for config writes that change
  PCIR_COMMAND.

Modified:
  stable/12/usr.sbin/bhyve/pci_emul.c
  stable/12/usr.sbin/bhyve/pci_emul.h
  stable/12/usr.sbin/bhyve/pci_passthru.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/pci_emul.c
==
--- stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:26:39 2019
(r353705)
+++ stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:29:52 2019
(r353706)
@@ -1686,33 +1686,20 @@ pci_emul_hdrtype_fixup(int bus, int slot, int off, int
}
 }
 
-static void
-pci_emul_cmdsts_write(struct pci_devinst *pi, int coff, uint32_t new, int 
bytes)
+/*
+ * Update device state in response to changes to the PCI command
+ * register.
+ */
+void
+pci_emul_cmd_changed(struct pci_devinst *pi, uint16_t old)
 {
-   int i, rshift;
-   uint32_t cmd, cmd2, changed, old, readonly;
+   int i;
+   uint16_t changed, new;
 
-   cmd = pci_get_cfgdata16(pi, PCIR_COMMAND);  /* stash old value */
+   new = pci_get_cfgdata16(pi, PCIR_COMMAND);
+   changed = old ^ new;
 
/*
-* From PCI Local Bus Specification 3.0 sections 6.2.2 and 6.2.3.
-*
-* XXX Bits 8, 11, 12, 13, 14 and 15 in the status register are
-* 'write 1 to clear'. However these bits are not set to '1' by
-* any device emulation so it is simpler to treat them as readonly.
-*/
-   rshift = (coff & 0x3) * 8;
-   readonly = 0xF880 >> rshift;
-
-   old = CFGREAD(pi, coff, bytes);
-   new &= ~readonly;
-   new |= (old & readonly);
-   CFGWRITE(pi, coff, new, bytes); /* update config */
-
-   cmd2 = pci_get_cfgdata16(pi, PCIR_COMMAND); /* get updated value */
-   changed = cmd ^ cmd2;
-
-   /*
 * If the MMIO or I/O address space decoding has changed then
 * register/unregister all BARs that decode that address space.
 */
@@ -1724,7 +1711,7 @@ pci_emul_cmdsts_write(struct pci_devinst *pi, int coff
case PCIBAR_IO:
/* I/O address space decoding changed? */
if (changed & PCIM_CMD_PORTEN) {
-   if (porten(pi))
+   if (new & PCIM_CMD_PORTEN)
register_bar(pi, i);
else
unregister_bar(pi, i);
@@ -1734,7 +1721,7 @@ pci_emul_cmdsts_write(struct pci_devinst *pi, int coff
case PCIBAR_MEM64:
/* MMIO address space decoding changed? */
if (changed & PCIM_CMD_MEMEN) {
-   if (memen(pi))
+   if (new & PCIM_CMD_MEMEN)
register_bar(pi, i);
else
unregister_bar(pi, i);
@@ -1750,6 +1737,32 @@ pci_emul_cmdsts_write(struct pci_devinst *pi, int coff
 * interrupt.
 */
pci_lintr_update(pi);
+}
+
+static void
+pci_emul_cmdsts_write(struct pci_devinst *pi, int coff, uint32_t new, int 
bytes)
+{
+   int rshift;
+   uint32_t cmd, old, readonly;
+
+   cmd = pci_get_cfgdata16(pi, PCIR_COMMAND);  /* stash old value */
+
+   /*
+* From PCI Local Bus Specification 3.0 sections 6.2.2 and 6.2.3.
+*
+* XXX Bits 8, 11, 12, 13, 14 and 15 in the status register are
+* 'write 1 to clear'. However these bits are not set to '1' by
+* any device emulation so it is simpler to treat them as readonly.
+*/
+   rshift = (coff & 0x3) * 8;
+   readonly = 0xF880 >> rshift;
+
+   old = CFGREAD(pi, coff, bytes);
+   new &= ~readonly;
+   new |= (old & readonly);
+   CFGWRITE(pi, coff, new, bytes); /* update config */
+
+   pci_emul_cmd_changed(pi, cmd);
 }
 
 static void

Modified: stable/12/usr.sbin/bhyve/pci_emul.h
==
--- stable/12/usr.sbin/bhyve/pci_emul.h Thu Oct 17 23:26:39 2019
(r353705)
+++ stable/12/usr.sbin/bhyve/pci_emul.h Thu Oct 17 23:29:52 2019
(r353706)
@@ -223,6 +223,7 @@ int pci_emul_alloc_pbar(struct pci_devinst *pdi, int i
  

svn commit: r353705 - stable/12/usr.sbin/bhyve

2019-10-17 Thread John Baldwin
Author: jhb
Date: Thu Oct 17 23:26:39 2019
New Revision: 353705
URL: https://svnweb.freebsd.org/changeset/base/353705

Log:
  MFC 348778,348998: Enable memory and I/O decoding in PCI devices on demand.
  
  348778:
  Enable memory and I/O decoding in PCI devices on demand.
  
  Rather than uncoditionally setting the MEMEN and PORTEN bits in
  PCIR_COMMAND for PCI devices, set the respective bit when the first
  BAR of a given type is added to the device.  This more closely matches
  what firmware does on bare metal.
  
  BUSMASTEREN is still set unconditionally.  Eventually this bit should
  move into the device models as not all device models need this set.
  
  348998:
  Remove a spurious break when setting up a 64-bit memory BAR.
  
  This was causing 'enbit' to not be initialized in this case.

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

Modified: stable/12/usr.sbin/bhyve/pci_emul.c
==
--- stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:22:00 2019
(r353704)
+++ stable/12/usr.sbin/bhyve/pci_emul.c Thu Oct 17 23:26:39 2019
(r353705)
@@ -586,6 +586,7 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, 
 {
int error;
uint64_t *baseptr, limit, addr, mask, lobits, bar;
+   uint16_t cmd, enbit;
 
assert(idx >= 0 && idx <= PCI_BARMAX);
 
@@ -604,13 +605,14 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, 
switch (type) {
case PCIBAR_NONE:
baseptr = NULL;
-   addr = mask = lobits = 0;
+   addr = mask = lobits = enbit = 0;
break;
case PCIBAR_IO:
baseptr = _emul_iobase;
limit = PCI_EMUL_IOLIMIT;
mask = PCIM_BAR_IO_BASE;
lobits = PCIM_BAR_IO_SPACE;
+   enbit = PCIM_CMD_PORTEN;
break;
case PCIBAR_MEM64:
/*
@@ -632,19 +634,20 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, 
mask = PCIM_BAR_MEM_BASE;
lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_64 |
 PCIM_BAR_MEM_PREFETCH;
-   break;
} else {
baseptr = _emul_membase32;
limit = PCI_EMUL_MEMLIMIT32;
mask = PCIM_BAR_MEM_BASE;
lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_64;
}
+   enbit = PCIM_CMD_MEMEN;
break;
case PCIBAR_MEM32:
baseptr = _emul_membase32;
limit = PCI_EMUL_MEMLIMIT32;
mask = PCIM_BAR_MEM_BASE;
lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_32;
+   enbit = PCIM_CMD_MEMEN;
break;
default:
printf("pci_emul_alloc_base: invalid bar type %d\n", type);
@@ -671,6 +674,9 @@ pci_emul_alloc_pbar(struct pci_devinst *pdi, int idx, 
pci_set_cfgdata32(pdi, PCIR_BAR(idx + 1), bar >> 32);
}

+   cmd = pci_get_cfgdata16(pdi, PCIR_COMMAND);
+   if ((cmd & enbit) != enbit)
+   pci_set_cfgdata16(pdi, PCIR_COMMAND, cmd | enbit);
register_bar(pdi, idx);
 
return (0);
@@ -756,8 +762,7 @@ pci_emul_init(struct vmctx *ctx, struct pci_devemu *pd
pci_set_cfgdata8(pdi, PCIR_INTLINE, 255);
pci_set_cfgdata8(pdi, PCIR_INTPIN, 0);
 
-   pci_set_cfgdata8(pdi, PCIR_COMMAND,
-   PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
+   pci_set_cfgdata8(pdi, PCIR_COMMAND, PCIM_CMD_BUSMASTEREN);
 
err = (*pde->pe_init)(ctx, pdi, fi->fi_param);
if (err == 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: r353704 - stable/12/usr.sbin/bhyve

2019-10-17 Thread John Baldwin
Author: jhb
Date: Thu Oct 17 23:22:00 2019
New Revision: 353704
URL: https://svnweb.freebsd.org/changeset/base/353704

Log:
  MFC 348253: Add initial support for 'qSupported' to the debug server.
  
  This doesn't recognize any features yet, but does parse the features
  string.  It advertises an arbitrary packet size of 4k.

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

Modified: stable/12/usr.sbin/bhyve/gdb.c
==
--- stable/12/usr.sbin/bhyve/gdb.c  Thu Oct 17 23:17:56 2019
(r353703)
+++ stable/12/usr.sbin/bhyve/gdb.c  Thu Oct 17 23:22:00 2019
(r353704)
@@ -991,13 +991,72 @@ command_equals(const uint8_t *data, size_t len, const 
 }
 
 static void
+check_features(const uint8_t *data, size_t len)
+{
+   char *feature, *next_feature, *str, *value;
+   bool supported;
+
+   str = malloc(len + 1);
+   memcpy(str, data, len);
+   str[len] = '\0';
+   next_feature = str;
+
+   while ((feature = strsep(_feature, ";")) != NULL) {
+   /*
+* Null features shouldn't exist, but skip if they
+* do.
+*/
+   if (strcmp(feature, "") == 0)
+   continue;
+
+   /*
+* Look for the value or supported / not supported
+* flag.
+*/
+   value = strchr(feature, '=');
+   if (value != NULL) {
+   *value = '\0';
+   value++;
+   supported = true;
+   } else {
+   value = feature + strlen(feature) - 1;
+   switch (*value) {
+   case '+':
+   supported = true;
+   break;
+   case '-':
+   supported = false;
+   break;
+   default:
+   /*
+* This is really a protocol error,
+* but we just ignore malformed
+* features for ease of
+* implementation.
+*/
+   continue;
+   }
+   value = NULL;
+   }
+
+   /* No currently supported features. */
+   }
+   free(str);
+
+   start_packet();
+
+   /* This is an arbitrary limit. */
+   append_string("PacketSize=4096");
+   finish_packet();
+}
+
+static void
 gdb_query(const uint8_t *data, size_t len)
 {
 
/*
 * TODO:
 * - qSearch
-* - qSupported
 */
if (command_equals(data, len, "qAttached")) {
start_packet();
@@ -1035,6 +1094,10 @@ gdb_query(const uint8_t *data, size_t len)
start_packet();
append_char('l');
finish_packet();
+   } else if (command_equals(data, len, "qSupported")) {
+   data += strlen("qSupported");
+   len -= strlen("qSupported");
+   check_features(data, len);
} else if (command_equals(data, len, "qThreadExtraInfo")) {
char buf[16];
int tid;
___
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: r353703 - stable/12/usr.sbin/bhyve

2019-10-17 Thread John Baldwin
Author: jhb
Date: Thu Oct 17 23:17:56 2019
New Revision: 353703
URL: https://svnweb.freebsd.org/changeset/base/353703

Log:
  MFC 348212,348712: Add support for writing to guest memory in the debug 
server.
  
  348212:
  Add support for writing to guest memory in the debug server.
  
  - Add a write_mem counterpart to read_mem to handle writes to MMIO.
  - Add support for the GDB 'M' packet to write bytes to the guest's
memory.  For MMIO writes, attempt to batch writes up into words.
This is imprecise, but if you write a single 2 or 4-byte aligned
word, it should be treated as a single MMIO write operation.
  - While here, tidy up the parsing of the 'm' command used for reading
memory to match 'M'.
  
  348712:
  Use parse_integer to avoid sign extension.
  
  Coverity warned about gdb_write_mem sign extending the result of
  parse_byte shifted left by 24 bits when generating a 32-bit memory
  write value for MMIO.  Simplify the code by using parse_integer
  instead of unrolled parse_byte calls.

Modified:
  stable/12/usr.sbin/bhyve/gdb.c
  stable/12/usr.sbin/bhyve/mem.c
  stable/12/usr.sbin/bhyve/mem.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/gdb.c
==
--- stable/12/usr.sbin/bhyve/gdb.c  Thu Oct 17 22:37:25 2019
(r353702)
+++ stable/12/usr.sbin/bhyve/gdb.c  Thu Oct 17 23:17:56 2019
(r353703)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #ifndef WITHOUT_CAPSICUM
 #include 
 #endif
+#include 
 #include 
 #include 
 #include 
@@ -768,15 +769,24 @@ gdb_read_mem(const uint8_t *data, size_t len)
bool started;
int error;
 
+   /* Skip 'm' */
+   data += 1;
+   len -= 1;
+
+   /* Parse and consume address. */
cp = memchr(data, ',', len);
-   if (cp == NULL) {
+   if (cp == NULL || cp == data) {
send_error(EINVAL);
return;
}
-   gva = parse_integer(data + 1, cp - (data + 1));
-   resid = parse_integer(cp + 1, len - (cp + 1 - data));
-   started = false;
+   gva = parse_integer(data, cp - data);
+   len -= (cp - data) + 1;
+   data += (cp - data) + 1;
 
+   /* Parse length. */
+   resid = parse_integer(data, len);
+
+   started = false;
while (resid > 0) {
error = guest_vaddr2paddr(cur_vcpu, gva, );
if (error == -1) {
@@ -862,6 +872,115 @@ gdb_read_mem(const uint8_t *data, size_t len)
finish_packet();
 }
 
+static void
+gdb_write_mem(const uint8_t *data, size_t len)
+{
+   uint64_t gpa, gva, val;
+   uint8_t *cp;
+   size_t resid, todo, bytes;
+   int error;
+
+   /* Skip 'M' */
+   data += 1;
+   len -= 1;
+
+   /* Parse and consume address. */
+   cp = memchr(data, ',', len);
+   if (cp == NULL || cp == data) {
+   send_error(EINVAL);
+   return;
+   }
+   gva = parse_integer(data, cp - data);
+   len -= (cp - data) + 1;
+   data += (cp - data) + 1;
+
+   /* Parse and consume length. */
+   cp = memchr(data, ':', len);
+   if (cp == NULL || cp == data) {
+   send_error(EINVAL);
+   return;
+   }
+   resid = parse_integer(data, cp - data);
+   len -= (cp - data) + 1;
+   data += (cp - data) + 1;
+
+   /* Verify the available bytes match the length. */
+   if (len != resid * 2) {
+   send_error(EINVAL);
+   return;
+   }
+
+   while (resid > 0) {
+   error = guest_vaddr2paddr(cur_vcpu, gva, );
+   if (error == -1) {
+   send_error(errno);
+   return;
+   }
+   if (error == 0) {
+   send_error(EFAULT);
+   return;
+   }
+
+   /* Write bytes to current page. */
+   todo = getpagesize() - gpa % getpagesize();
+   if (todo > resid)
+   todo = resid;
+
+   cp = paddr_guest2host(ctx, gpa, todo);
+   if (cp != NULL) {
+   /*
+* If this page is guest RAM, write it a byte
+* at a time.
+*/
+   while (todo > 0) {
+   assert(len >= 2);
+   *cp = parse_byte(data);
+   data += 2;
+   len -= 2;
+   cp++;
+   gpa++;
+   gva++;
+   resid--;
+   todo--;
+   }
+   } else {
+   /*
+* If this page isn't guest RAM, try to handle
+* it via MMIO.  For MMIO requests, use
+ 

svn commit: r353702 - head/sys/gdb

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 22:37:25 2019
New Revision: 353702
URL: https://svnweb.freebsd.org/changeset/base/353702

Log:
  gdb(4): Implement support for NoAckMode
  
  When the underlying debugport transport is reliable, GDB's additional
  checksums and acknowledgements are redundant.  NoAckMode eliminates the
  the acks and allows us to skip checking RX checksums.  The GDB packet
  framing does not change, so unfortunately (valid) checksums are still
  included as message trailers.
  
  The gdb(4) stub in FreeBSD advertises support for the feature in response to
  the client's 'qSupported' request IFF the current debugport has the
  gdb_dbfeatures flag GDB_DBGP_FEAT_RELIABLE set.  Currently, only netgdb(4)
  supports this feature.
  
  If the remote GDB client supports the feature and does not have it disabled
  via a GDB configuration knob, it may instruct our gdb(4) stub to enter
  NoAckMode.  Unless and until it issues that command, we must continue to
  transmit acks as usual (and for now, we continue to wait until we receive
  them as well, even if we know the debugport is on a reliable transport).
  
  In the kernel sources, the sense of the flag representing the state of the
  feature is reversed from that of the GDB command.  (I.e., it is
  'gdb_ackmode', not 'gdb_noackmode.')  This is to avoid confusing double-
  negative conditions.
  
  For reference, see:
* https://sourceware.org/gdb/onlinedocs/gdb/Packet-Acknowledgment.html
* 
https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#QStartNoAckMode
  
  Reviewed by:  jhb, markj (both earlier version)
  Differential Revision:https://reviews.freebsd.org/D21761

Modified:
  head/sys/gdb/gdb.h
  head/sys/gdb/gdb_int.h
  head/sys/gdb/gdb_main.c
  head/sys/gdb/gdb_packet.c
  head/sys/gdb/netgdb.c

Modified: head/sys/gdb/gdb.h
==
--- head/sys/gdb/gdb.h  Thu Oct 17 21:39:23 2019(r353701)
+++ head/sys/gdb/gdb.h  Thu Oct 17 22:37:25 2019(r353702)
@@ -55,6 +55,9 @@ struct gdb_dbgport {
   deadcode and never invoked for so
   long I don't want to just blindly
   start invoking it without opt-in. */
+#defineGDB_DBGP_FEAT_RELIABLE  0x2 /* The debugport promises it is 
a
+  reliable transport, which allows GDB
+  acks to be turned off. */
 
 #defineGDB_DBGPORT(name, probe, init, term, getc, putc)
\
static struct gdb_dbgport name##_gdb_dbgport = {\

Modified: head/sys/gdb/gdb_int.h
==
--- head/sys/gdb/gdb_int.h  Thu Oct 17 21:39:23 2019(r353701)
+++ head/sys/gdb/gdb_int.h  Thu Oct 17 22:37:25 2019(r353702)
@@ -54,6 +54,8 @@ extern char *gdb_rxp;
 extern size_t gdb_rxsz;
 extern char *gdb_txp;
 
+extern bool gdb_ackmode;
+
 #ifdef DDB
 /* If set, return to DDB when controlling GDB detaches. */
 extern bool gdb_return_to_ddb;
@@ -132,6 +134,20 @@ static __inline void
 gdb_tx_varhex(uintmax_t n)
 {
gdb_txp += sprintf(gdb_txp, "%jx", n);
+}
+
+static __inline void
+gdb_nack(void)
+{
+   if (gdb_ackmode)
+   gdb_cur->gdb_putc('-');
+}
+
+static __inline void
+gdb_ack(void)
+{
+   if (gdb_ackmode)
+   gdb_cur->gdb_putc('+');
 }
 
 #endif /* !_GDB_GDB_INT_H_ */

Modified: head/sys/gdb/gdb_main.c
==
--- head/sys/gdb/gdb_main.c Thu Oct 17 21:39:23 2019(r353701)
+++ head/sys/gdb/gdb_main.c Thu Oct 17 22:37:25 2019(r353702)
@@ -57,6 +57,7 @@ SET_DECLARE(gdb_dbgport_set, struct gdb_dbgport);
 
 struct gdb_dbgport *gdb_cur = NULL;
 int gdb_listening = 0;
+bool gdb_ackmode = true;
 
 static unsigned char gdb_bindata[64];
 
@@ -262,6 +263,14 @@ gdb_do_qsupported(uint32_t *feat)
gdb_tx_str(";qXfer:threads:read+");
 
/*
+* If the debugport is a reliable transport, request No Ack mode from
+* the server.  The server may or may not choose to enter No Ack mode.
+* https://sourceware.org/gdb/onlinedocs/gdb/Packet-Acknowledgment.html
+*/
+   if (gdb_cur->gdb_dbfeatures & GDB_DBGP_FEAT_RELIABLE)
+   gdb_tx_str(";QStartNoAckMode+");
+
+   /*
 * Future consideration:
 *   - vCont
 *   - multiprocess
@@ -610,6 +619,8 @@ gdb_trap(int type, int code)
}
 
gdb_listening = 0;
+   gdb_ackmode = true;
+
/*
 * Send a T packet. We currently do not support watchpoints (the
 * awatch, rwatch or watch elements).
@@ -759,6 +770,22 @@ gdb_trap(int type, int code)
} else if (gdb_rx_equal("Search:memory:")) {
  

svn commit: r353701 - head/sys/conf

2019-10-17 Thread Mark Johnston
Author: markj
Date: Thu Oct 17 21:39:23 2019
New Revision: 353701
URL: https://svnweb.freebsd.org/changeset/base/353701

Log:
  Add an ldscript for amd64 kernel modules.
  
  Use it to pad the text and read-only data sections to a 4KB boundary.
  This will be used to enforce strict memory protections for some
  sections of loadable kernel modules.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21970

Added:
  head/sys/conf/ldscript.kmod.amd64   (contents, props changed)

Added: head/sys/conf/ldscript.kmod.amd64
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/conf/ldscript.kmod.amd64   Thu Oct 17 21:39:23 2019
(r353701)
@@ -0,0 +1,48 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Mark Johnston 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+ /*
+  * Coalesce executable and read-only sections, and pad to page alignment so
+  * that memory protections can be strictly enforced.
+  */
+
+SECTIONS
+{
+   .text   :
+   {
+   *(.text .text.*)
+   . = ALIGN(CONSTANT(COMMONPAGESIZE));
+   }
+
+   .rodata :
+   {
+   *(.rodata .rodata.*)
+   . = ALIGN(CONSTANT(COMMONPAGESIZE));
+   }
+}
___
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: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 21:33:01 2019
New Revision: 353700
URL: https://svnweb.freebsd.org/changeset/base/353700

Log:
  Implement NetGDB(4)
  
  NetGDB(4) is a component of a system using a panic-time network stack to
  remotely debug crashed FreeBSD kernels over the network, instead of
  traditional serial interfaces.
  
  There are three pieces in the complete NetGDB system.
  
  First, a dedicated proxy server must be running to accept connections from
  both NetGDB and gdb(1), and pass bidirectional traffic between the two
  protocols.
  
  Second, the NetGDB client is activated much like ordinary 'gdb' and
  similarly to 'netdump' in ddb(4) after a panic.  Like other debugnet(4)
  clients (netdump(4)), the network interface on the route to the proxy server
  must be online and support debugnet(4).
  
  Finally, the remote (k)gdb(1) uses 'target remote :' (like any
  other TCP remote) to connect to the proxy server.
  
  The NetGDB v1 protocol speaks the literal GDB remote serial protocol, and
  uses a 1:1 relationship between GDB packets and sequences of debugnet
  packets (fragmented by MTU).  There is no encryption utilized to keep
  debugging sessions private, so this is only appropriate for local
  segments or trusted networks.
  
  Submitted by: John Reimer  (earlier version)
  Discussed some with:  emaste, markj
  Relnotes: sure
  Differential Revision:https://reviews.freebsd.org/D21568

Added:
  head/share/man/man4/netgdb.4   (contents, props changed)
  head/sys/gdb/netgdb.c   (contents, props changed)
  head/sys/gdb/netgdb.h   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/share/man/man4/ddb.4
  head/sys/amd64/conf/GENERIC
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options
  head/sys/gdb/gdb.h
  head/sys/gdb/gdb_int.h
  head/sys/gdb/gdb_main.c
  head/sys/gdb/gdb_packet.c
  head/sys/i386/conf/GENERIC
  head/sys/kern/subr_kdb.c
  head/sys/net/debugnet.c
  head/sys/net/debugnet.h
  head/sys/net/debugnet_inet.c
  head/sys/net/debugnet_int.h
  head/sys/sys/kdb.h
  head/sys/sys/param.h

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileThu Oct 17 21:25:50 2019
(r353699)
+++ head/share/man/man4/MakefileThu Oct 17 21:33:01 2019
(r353700)
@@ -307,6 +307,7 @@ MAN=aac.4 \
net80211.4 \
netdump.4 \
netfpga10g_nf10bmac.4 \
+   netgdb.4 \
netgraph.4 \
netintro.4 \
netmap.4 \

Modified: head/share/man/man4/ddb.4
==
--- head/share/man/man4/ddb.4   Thu Oct 17 21:25:50 2019(r353699)
+++ head/share/man/man4/ddb.4   Thu Oct 17 21:33:01 2019(r353700)
@@ -1211,6 +1211,15 @@ Finally, the
 .Ic netdump
 command does not provide any way to configure compression or encryption.
 .Pp
+.It Ic netgdb Fl s Ar server Oo Fl g Ar gateway Fl c Ar client Fl i Ar iface Oc
+Initiate a
+.Xr netgdb 4
+session with the provided parameters.
+.Pp
+.Ic netgdb
+has identical limitations to
+.Ic netdump .
+.Pp
 .It Ic capture on
 .It Ic capture off
 .It Ic capture reset

Added: head/share/man/man4/netgdb.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/netgdb.4Thu Oct 17 21:33:01 2019
(r353700)
@@ -0,0 +1,147 @@
+.\"-
+.\" Copyright (c) 2019 Conrad Meyer 
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 17, 2019
+.Dt NETGDB 4
+.Os
+.Sh NAME
+.Nm netgdb
+.Nd protocol for 

svn commit: r353699 - head/sys/kern

2019-10-17 Thread Mark Johnston
Author: markj
Date: Thu Oct 17 21:25:50 2019
New Revision: 353699
URL: https://svnweb.freebsd.org/changeset/base/353699

Log:
  Clean up some nits in link_elf_(un)load_file().
  
  - Remove a redundant assignment of ef->address.
  - Don't return a Mach error number to the caller if vm_map_find() fails.
  - Use ptoa() and fix style.
  
  MFC after:2 weeks
  Sponsored by: Netflix

Modified:
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cThu Oct 17 20:46:33 2019
(r353698)
+++ head/sys/kern/link_elf_obj.cThu Oct 17 21:25:50 2019
(r353699)
@@ -779,7 +779,6 @@ link_elf_load_file(linker_class_t cls, const char *fil
error = ENOMEM;
goto out;
}
-   ef->address = (caddr_t) vm_map_min(kernel_map);
 
/*
 * In order to satisfy amd64's architectural requirements on the
@@ -794,9 +793,10 @@ link_elf_load_file(linker_class_t cls, const char *fil
error = vm_map_find(kernel_map, ef->object, 0, ,
round_page(mapsize), 0, VMFS_OPTIMAL_SPACE, VM_PROT_ALL,
VM_PROT_ALL, 0);
-   if (error) {
+   if (error != KERN_SUCCESS) {
vm_object_deallocate(ef->object);
-   ef->object = 0;
+   ef->object = NULL;
+   error = ENOMEM;
goto out;
}
 
@@ -1084,11 +1084,9 @@ link_elf_unload_file(linker_file_t file)
free(ef->relatab, M_LINKER);
free(ef->progtab, M_LINKER);
 
-   if (ef->object) {
-   vm_map_remove(kernel_map, (vm_offset_t) ef->address,
-   (vm_offset_t) ef->address +
-   (ef->object->size << PAGE_SHIFT));
-   }
+   if (ef->object != NULL)
+   vm_map_remove(kernel_map, (vm_offset_t)ef->address,
+   (vm_offset_t)ef->address + ptoa(ef->object->size));
free(ef->e_shdr, M_LINKER);
free(ef->ddbsymtab, M_LINKER);
free(ef->ddbstrtab, M_LINKER);
___
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: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm

2019-10-17 Thread Ian Lepore
On Thu, 2019-10-17 at 13:05 -0600, Alan Somers wrote:
> On Thu, Oct 17, 2019 at 12:48 PM Ian Lepore  wrote:
> 
> > On Thu, 2019-10-17 at 12:17 -0600, Alan Somers wrote:
> > > There might be something wrong with my environment:
> > > /usr/include/libcasper.h is absent.  But still, shouldn't the
> > > build
> > > be
> > > using the version from the source tree, instead of from the
> > > environment?
> > > -Alan
> > > 
> > 
> > There should be copies of libcasper.h in your objdir:
> > 
> > obj/arm.armv7/tmp/legacy/usr/include/libcasper.h
> > obj/arm.armv7/tmp/usr/include/libcasper.h
> > 
> > -- Ian
> 
> 
> Uh, I found the problem.  I had WITHOUT_CASPER=1 in
> /etc/src.conf.  So the
> problem is that nm can't build without casper.  Perhaps the #include
> should
> be guarded, as it is in usr.bin/kdump/kdump.c.  But plenty of other
> programs, like usr.bin/tail and usr.bin/wc, don't have such
> guards.  And
> looking at lib/libcasper/libcasper/Makefile, it seems as though
> libcasper.h
> should be installed regardless.  So I still need to figure out why it
> wasn't installed on my system.
> 
> -Alan

It's probably because Makefile.inc1 contains:

.if ${MK_CASPER} != "no"
_lib_casper=lib/libcasper
.endif

so WITHOUT_CASPER means that the libcasper dir isn't even visited when
prebuilding libs.  But you need to visit that dir so that it can
install the header file (but not the lib, because MK_CASPER will be
"no").  I think lib/libcasper just needs to be unconditionally listed
as one of the prebuild libs in Makefile.inc1.

-- Ian

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


Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm

2019-10-17 Thread Mark Johnston
On Thu, Oct 17, 2019 at 01:05:42PM -0600, Alan Somers wrote:
> On Thu, Oct 17, 2019 at 12:48 PM Ian Lepore  wrote:
> 
> > On Thu, 2019-10-17 at 12:17 -0600, Alan Somers wrote:
> > > There might be something wrong with my environment:
> > > /usr/include/libcasper.h is absent.  But still, shouldn't the build
> > > be
> > > using the version from the source tree, instead of from the
> > > environment?
> > > -Alan
> > >
> >
> > There should be copies of libcasper.h in your objdir:
> >
> > obj/arm.armv7/tmp/legacy/usr/include/libcasper.h
> > obj/arm.armv7/tmp/usr/include/libcasper.h
> >
> > -- Ian
> 
> 
> Uh, I found the problem.  I had WITHOUT_CASPER=1 in /etc/src.conf.  So the
> problem is that nm can't build without casper.  Perhaps the #include should
> be guarded, as it is in usr.bin/kdump/kdump.c.  But plenty of other
> programs, like usr.bin/tail and usr.bin/wc, don't have such guards.  And
> looking at lib/libcasper/libcasper/Makefile, it seems as though libcasper.h
> should be installed regardless.  So I still need to figure out why it
> wasn't installed on my system.

Indeed, "make -C usr.bin/nm WITHOUT_CASPER=" builds fine for me.
libcasper.h provides stub routines unless WITH_CASPER is defined in the
preprocessor, so applications which make use of casper must define this
symbol unless the make variable WITHOUT_CASPER is set.
___
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: r353698 - head/sys/sys

2019-10-17 Thread Mark Johnston
Author: markj
Date: Thu Oct 17 20:46:33 2019
New Revision: 353698
URL: https://svnweb.freebsd.org/changeset/base/353698

Log:
  Belatedly bump __FreeBSD_version for r353537 and related commits.
  
  At least one small update to the out-of-tree DRM drivers is required
  now that cdev_pager_free_page() expects an xbusy page.
  
  Discussed with:   jeff, zeising

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hThu Oct 17 20:40:06 2019(r353697)
+++ head/sys/sys/param.hThu Oct 17 20:46:33 2019(r353698)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300051  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300052  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r353697 - head/stand/efi/loader

2019-10-17 Thread Simon J. Gerraty
Author: sjg
Date: Thu Oct 17 20:40:06 2019
New Revision: 353697
URL: https://svnweb.freebsd.org/changeset/base/353697

Log:
  Allow loader.efi to identify non-standard boot setup
  
  PATH_BOOTABLE_TOKEN can be set to a non-standard
  path that identifies a device as bootable.
  
  Reviewed by: kevans, bcran
  Differential Revision:  https://reviews.freebsd.org/D22062

Modified:
  head/stand/efi/loader/main.c

Modified: head/stand/efi/loader/main.c
==
--- head/stand/efi/loader/main.cThu Oct 17 20:25:15 2019
(r353696)
+++ head/stand/efi/loader/main.cThu Oct 17 20:40:06 2019
(r353697)
@@ -239,6 +239,9 @@ sanity_check_currdev(void)
struct stat st;
 
return (stat(PATH_DEFAULTS_LOADER_CONF, ) == 0 ||
+#ifdef PATH_BOOTABLE_TOKEN
+   stat(PATH_BOOTABLE_TOKEN, ) == 0 || /* non-standard layout */
+#endif
stat(PATH_KERNEL, ) == 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: r353696 - in head/sys: net netinet/netdump

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 20:25:15 2019
New Revision: 353696
URL: https://svnweb.freebsd.org/changeset/base/353696

Log:
  debugnet(4): Add optional full-duplex mode
  
  It remains unattached to any client protocol.  Netdump is unaffected
  (remaining half-duplex).  The intended consumer is NetGDB.
  
  Submitted by: John Reimer  (earlier version)
  Discussed with:   markj
  Differential Revision:https://reviews.freebsd.org/D21541

Modified:
  head/sys/net/debugnet.c
  head/sys/net/debugnet.h
  head/sys/net/debugnet_int.h
  head/sys/netinet/netdump/netdump_client.c

Modified: head/sys/net/debugnet.c
==
--- head/sys/net/debugnet.c Thu Oct 17 20:18:07 2019(r353695)
+++ head/sys/net/debugnet.c Thu Oct 17 20:25:15 2019(r353696)
@@ -175,7 +175,7 @@ debugnet_udp_output(struct debugnet_pcb *pcb, struct m
udp = mtod(m, void *);
udp->uh_ulen = htons(m->m_pkthdr.len);
/* Use this src port so that the server can connect() the socket */
-   udp->uh_sport = htons(pcb->dp_client_ack_port);
+   udp->uh_sport = htons(pcb->dp_client_port);
udp->uh_dport = htons(pcb->dp_server_port);
/* Computed later (protocol-dependent). */
udp->uh_sum = 0;
@@ -183,6 +183,28 @@ debugnet_udp_output(struct debugnet_pcb *pcb, struct m
return (debugnet_ip_output(pcb, m));
 }
 
+static int
+debugnet_ack_output(struct debugnet_pcb *pcb, uint32_t seqno /* net endian */)
+{
+   struct debugnet_ack *dn_ack;
+   struct mbuf *m;
+
+   DNETDEBUG("Acking with seqno %u\n", ntohl(seqno));
+
+   m = m_gethdr(M_NOWAIT, MT_DATA);
+   if (m == NULL) {
+   printf("%s: Out of mbufs\n", __func__);
+   return (ENOBUFS);
+   }
+   m->m_len = sizeof(*dn_ack);
+   m->m_pkthdr.len = sizeof(*dn_ack);
+   MH_ALIGN(m, sizeof(*dn_ack));
+   dn_ack = mtod(m, void *);
+   dn_ack->da_seqno = seqno;
+
+   return (debugnet_udp_output(pcb, m));
+}
+
 /*
  * Dummy free function for debugnet clusters.
  */
@@ -216,6 +238,9 @@ debugnet_send(struct debugnet_pcb *pcb, uint32_t type,
uint32_t i, pktlen, sent_so_far;
int retries, polls, error;
 
+   if (pcb->dp_state == DN_STATE_REMOTE_CLOSED)
+   return (ECONNRESET);
+
want_acks = 0;
pcb->dp_rcvd_acks = 0;
retries = 0;
@@ -307,6 +332,8 @@ retransmit:
}
debugnet_network_poll(pcb->dp_ifp);
DELAY(500);
+   if (pcb->dp_state == DN_STATE_REMOTE_CLOSED)
+   return (ECONNRESET);
}
pcb->dp_seqno += i;
return (0);
@@ -316,7 +343,63 @@ retransmit:
  * Network input primitives.
  */
 
+/*
+ * Just introspect the header enough to fire off a seqno ack and validate
+ * length fits.
+ */
 static void
+debugnet_handle_rx_msg(struct debugnet_pcb *pcb, struct mbuf **mb)
+{
+   const struct debugnet_msg_hdr *dnh;
+   struct mbuf *m;
+   int error;
+
+   m = *mb;
+
+   if (m->m_pkthdr.len < sizeof(*dnh)) {
+   DNETDEBUG("ignoring small debugnet_msg packet\n");
+   return;
+   }
+
+   /* Get ND header. */
+   if (m->m_len < sizeof(*dnh)) {
+   m = m_pullup(m, sizeof(*dnh));
+   *mb = m;
+   if (m == NULL) {
+   DNETDEBUG("m_pullup failed\n");
+   return;
+   }
+   }
+   dnh = mtod(m, const void *);
+
+   if (ntohl(dnh->mh_len) + sizeof(*dnh) > m->m_pkthdr.len) {
+   DNETDEBUG("Dropping short packet.\n");
+   return;
+   }
+
+   /*
+* If the issue is transient (ENOBUFS), sender should resend.  If
+* non-transient (like driver objecting to rx -> tx from the same
+* thread), not much else we can do.
+*/
+   error = debugnet_ack_output(pcb, dnh->mh_seqno);
+   if (error != 0)
+   return;
+
+   if (ntohl(dnh->mh_type) == DEBUGNET_FINISHED) {
+   printf("Remote shut down the connection on us!\n");
+   pcb->dp_state = DN_STATE_REMOTE_CLOSED;
+
+   /*
+* Continue through to the user handler so they are signalled
+* not to wait for further rx.
+*/
+   }
+
+   pcb->dp_rx_handler(pcb, mb);
+}
+
+static void
 debugnet_handle_ack(struct debugnet_pcb *pcb, struct mbuf **mb, uint16_t sport)
 {
const struct debugnet_ack *dn_ack;
@@ -325,10 +408,6 @@ debugnet_handle_ack(struct debugnet_pcb *pcb, struct m
 
m = *mb;
 
-   if (m->m_pkthdr.len < sizeof(*dn_ack)) {
-   DNETDEBUG("ignoring small ACK packet\n");
-   return;
-   }
/* Get Ack. */
if (m->m_len < sizeof(*dn_ack)) {
m = m_pullup(m, sizeof(*dn_ack));
@@ -363,7 +442,7 @@ debugnet_handle_udp(struct 

svn commit: r353695 - head/sys/net

2019-10-17 Thread Gleb Smirnoff
Author: glebius
Date: Thu Oct 17 20:18:07 2019
New Revision: 353695
URL: https://svnweb.freebsd.org/changeset/base/353695

Log:
  Revert two parts of r353292 that enter epoch when processing vlan 
capabilities.
  It could be that entering epoch isn't necessary here, but better take a
  conservative approach.
  
  Submitted by: kp

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Thu Oct 17 20:10:32 2019(r353694)
+++ head/sys/net/if_vlan.c  Thu Oct 17 20:18:07 2019(r353695)
@@ -1625,14 +1625,16 @@ vlan_setflags(struct ifnet *ifp, int status)
 static void
 vlan_link_state(struct ifnet *ifp)
 {
+   struct epoch_tracker et;
struct ifvlantrunk *trunk;
struct ifvlan *ifv;
 
-   NET_EPOCH_ASSERT();
-
+   NET_EPOCH_ENTER(et);
trunk = ifp->if_vlantrunk;
-   if (trunk == NULL)
+   if (trunk == NULL) {
+   NET_EPOCH_EXIT(et);
return;
+   }
 
TRUNK_WLOCK(trunk);
VLAN_FOREACH(ifv, trunk) {
@@ -1641,6 +1643,7 @@ vlan_link_state(struct ifnet *ifp)
trunk->parent->if_link_state);
}
TRUNK_WUNLOCK(trunk);
+   NET_EPOCH_EXIT(et);
 }
 
 static void
@@ -1770,6 +1773,7 @@ vlan_capabilities(struct ifvlan *ifv)
 static void
 vlan_trunk_capabilities(struct ifnet *ifp)
 {
+   struct epoch_tracker et;
struct ifvlantrunk *trunk;
struct ifvlan *ifv;
 
@@ -1779,8 +1783,10 @@ vlan_trunk_capabilities(struct ifnet *ifp)
VLAN_SUNLOCK();
return;
}
+   NET_EPOCH_ENTER(et);
VLAN_FOREACH(ifv, trunk)
vlan_capabilities(ifv);
+   NET_EPOCH_EXIT(et);
VLAN_SUNLOCK();
 }
 
___
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: r353694 - in head: share/man/man4 sys/net sys/netinet/netdump

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 20:10:32 2019
New Revision: 353694
URL: https://svnweb.freebsd.org/changeset/base/353694

Log:
  debugnet(4): Infer non-server connection parameters
  
  Loosen requirements for connecting to debugnet-type servers.  Only require a
  destination address; the rest can theoretically be inferred from the routing
  table.
  
  Relax corresponding constraints in netdump(4) and move ifp validation to
  debugnet connection time.
  
  Submitted by: John Reimer  (earlier version)
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D21482

Modified:
  head/share/man/man4/ddb.4
  head/sys/net/debugnet.c
  head/sys/net/debugnet.h
  head/sys/net/debugnet_int.h
  head/sys/netinet/netdump/netdump_client.c

Modified: head/share/man/man4/ddb.4
==
--- head/share/man/man4/ddb.4   Thu Oct 17 19:53:55 2019(r353693)
+++ head/share/man/man4/ddb.4   Thu Oct 17 20:10:32 2019(r353694)
@@ -1192,7 +1192,7 @@ In remote GDB mode, another machine is required that r
 using the remote debug feature, with a connection to the serial
 console port on the target machine.
 .Pp
-.It Ic netdump Fl s Ar server Oo Fl g Ar gateway Oc Fl c Ar client Fl i Ar 
iface
+.It Ic netdump Fl s Ar server Oo Fl g Ar gateway Fl c Ar client Fl i Ar iface 
Oc
 Configure
 .Xr netdump 4
 with the provided parameters, and immediately perform a netdump.

Modified: head/sys/net/debugnet.c
==
--- head/sys/net/debugnet.c Thu Oct 17 19:53:55 2019(r353693)
+++ head/sys/net/debugnet.c Thu Oct 17 20:10:32 2019(r353694)
@@ -491,8 +491,12 @@ debugnet_free(struct debugnet_pcb *pcb)
MPASS(pcb == _dnet_pcb);
 
ifp = pcb->dp_ifp;
-   ifp->if_input = pcb->dp_drv_input;
-   ifp->if_debugnet_methods->dn_event(ifp, DEBUGNET_END);
+   if (ifp != NULL) {
+   if (pcb->dp_drv_input != NULL)
+   ifp->if_input = pcb->dp_drv_input;
+   if (pcb->dp_event_started)
+   ifp->if_debugnet_methods->dn_event(ifp, DEBUGNET_END);
+   }
debugnet_mbuf_finish();
 
g_debugnet_pcb_inuse = false;
@@ -527,8 +531,87 @@ debugnet_connect(const struct debugnet_conn_params *dc
/* Switch to the debugnet mbuf zones. */
debugnet_mbuf_start();
 
+   /* At least one needed parameter is missing; infer it. */
+   if (pcb->dp_client == INADDR_ANY || pcb->dp_gateway == INADDR_ANY ||
+   pcb->dp_ifp == NULL) {
+   struct sockaddr_in dest_sin, *gw_sin, *local_sin;
+   struct rtentry *dest_rt;
+   struct ifnet *rt_ifp;
+
+   memset(_sin, 0, sizeof(dest_sin));
+   dest_sin = (struct sockaddr_in) {
+   .sin_len = sizeof(dest_sin),
+   .sin_family = AF_INET,
+   .sin_addr.s_addr = pcb->dp_server,
+   };
+
+   CURVNET_SET(vnet0);
+   dest_rt = rtalloc1((struct sockaddr *)_sin, 0,
+   RTF_RNH_LOCKED);
+   CURVNET_RESTORE();
+
+   if (dest_rt == NULL) {
+   db_printf("%s: Could not get route for that server.\n",
+   __func__);
+   error = ENOENT;
+   goto cleanup;
+   }
+
+   if (dest_rt->rt_gateway->sa_family == AF_INET)
+   gw_sin = (struct sockaddr_in *)dest_rt->rt_gateway;
+   else {
+   if (dest_rt->rt_gateway->sa_family == AF_LINK)
+   DNETDEBUG("Destination address is on link.\n");
+   gw_sin = NULL;
+   }
+
+   MPASS(dest_rt->rt_ifa->ifa_addr->sa_family == AF_INET);
+   local_sin = (struct sockaddr_in *)dest_rt->rt_ifa->ifa_addr;
+
+   rt_ifp = dest_rt->rt_ifp;
+
+   if (pcb->dp_client == INADDR_ANY)
+   pcb->dp_client = local_sin->sin_addr.s_addr;
+   if (pcb->dp_gateway == INADDR_ANY && gw_sin != NULL)
+   pcb->dp_gateway = gw_sin->sin_addr.s_addr;
+   if (pcb->dp_ifp == NULL)
+   pcb->dp_ifp = rt_ifp;
+
+   RTFREE_LOCKED(dest_rt);
+   }
+
ifp = pcb->dp_ifp;
+
+   if (debugnet_debug > 0) {
+   char serbuf[INET_ADDRSTRLEN], clibuf[INET_ADDRSTRLEN],
+   gwbuf[INET_ADDRSTRLEN];
+   inet_ntop(AF_INET, >dp_server, serbuf, sizeof(serbuf));
+   inet_ntop(AF_INET, >dp_client, clibuf, sizeof(clibuf));
+   if (pcb->dp_gateway != INADDR_ANY)
+   inet_ntop(AF_INET, >dp_gateway, gwbuf, 
sizeof(gwbuf));
+   DNETDEBUG("Connecting to %s:%d%s%s from %s:%d on %s\n",
+   

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

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 19:53:55 2019
New Revision: 353693
URL: https://svnweb.freebsd.org/changeset/base/353693

Log:
  acpica: Fix for the fix, unfortunately
  
  Follow-up to incomplete pedantic change in r353691 by actually fixing the
  default implementation to match the interface type.  Mea culpa.
  
  X-MFC-With:   r353691, r339754

Modified:
  head/sys/dev/acpica/acpi_if.m

Modified: head/sys/dev/acpica/acpi_if.m
==
--- head/sys/dev/acpica/acpi_if.m   Thu Oct 17 19:49:20 2019
(r353692)
+++ head/sys/dev/acpica/acpi_if.m   Thu Oct 17 19:53:55 2019
(r353693)
@@ -61,11 +61,11 @@ HEADER {
 # Default implementation for acpi_id_probe().
 #
 CODE {
-   static char *
+   static int
acpi_generic_id_probe(device_t bus, device_t dev, char **ids,
char **match)
{
-   return (NULL);
+   return (ENXIO);
}
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353692 - in head: share/man/man4 sys/net sys/netinet/netdump

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 19:49:20 2019
New Revision: 353692
URL: https://svnweb.freebsd.org/changeset/base/353692

Log:
  Add ddb(4) 'netdump' command to netdump a core without preconfiguration
  
  Add a 'X -s  -c  [-g ] -i ' subroutine
  to the generic debugnet code.  The imagined use is both netdump, shown here,
  and NetGDB (vaporware).  It uses the ddb(4) lexer, with some new extensions,
  to parse out IPv4 addresses.
  
  'Netdump' uses the generic debugnet routine to load a configuration and
  start a dump, without any netdump configuration prior to panic.
  
  Loosely derived from work by: John Reimer 
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D21460

Modified:
  head/share/man/man4/ddb.4
  head/share/man/man4/netdump.4
  head/sys/net/debugnet.c
  head/sys/net/debugnet.h
  head/sys/netinet/netdump/netdump_client.c

Modified: head/share/man/man4/ddb.4
==
--- head/share/man/man4/ddb.4   Thu Oct 17 18:45:11 2019(r353691)
+++ head/share/man/man4/ddb.4   Thu Oct 17 19:49:20 2019(r353692)
@@ -24,43 +24,9 @@
 .\" any improvements or extensions that they make and grant Carnegie Mellon
 .\" the rights to redistribute these changes.
 .\"
-.\" changed a \# to #, since groff choked on it.
-.\"
-.\" HISTORY
-.\" ddb.4,v
-.\" Revision 1.1  1993/07/15  18:41:02  brezak
-.\" Man page for DDB
-.\"
-.\" Revision 2.6  92/04/08  08:52:57  rpd
-.\"Changes from OSF.
-.\"[92/01/17  14:19:22  jsb]
-.\"Changes for OSF debugger modifications.
-.\"[91/12/12tak]
-.\"
-.\" Revision 2.5  91/06/25  13:50:22  rpd
-.\"Added some watchpoint explanation.
-.\"[91/06/25rpd]
-.\"
-.\" Revision 2.4  91/06/17  15:47:31  jsb
-.\"Added documentation for continue/c, match, search, and watchpoints.
-.\"I've not actually explained what a watchpoint is; maybe Rich can
-.\"do that (hint, hint).
-.\"[91/06/17  10:58:08  jsb]
-.\"
-.\" Revision 2.3  91/05/14  17:04:23  mrt
-.\"Correcting copyright
-.\"
-.\" Revision 2.2  91/02/14  14:10:06  mrt
-.\"Changed to new Mach copyright
-.\"[91/02/12  18:10:12  mrt]
-.\"
-.\" Revision 2.2  90/08/30  14:23:15  dbg
-.\"Created.
-.\"[90/08/30dbg]
-.\"
 .\" $FreeBSD$
 .\"
-.Dd October 10, 2019
+.Dd October 17, 2019
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -212,7 +178,12 @@ arrow keys may be used to
 browse through the history buffer, and move the cursor within the
 current line.
 .Sh COMMANDS
+.Ss COMMON DEBUGGER COMMANDS
 .Bl -tag -width indent -compact
+.It Ic help
+Print a short summary of the available commands and command
+abbreviations.
+.Pp
 .It Xo
 .Ic examine Ns Op Li / Ns Cm AISabcdghilmorsuxz ...
 .Oo Ar addr Oc Ns Op , Ns Ar count
@@ -396,6 +367,9 @@ command, or by omitting
 to get the default address of
 .Va dot .
 .Pp
+.It Ic halt
+Halt the system.
+.Pp
 .It Ic watch Oo Ar addr Oc Ns Op , Ns Ar size
 Set a watchpoint for a region.
 Execution stops when an attempt to modify the region occurs.
@@ -429,6 +403,20 @@ its use on user mode address spaces.
 .It Ic dhwatch Oo Ar addr Oc Ns Op , Ns Ar size
 Delete specified hardware watchpoint.
 .Pp
+.It Ic kill Ar sig pid
+Send signal
+.Ar sig
+to process
+.Ar pid .
+The signal is acted on upon returning from the debugger.
+This command can be used to kill a process causing resource contention
+in the case of a hung system.
+See
+.Xr signal 3
+for a list of signals.
+Note that the arguments are reversed relative to
+.Xr kill 2 .
+.Pp
 .It Ic step Ns Oo Li / Ns Cm p Oc Ns Op , Ns Ar count
 .It Ic sNs Oo Li / Ns Cm p Oc Ns Op , Ns Ar count
 Single step
@@ -529,6 +517,25 @@ The optional
 argument limits the search.
 .\"
 .Pp
+.It Ic reboot Op Ar seconds
+.It Ic reset Op Ar seconds
+Hard reset the system.
+If the optional argument
+.Ar seconds
+is given, the debugger will wait for this long, at most a week,
+before rebooting.
+.Pp
+.It Ic thread Ar addr | tid
+Switch the debugger to the thread with ID
+.Ar tid ,
+if the argument is a decimal number, or address
+.Ar addr ,
+otherwise.
+.El
+.Pp
+.Ss SPECIALIZED HELPER COMMANDS
+.Pp
+.Bl -tag -width indent -compact
 .It Xo
 .Ic findstack
 .Ar addr
@@ -1174,47 +1181,36 @@ Shows watchpoints set with "watch" command.
 Shows information about lock acquisition coming from the
 .Xr witness 4
 subsystem.
-.\"
+.El
 .Pp
+.Ss OFFLINE DEBUGGING COMMANDS
+.Bl -tag -width indent -compact
 .It Ic gdb
-Toggles between remote GDB and DDB mode.
+Switches to remote GDB mode.
 In remote GDB mode, another machine is required that runs
 .Xr gdb 1
 using the remote debug feature, with a connection to the serial
 console port on the target machine.
-Currently only available on the
-i386
-architecture.
 .Pp
-.It Ic halt
-Halt the system.
+.It Ic netdump Fl s Ar server Oo Fl g Ar gateway Oc Fl c Ar client Fl i Ar 
iface
+Configure
+.Xr netdump 4
+with the provided parameters, and immediately perform a netdump.
 

Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm

2019-10-17 Thread Alan Somers
On Thu, Oct 17, 2019 at 12:48 PM Ian Lepore  wrote:

> On Thu, 2019-10-17 at 12:17 -0600, Alan Somers wrote:
> > There might be something wrong with my environment:
> > /usr/include/libcasper.h is absent.  But still, shouldn't the build
> > be
> > using the version from the source tree, instead of from the
> > environment?
> > -Alan
> >
>
> There should be copies of libcasper.h in your objdir:
>
> obj/arm.armv7/tmp/legacy/usr/include/libcasper.h
> obj/arm.armv7/tmp/usr/include/libcasper.h
>
> -- Ian


Uh, I found the problem.  I had WITHOUT_CASPER=1 in /etc/src.conf.  So the
problem is that nm can't build without casper.  Perhaps the #include should
be guarded, as it is in usr.bin/kdump/kdump.c.  But plenty of other
programs, like usr.bin/tail and usr.bin/wc, don't have such guards.  And
looking at lib/libcasper/libcasper/Makefile, it seems as though libcasper.h
should be installed regardless.  So I still need to figure out why it
wasn't installed on my system.

-Alan
___
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: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm

2019-10-17 Thread Ian Lepore
On Thu, 2019-10-17 at 12:17 -0600, Alan Somers wrote:
> There might be something wrong with my environment:
> /usr/include/libcasper.h is absent.  But still, shouldn't the build
> be
> using the version from the source tree, instead of from the
> environment?
> -Alan
> 

There should be copies of libcasper.h in your objdir:

obj/arm.armv7/tmp/legacy/usr/include/libcasper.h
obj/arm.armv7/tmp/usr/include/libcasper.h

-- Ian

> On Thu, Oct 17, 2019 at 11:48 AM Mark Johnston 
> wrote:
> 
> > On Thu, Oct 17, 2019 at 11:37:44AM -0600, Alan Somers wrote:
> > > On Mon, Sep 30, 2019 at 11:28 AM Mark Johnston  > > >
> > 
> > wrote:
> > > 
> > > > Author: markj
> > > > Date: Mon Sep 30 17:27:59 2019
> > > > New Revision: 352909
> > > > URL: https://svnweb.freebsd.org/changeset/base/352909
> > > > 
> > > > Log:
> > > >   Capsicumize nm(1).
> > > > 
> > > >   Reviewed by:  emaste
> > > >   Sponsored by: The FreeBSD Foundation
> > > >   Differential Revision:
> > > > https://reviews.freebsd.org/D21107
> > > > 
> > > > Modified:
> > > >   head/contrib/elftoolchain/nm/nm.c
> > > >   head/usr.bin/nm/Makefile
> > > > 
> > > 
> > > I can no longer build world after this change.  I think nm is
> > > being built
> > > before libcasper, because I don't see libcasper.h in my object
> > > directory.
> > > Has anybody else had this problem?
> > > 
> > > In file included from
> > > /usr/home/somers/freebsd/base/head/contrib/elftoolchain/nm/nm.c:3
> > > 2:
> > > /usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h'
> > > file
> > 
> > not
> > > found
> > > #include 
> > >  ^
> > > 1 error generated.
> > > *** [nm.o] Error code 1
> > > 
> > > make[3]: stopped in /usr/home/somers/freebsd/base/head/usr.bin/nm
> > > 1 error
> > 
> > Could you share the full build log somewhere?  I haven't seen any
> > other
> > reports of this, and other elftoolchain utilities have been making
> > use
> > of libcasper for a long time.
> > 

___
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: r353691 - head/sys/dev/acpica

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 18:45:11 2019
New Revision: 353691
URL: https://svnweb.freebsd.org/changeset/base/353691

Log:
  acpica: Match ID_PROBE default implementation to interface
  
  After r339754, the additional interface parameter was accidentally left out
  of the default acpi_generic_id_probe implementation.  Apparently this does
  not cause any real problems, so this fix is mostly stylistic.
  
  No functional change intended.
  
  X-MFC-With:   r339754

Modified:
  head/sys/dev/acpica/acpi_if.m

Modified: head/sys/dev/acpica/acpi_if.m
==
--- head/sys/dev/acpica/acpi_if.m   Thu Oct 17 18:29:44 2019
(r353690)
+++ head/sys/dev/acpica/acpi_if.m   Thu Oct 17 18:45:11 2019
(r353691)
@@ -62,7 +62,8 @@ HEADER {
 #
 CODE {
static char *
-   acpi_generic_id_probe(device_t bus, device_t dev, char **ids)
+   acpi_generic_id_probe(device_t bus, device_t dev, char **ids,
+   char **match)
{
return (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: r353690 - in head/sys: kern sys

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 18:29:44 2019
New Revision: 353690
URL: https://svnweb.freebsd.org/changeset/base/353690

Log:
  Add a very limited DDB dumpon(8)-alike to MI dumper code
  
  This allows ddb(4) commands to construct a static dumperinfo during
  panic/debug and invoke doadump(false) using the provided dumper
  configuration (always inserted first in the list).
  
  The intended usecase is a ddb(4)-time netdump(4) command.
  
  Reviewed by:  markj (earlier version)
  Differential Revision:https://reviews.freebsd.org/D21448

Modified:
  head/sys/kern/kern_shutdown.c
  head/sys/sys/conf.h

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Thu Oct 17 17:48:32 2019
(r353689)
+++ head/sys/kern/kern_shutdown.c   Thu Oct 17 18:29:44 2019
(r353690)
@@ -1267,6 +1267,20 @@ cleanup:
return (error);
 }
 
+#ifdef DDB
+void
+dumper_ddb_insert(struct dumperinfo *newdi)
+{
+   TAILQ_INSERT_HEAD(_configs, newdi, di_next);
+}
+
+void
+dumper_ddb_remove(struct dumperinfo *di)
+{
+   TAILQ_REMOVE(_configs, di, di_next);
+}
+#endif
+
 static bool
 dumper_config_match(const struct dumperinfo *di, const char *devname,
 const struct diocskerneldump_arg *kda)

Modified: head/sys/sys/conf.h
==
--- head/sys/sys/conf.h Thu Oct 17 17:48:32 2019(r353689)
+++ head/sys/sys/conf.h Thu Oct 17 18:29:44 2019(r353690)
@@ -366,6 +366,10 @@ int dumper_insert(const struct dumperinfo *di_template
 const struct diocskerneldump_arg *kda);
 int dumper_remove(const char *devname, const struct diocskerneldump_arg *kda);
 
+/* For ddb(4)-time use only. */
+void dumper_ddb_insert(struct dumperinfo *);
+void dumper_ddb_remove(struct dumperinfo *);
+
 int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh);
 int dump_append(struct dumperinfo *, void *, vm_offset_t, size_t);
 int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);
___
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: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm

2019-10-17 Thread Alan Somers
There might be something wrong with my environment:
/usr/include/libcasper.h is absent.  But still, shouldn't the build be
using the version from the source tree, instead of from the environment?
-Alan

On Thu, Oct 17, 2019 at 11:48 AM Mark Johnston  wrote:

> On Thu, Oct 17, 2019 at 11:37:44AM -0600, Alan Somers wrote:
> > On Mon, Sep 30, 2019 at 11:28 AM Mark Johnston 
> wrote:
> >
> > > Author: markj
> > > Date: Mon Sep 30 17:27:59 2019
> > > New Revision: 352909
> > > URL: https://svnweb.freebsd.org/changeset/base/352909
> > >
> > > Log:
> > >   Capsicumize nm(1).
> > >
> > >   Reviewed by:  emaste
> > >   Sponsored by: The FreeBSD Foundation
> > >   Differential Revision:https://reviews.freebsd.org/D21107
> > >
> > > Modified:
> > >   head/contrib/elftoolchain/nm/nm.c
> > >   head/usr.bin/nm/Makefile
> > >
> >
> > I can no longer build world after this change.  I think nm is being built
> > before libcasper, because I don't see libcasper.h in my object directory.
> > Has anybody else had this problem?
> >
> > In file included from
> > /usr/home/somers/freebsd/base/head/contrib/elftoolchain/nm/nm.c:32:
> > /usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h' file
> not
> > found
> > #include 
> >  ^
> > 1 error generated.
> > *** [nm.o] Error code 1
> >
> > make[3]: stopped in /usr/home/somers/freebsd/base/head/usr.bin/nm
> > 1 error
>
> Could you share the full build log somewhere?  I haven't seen any other
> reports of this, and other elftoolchain utilities have been making use
> of libcasper for a long time.
>
___
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: r353689 - head/sys/net

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 17:48:32 2019
New Revision: 353689
URL: https://svnweb.freebsd.org/changeset/base/353689

Log:
  debugnet: Respond to broadcast ARP requests
  
  The in-tree netdump code has always ignored non-directed ARP requests, and
  that seems to work most of the time for netdump.
  
  In my work and testing on NetGDB, it seems like sometimes the remote FreeBSD
  conversant (the non-panic system) will send broadcast-destination ARP
  requests to the debugnet kernel; without this change, those are dropped and
  the remote will see EHOSTDOWN "Host is down" errors from the userspace
  interface of the network stack.
  
  Discussed with:   markj

Modified:
  head/sys/net/debugnet.c

Modified: head/sys/net/debugnet.c
==
--- head/sys/net/debugnet.c Thu Oct 17 17:19:16 2019(r353688)
+++ head/sys/net/debugnet.c Thu Oct 17 17:48:32 2019(r353689)
@@ -434,7 +434,8 @@ debugnet_pkt_in(struct ifnet *ifp, struct mbuf *m)
goto done;
}
if (memcmp(ifr.ifr_addr.sa_data, eh->ether_dhost,
-   ETHER_ADDR_LEN) != 0) {
+   ETHER_ADDR_LEN) != 0 &&
+   (etype != ETHERTYPE_ARP || !ETHER_IS_BROADCAST(eh->ether_dhost))) {
DNETDEBUG_IF(ifp,
"discard frame with incorrect destination addr\n");
goto done;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm

2019-10-17 Thread Mark Johnston
On Thu, Oct 17, 2019 at 11:37:44AM -0600, Alan Somers wrote:
> On Mon, Sep 30, 2019 at 11:28 AM Mark Johnston  wrote:
> 
> > Author: markj
> > Date: Mon Sep 30 17:27:59 2019
> > New Revision: 352909
> > URL: https://svnweb.freebsd.org/changeset/base/352909
> >
> > Log:
> >   Capsicumize nm(1).
> >
> >   Reviewed by:  emaste
> >   Sponsored by: The FreeBSD Foundation
> >   Differential Revision:https://reviews.freebsd.org/D21107
> >
> > Modified:
> >   head/contrib/elftoolchain/nm/nm.c
> >   head/usr.bin/nm/Makefile
> >
> 
> I can no longer build world after this change.  I think nm is being built
> before libcasper, because I don't see libcasper.h in my object directory.
> Has anybody else had this problem?
> 
> In file included from
> /usr/home/somers/freebsd/base/head/contrib/elftoolchain/nm/nm.c:32:
> /usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h' file not
> found
> #include 
>  ^
> 1 error generated.
> *** [nm.o] Error code 1
> 
> make[3]: stopped in /usr/home/somers/freebsd/base/head/usr.bin/nm
> 1 error

Could you share the full build log somewhere?  I haven't seen any other
reports of this, and other elftoolchain utilities have been making use
of libcasper for a long time.
___
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: r352909 - in head: contrib/elftoolchain/nm usr.bin/nm

2019-10-17 Thread Alan Somers
On Mon, Sep 30, 2019 at 11:28 AM Mark Johnston  wrote:

> Author: markj
> Date: Mon Sep 30 17:27:59 2019
> New Revision: 352909
> URL: https://svnweb.freebsd.org/changeset/base/352909
>
> Log:
>   Capsicumize nm(1).
>
>   Reviewed by:  emaste
>   Sponsored by: The FreeBSD Foundation
>   Differential Revision:https://reviews.freebsd.org/D21107
>
> Modified:
>   head/contrib/elftoolchain/nm/nm.c
>   head/usr.bin/nm/Makefile
>

I can no longer build world after this change.  I think nm is being built
before libcasper, because I don't see libcasper.h in my object directory.
Has anybody else had this problem?

In file included from
/usr/home/somers/freebsd/base/head/contrib/elftoolchain/nm/nm.c:32:
/usr/include/capsicum_helpers.h:42:10: fatal error: 'libcasper.h' file not
found
#include 
 ^
1 error generated.
*** [nm.o] Error code 1

make[3]: stopped in /usr/home/somers/freebsd/base/head/usr.bin/nm
1 error
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353688 - head/sys/net

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 17:19:16 2019
New Revision: 353688
URL: https://svnweb.freebsd.org/changeset/base/353688

Log:
  debugnet(4): Check hardware-validated UDP checksums
  
  Similar to INET checksums, lazily validate UDP checksums when the driver has
  already performed the check for us.  Like debugnet(4) INET checksums,
  validation in software is left as future work.
  
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D21745

Modified:
  head/sys/net/debugnet_inet.c

Modified: head/sys/net/debugnet_inet.c
==
--- head/sys/net/debugnet_inet.cThu Oct 17 17:02:50 2019
(r353687)
+++ head/sys/net/debugnet_inet.cThu Oct 17 17:19:16 2019
(r353688)
@@ -196,6 +196,15 @@ debugnet_handle_ip(struct debugnet_pcb *pcb, struct mb
return;
}
 
+   if ((m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) != 0) {
+   if ((m->m_pkthdr.csum_flags & CSUM_DATA_VALID) == 0) {
+   DNETDEBUG("bad UDP checksum\n");
+   return;
+   }
+   } else {
+   /* XXX */ ;
+   }
+
/* UDP custom is to have packet length not include IP header. */
ip->ip_len -= hlen;
 
___
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: r353687 - head/sys/netinet

2019-10-17 Thread Gleb Smirnoff
Author: glebius
Date: Thu Oct 17 17:02:50 2019
New Revision: 353687
URL: https://svnweb.freebsd.org/changeset/base/353687

Log:
  Quickly fix up r353683: enter the epoch before calling into netisr_dispatch().

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Thu Oct 17 16:38:44 2019(r353686)
+++ head/sys/netinet/igmp.c Thu Oct 17 17:02:50 2019(r353687)
@@ -2174,6 +2174,7 @@ igmp_slowtimo_vnet(void)
 static int
 igmp_v1v2_queue_report(struct in_multi *inm, const int type)
 {
+   struct epoch_trackeret;
struct ifnet*ifp;
struct igmp *igmp;
struct ip   *ip;
@@ -2223,7 +2224,9 @@ igmp_v1v2_queue_report(struct in_multi *inm, const int
m->m_flags |= M_IGMP_LOOP;
 
CTR2(KTR_IGMPV3, "%s: netisr_dispatch(NETISR_IGMP, %p)", __func__, m);
+   NET_EPOCH_ENTER(et);
netisr_dispatch(NETISR_IGMP, m);
+   NET_EPOCH_EXIT(et);
 
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: r353683 - head/sys/netinet

2019-10-17 Thread Gleb Smirnoff
On Thu, Oct 17, 2019 at 12:51:35PM -0400, Mark Johnston wrote:
M> On Thu, Oct 17, 2019 at 04:02:34PM +, Gleb Smirnoff wrote:
M> > Author: glebius
M> > Date: Thu Oct 17 16:02:34 2019
M> > New Revision: 353683
M> > URL: https://svnweb.freebsd.org/changeset/base/353683
M> > 
M> > Log:
M> >   igmp_v1v2_queue_report() doesn't require epoch.
M> 
M> igmp_v1v2_queue_report() calls netisr_dispatch(), which does require
M> epoch.

Doh! Will fix.

-- 
Gleb Smirnoff
___
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: r353683 - head/sys/netinet

2019-10-17 Thread Mark Johnston
On Thu, Oct 17, 2019 at 04:02:34PM +, Gleb Smirnoff wrote:
> Author: glebius
> Date: Thu Oct 17 16:02:34 2019
> New Revision: 353683
> URL: https://svnweb.freebsd.org/changeset/base/353683
> 
> Log:
>   igmp_v1v2_queue_report() doesn't require epoch.

igmp_v1v2_queue_report() calls netisr_dispatch(), which does require
epoch.
___
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: r353686 - in head/sys/dev/vt: . logo

2019-10-17 Thread Ed Maste
Author: emaste
Date: Thu Oct 17 16:38:44 2019
New Revision: 353686
URL: https://svnweb.freebsd.org/changeset/base/353686

Log:
  Update Conrad Meyer's email
  
  cem is now a committer
  
  Approved by:  cem

Modified:
  head/sys/dev/vt/logo/logo_beastie.c
  head/sys/dev/vt/vt_cpulogos.c

Modified: head/sys/dev/vt/logo/logo_beastie.c
==
--- head/sys/dev/vt/logo/logo_beastie.c Thu Oct 17 16:23:03 2019
(r353685)
+++ head/sys/dev/vt/logo/logo_beastie.c Thu Oct 17 16:38:44 2019
(r353686)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 Conrad Meyer 
+ * Copyright (c) 2015 Conrad Meyer 
  * Copyright (c) 2005 The FreeBSD Foundation
  * Copyright (c) 1996 Larry Ewing 
  * Copyright (c) 1988 Kirk McKusick 

Modified: head/sys/dev/vt/vt_cpulogos.c
==
--- head/sys/dev/vt/vt_cpulogos.c   Thu Oct 17 16:23:03 2019
(r353685)
+++ head/sys/dev/vt/vt_cpulogos.c   Thu Oct 17 16:38:44 2019
(r353686)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 Conrad Meyer 
+ * Copyright (c) 2015 Conrad Meyer 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
___
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: r353685 - in head/sys: amd64/conf arm64/conf conf dev/alc dev/bge dev/bxe dev/cxgb dev/mlx4/mlx4_en dev/re dev/virtio/network i386/conf kern net netinet/netdump powerpc/conf sparc64/con...

2019-10-17 Thread Conrad Meyer
Author: cem
Date: Thu Oct 17 16:23:03 2019
New Revision: 353685
URL: https://svnweb.freebsd.org/changeset/base/353685

Log:
  Split out a more generic debugnet(4) from netdump(4)
  
  Debugnet is a simplistic and specialized panic- or debug-time reliable
  datagram transport.  It can drive a single connection at a time and is
  currently unidirectional (debug/panic machine transmit to remote server
  only).
  
  It is mostly a verbatim code lift from netdump(4).  Netdump(4) remains
  the only consumer (until the rest of this patch series lands).
  
  The INET-specific logic has been extracted somewhat more thoroughly than
  previously in netdump(4), into debugnet_inet.c.  UDP-layer logic and up, as
  much as possible as is protocol-independent, remains in debugnet.c.  The
  separation is not perfect and future improvement is welcome.  Supporting
  INET6 is a long-term goal.
  
  Much of the diff is "gratuitous" renaming from 'netdump_' or 'nd_' to
  'debugnet_' or 'dn_' -- sorry.  I thought keeping the netdump name on the
  generic module would be more confusing than the refactoring.
  
  The only functional change here is the mbuf allocation / tracking.  Instead
  of initiating solely on netdump-configured interface(s) at dumpon(8)
  configuration time, we watch for any debugnet-enabled NIC for link
  activation and query it for mbuf parameters at that time.  If they exceed
  the existing high-water mark allocation, we re-allocate and track the new
  high-water mark.  Otherwise, we leave the pre-panic mbuf allocation alone.
  In a future patch in this series, this will allow initiating netdump from
  panic ddb(4) without pre-panic configuration.
  
  No other functional change intended.
  
  Reviewed by:  markj (earlier version)
  Some discussion with: emaste, jhb
  Objection from:   marius
  Differential Revision:https://reviews.freebsd.org/D21421

Added:
  head/sys/net/debugnet.c   (contents, props changed)
  head/sys/net/debugnet.h   (contents, props changed)
  head/sys/net/debugnet_inet.c   (contents, props changed)
  head/sys/net/debugnet_int.h   (contents, props changed)
Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/arm64/conf/GENERIC
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options
  head/sys/dev/alc/if_alc.c
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bxe/bxe.c
  head/sys/dev/bxe/bxe.h
  head/sys/dev/cxgb/cxgb_adapter.h
  head/sys/dev/cxgb/cxgb_main.c
  head/sys/dev/cxgb/cxgb_sge.c
  head/sys/dev/mlx4/mlx4_en/en.h
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  head/sys/dev/re/if_re.c
  head/sys/dev/virtio/network/if_vtnet.c
  head/sys/i386/conf/GENERIC
  head/sys/kern/kern_mbuf.c
  head/sys/net/if.c
  head/sys/net/if_var.h
  head/sys/net/iflib.c
  head/sys/netinet/netdump/netdump.h
  head/sys/netinet/netdump/netdump_client.c
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64
  head/sys/sparc64/conf/GENERIC
  head/sys/sys/mbuf.h
  head/sys/sys/param.h

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Thu Oct 17 16:20:24 2019(r353684)
+++ head/sys/amd64/conf/GENERIC Thu Oct 17 16:23:03 2019(r353685)
@@ -111,6 +111,7 @@ options VERBOSE_SYSINIT=0   # Support 
debug.verbose_sys
 optionsEKCD# Support for encrypted kernel dumps
 optionsGZIO# gzip-compressed kernel and user dumps
 optionsZSTDIO  # zstd-compressed kernel and user dumps
+optionsDEBUGNET# debugnet networking
 optionsNETDUMP # netdump(4) client support
 
 # Make an SMP-capable kernel by default

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Thu Oct 17 16:20:24 2019(r353684)
+++ head/sys/arm64/conf/GENERIC Thu Oct 17 16:23:03 2019(r353685)
@@ -103,6 +103,7 @@ options VERBOSE_SYSINIT=0   # Support 
debug.verbose_sys
 optionsEKCD# Support for encrypted kernel dumps
 optionsGZIO# gzip-compressed kernel and user dumps
 optionsZSTDIO  # zstd-compressed kernel and user dumps
+optionsDEBUGNET# debugnet networking
 optionsNETDUMP # netdump(4) client support
 
 # SoC support

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Thu Oct 17 16:20:24 2019(r353684)
+++ head/sys/conf/NOTES Thu Oct 17 16:23:03 2019(r353685)
@@ -1042,6 +1042,10 @@ options  DUMMYNET
 # This allows a panicking kernel to transmit a kernel dump to a remote host.
 optionsNETDUMP
 
+# The DEBUGNET option enables a basic debug/panic-time networking API.  It
+# is used by NETDUMP.
+optionsDEBUGNET
+
 

svn commit: r353684 - in releng/12.1/sys: arm/ti dev/sdhci

2019-10-17 Thread Ian Lepore
Author: ian
Date: Thu Oct 17 16:20:24 2019
New Revision: 353684
URL: https://svnweb.freebsd.org/changeset/base/353684

Log:
  MFC r353675 from stable-12 (r353651-r353652 from head)...
  
  r353651:
  Relax the sdhci(4) check that filters out the 1.8v voltage option unless
  the slot is flagged as 'embedded'.
  
  The features related to embedded and shared slots were added in v3.0 of
  the sdhci spec.  Hardware prior to v3 sometimes supported 1.8v on non-
  removable devices in embedded systems, but had no way to indicate that
  via the standard sdhci registers (instead they use out of band metadata
  such as FDT data).
  
  This change adds the controller specification version to the check for
  whether to filter out the 1.8v selection.  On older hardware, the 1.8v
  option is allowed to remain.  On 3.0 or later it still requires the
  embedded-slot flag to remain.
  
  This is part of the fix for PR 241301 (eMMC not detected on Beaglebone).
  Changes to the sdhci_ti driver are also needed for a full fix.
  
  PR:   241301
  
  r353652:
  Revert r351218 (by manu).  While the changes in r351218 appear to be (and
  should be) correct, they lead to the eMMC on a Beaglebone failing to work
  in some situations.
  
  The TI sdhci hardware is kind of strange.  The first device inherently
  supports 1.8v and 3.3v and the abililty to switch between them, and the
  other two devices must be set to 1.8v in the sdhci power control register to
  operate correctly, but doing so actually makes them run at 3.3v (unless an
  external level-shifter is present in the signal path).  Even the 1.8v on the
  first device may actually be 3.3v (or any other value), depending on what
  voltage is fed to the VDDS1-VDDS7 power supply pins on the am335x chip.
  
  Another strange quirk is that the convention for am335x sdhci drivers in
  linux and uboot and the am335x boot ROM seems to be to set the voltage in
  the sdhci capabilities register to 3.0v even though the actual voltage is
  3.3v.  Why this is done is a complete mystery to me, but it seems to be
  required for correct operation.
  
  If we had complete modern support for the am335x chip we could get the
  actual voltages from the FDT data and the regulator framework.  But our
  am335x code currently doesn't have any regulator framework support.
  Reverting to the prior code will get the popular Beaglebone boards working
  again.
  
  This is part of the fix for PR 241301, but also requires r353651 for a
  complete fix.
  
  PR:   241301
  Discussed with: manu
  
  Approved by:  re(kib)

Modified:
  releng/12.1/sys/arm/ti/ti_sdhci.c
  releng/12.1/sys/dev/sdhci/sdhci.c
Directory Properties:
  releng/12.1/   (props changed)

Modified: releng/12.1/sys/arm/ti/ti_sdhci.c
==
--- releng/12.1/sys/arm/ti/ti_sdhci.c   Thu Oct 17 16:02:34 2019
(r353683)
+++ releng/12.1/sys/arm/ti/ti_sdhci.c   Thu Oct 17 16:20:24 2019
(r353684)
@@ -482,14 +482,15 @@ ti_sdhci_hw_init(device_t dev)
 * The attach() routine has examined fdt data and set flags in
 * slot.host.caps to reflect what voltages we can handle.  Set those
 * values in the CAPA register.  The manual says that these values can
-* only be set once, and that they survive a reset so unless u-boot 
didn't
-* set this register this code is a no-op.
+* only be set once, "before initialization" whatever that means, and
+* that they survive a reset.  So maybe doing this will be a no-op if
+* u-boot has already initialized the hardware.
 */
regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA);
if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE)
regval |= MMCHS_SD_CAPA_VS18;
-   if (sc->slot.host.caps & (MMC_OCR_320_330 | MMC_OCR_330_340))
-   regval |= MMCHS_SD_CAPA_VS33;
+   if (sc->slot.host.caps & (MMC_OCR_290_300 | MMC_OCR_300_310))
+   regval |= MMCHS_SD_CAPA_VS30;
ti_mmchs_write_4(sc, MMCHS_SD_CAPA, regval);
 
/* Set initial host configuration (1-bit, std speed, pwr off). */
@@ -523,20 +524,17 @@ ti_sdhci_attach(device_t dev)
}
 
/*
-* The hardware can inherently do dual-voltage (1p8v, 3p3v) on the first
+* The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first
 * device, and only 1p8v on other devices unless an external transceiver
 * is used.  The only way we could know about a transceiver is fdt data.
 * Note that we have to do this before calling ti_sdhci_hw_init() so
 * that it can set the right values in the CAPA register, which can only
 * be done once and never reset.
 */
-   if (OF_hasprop(node, "ti,dual-volt")) {
-   sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE | MMC_OCR_320_330 | 
MMC_OCR_330_340;
-   } else if (OF_hasprop(node, "no-1-8-v")) {
-   

svn commit: r353683 - head/sys/netinet

2019-10-17 Thread Gleb Smirnoff
Author: glebius
Date: Thu Oct 17 16:02:34 2019
New Revision: 353683
URL: https://svnweb.freebsd.org/changeset/base/353683

Log:
  igmp_v1v2_queue_report() doesn't require epoch.

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Thu Oct 17 14:58:03 2019(r353682)
+++ head/sys/netinet/igmp.c Thu Oct 17 16:02:34 2019(r353683)
@@ -2179,7 +2179,6 @@ igmp_v1v2_queue_report(struct in_multi *inm, const int
struct ip   *ip;
struct mbuf *m;
 
-   NET_EPOCH_ASSERT();
IN_MULTI_LIST_LOCK_ASSERT();
IGMP_LOCK_ASSERT();
 
___
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: r353635 - in head/sys: netinet netinet6

2019-10-17 Thread Gleb Smirnoff
On Wed, Oct 16, 2019 at 10:46:44PM +0200, Hans Petter Selasky wrote:
H> > as far as I remember I was against this changeset and I had
H> > several other developers agreed that this should be fixed in
H> > different way. Why did you proceed with checking it in? :(
H> 
H> Hi Gleb,
H> 
H> This issue has been discussed in-depth at various transport meetings and 
H> we have agreed on a solution.

Is the list of people who agreed longer than "Reviewed by" list?

H> Are you seeing something broken as of this patch?

As I already explained, first, we are dropping absolutely legitimate
packets. At the time of arrival there were nothing wrong about them.
This is idelogically wrong from viewpoint of abstract network stack.

Second, the problem should be fixed in a different way: when we put
packets on the queue, we should take all important values out of the
ifnet and store them on queue entry.

-- 
Gleb Smirnoff
___
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: r353682 - head/sys/dev/sound/pci/hda

2019-10-17 Thread Ed Maste
Author: emaste
Date: Thu Oct 17 14:58:03 2019
New Revision: 353682
URL: https://svnweb.freebsd.org/changeset/base/353682

Log:
  snd_hda: style(9) whitespace fixup
  
  PR:   241299
  Submitted by: Neel Chauhan

Modified:
  head/sys/dev/sound/pci/hda/hdaa_patches.c

Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c
==
--- head/sys/dev/sound/pci/hda/hdaa_patches.c   Thu Oct 17 13:49:47 2019
(r353681)
+++ head/sys/dev/sound/pci/hda/hdaa_patches.c   Thu Oct 17 14:58:03 2019
(r353682)
@@ -447,7 +447,7 @@ hdac_pin_patch(struct hdaa_widget *w)
config = 0x01a1913d;
break;
}
-   } else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR ) {
+   } else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR) {
switch (nid) {
case 20:
patch = "as=1 seq=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: r353681 - head/sys/vm

2019-10-17 Thread Konstantin Belousov
Author: kib
Date: Thu Oct 17 13:49:47 2019
New Revision: 353681
URL: https://svnweb.freebsd.org/changeset/base/353681

Log:
  swapon_check_swzone(): use already calculated static variables.
  
  Submitted by: o...@j.email.ne.jp
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D22065

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cThu Oct 17 13:08:50 2019(r353680)
+++ head/sys/vm/swap_pager.cThu Oct 17 13:49:47 2019(r353681)
@@ -590,6 +590,7 @@ swap_pager_swap_init(void)
if (n < n2)
printf("Swap blk zone entries changed from %lu to %lu.\n",
n2, n);
+   /* absolute maximum we can handle assuming 100% efficiency */
swap_maxpages = n * SWAP_META_PAGES;
swzone = n * sizeof(struct swblk);
if (!uma_zone_reserve_kva(swpctrie_zone, n))
@@ -2250,17 +2251,12 @@ done:
 static void
 swapon_check_swzone(void)
 {
-   unsigned long maxpages, npages;
 
-   npages = swap_total;
-   /* absolute maximum we can handle assuming 100% efficiency */
-   maxpages = uma_zone_get_max(swblk_zone) * SWAP_META_PAGES;
-
/* recommend using no more than half that amount */
-   if (npages > maxpages / 2) {
+   if (swap_total > swap_maxpages / 2) {
printf("warning: total configured swap (%lu pages) "
"exceeds maximum recommended amount (%lu pages).\n",
-   npages, maxpages / 2);
+   swap_total, swap_maxpages / 2);
printf("warning: increase kern.maxswzone "
"or reduce amount of swap.\n");
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r353680 - head/sys/dev/vt

2019-10-17 Thread Ed Maste
Author: emaste
Date: Thu Oct 17 13:08:50 2019
New Revision: 353680
URL: https://svnweb.freebsd.org/changeset/base/353680

Log:
  vt: remove comment that is not true since r259680
  
  r259680 added support to vt(4) for printing double-width characters.
  Remove the comment that claims no support.
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_font.c

Modified: head/sys/dev/vt/vt_font.c
==
--- head/sys/dev/vt/vt_font.c   Thu Oct 17 06:58:07 2019(r353679)
+++ head/sys/dev/vt/vt_font.c   Thu Oct 17 13:08:50 2019(r353680)
@@ -92,11 +92,6 @@ vtfont_lookup(const struct vt_font *vf, term_char_t c)
unsigned int normal_map;
unsigned int bold_map;
 
-   /*
-* No support for printing right hand sides for CJK fullwidth
-* characters. Simply print a space and assume that the left
-* hand side describes the entire character.
-*/
src = TCHAR_CHARACTER(c);
if (TCHAR_FORMAT(c) & TF_CJK_RIGHT) {
normal_map = VFNT_MAP_NORMAL_RIGHT;
___
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: r351379 - head/usr.bin/w

2019-10-17 Thread Alexey Dokuchaev
On Thu, Aug 22, 2019 at 03:28:31AM +, Mike Karels wrote:
> New Revision: 351379
> URL: https://svnweb.freebsd.org/changeset/base/351379
> 
> Log:
>   Change w(1) to compute FROM (host) field size dynamically
>   
>   It's nice to be able to display a full IPv6 host address if
>   needed, but it's also nice to display more than 3 characters of a command
>   line. Compute the needed size for the FROM column in an earlier pass,
>   and determine the maximum, then print what fits for the command.

Thank you Mike, this had been bugging me for quite a while!  Now I only
need one-line W_DISPUSERSIZE=8 patch to get my perfect w(1). :-)

./danfe
___
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: r353679 - head/share/man/man9

2019-10-17 Thread Andriy Gapon
Author: avg
Date: Thu Oct 17 06:58:07 2019
New Revision: 353679
URL: https://svnweb.freebsd.org/changeset/base/353679

Log:
  document taskqueue_start_threads_in_proc
  
  While here, fix taskqueue_start_threads_cpuset that was documented under
  old name of taskqueue_start_threads_pinned.
  
  MFC after:4 weeks

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/taskqueue.9

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileThu Oct 17 06:32:34 2019
(r353678)
+++ head/share/man/man9/MakefileThu Oct 17 06:58:07 2019
(r353679)
@@ -2085,7 +2085,8 @@ MLINKS+=taskqueue.9 TASK_INIT.9 \
taskqueue.9 taskqueue_run.9 \
taskqueue.9 taskqueue_set_callback.9 \
taskqueue.9 taskqueue_start_threads.9 \
-   taskqueue.9 taskqueue_start_threads_pinned.9 \
+   taskqueue.9 taskqueue_start_threads_cpuset.9 \
+   taskqueue.9 taskqueue_start_threads_in_proc.9 \
taskqueue.9 taskqueue_unblock.9 \
taskqueue.9 TIMEOUT_TASK_INIT.9
 MLINKS+=tcp_functions.9 register_tcp_functions.9 \

Modified: head/share/man/man9/taskqueue.9
==
--- head/share/man/man9/taskqueue.9 Thu Oct 17 06:32:34 2019
(r353678)
+++ head/share/man/man9/taskqueue.9 Thu Oct 17 06:58:07 2019
(r353679)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 21, 2018
+.Dd October 17, 2019
 .Dt TASKQUEUE 9
 .Os
 .Sh NAME
@@ -69,10 +69,15 @@ struct timeout_task;
 .Ft int
 .Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int pri" 
"const char *name" "..."
 .Ft int
-.Fo taskqueue_start_threads_pinned
-.Fa "struct taskqueue **tqp" "int count" "int pri" "int cpu_id"
+.Fo taskqueue_start_threads_cpuset
+.Fa "struct taskqueue **tqp" "int count" "int pri" "cpuset_t *mask"
 .Fa "const char *name" "..."
 .Fc
+.Ft int
+.Fo taskqueue_start_threads_in_proc
+.Fa "struct taskqueue **tqp" "int count" "int pri" "struct proc *proc"
+.Fa "const char *name" "..."
+.Fc
 .Ft void
 .Fn taskqueue_set_callback "struct taskqueue *queue" "enum 
taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void 
*context"
 .Ft void
@@ -152,14 +157,20 @@ Any tasks that are on the queue will be executed at th
 which the thread servicing the queue will be signaled that it should exit.
 .Pp
 Once a taskqueue has been created, its threads should be started using
-.Fn taskqueue_start_threads
+.Fn taskqueue_start_threads ,
+.Fn taskqueue_start_threads_cpuset
 or
-.Fn taskqueue_start_threads_pinned .
-.Fn taskqueue_start_threads_pinned
+.Fn taskqueue_start_threads_in_proc .
+.Fn taskqueue_start_threads_cpuset
 takes a
-.Va cpu_id
+.Va cpuset
 argument which will cause the threads which are started for the taskqueue
-to be pinned to run on the given CPU.
+to be restricted to run on the given CPUs.
+.Fn taskqueue_start_threads_in_proc
+takes a
+.Va proc
+argument which will cause the threads which are started for the taskqueue
+to be assigned to the given kernel process.
 Callbacks may optionally be registered using
 .Fn taskqueue_set_callback .
 Currently, callbacks may be registered for the following purposes:
___
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: r353678 - in head/sys: kern sys

2019-10-17 Thread Andriy Gapon
Author: avg
Date: Thu Oct 17 06:32:34 2019
New Revision: 353678
URL: https://svnweb.freebsd.org/changeset/base/353678

Log:
  provide a way to assign taskqueue threads to a kernel process
  
  This can be used to group all threads belonging to a single logical
  entity under a common kernel process.
  I am planning to use the new interface for ZFS threads.
  
  MFC after:4 weeks

Modified:
  head/sys/kern/subr_taskqueue.c
  head/sys/sys/taskqueue.h

Modified: head/sys/kern/subr_taskqueue.c
==
--- head/sys/kern/subr_taskqueue.c  Thu Oct 17 06:21:09 2019
(r353677)
+++ head/sys/kern/subr_taskqueue.c  Thu Oct 17 06:32:34 2019
(r353678)
@@ -654,7 +654,7 @@ taskqueue_swi_giant_run(void *dummy)
 
 static int
 _taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
-cpuset_t *mask, const char *name, va_list ap)
+cpuset_t *mask, struct proc *p, const char *name, va_list ap)
 {
char ktname[MAXCOMLEN + 1];
struct thread *td;
@@ -676,10 +676,10 @@ _taskqueue_start_threads(struct taskqueue **tqp, int c
 
for (i = 0; i < count; i++) {
if (count == 1)
-   error = kthread_add(taskqueue_thread_loop, tqp, NULL,
+   error = kthread_add(taskqueue_thread_loop, tqp, p,
>tq_threads[i], RFSTOPPED, 0, "%s", ktname);
else
-   error = kthread_add(taskqueue_thread_loop, tqp, NULL,
+   error = kthread_add(taskqueue_thread_loop, tqp, p,
>tq_threads[i], RFSTOPPED, 0,
"%s_%d", ktname, i);
if (error) {
@@ -729,12 +729,25 @@ taskqueue_start_threads(struct taskqueue **tqp, int co
int error;
 
va_start(ap, name);
-   error = _taskqueue_start_threads(tqp, count, pri, NULL, name, ap);
+   error = _taskqueue_start_threads(tqp, count, pri, NULL, NULL, name, ap);
va_end(ap);
return (error);
 }
 
 int
+taskqueue_start_threads_in_proc(struct taskqueue **tqp, int count, int pri,
+struct proc *proc, const char *name, ...)
+{
+   va_list ap;
+   int error;
+
+   va_start(ap, name);
+   error = _taskqueue_start_threads(tqp, count, pri, NULL, proc, name, ap);
+   va_end(ap);
+   return (error);
+}
+
+int
 taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count, int pri,
 cpuset_t *mask, const char *name, ...)
 {
@@ -742,7 +755,7 @@ taskqueue_start_threads_cpuset(struct taskqueue **tqp,
int error;
 
va_start(ap, name);
-   error = _taskqueue_start_threads(tqp, count, pri, mask, name, ap);
+   error = _taskqueue_start_threads(tqp, count, pri, mask, NULL, name, ap);
va_end(ap);
return (error);
 }

Modified: head/sys/sys/taskqueue.h
==
--- head/sys/sys/taskqueue.hThu Oct 17 06:21:09 2019(r353677)
+++ head/sys/sys/taskqueue.hThu Oct 17 06:32:34 2019(r353678)
@@ -42,6 +42,7 @@
 
 struct taskqueue;
 struct taskqgroup;
+struct proc;
 struct thread;
 
 struct timeout_task {
@@ -75,7 +76,9 @@ struct taskqueue *taskqueue_create(const char *name, i
taskqueue_enqueue_fn enqueue,
void *context);
 inttaskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
-   const char *name, ...) __printflike(4, 5);
+   const char *name, ...) __printflike(4, 5);
+inttaskqueue_start_threads_in_proc(struct taskqueue **tqp, int count,
+   int pri, struct proc *p, const char *name, ...) __printflike(5, 6);
 inttaskqueue_start_threads_cpuset(struct taskqueue **tqp, int count,
int pri, cpuset_t *mask, const char *name, ...) __printflike(5, 6);
 inttaskqueue_enqueue(struct taskqueue *queue, struct task *task);
___
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: r353677 - head/sys/dev/wbwd

2019-10-17 Thread Andriy Gapon
Author: avg
Date: Thu Oct 17 06:21:09 2019
New Revision: 353677
URL: https://svnweb.freebsd.org/changeset/base/353677

Log:
  wbwd: small clean-ups and improvements
  
  This change applies some suggestions by delphij from D21979.
  A write-only variable is removed.
  There is a diagnostic message if the driver does not recognize the chip.
  A chained if-statement is converted to a switch.
  
  MFC after:3 weeks

Modified:
  head/sys/dev/wbwd/wbwd.c

Modified: head/sys/dev/wbwd/wbwd.c
==
--- head/sys/dev/wbwd/wbwd.cThu Oct 17 05:50:57 2019(r353676)
+++ head/sys/dev/wbwd/wbwd.cThu Oct 17 06:21:09 2019(r353677)
@@ -466,7 +466,7 @@ wb_probe(device_t dev)
 {
char buf[128];
struct wb_softc *sc;
-   int found, j;
+   int j;
uint8_t devid;
uint8_t revid;
 
@@ -478,7 +478,6 @@ wb_probe(device_t dev)
sc = device_get_softc(dev);
devid = superio_devid(dev) >> 8;
revid = superio_revid(dev);
-   found = 0;
for (j = 0; j < nitems(wb_devs); j++) {
if (wb_devs[j].device_id == devid) {
sc->chip = wb_devs[j].chip;
@@ -489,6 +488,11 @@ wb_probe(device_t dev)
return (BUS_PROBE_SPECIFIC);
}
}
+   if (bootverbose) {
+   device_printf(dev,
+   "unrecognized chip: devid 0x%02x, revid 0x%02x\n",
+   devid, revid);
+   }
return (ENXIO);
 }
 
@@ -504,20 +508,27 @@ wb_attach(device_t dev)
sc = device_get_softc(dev);
sc->dev = dev;
 
-   sc->ctl_reg = 0xf5;
-   sc->time_reg = 0xf6;
-   sc->csr_reg = 0xf7;
-   if (sc->chip == w83697hf || sc->chip == w83697ug) {
+   /* Make sure WDT is enabled. */
+   superio_dev_enable(dev, WB_LDN8_CR30_ACTIVE);
+
+   switch (sc->chip) {
+   case w83697hf:
+   case w83697ug:
sc->ctl_reg = 0xf3;
sc->time_reg = 0xf4;
-   } else if (sc->chip == nct6102) {
+   sc->csr_reg = 0xf7;
+   break;
+   case nct6102:
sc->ctl_reg = 0xf0;
sc->time_reg = 0xf1;
sc->csr_reg = 0xf2;
+   break;
+   default:
+   sc->ctl_reg = 0xf5;
+   sc->time_reg = 0xf6;
+   sc->csr_reg = 0xf7;
+   break;
}
-
-   /* Make sure WDT is enabled. */
-   superio_dev_enable(dev, WB_LDN8_CR30_ACTIVE);
 
switch (sc->chip) {
case w83627hf:
___
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"