svn commit: r366283 - head/sys/kern

2020-09-29 Thread Mateusz Guzik
Author: mjg
Date: Wed Sep 30 04:27:38 2020
New Revision: 366283
URL: https://svnweb.freebsd.org/changeset/base/366283

Log:
  cache: use cache_has_entries where appropriate instead of opencoding it

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Sep 30 03:38:13 2020(r366282)
+++ head/sys/kern/vfs_cache.c   Wed Sep 30 04:27:38 2020(r366283)
@@ -2240,8 +2240,7 @@ cache_purge_vgone(struct vnode *vp)
 
VNPASS(VN_IS_DOOMED(vp), vp);
vlp = VP2VNODELOCK(vp);
-   if (!(LIST_EMPTY(&vp->v_cache_src) && TAILQ_EMPTY(&vp->v_cache_dst) &&
-   vp->v_cache_dd == NULL)) {
+   if (cache_has_entries(vp)) {
mtx_lock(vlp);
cache_purge_impl(vp);
mtx_assert(vlp, MA_NOTOWNED);
@@ -2249,12 +2248,10 @@ cache_purge_vgone(struct vnode *vp)
}
 
/*
-* All the NULL pointer state we found above may be transient.
-* Serialize against a possible thread doing cache_purge.
+* Serialize against a potential thread doing cache_purge.
 */
mtx_wait_unlocked(vlp);
-   if (!(LIST_EMPTY(&vp->v_cache_src) && TAILQ_EMPTY(&vp->v_cache_dst) &&
-   vp->v_cache_dd == NULL)) {
+   if (cache_has_entries(vp)) {
mtx_lock(vlp);
cache_purge_impl(vp);
mtx_assert(vlp, MA_NOTOWNED);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366279 - head/sys/riscv/include

2020-09-29 Thread Jessica Clarke
Author: jrtc27
Date: Wed Sep 30 02:21:38 2020
New Revision: 366279
URL: https://svnweb.freebsd.org/changeset/base/366279

Log:
  riscv: Define __PCI_REROUTE_INTERRUPT
  
  Every other architecture defines this and this is required for
  interrupts to work when using QEMU's PCI VirtIO devices (which all
  report an interrupt line of 0) for two reasons.
  
  Firstly, interrupt line 0 is wrong; they use one of 0x20-0x23 with the
  lines being cycled across devices like normal. Moreover, RISC-V uses
  INTRNG, whose IRQs are virtual as indices into its irq_map, so even if
  we have the right interrupt line we still need to try and route the
  interrupt in order to ultimately call into intr_map_irq and get back a
  unique index into the map for the given line, otherwise we will use
  whatever happens to be in irq_map[line] (which for QEMU where the line
  is initialised to 0 results in using the first allocated interrupt,
  namely the RTC on IRQ 11 at time of commit).
  
  Note that pci_assign_interrupt will still do the wrong thing for INTRNG
  when using a tunable, as it will bypass INTRNG entirely and use the
  tunable's value as the index into irq_map, when it should instead
  (indirectly) call intr_map_irq to allocate a new entry for the given
  IRQ and treat the tunable as stating the physical line in use, which is
  what one would expect. This, however, is a problem shared by all INTRNG
  architectures, and not exclusive to RISC-V.
  
  Reviewed by:  kib
  Approved by:  kib
  Differential Revision:https://reviews.freebsd.org/D26564

Modified:
  head/sys/riscv/include/param.h

Modified: head/sys/riscv/include/param.h
==
--- head/sys/riscv/include/param.h  Wed Sep 30 02:18:09 2020
(r366278)
+++ head/sys/riscv/include/param.h  Wed Sep 30 02:21:38 2020
(r366279)
@@ -42,6 +42,8 @@
 #defineSTACKALIGNBYTES (16 - 1)
 #defineSTACKALIGN(p)   ((uint64_t)(p) & ~STACKALIGNBYTES)
 
+#define __PCI_REROUTE_INTERRUPT
+
 #ifndef MACHINE
 #defineMACHINE "riscv"
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366278 - head/sys/kern

2020-09-29 Thread Rick Macklem
Author: rmacklem
Date: Wed Sep 30 02:18:09 2020
New Revision: 366278
URL: https://svnweb.freebsd.org/changeset/base/366278

Log:
  Make copy_file_range(2) Linux compatible for overflow of offset + len.
  
  Without this patch, if a call to copy_file_range(2) specifies an input file
  offset + len that would wrap around, EINVAL is returned.
  I thought that was the Linux behaviour, but recent testing showed that
  Linux accepts this case and does the copy_file_range() to EOF.
  
  This patch changes the FreeBSD code to exhibit the same behaviour as
  Linux for this case.
  
  Reviewed by:  asomers, kib
  Differential Revision:https://reviews.freebsd.org/D26569

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Wed Sep 30 00:56:08 2020(r366277)
+++ head/sys/kern/vfs_vnops.c   Wed Sep 30 02:18:09 2020(r366278)
@@ -2790,25 +2790,31 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, 
 {
int error;
size_t len;
-   uint64_t uvalin, uvalout;
+   uint64_t uval;
 
len = *lenp;
*lenp = 0;  /* For error returns. */
error = 0;
 
/* Do some sanity checks on the arguments. */
-   uvalin = *inoffp;
-   uvalin += len;
-   uvalout = *outoffp;
-   uvalout += len;
if (invp->v_type == VDIR || outvp->v_type == VDIR)
error = EISDIR;
-   else if (*inoffp < 0 || uvalin > INT64_MAX || uvalin <
-   (uint64_t)*inoffp || *outoffp < 0 || uvalout > INT64_MAX ||
-   uvalout < (uint64_t)*outoffp || invp->v_type != VREG ||
-   outvp->v_type != VREG)
+   else if (*inoffp < 0 || *outoffp < 0 ||
+   invp->v_type != VREG || outvp->v_type != VREG)
error = EINVAL;
if (error != 0)
+   goto out;
+
+   /* Ensure offset + len does not wrap around. */
+   uval = *inoffp;
+   uval += len;
+   if (uval > INT64_MAX)
+   len = INT64_MAX - *inoffp;
+   uval = *outoffp;
+   uval += len;
+   if (uval > INT64_MAX)
+   len = INT64_MAX - *outoffp;
+   if (len == 0)
goto out;
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-09-29 Thread Warner Losh
On Tue, Sep 29, 2020, 1:00 PM Hans Petter Selasky  wrote:

> On 2020-09-29 20:06, Warner Losh wrote:
> > Author: imp
> > Date: Tue Sep 29 18:06:02 2020
> > New Revision: 366265
> > URL: https://svnweb.freebsd.org/changeset/base/366265
> >
> > Log:
> >Standalone SX shims
> >
> >Create a do-nothing version of SX locks. OpenZFS needs them. However,
> >since the boot loader is single threaded, they can be nops.
> >
> > Modified:
> >head/sys/sys/sx.h
> >
> > Modified: head/sys/sys/sx.h
> >
> ==
> > --- head/sys/sys/sx.h Tue Sep 29 17:52:15 2020(r366264)
> > +++ head/sys/sys/sx.h Tue Sep 29 18:06:02 2020(r366265)
> > @@ -300,4 +300,26 @@ __sx_xunlock(struct sx *sx, struct thread *td,
> const c
> >
> >   #endif /* _KERNEL */
> >
> > +#ifdef _STANDALONE
> > +/* since we have no threads in the boot loader, trivially implement
> no-op version */
> > +#define sx_xlock(s) (1)
> > +#define sx_try_xlock(s) (1)
> > +#define sx_xunlock(s) (1)
> > +#define SX_DUPOK 0
> > +#define SX_NEW 0
> > +#define SX_NOWITNESS 0
> > +
> > +static __inline void
> > +sx_init_flags(struct sx *sx, const char *description, int opts)
> > +{
> > +
> > +}
> > +
> > +static __inline void
> > +sx_destroy(struct sx *sx)
> > +{
> > +
> > +}
> > +#endif /* _STANDALONE */
> > +
> >   #endif /* !_SYS_SX_H_ */
> >
>
> You may want to use:
>
> bsd_kernel.c:sx_init_flags(struct sx *sx, const char *name, int flags)
> bsd_kernel.c:   sx->owned = 0;
> bsd_kernel.c:sx_destroy(struct sx *sx)
> bsd_kernel.c:sx_xlock(struct sx *sx)
> bsd_kernel.c:   sx->owned++;
> bsd_kernel.c:sx_xunlock(struct sx *sx)
> bsd_kernel.c:   sx->owned--;
> bsd_kernel.c:sx_xlocked(struct sx *sx)
> bsd_kernel.c:   return (sx->owned != 0);
> bsd_kernel.h:struct sx {
> bsd_kernel.h:#definesx_assert(...) do { } while (0)
> bsd_kernel.h:#definesx_init(...) sx_init_flags(__VA_ARGS__, 0)
> bsd_kernel.h:void   sx_init_flags(struct sx *, const char *, int);
> bsd_kernel.h:void   sx_destroy(struct sx *);
> bsd_kernel.h:void   sx_xlock(struct sx *);
> bsd_kernel.h:void   sx_xunlock(struct sx *);
> bsd_kernel.h:intsx_xlocked(struct sx *);
>
> from "src/stand/kshim"
>

Yea. This, and other parts of the shims, need to be integrated into stand...

Warner

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


svn commit: r366275 - head

2020-09-29 Thread Kyle Evans
Author: kevans
Date: Wed Sep 30 00:47:57 2020
New Revision: 366275
URL: https://svnweb.freebsd.org/changeset/base/366275

Log:
  Makefile.inc1: sysent: allow subordinate sysent targets to run in parallel
  
  makesyscalls.lua (and indeed makesyscalls.sh) are both safe to be run in
  parallel, so let's do it.
  
  This is a trivial difference because runtime per-target is pretty small, but
  I like seeing it run in parallel when my muscle memory types `make -sj4`.
  
  Reviewed by:  brooks, emaste
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D26594

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Sep 30 00:13:19 2020(r366274)
+++ head/Makefile.inc1  Wed Sep 30 00:47:57 2020(r366275)
@@ -1503,10 +1503,14 @@ _sysent_dirs+=  sys/amd64/linux \
sys/arm/linux   \
sys/arm64/linux \
sys/i386/linux
+
 sysent: .PHONY
 .for _dir in ${_sysent_dirs}
+sysent-${_dir}: .PHONY
@echo "${MAKE} -C ${.CURDIR}/${_dir} sysent"
${_+_}@env PATH=${_sysent_PATH} ${MAKE} -C ${.CURDIR}/${_dir} sysent
+
+sysent: sysent-${_dir}
 .endfor
 
 #
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366273 - head/share/mk

2020-09-29 Thread Brooks Davis
Author: brooks
Date: Tue Sep 29 23:48:05 2020
New Revision: 366273
URL: https://svnweb.freebsd.org/changeset/base/366273

Log:
  Hoist comment on fixup of ld path
  
  Reported by:  jrtc27
  Differential Revision:https://reviews.freebsd.org/D26591

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkTue Sep 29 23:35:46 2020(r366272)
+++ head/share/mk/bsd.sys.mkTue Sep 29 23:48:05 2020(r366273)
@@ -297,10 +297,10 @@ CFLAGS+=  ERROR-tried-to-rebuild-during-make-install
 .if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld")
 # Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld".
 .if ${COMPILER_TYPE} == "clang"
+# Note: Clang does not like relative paths for ld so we map ld.lld -> lld.
 .if ${COMPILER_VERSION} >= 12
 LDFLAGS+=  --ld-path=${LD:[1]:S/^ld.//1W}
 .else
-# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld.
 LDFLAGS+=  -fuse-ld=${LD:[1]:S/^ld.//1W}
 .endif
 .else
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366271 - head/sys/arm64/arm64

2020-09-29 Thread Mitchell Horne
Author: mhorne
Date: Tue Sep 29 23:21:56 2020
New Revision: 366271
URL: https://svnweb.freebsd.org/changeset/base/366271

Log:
  arm64: set the correct HWCAP
  
  This appears to be a typo. The AdvSIMD field encodes support for
  half-precision floating point SIMD instructions, which corresponds to
  HWCAP_ASIMDHP, not HWCAP_ASIMDDP.
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Tue Sep 29 22:30:15 2020
(r366270)
+++ head/sys/arm64/arm64/identcpu.c Tue Sep 29 23:21:56 2020
(r366271)
@@ -1295,7 +1295,7 @@ parse_cpu_features_hwcap(void)
hwcap |= HWCAP_ASIMD;
break;
case ID_AA64PFR0_AdvSIMD_HP:
-   hwcap |= HWCAP_ASIMD | HWCAP_ASIMDDP;
+   hwcap |= HWCAP_ASIMD | HWCAP_ASIMDHP;
break;
default:
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366270 - head/share/mk

2020-09-29 Thread Brooks Davis
Author: brooks
Date: Tue Sep 29 22:30:15 2020
New Revision: 366270
URL: https://svnweb.freebsd.org/changeset/base/366270

Log:
  Prefer --ld-path=/path/to/ld on clang >= 12
  
  Clang 12 warns about passing a path to -fuse-ld and -Werror makes that
  an error preventing building world without this change.
  
  Reviewed by:  arichardson, emaste
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26591

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkTue Sep 29 21:51:32 2020(r366269)
+++ head/share/mk/bsd.sys.mkTue Sep 29 22:30:15 2020(r366270)
@@ -296,10 +296,13 @@ CFLAGS+=  ERROR-tried-to-rebuild-during-make-install
 # Please keep this if in sync with kern.mk
 .if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld")
 # Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld".
-# Note: Clang 12+ will prefer --ld-path= over -fuse-ld=.
 .if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_VERSION} >= 12
+LDFLAGS+=  --ld-path=${LD:[1]:S/^ld.//1W}
+.else
 # Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld.
 LDFLAGS+=  -fuse-ld=${LD:[1]:S/^ld.//1W}
+.endif
 .else
 # GCC does not support an absolute path for -fuse-ld so we just print this
 # warning instead and let the user add the required symlinks.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366269 - head/sys/dev/cxgbe/crypto

2020-09-29 Thread John Baldwin
Author: jhb
Date: Tue Sep 29 21:51:32 2020
New Revision: 366269
URL: https://svnweb.freebsd.org/changeset/base/366269

Log:
  Fallback to software for more GCM and CCM requests.
  
  ccr(4) uses software to handle GCM and CCM requests not supported by
  the crypto engine (e.g. with only AAD and no payload).  This change
  adds a fallback for a few more requests such as those with more SGL
  entries than can fit in a work request (this can happen for GCM when
  decrypting a TLS record split across 15 or more packets).
  
  Reported by:  Chelsio QA
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D26582

Modified:
  head/sys/dev/cxgbe/crypto/t4_crypto.c

Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- head/sys/dev/cxgbe/crypto/t4_crypto.c   Tue Sep 29 20:46:25 2020
(r366268)
+++ head/sys/dev/cxgbe/crypto/t4_crypto.c   Tue Sep 29 21:51:32 2020
(r366269)
@@ -2777,7 +2777,7 @@ ccr_process(device_t dev, struct cryptop *crp, int hin
return (0);
}
error = ccr_gcm(sc, s, crp);
-   if (error == EMSGSIZE) {
+   if (error == EMSGSIZE || error == EFBIG) {
counter_u64_add(sc->stats_sw_fallback, 1);
mtx_unlock(&s->lock);
ccr_gcm_soft(s, crp);
@@ -2796,7 +2796,7 @@ ccr_process(device_t dev, struct cryptop *crp, int hin
csp->csp_cipher_klen);
}
error = ccr_ccm(sc, s, crp);
-   if (error == EMSGSIZE) {
+   if (error == EMSGSIZE || error == EFBIG) {
counter_u64_add(sc->stats_sw_fallback, 1);
mtx_unlock(&s->lock);
ccr_ccm_soft(s, crp);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366268 - head/sys/dev/rtwn/usb

2020-09-29 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Sep 29 20:46:25 2020
New Revision: 366268
URL: https://svnweb.freebsd.org/changeset/base/366268

Log:
  rtwn: narrow the epoch area
  
  Rather than placing the epoch around the entire receive loop which
  might call into rtwn_rx_frame() and USB and sleep, split the loop
  into two[1] and leave us with one unlock/lock cycle as well.
  
  PR:   249925
  Reported by:  thj, (rkoberman gmail.com)
  Tested by:thj
  Suggested by: adrian [1]
  Reviewed by:  adrian
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation (initially, paniced my iwl lab host)
  Differential Revision:https://reviews.freebsd.org/D26554

Modified:
  head/sys/dev/rtwn/usb/rtwn_usb_rx.c

Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c
==
--- head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Sep 29 20:29:07 2020
(r366267)
+++ head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Sep 29 20:46:25 2020
(r366268)
@@ -368,7 +368,7 @@ rtwn_bulk_rx_callback(struct usb_xfer *xfer, usb_error
struct rtwn_softc *sc = &uc->uc_sc;
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_node *ni;
-   struct mbuf *m = NULL, *next;
+   struct mbuf *m0, *m = NULL, *next;
struct rtwn_data *data;
 
RTWN_ASSERT_LOCKED(sc);
@@ -400,24 +400,30 @@ tr_setup:
 * ieee80211_input() because here is at the end of a USB
 * callback and safe to unlock.
 */
+   m0 = m;
+   while (m != NULL) {
+   M_ASSERTPKTHDR(m);
+   m->m_pkthdr.PH_loc.ptr = rtwn_rx_frame(sc, m);
+   m = m->m_nextpkt;
+   }
NET_EPOCH_ENTER(et);
+   RTWN_UNLOCK(sc);
+   m = m0;
while (m != NULL) {
next = m->m_nextpkt;
m->m_nextpkt = NULL;
 
-   ni = rtwn_rx_frame(sc, m);
-
-   RTWN_UNLOCK(sc);
-
+   ni = m->m_pkthdr.PH_loc.ptr;
+   m->m_pkthdr.PH_loc.ptr = NULL;
if (ni != NULL) {
(void)ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni);
} else {
(void)ieee80211_input_mimo_all(ic, m);
}
-   RTWN_LOCK(sc);
m = next;
}
+   RTWN_LOCK(sc);
NET_EPOCH_EXIT(et);
break;
default:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366267 - in head/sys: amd64/conf conf dev/acpica dev/pci i386/conf x86/x86

2020-09-29 Thread Ruslan Bukin
Author: br
Date: Tue Sep 29 20:29:07 2020
New Revision: 366267
URL: https://svnweb.freebsd.org/changeset/base/366267

Log:
  Rename kernel option ACPI_DMAR to IOMMU.
  This is mostly needed for a common arm64/amd64 iommu code.
  
  Reviewed by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D26587

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/amd64/conf/MINIMAL
  head/sys/conf/files.x86
  head/sys/conf/options
  head/sys/dev/acpica/acpi_pci.c
  head/sys/dev/pci/pci.c
  head/sys/i386/conf/MINIMAL
  head/sys/i386/conf/NOTES
  head/sys/x86/x86/busdma_machdep.c
  head/sys/x86/x86/io_apic.c
  head/sys/x86/x86/msi.c

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Tue Sep 29 18:13:54 2020(r366266)
+++ head/sys/amd64/conf/GENERIC Tue Sep 29 20:29:07 2020(r366267)
@@ -102,6 +102,7 @@ options WITNESS # Enable checks to 
detect deadlocks
 optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for 
speed
 optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
 optionsVERBOSE_SYSINIT=0   # Support debug.verbose_sysinit, off by 
default
+optionsIOMMU
 
 # Kernel Sanitizers
 #options   COVERAGE# Generic kernel coverage. Used by KCOV
@@ -127,7 +128,6 @@ device  cpufreq
 
 # Bus support.
 device acpi
-optionsACPI_DMAR
 device pci
 optionsPCI_HP  # PCI-Express native HotPlug
 optionsPCI_IOV # PCI SR-IOV support

Modified: head/sys/amd64/conf/MINIMAL
==
--- head/sys/amd64/conf/MINIMAL Tue Sep 29 18:13:54 2020(r366266)
+++ head/sys/amd64/conf/MINIMAL Tue Sep 29 20:29:07 2020(r366267)
@@ -93,6 +93,7 @@ options   WITNESS # Enable checks to 
detect deadlocks
 optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for 
speed
 optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
 optionsVERBOSE_SYSINIT=0   # Support debug.verbose_sysinit, off by 
default
+optionsIOMMU
 
 # Make an SMP-capable kernel by default
 optionsSMP # Symmetric MultiProcessor Kernel
@@ -103,7 +104,6 @@ device  cpufreq
 
 # Bus support.
 device acpi
-optionsACPI_DMAR
 device pci
 
 # atkbdc0 controls both the keyboard and the PS/2 mouse

Modified: head/sys/conf/files.x86
==
--- head/sys/conf/files.x86 Tue Sep 29 18:13:54 2020(r366266)
+++ head/sys/conf/files.x86 Tue Sep 29 20:29:07 2020(r366267)
@@ -165,8 +165,8 @@ dev/imcsmb/imcsmb.c optionalimcsmb
 dev/imcsmb/imcsmb_pci.coptionalimcsmb pci
 dev/intel/spi.coptionalintelspi
 dev/io/iodev.c optionalio
-dev/iommu/busdma_iommu.c   optionalacpi acpi_dmar pci
-dev/iommu/iommu_gas.c  optionalacpi acpi_dmar pci
+dev/iommu/busdma_iommu.c   optionalacpi iommu pci
+dev/iommu/iommu_gas.c  optionalacpi iommu pci
 dev/ipmi/ipmi.coptionalipmi
 dev/ipmi/ipmi_acpi.c   optionalipmi acpi
 dev/ipmi/ipmi_isa.coptionalipmi isa
@@ -302,14 +302,14 @@ x86/cpufreq/hwpstate_amd.coptionalcpufreq
 x86/cpufreq/hwpstate_intel.c   optionalcpufreq
 x86/cpufreq/p4tcc.coptionalcpufreq
 x86/cpufreq/powernow.c optionalcpufreq
-x86/iommu/intel_ctx.c  optionalacpi acpi_dmar pci
-x86/iommu/intel_drv.c  optionalacpi acpi_dmar pci
-x86/iommu/intel_fault.coptionalacpi acpi_dmar pci
-x86/iommu/intel_idpgtbl.c  optionalacpi acpi_dmar pci
-x86/iommu/intel_intrmap.c  optionalacpi acpi_dmar pci
-x86/iommu/intel_qi.c   optionalacpi acpi_dmar pci
-x86/iommu/intel_quirks.c   optionalacpi acpi_dmar pci
-x86/iommu/intel_utils.coptionalacpi acpi_dmar pci
+x86/iommu/intel_ctx.c  optionalacpi iommu pci
+x86/iommu/intel_drv.c  optionalacpi iommu pci
+x86/iommu/intel_fault.coptionalacpi iommu pci
+x86/iommu/intel_idpgtbl.c  optionalacpi iommu pci
+x86/iommu/intel_intrmap.c  optionalacpi iommu pci
+x86/iommu/intel_qi.c   optionalacpi iommu pci
+x86/iommu/intel_quirks.c   optionalacpi iommu pci
+x86/iommu/intel_utils.coptionalacpi iommu pci
 x86/isa/atrtc.cstandard
 x86/isa/clock.cstandard
 x86/isa/isa.c  op

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

2020-09-29 Thread Hans Petter Selasky

On 2020-09-29 20:06, Warner Losh wrote:

Author: imp
Date: Tue Sep 29 18:06:02 2020
New Revision: 366265
URL: https://svnweb.freebsd.org/changeset/base/366265

Log:
   Standalone SX shims
   
   Create a do-nothing version of SX locks. OpenZFS needs them. However,

   since the boot loader is single threaded, they can be nops.

Modified:
   head/sys/sys/sx.h

Modified: head/sys/sys/sx.h
==
--- head/sys/sys/sx.h   Tue Sep 29 17:52:15 2020(r366264)
+++ head/sys/sys/sx.h   Tue Sep 29 18:06:02 2020(r366265)
@@ -300,4 +300,26 @@ __sx_xunlock(struct sx *sx, struct thread *td, const c
  
  #endif /* _KERNEL */
  
+#ifdef _STANDALONE

+/* since we have no threads in the boot loader, trivially implement no-op 
version */
+#define sx_xlock(s) (1)
+#define sx_try_xlock(s) (1)
+#define sx_xunlock(s) (1)
+#define SX_DUPOK 0
+#define SX_NEW 0
+#define SX_NOWITNESS 0
+
+static __inline void
+sx_init_flags(struct sx *sx, const char *description, int opts)
+{
+
+}
+
+static __inline void
+sx_destroy(struct sx *sx)
+{
+
+}
+#endif /* _STANDALONE */
+
  #endif /* !_SYS_SX_H_ */



You may want to use:

bsd_kernel.c:sx_init_flags(struct sx *sx, const char *name, int flags)
bsd_kernel.c:   sx->owned = 0;
bsd_kernel.c:sx_destroy(struct sx *sx)
bsd_kernel.c:sx_xlock(struct sx *sx)
bsd_kernel.c:   sx->owned++;
bsd_kernel.c:sx_xunlock(struct sx *sx)
bsd_kernel.c:   sx->owned--;
bsd_kernel.c:sx_xlocked(struct sx *sx)
bsd_kernel.c:   return (sx->owned != 0);
bsd_kernel.h:struct sx {
bsd_kernel.h:#definesx_assert(...) do { } while (0)
bsd_kernel.h:#definesx_init(...) sx_init_flags(__VA_ARGS__, 0)
bsd_kernel.h:void   sx_init_flags(struct sx *, const char *, int);
bsd_kernel.h:void   sx_destroy(struct sx *);
bsd_kernel.h:void   sx_xlock(struct sx *);
bsd_kernel.h:void   sx_xunlock(struct sx *);
bsd_kernel.h:intsx_xlocked(struct sx *);

from "src/stand/kshim"

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


svn commit: r366266 - head/lib/libc/sys

2020-09-29 Thread Warner Losh
Author: imp
Date: Tue Sep 29 18:13:54 2020
New Revision: 366266
URL: https://svnweb.freebsd.org/changeset/base/366266

Log:
  Updates to chroot(2) docs
  
  1. Note what settings give historic behavior
  2. Recommend jail under security considerations.

Modified:
  head/lib/libc/sys/chroot.2

Modified: head/lib/libc/sys/chroot.2
==
--- head/lib/libc/sys/chroot.2  Tue Sep 29 18:06:02 2020(r366265)
+++ head/lib/libc/sys/chroot.2  Tue Sep 29 18:13:54 2020(r366266)
@@ -28,7 +28,7 @@
 .\" @(#)chroot.2   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 26, 2020
+.Dd September 29, 2020
 .Dt CHROOT 2
 .Os
 .Sh NAME
@@ -91,7 +91,10 @@ system call.
 .Pp
 Any other value for
 .Ql kern.chroot_allow_open_directories
-will bypass the check for open directories
+will bypass the check for open directories,
+mimicking the historic insecure behavior of
+.Fn chroot
+still present on other systems.
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS
@@ -156,3 +159,7 @@ root,
 for instance,
 setup the sandbox so that the sandboxed user will have no write
 access to any well-known system directories.
+.Pp
+For complete isolation from the rest of the system, use
+.Xr jail 2
+instead.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366265 - head/sys/sys

2020-09-29 Thread Warner Losh
Author: imp
Date: Tue Sep 29 18:06:02 2020
New Revision: 366265
URL: https://svnweb.freebsd.org/changeset/base/366265

Log:
  Standalone SX shims
  
  Create a do-nothing version of SX locks. OpenZFS needs them. However,
  since the boot loader is single threaded, they can be nops.

Modified:
  head/sys/sys/sx.h

Modified: head/sys/sys/sx.h
==
--- head/sys/sys/sx.h   Tue Sep 29 17:52:15 2020(r366264)
+++ head/sys/sys/sx.h   Tue Sep 29 18:06:02 2020(r366265)
@@ -300,4 +300,26 @@ __sx_xunlock(struct sx *sx, struct thread *td, const c
 
 #endif /* _KERNEL */
 
+#ifdef _STANDALONE
+/* since we have no threads in the boot loader, trivially implement no-op 
version */
+#define sx_xlock(s) (1)
+#define sx_try_xlock(s) (1)
+#define sx_xunlock(s) (1)
+#define SX_DUPOK 0
+#define SX_NEW 0
+#define SX_NOWITNESS 0
+
+static __inline void
+sx_init_flags(struct sx *sx, const char *description, int opts)
+{
+
+}
+
+static __inline void
+sx_destroy(struct sx *sx)
+{
+
+}
+#endif /* _STANDALONE */
+
 #endif /* !_SYS_SX_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366264 - head/sbin/kldconfig

2020-09-29 Thread Fernando Apesteguía
Author: fernape (ports committer)
Date: Tue Sep 29 17:52:15 2020
New Revision: 366264
URL: https://svnweb.freebsd.org/changeset/base/366264

Log:
  kldconfig(8): Add EXAMPLES to the man page
  
  Add EXAMPLES section to the man page showing the use of all flags except for
  -S.
  
  While here, clarify -f description. It not only suppresses diagnostic messages
  but it also affects the exit status of the command itself. This is shown in 
two
  of the examples.
  
  Approved by:  bcr@
  Differential Revision:https://reviews.freebsd.org/D26588

Modified:
  head/sbin/kldconfig/kldconfig.8

Modified: head/sbin/kldconfig/kldconfig.8
==
--- head/sbin/kldconfig/kldconfig.8 Tue Sep 29 17:22:14 2020
(r366263)
+++ head/sbin/kldconfig/kldconfig.8 Tue Sep 29 17:52:15 2020
(r366264)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2017
+.Dd September 29, 2020
 .Dt KLDCONFIG 8
 .Os
 .Sh NAME
@@ -54,9 +54,8 @@ The following options are available:
 .It Fl d
 Remove the specified paths from the module search path.
 .It Fl f
-Do not display a diagnostic message if a path specified for adding is
-already present in the search path, or if a path specified for removing
-is not present in the search path.
+Do not fail if a path specified for adding is already present in the search
+path, or if a path specified for removing is not present in the search path.
 This may be useful in startup/shutdown scripts for adding a path to
 a file system which is still not mounted, or in shutdown scripts for
 unconditionally removing a path that may have been added during startup.
@@ -95,6 +94,69 @@ The default module search path used by the kernel.
 .El
 .Sh EXIT STATUS
 .Ex -std
+.Sh EXAMPLES
+Show the module search path
+.Bd -literal -offset indent
+$ kldconfig -r
+/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays
+.Ed
+.Pp
+Try to delete the
+.Pa /boot
+directory from the search path.
+The command will fail:
+.Bd -literal -offset indent
+$ kldconfig -d /boot
+kldconfig: not in module search path: /boot
+$ echo $?
+1
+.Ed
+.Pp
+Same as above but forcing the operation.
+This time the command will succeed:
+.Bd -literal -offset indent
+$ kldconfig -d -f /boot
+$ echo $?
+0
+.Ed
+.Pp
+Add the
+.Pa /boot
+directory to the beginning of the search path and display extra verbose output:
+.Bd -literal -offset indent
+$ kldconfig -i -m -vv /boot
+/boot/kernel;/boot/modules -> /boot;/boot/kernel;/boot/modules
+.Ed
+.Pp
+Without
+.Fl m
+the
+.Fl i
+flag will overwrite the contents of the search path list:
+.Bd -literal -offset indent
+$ kldconfig -i -vv /boot
+/boot;/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays -> /boot
+.Ed
+.Pp
+Same as above but using
+.Fl n
+to simulate the operation without actually doing it:
+.Bd -literal -offset indent
+$ kldconfig -i -n -vv /boot
+/boot;/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays -> /boot
+.Ed
+.Pp
+Add directories to the search path removing duplicates.
+Note the need of
+.Fl f
+to force the operation in case any of the directories is already in the
+search path.
+The
+.Pa /boot/kernel
+directory will be added once:
+.Bd -literal -offset indent
+$ kldconfig -f -U /boot/kernel /boot/kernel /boot/modules /boot/dtb 
/boot/dtb/overlays
+.Ed
 .Sh SEE ALSO
 .Xr kldload 2 ,
 .Xr kldload 8 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366260 - head/stand/libsa

2020-09-29 Thread Warner Losh
Author: imp
Date: Tue Sep 29 16:29:50 2020
New Revision: 366260
URL: https://svnweb.freebsd.org/changeset/base/366260

Log:
  Implement some time variables from kernel
  
  OpenZFS will start using some of the kernel timekeeping bits
  shortly. This implements the bare minimum of that which currently
  is just the time_seconds variable.

Added:
  head/stand/libsa/time.c   (contents, props changed)
Modified:
  head/stand/libsa/Makefile

Modified: head/stand/libsa/Makefile
==
--- head/stand/libsa/Makefile   Tue Sep 29 15:37:57 2020(r366259)
+++ head/stand/libsa/Makefile   Tue Sep 29 16:29:50 2020(r366260)
@@ -160,6 +160,9 @@ SRCS+=  dosfs.c ext2fs.c
 SRCS+= splitfs.c
 SRCS+= pkgfs.c
 
+# Time support
+SRCS+= time.c
+
 # kernel ufs support
 .PATH: ${SRCTOP}/sys/ufs/ffs
 SRCS+=ffs_subr.c ffs_tables.c

Added: head/stand/libsa/time.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/stand/libsa/time.c Tue Sep 29 16:29:50 2020(r366260)
@@ -0,0 +1,35 @@
+/*-
+ * Copyright (c) 2020 M. Warner Losh 
+ *
+ * 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.
+ */
+
+/*
+ * The parts of kern_tc.c and other timekeeping bits of the kernel.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+
+volatile time_t time_second = 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366186 - in head/usr.sbin: bsdconfig/share/media bsdinstall/scripts

2020-09-29 Thread Niclas Zeising

On 2020-09-29 17:26, Scott Long wrote:



On Sep 27, 2020, at 2:41 AM, Niclas Zeising  wrote:

On 2020-09-27 03:38, Scott Long wrote:

On Sep 26, 2020, at 5:24 PM, Rodney W. Grimes  wrote:






On Sep 26, 2020, at 1:22 PM, Warner Losh  wrote:




I am the wrong person to answer that question.

In this case, things have not become lame.  For instance, the names
ervers for se.freebsd.org work fine, but ftp3.se and ftp6.se records are
removed.  Same for ru.freebsd.org and ftp4.ru.
I'm merely pointing out that changing ftp.CC.freebsd.org usually
requires contacting the person(s) maintaining the CC.freebsd.org zone,
which is usually not the project.

It's usually people associated with the project in some way, but who might not 
be as responsive as cluster admin. These domains have been delegated, so we 
have to get the delegated admin to make the changes, which can take a bit of 
time to chase down and doesn't lend itself to easy / automated coping with this 
situation.



Just a spitball idea here, but maybe we should consider not embedding these 
lists of mirror URLs into the binaries.  It seems pretty straight-forward that 
the list evolves over time, and that evolution is not tightly coupled with the 
updating of the binaries.  It sounds like the pkg and freebsd-update 
infrastructure use DNS TXT and/or SRV records to point to the metadata needed 
to construct a mirror URL list dynamically.  Maybe something similar can be 
done for bsdconfig?  If it?s not a crazy idea, is there anyone who would be 
interested in helping me write a proposal over at arch@?


100% behind that idea!  Especially since it seems the project has lost
(some) control over its DNS space, which IMHO, is still an issue, if
the people whom DNS zones have been deligated to are not responsive
that should also

Words of agreement don’t help at the moment, though i appreciate your 
enthusiasm.  Would you he able to help write a proposal for the arch@ mailing 
list?


I think this is the wrong approach, and the better approach is to have the 
official installer use download.freebsd.org (which already is geo-located).  I 
also feel like this is probably something that core and possibly clusteradm 
should weigh in on, since it affects how we distribute FreeBSD.

My impression was that we were generally trying to move away from mirrors 
hosted by various people and organizations all over the world, where we have 
little control, to our own mirrors behind download.freebsd.org.  If this is the 
case, perhaps we should do so in the installer as well.



I’m totally fine with this.  Also, I don’t speak for core on my own, but I am 
part of core.  We’re trying to encourage public discussion and participation on 
these kinds of issues, so that’s why I’m suggesting that this conversation 
should move to an appropriate mailing list.


I'll try to come up with something that uses download.freebsd.org, and 
send it out for discussion.  I'm not sure I can make it in time for 12.2 
though, so in the meantime I'll MFC this commit and ask re@ about 
getting it into 12.2.  That way users won't stumble over the obviously 
dead mirrors while we discuss a better approach for the future.

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


Re: svn commit: r366186 - in head/usr.sbin: bsdconfig/share/media bsdinstall/scripts

2020-09-29 Thread Scott Long

> On Sep 27, 2020, at 2:41 AM, Niclas Zeising  wrote:
> 
> On 2020-09-27 03:38, Scott Long wrote:
>>> On Sep 26, 2020, at 5:24 PM, Rodney W. Grimes  
>>> wrote:
>>> 
>>> 
 
 
>> On Sep 26, 2020, at 1:22 PM, Warner Losh  wrote:
> 
> 
> 
> I am the wrong person to answer that question.
> 
> In this case, things have not become lame.  For instance, the names
> ervers for se.freebsd.org work fine, but ftp3.se and ftp6.se records are
> removed.  Same for ru.freebsd.org and ftp4.ru.
> I'm merely pointing out that changing ftp.CC.freebsd.org usually
> requires contacting the person(s) maintaining the CC.freebsd.org zone,
> which is usually not the project.
> 
> It's usually people associated with the project in some way, but who 
> might not be as responsive as cluster admin. These domains have been 
> delegated, so we have to get the delegated admin to make the changes, 
> which can take a bit of time to chase down and doesn't lend itself to 
> easy / automated coping with this situation.
> 
 
 Just a spitball idea here, but maybe we should consider not embedding 
 these lists of mirror URLs into the binaries.  It seems pretty 
 straight-forward that the list evolves over time, and that evolution is 
 not tightly coupled with the updating of the binaries.  It sounds like the 
 pkg and freebsd-update infrastructure use DNS TXT and/or SRV records to 
 point to the metadata needed to construct a mirror URL list dynamically.  
 Maybe something similar can be done for bsdconfig?  If it?s not a crazy 
 idea, is there anyone who would be interested in helping me write a 
 proposal over at arch@?
>>> 
>>> 100% behind that idea!  Especially since it seems the project has lost
>>> (some) control over its DNS space, which IMHO, is still an issue, if
>>> the people whom DNS zones have been deligated to are not responsive
>>> that should also
>> Words of agreement don’t help at the moment, though i appreciate your 
>> enthusiasm.  Would you he able to help write a proposal for the arch@ 
>> mailing list?
> 
> I think this is the wrong approach, and the better approach is to have the 
> official installer use download.freebsd.org (which already is geo-located).  
> I also feel like this is probably something that core and possibly clusteradm 
> should weigh in on, since it affects how we distribute FreeBSD.
> 
> My impression was that we were generally trying to move away from mirrors 
> hosted by various people and organizations all over the world, where we have 
> little control, to our own mirrors behind download.freebsd.org.  If this is 
> the case, perhaps we should do so in the installer as well.
> 

I’m totally fine with this.  Also, I don’t speak for core on my own, but I am 
part of core.  We’re trying to encourage public discussion and participation on 
these kinds of issues, so that’s why I’m suggesting that this conversation 
should move to an appropriate mailing list.

> That said, I'm not opposed to the idea of using DNS SRV/TXT records to 
> construct mirror lists, especially if we want to keep on using those mirrors.

Scott

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


svn commit: r366257 - in head/sys/dev: acpica iommu pci

2020-09-29 Thread Ruslan Bukin
Author: br
Date: Tue Sep 29 15:10:56 2020
New Revision: 366257
URL: https://svnweb.freebsd.org/changeset/base/366257

Log:
  o Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().
This function isn't ACPI dependent and we may use it on FDT systems
as well.
  o Don't repeat the function declaration, include iommu.h instead.
  
  Reviewed by:  andrew, kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D26584

Modified:
  head/sys/dev/acpica/acpi_pci.c
  head/sys/dev/iommu/busdma_iommu.c
  head/sys/dev/iommu/busdma_iommu.h
  head/sys/dev/iommu/iommu.h
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/acpica/acpi_pci.c
==
--- head/sys/dev/acpica/acpi_pci.c  Tue Sep 29 15:09:38 2020
(r366256)
+++ head/sys/dev/acpica/acpi_pci.c  Tue Sep 29 15:10:56 2020
(r366257)
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -49,6 +51,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include "pcib_if.h"
 #include "pci_if.h"
 
@@ -456,7 +460,6 @@ acpi_pci_detach(device_t dev)
 }
 
 #ifdef ACPI_DMAR
-bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
 static bus_dma_tag_t
 acpi_pci_get_dma_tag(device_t bus, device_t child)
 {
@@ -464,7 +467,7 @@ acpi_pci_get_dma_tag(device_t bus, device_t child)
 
if (device_get_parent(child) == bus) {
/* try iommu and return if it works */
-   tag = acpi_iommu_get_dma_tag(bus, child);
+   tag = iommu_get_dma_tag(bus, child);
} else
tag = NULL;
if (tag == NULL)

Modified: head/sys/dev/iommu/busdma_iommu.c
==
--- head/sys/dev/iommu/busdma_iommu.c   Tue Sep 29 15:09:38 2020
(r366256)
+++ head/sys/dev/iommu/busdma_iommu.c   Tue Sep 29 15:10:56 2020
(r366257)
@@ -270,7 +270,7 @@ iommu_instantiate_ctx(struct iommu_unit *unit, device_
 }
 
 bus_dma_tag_t
-acpi_iommu_get_dma_tag(device_t dev, device_t child)
+iommu_get_dma_tag(device_t dev, device_t child)
 {
struct iommu_unit *unit;
struct iommu_ctx *ctx;

Modified: head/sys/dev/iommu/busdma_iommu.h
==
--- head/sys/dev/iommu/busdma_iommu.h   Tue Sep 29 15:09:38 2020
(r366256)
+++ head/sys/dev/iommu/busdma_iommu.h   Tue Sep 29 15:10:56 2020
(r366257)
@@ -61,6 +61,4 @@ struct bus_dmamap_iommu {
 
 extern struct bus_dma_impl bus_dma_iommu_impl;
 
-bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
-
 #endif

Modified: head/sys/dev/iommu/iommu.h
==
--- head/sys/dev/iommu/iommu.h  Tue Sep 29 15:09:38 2020(r366256)
+++ head/sys/dev/iommu/iommu.h  Tue Sep 29 15:10:56 2020(r366257)
@@ -232,6 +232,8 @@ bool bus_dma_iommu_set_buswide(device_t dev);
 int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
 vm_paddr_t start, vm_size_t length, int flags);
 
+bus_dma_tag_t iommu_get_dma_tag(device_t dev, device_t child);
+
 SYSCTL_DECL(_hw_iommu);
 
 #endif /* !_SYS_IOMMU_H_ */

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Tue Sep 29 15:09:38 2020(r366256)
+++ head/sys/dev/pci/pci.c  Tue Sep 29 15:10:56 2020(r366257)
@@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -77,6 +79,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include "pcib_if.h"
 #include "pci_if.h"
 
@@ -5680,7 +5684,6 @@ pci_get_resource_list (device_t dev, device_t child)
 }
 
 #ifdef ACPI_DMAR
-bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
 bus_dma_tag_t
 pci_get_dma_tag(device_t bus, device_t dev)
 {
@@ -5689,7 +5692,7 @@ pci_get_dma_tag(device_t bus, device_t dev)
 
if (device_get_parent(dev) == bus) {
/* try iommu and return if it works */
-   tag = acpi_iommu_get_dma_tag(bus, dev);
+   tag = iommu_get_dma_tag(bus, dev);
} else
tag = NULL;
if (tag == NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366252 - head/sys/contrib/openzfs/module/os/freebsd/zfs

2020-09-29 Thread Kyle Evans
On Tue, Sep 29, 2020 at 9:04 AM Mark Johnston  wrote:
>
> On Tue, Sep 29, 2020 at 08:47:37AM -0500, Kyle Evans wrote:
> > On Tue, Sep 29, 2020 at 8:42 AM Mark Johnston  wrote:
> > >
> > > Author: markj
> > > Date: Tue Sep 29 13:41:47 2020
> > > New Revision: 366252
> > > URL: https://svnweb.freebsd.org/changeset/base/366252
> > >
> > > Log:
> > >   ZFS: Fix a logic bug in the FreeBSD getpages VOP
> > >
> > >   This was introduced when I merged r361287 to OpenZFS and has been fixed
> > >   there already, commit 3f6bb6e43fd68e.
> > >
> > >   Reported by:  swills
> > >   Reviewed by:  allanjude, freqlabs, mmacy
> > >
> >
> > I think this should have been a commit to vendor-sys/zfs/dist with an
> > svn merge into sys/contrib/openzfs to make 100% sure that there's no
> > merge conflict (even trivial) upon mmacy's next import, though it's
> > perhaps not likely for the code to change anymore upstream and svn
> > might be smart enough to realize if the diff matches. You might
> > consider going ahead and committing the diff to vendor-sys and doing a
> > record-only MFC of that commit into sys/contrib/openzfs.
>
> Done in r366254.

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


Re: svn commit: r366252 - head/sys/contrib/openzfs/module/os/freebsd/zfs

2020-09-29 Thread Mark Johnston
On Tue, Sep 29, 2020 at 08:47:37AM -0500, Kyle Evans wrote:
> On Tue, Sep 29, 2020 at 8:42 AM Mark Johnston  wrote:
> >
> > Author: markj
> > Date: Tue Sep 29 13:41:47 2020
> > New Revision: 366252
> > URL: https://svnweb.freebsd.org/changeset/base/366252
> >
> > Log:
> >   ZFS: Fix a logic bug in the FreeBSD getpages VOP
> >
> >   This was introduced when I merged r361287 to OpenZFS and has been fixed
> >   there already, commit 3f6bb6e43fd68e.
> >
> >   Reported by:  swills
> >   Reviewed by:  allanjude, freqlabs, mmacy
> >
> 
> I think this should have been a commit to vendor-sys/zfs/dist with an
> svn merge into sys/contrib/openzfs to make 100% sure that there's no
> merge conflict (even trivial) upon mmacy's next import, though it's
> perhaps not likely for the code to change anymore upstream and svn
> might be smart enough to realize if the diff matches. You might
> consider going ahead and committing the diff to vendor-sys and doing a
> record-only MFC of that commit into sys/contrib/openzfs.

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


svn commit: r366254 - head/sys/contrib/openzfs

2020-09-29 Thread Mark Johnston
Author: markj
Date: Tue Sep 29 14:02:42 2020
New Revision: 366254
URL: https://svnweb.freebsd.org/changeset/base/366254

Log:
  MFV r366253
  
  This modifies only the openzfs svn:mergeinfo property, since r366253 has
  already been committed to head.

Modified:
Directory Properties:
  head/sys/contrib/openzfs/   (props changed)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366252 - head/sys/contrib/openzfs/module/os/freebsd/zfs

2020-09-29 Thread Kyle Evans
On Tue, Sep 29, 2020 at 8:47 AM Kyle Evans  wrote:
>
> On Tue, Sep 29, 2020 at 8:42 AM Mark Johnston  wrote:
> >
> > Author: markj
> > Date: Tue Sep 29 13:41:47 2020
> > New Revision: 366252
> > URL: https://svnweb.freebsd.org/changeset/base/366252
> >
> > Log:
> >   ZFS: Fix a logic bug in the FreeBSD getpages VOP
> >
> >   This was introduced when I merged r361287 to OpenZFS and has been fixed
> >   there already, commit 3f6bb6e43fd68e.
> >
> >   Reported by:  swills
> >   Reviewed by:  allanjude, freqlabs, mmacy
> >
>
> I think this should have been a commit to vendor-sys/zfs/dist with an
> svn merge into sys/contrib/openzfs to make 100% sure that there's no
> merge conflict (even trivial) upon mmacy's next import, though it's
> perhaps not likely for the code to change anymore upstream and svn
> might be smart enough to realize if the diff matches. You might
> consider going ahead and committing the diff to vendor-sys and doing a
> record-only MFC of that commit into sys/contrib/openzfs.
>

Bah, sorry: "record-only MFC" -> "record-only MFV"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366252 - head/sys/contrib/openzfs/module/os/freebsd/zfs

2020-09-29 Thread Kyle Evans
On Tue, Sep 29, 2020 at 8:42 AM Mark Johnston  wrote:
>
> Author: markj
> Date: Tue Sep 29 13:41:47 2020
> New Revision: 366252
> URL: https://svnweb.freebsd.org/changeset/base/366252
>
> Log:
>   ZFS: Fix a logic bug in the FreeBSD getpages VOP
>
>   This was introduced when I merged r361287 to OpenZFS and has been fixed
>   there already, commit 3f6bb6e43fd68e.
>
>   Reported by:  swills
>   Reviewed by:  allanjude, freqlabs, mmacy
>

I think this should have been a commit to vendor-sys/zfs/dist with an
svn merge into sys/contrib/openzfs to make 100% sure that there's no
merge conflict (even trivial) upon mmacy's next import, though it's
perhaps not likely for the code to change anymore upstream and svn
might be smart enough to realize if the diff matches. You might
consider going ahead and committing the diff to vendor-sys and doing a
record-only MFC of that commit into sys/contrib/openzfs.

Thanks,

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


svn commit: r366252 - head/sys/contrib/openzfs/module/os/freebsd/zfs

2020-09-29 Thread Mark Johnston
Author: markj
Date: Tue Sep 29 13:41:47 2020
New Revision: 366252
URL: https://svnweb.freebsd.org/changeset/base/366252

Log:
  ZFS: Fix a logic bug in the FreeBSD getpages VOP
  
  This was introduced when I merged r361287 to OpenZFS and has been fixed
  there already, commit 3f6bb6e43fd68e.
  
  Reported by:  swills
  Reviewed by:  allanjude, freqlabs, mmacy

Modified:
  head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c

Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c
==
--- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c  Tue Sep 29 
11:48:22 2020(r366251)
+++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c  Tue Sep 29 
13:41:47 2020(r366252)
@@ -4859,7 +4859,8 @@ zfs_getpages(struct vnode *vp, vm_page_t *ma, int coun
obj_size = object->un_pager.vnp.vnp_size;
zfs_vmobject_wunlock(object);
if (IDX_TO_OFF(ma[count - 1]->pindex) >= obj_size) {
-   zfs_rangelock_exit(lr);
+   if (lr != NULL)
+   zfs_rangelock_exit(lr);
ZFS_EXIT(zfsvfs);
return (zfs_vm_pagerret_bad);
}
@@ -4887,7 +4888,8 @@ zfs_getpages(struct vnode *vp, vm_page_t *ma, int coun
error = dmu_read_pages(os, zp->z_id, ma, count, &pgsin_b, &pgsin_a,
MIN(end, obj_size) - (end - PAGE_SIZE));
 
-   zfs_rangelock_exit(lr);
+   if (lr != NULL)
+   zfs_rangelock_exit(lr);
ZFS_ACCESSTIME_STAMP(zfsvfs, zp);
ZFS_EXIT(zfsvfs);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366251 - head/sys/conf

2020-09-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Sep 29 11:48:22 2020
New Revision: 366251
URL: https://svnweb.freebsd.org/changeset/base/366251

Log:
  Build debug kernels with -O2.
  
  LLVM 11 changed the meaning of '-O' from '-O2' to '-O1', which resulted
  in debug kernels (with 'makeoptions DEBUG=-g') being built with inlining
  disabled, causing severe performance hit.
  
  The -O2 was already being used for building amd64, powerpc, and powerpcspe.
  
  Discussed with:   jrtc27, arichardson, bdragon, jhibbits
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26471

Modified:
  head/sys/conf/kern.pre.mk

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Tue Sep 29 11:18:48 2020(r366250)
+++ head/sys/conf/kern.pre.mk   Tue Sep 29 11:48:22 2020(r366251)
@@ -51,25 +51,14 @@ OBJCOPY?=   objcopy
 SIZE?= size
 
 .if defined(DEBUG)
-.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe"
-# Work around clang 11 miscompile on 32 bit powerpc.
-_MINUS_O=  -O2
-.else
-_MINUS_O=  -O
-.endif
 CTFFLAGS+= -g
-.else
-_MINUS_O=  -O2
 .endif
-.if ${MACHINE_CPUARCH} == "amd64"
-.if ${COMPILER_TYPE} == "clang"
-COPTFLAGS?=-O2 -pipe
+.if ${MACHINE_CPUARCH} == "amd64" && ${COMPILER_TYPE} != "clang"
+_COPTFLAGS_EXTRA=-frename-registers
 .else
-COPTFLAGS?=-O2 -frename-registers -pipe
+_COPTFLAGS_EXTRA=
 .endif
-.else
-COPTFLAGS?=${_MINUS_O} -pipe
-.endif
+COPTFLAGS?=-O2 -pipe ${_COPTFLAGS_EXTRA}
 .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
 COPTFLAGS+= -fno-strict-aliasing
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366250 - head/sys/kern

2020-09-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Sep 29 11:18:48 2020
New Revision: 366250
URL: https://svnweb.freebsd.org/changeset/base/366250

Log:
  Use the 'traced' variable instead of comparing p->p_flag again.
  
  Reviewed by:  kib
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26577

Modified:
  head/sys/kern/subr_syscall.c

Modified: head/sys/kern/subr_syscall.c
==
--- head/sys/kern/subr_syscall.cTue Sep 29 10:07:46 2020
(r366249)
+++ head/sys/kern/subr_syscall.cTue Sep 29 11:18:48 2020
(r366250)
@@ -90,7 +90,7 @@ syscallenter(struct thread *td)
goto retval;
}
 
-   if (__predict_false((p->p_flag & P_TRACED) != 0)) {
+   if (__predict_false(traced)) {
PROC_LOCK(p);
if (p->p_ptevents & PTRACE_SCE)
ptracestop((td), SIGTRAP, NULL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366249 - head/usr.bin/calendar

2020-09-29 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Tue Sep 29 10:07:46 2020
New Revision: 366249
URL: https://svnweb.freebsd.org/changeset/base/366249

Log:
  Bump manual page date after 366243
  
  While here, address mandoc warnings.

Modified:
  head/usr.bin/calendar/calendar.1

Modified: head/usr.bin/calendar/calendar.1
==
--- head/usr.bin/calendar/calendar.1Tue Sep 29 09:36:06 2020
(r366248)
+++ head/usr.bin/calendar/calendar.1Tue Sep 29 10:07:46 2020
(r366249)
@@ -28,7 +28,7 @@
 .\" @(#)calendar.1  8.1 (Berkeley) 6/29/93
 .\" $FreeBSD$
 .\"
-.Dd July 24, 2016
+.Dd September 29, 2020
 .Dt CALENDAR 1
 .Os
 .Sh NAME
@@ -200,7 +200,7 @@ internally, allowing the inclusion of shared files suc
 lists of company holidays or meetings.
 This limited subset consists of \fB#include #ifndef #endif\fR and 
\fB#define\fR.
 If the shared file is not referenced by a full pathname,
-.Xr calendar 1
+.Nm
 searches in the current (or home) directory first, and then in the
 directory
 .Pa /usr/share/calendar .
@@ -248,7 +248,7 @@ do not send mail if this file exists.
 .El
 .Pp
 The following default calendar files are provided in
-.Pa /usr/share/calendar:
+.Pa /usr/share/calendar :
 .Pp
 .Bl -tag -width calendar.southafrica -compact
 .It Pa calendar.all
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366248 - head/sys/netinet

2020-09-29 Thread Michael Tuexen
Author: tuexen
Date: Tue Sep 29 09:36:06 2020
New Revision: 366248
URL: https://svnweb.freebsd.org/changeset/base/366248

Log:
  Improve the input validation and processing of cookies.
  This avoids setting the association in an inconsistent
  state, which could result in a use-after-free situation.
  This can be triggered by a malicious peer, if the peer
  can modify the cookie without the local endpoint recognizing
  it.
  Thanks to Ned Williamson for reporting the issue.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Tue Sep 29 09:25:52 2020
(r366247)
+++ head/sys/netinet/sctp_input.c   Tue Sep 29 09:36:06 2020
(r366248)
@@ -2032,10 +2032,6 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in
vrf_id, port);
return (NULL);
}
-   /* get the correct sctp_nets */
-   if (netp)
-   *netp = sctp_findnet(stcb, init_src);
-
asoc = &stcb->asoc;
/* get scope variables out of cookie */
asoc->scope.ipv4_local_scope = cookie->ipv4_scope;
@@ -2074,10 +2070,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in
asoc->advanced_peer_ack_point = asoc->last_acked_seq;
 
/* process the INIT info (peer's info) */
-   if (netp)
-   retval = sctp_process_init(init_cp, stcb);
-   else
-   retval = 0;
+   retval = sctp_process_init(init_cp, stcb);
if (retval < 0) {
(void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
SCTP_FROM_SCTP_INPUT + SCTP_LOC_19);
@@ -2191,19 +2184,21 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in
 */
;
}
-   /* since we did not send a HB make sure we don't double things */
-   if ((netp) && (*netp))
-   (*netp)->hb_responded = 1;
-
if (stcb->asoc.sctp_autoclose_ticks &&
sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) {
sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL);
}
(void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
-   if ((netp != NULL) && (*netp != NULL)) {
+   *netp = sctp_findnet(stcb, init_src);
+   if (*netp != NULL) {
struct timeval old;
 
-   /* calculate the RTT and set the encaps port */
+   /*
+* Since we did not send a HB, make sure we don't double
+* things.
+*/
+   (*netp)->hb_responded = 1;
+   /* Calculate the RTT. */
old.tv_sec = cookie->time_entered.tv_sec;
old.tv_usec = cookie->time_entered.tv_usec;
sctp_calculate_rto(stcb, asoc, *netp, &old, 
SCTP_RTT_FROM_NON_DATA);

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Tue Sep 29 09:25:52 2020(r366247)
+++ head/sys/netinet/sctp_pcb.c Tue Sep 29 09:36:06 2020(r366248)
@@ -4242,7 +4242,9 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd
if ((ntohs(sin->sin_port) == 0) ||
(sin->sin_addr.s_addr == INADDR_ANY) ||
(sin->sin_addr.s_addr == INADDR_BROADCAST) ||
-   IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
+   IN_MULTICAST(ntohl(sin->sin_addr.s_addr)) ||
+   (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) != 0) 
&&
+   (SCTP_IPV6_V6ONLY(inp) != 0))) {
/* Invalid address */
SCTP_INP_RUNLOCK(inp);
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_PCB, EINVAL);
@@ -4261,7 +4263,8 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd
sin6 = (struct sockaddr_in6 *)firstaddr;
if ((ntohs(sin6->sin6_port) == 0) ||
IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) ||
-   IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
+   IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr) ||
+   ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0)) 
{
/* Invalid address */
SCTP_INP_RUNLOCK(inp);
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_PCB, EINVAL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366247 - head/sys/dev/cxgbe

2020-09-29 Thread Navdeep Parhar
Author: np
Date: Tue Sep 29 09:25:52 2020
New Revision: 366247
URL: https://svnweb.freebsd.org/changeset/base/366247

Log:
  cxgbe(4): Avoid unnecessary work in the firmware during netmap tx.
  
  Bind the netmap tx queues to a special '0xff' scheduling class which
  makes the firmware skip some processing related to rate limiting on the
  outgoing traffic.  Future firmwares will do this automatically.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Tue Sep 29 09:11:51 2020
(r366246)
+++ head/sys/dev/cxgbe/t4_netmap.c  Tue Sep 29 09:25:52 2020
(r366247)
@@ -329,6 +329,22 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq
nm_txq->udb = (volatile void *)udb;
}
 
+   if (sc->params.fw_vers < FW_VERSION32(1, 25, 1, 0)) {
+   uint32_t param, val;
+
+   param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) |
+   V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH) 
|
+   V_FW_PARAMS_PARAM_YZ(nm_txq->cntxt_id);
+   val = 0xff;
+   rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val);
+   if (rc != 0) {
+   device_printf(vi->dev,
+   "failed to bind netmap txq %d to class 0xff: %d\n",
+   nm_txq->cntxt_id, rc);
+   rc = 0;
+   }
+   }
+
return (rc);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366246 - head/sys/dev/cxgbe

2020-09-29 Thread Navdeep Parhar
Author: np
Date: Tue Sep 29 09:11:51 2020
New Revision: 366246
URL: https://svnweb.freebsd.org/changeset/base/366246

Log:
  Remove duplicate line.

Modified:
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Tue Sep 29 07:51:06 2020
(r366245)
+++ head/sys/dev/cxgbe/t4_netmap.c  Tue Sep 29 09:11:51 2020
(r366246)
@@ -216,9 +216,6 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq
param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) |
V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_CONM_CTXT) |
V_FW_PARAMS_PARAM_YZ(nm_rxq->iq_cntxt_id);
-   param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) |
-   V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_CONM_CTXT) |
-   V_FW_PARAMS_PARAM_YZ(nm_rxq->iq_cntxt_id);
if (cong == 0)
val = 1 << 19;
else {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366245 - head/sys/dev/cxgbe

2020-09-29 Thread Navdeep Parhar
Author: np
Date: Tue Sep 29 07:51:06 2020
New Revision: 366245
URL: https://svnweb.freebsd.org/changeset/base/366245

Log:
  cxgbe(4): adjust the doorbell threshold for netmap freelists to match the
  maximum burst size used when fetching descriptors from the list.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hTue Sep 29 07:36:21 2020
(r366244)
+++ head/sys/dev/cxgbe/adapter.hTue Sep 29 07:51:06 2020
(r366245)
@@ -730,6 +730,7 @@ struct sge_nm_rxq {
uint32_t fl_sidx2;  /* copy of fl_sidx */
uint32_t fl_db_val;
u_int fl_db_saved;
+   u_int fl_db_threshold;  /* in descriptors */
u_int fl_hwidx:4;
 
/*

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Tue Sep 29 07:36:21 2020
(r366244)
+++ head/sys/dev/cxgbe/t4_netmap.c  Tue Sep 29 07:51:06 2020
(r366245)
@@ -196,6 +196,9 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq
 
nm_rxq->fl_cntxt_id = be16toh(c.fl0id);
nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0;
+   nm_rxq->fl_db_saved = 0;
+   /* matches the X_FETCHBURSTMAX_512B or X_FETCHBURSTMAX_256B above. */
+   nm_rxq->fl_db_threshold = chip_id(sc) <= CHELSIO_T5 ? 8 : 4;
MPASS(nm_rxq->fl_sidx == na->num_rx_desc);
cntxt_id = nm_rxq->fl_cntxt_id - sc->sge.eq_start;
if (cntxt_id >= sc->sge.neq) {
@@ -1063,7 +1066,7 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int fl
fl_pidx = 0;
slot = &ring->slot[0];
}
-   if (++dbinc == 8 && n >= 32) {
+   if (++dbinc == nm_rxq->fl_db_threshold) {
wmb();
if (starve_fl)
nm_rxq->fl_db_saved += dbinc;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366244 - head/sys/dev/cxgbe

2020-09-29 Thread Navdeep Parhar
Author: np
Date: Tue Sep 29 07:36:21 2020
New Revision: 366244
URL: https://svnweb.freebsd.org/changeset/base/366244

Log:
  cxgbe(4): display an error message when netmap cannot be enabled because
  the interface is down.
  
  MFC after:1 week

Modified:
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Tue Sep 29 05:49:45 2020
(r366243)
+++ head/sys/dev/cxgbe/t4_netmap.c  Tue Sep 29 07:36:21 2020
(r366244)
@@ -536,8 +536,11 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi
MPASS(vi->nnmtxq > 0);
 
if ((vi->flags & VI_INIT_DONE) == 0 ||
-   (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+   (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
+   if_printf(ifp, "cannot enable netmap operation because "
+   "interface is not UP.\n");
return (EAGAIN);
+   }
 
rxb = &sc->sge.rx_buf_info[0];
for (i = 0; i < SW_ZONE_SIZES; i++, rxb++) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"