svn commit: r344091 - in stable: 10/sbin/recoverdisk 11/sbin/recoverdisk 12/sbin/recoverdisk
Author: avos Date: Wed Feb 13 09:28:48 2019 New Revision: 344091 URL: https://svnweb.freebsd.org/changeset/base/344091 Log: MFC r343871: recoverdisk(1): fclose() file supplied via '-r readlist' parameter when it's no longer needed PR: 204952 Reported by: David Binderman Modified: stable/10/sbin/recoverdisk/recoverdisk.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sbin/recoverdisk/recoverdisk.c stable/12/sbin/recoverdisk/recoverdisk.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sbin/recoverdisk/recoverdisk.c == --- stable/10/sbin/recoverdisk/recoverdisk.cWed Feb 13 09:03:23 2019 (r344090) +++ stable/10/sbin/recoverdisk/recoverdisk.cWed Feb 13 09:28:48 2019 (r344091) @@ -123,6 +123,7 @@ read_worklist(off_t t) new_lump(s, l, state); d -= l; } + fclose(file); (void)fprintf(stderr, " done.\n"); /* * Return the number of bytes already read ___ 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: r344090 - stable/12/sys/dev/netmap
Author: vmaffione Date: Wed Feb 13 09:03:23 2019 New Revision: 344090 URL: https://svnweb.freebsd.org/changeset/base/344090 Log: MFC r343579 netmap: fix lock order reversal related to kqueue usage When using poll(), select() or kevent() on netmap file descriptors, netmap executes the equivalent of NIOCTXSYNC and NIOCRXSYNC commands, before collecting the events that are ready. In other words, the poll/kevent callback has side effects. This is done to avoid the overhead of two system call per iteration (e.g., poll() + ioctl(NIOC*XSYNC)). When the kqueue subsystem invokes the kqueue(9) f_event callback (netmap_knrw), it holds the lock of the struct knlist object associated to the netmap port (the lock is provided at initialization, by calling knlist_init_mtx). However, netmap_knrw() may need to wake up another netmap port (or even the same one), which means that it may need to call knote(). Since knote() needs the lock of the struct knlist object associated to the to-be-wake-up netmap port, it is possible to have a lock order reversal problem (AB/BA deadlock). This change prevents the deadlock by executing the knote() call in a per-selinfo taskqueue, where it is possible to hold a mutex. Reviewed by:aleksandr.fedorov_itglobal.com Differential Revision: https://reviews.freebsd.org/D18956 Modified: stable/12/sys/dev/netmap/netmap.c stable/12/sys/dev/netmap/netmap_freebsd.c stable/12/sys/dev/netmap/netmap_kern.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/netmap/netmap.c == --- stable/12/sys/dev/netmap/netmap.c Wed Feb 13 07:37:33 2019 (r344089) +++ stable/12/sys/dev/netmap/netmap.c Wed Feb 13 09:03:23 2019 (r344090) @@ -830,6 +830,7 @@ netmap_krings_create(struct netmap_adapter *na, u_int struct netmap_kring *kring; u_int n[NR_TXRX]; enum txrx t; + int err = 0; if (na->tx_rings != NULL) { if (netmap_debug & NM_DEBUG_ON) @@ -869,7 +870,6 @@ netmap_krings_create(struct netmap_adapter *na, u_int for (i = 0; i < n[t]; i++) { kring = NMR(na, t)[i]; bzero(kring, sizeof(*kring)); - kring->na = na; kring->notify_na = na; kring->ring_id = i; kring->tx = t; @@ -895,13 +895,21 @@ netmap_krings_create(struct netmap_adapter *na, u_int nm_txrx2str(t), i); nm_prdis("ktx %s h %d c %d t %d", kring->name, kring->rhead, kring->rcur, kring->rtail); + err = nm_os_selinfo_init(>si, kring->name); + if (err) { + netmap_krings_delete(na); + return err; + } mtx_init(>q_lock, (t == NR_TX ? "nm_txq_lock" : "nm_rxq_lock"), NULL, MTX_DEF); - nm_os_selinfo_init(>si); + kring->na = na; /* setting this field marks the mutex as initialized */ } - nm_os_selinfo_init(>si[t]); + err = nm_os_selinfo_init(>si[t], na->name); + if (err) { + netmap_krings_delete(na); + return err; + } } - return 0; } @@ -925,7 +933,8 @@ netmap_krings_delete(struct netmap_adapter *na) /* we rely on the krings layout described above */ for ( ; kring != na->tailroom; kring++) { - mtx_destroy(&(*kring)->q_lock); + if ((*kring)->na != NULL) + mtx_destroy(&(*kring)->q_lock); nm_os_selinfo_uninit(&(*kring)->si); } nm_os_free(na->tx_rings); Modified: stable/12/sys/dev/netmap/netmap_freebsd.c == --- stable/12/sys/dev/netmap/netmap_freebsd.c Wed Feb 13 07:37:33 2019 (r344089) +++ stable/12/sys/dev/netmap/netmap_freebsd.c Wed Feb 13 09:03:23 2019 (r344090) @@ -58,6 +58,7 @@ #include /* RFNOWAIT */ #include /* sched_bind() */ #include /* mp_maxid */ +#include /* taskqueue_enqueue(), taskqueue_create(), ... */ #include #include #include /* IFT_ETHER */ @@ -75,16 +76,48 @@ /* FREEBSD-SPECIFIC ROUTINES == */ -void nm_os_selinfo_init(NM_SELINFO_T *si) { - struct mtx *m = >m; - mtx_init(m, "nm_kn_lock", NULL, MTX_DEF); - knlist_init_mtx(>si.si_note, m); +static void +nm_kqueue_notify(void *opaque, int pending) +{ + struct nm_selinfo *si = opaque; + + /* We use a non-zero hint to distinguish this notification call +* from the call done in kqueue_scan(), which uses
Re: svn commit: r344027 - in stable/12/sys: dev/vmware/vmxnet3 modules/vmware/vmxnet3 net
> On 13. Feb 2019, at 00:54, Marius Strobl wrote: > > On Mon, Feb 11, 2019 at 05:24:18PM -0800, Rodney W. Grimes wrote: >>> On 2/11/19 4:26 PM, Rodney W. Grimes wrote: > Author: pkelsey > Date: Mon Feb 11 23:24:39 2019 > New Revision: 344027 > URL: https://svnweb.freebsd.org/changeset/base/344027 > > Log: > MFC r343291: > Convert vmx(4) to being an iflib driver. I strongly object to this MFC, given the current number of 12.0 RELEASE related iflib problems we have it is foolish of us to iflib any more drivers in 12.0 >>> >>> This isn't the release branch though and presumably we have some time before >>> 12.1 ships. If there are reports of vmx(4) breakage on stable before 12.1 >>> we could always revert this commit then? >> >> At this point the status if iflib in stable/12 is not certain, but >> what is certain is this merge to 12 is probably going to break >> someones system and at best is an unknown if working. >> >> People DO run stable/12, breaking it is a no no. >> >> Has the committer even booted this code in a stable/12 system >> and run a serious amount of testing on it? >> >>> >>> I've heard of some EN's for 12.0 for iflib fixes. Are those fixes in >>> stable/12 >>> yet or are we still waiting for them to land in HEAD and/or be merged? >> >> I sent a ping out earlier today trying to find that out. I belive that >> some of them are merged to stable/12, some are waiting to be merged, I >> do believe most if not all are commited to head. > > As for the iflib(4)-converted Intel Ethernet MAC drivers, it's > hard to imagine how these drivers could have a chance of properly > working on arm64 without r344060 and r344062 (which just hit head, > with the latter breaking KBI) but also some previous iflib(4) > fixes that were already MFCed to stable/12 (but aren't part of > 12.0) in place. However, despite em(4) and ix(4) being in its > GENERIC, I don't know what relevance these drivers actually have > for arm64. Hi Marius, would love to use an ix(4) card on an Overdrive 3000 system. However, this doesn't really work, since there is a PCI related problem when booting. Sometimes the box works for a while, sometimes it doesn't come up: pci0: on pcib0 pcib1: at device 2.1 on pci0 pcib0: pci_host_generic_core_alloc_resource FAIL: type=4, rid=28, start=, end=0fff, count=1000, flags=0 pcib1: failed to allocate initial I/O port window: 0-0xfff pci1: on pcib1 pcib0: pci_host_generic_core_alloc_resource FAIL: type=4, rid=28, start=, end=0fff, count=1000, flags=3000 ix0: port 0x1000-0x101f mem 0x7fffe8-0x7fffef,0x704000-0x707fff at device 0.0 on pci1 ix0: Using 2048 tx descriptors and 2048 rx descriptors ix0: Using 8 rx queues 8 tx queues ix0: Using MSI-X interrupts with 9 vectors ix0: allocated for 8 queues ix0: allocated for 8 rx queues ix0: Ethernet address: 90:e2:ba:f7:48:74 ix0: PCI Express Bus: Speed 5.0GT/s Width x8 ix1: mem 0x7fffe0-0x7fffe7,0x70-0x703fff at device 0.1 on pci1 ix1: Using 2048 tx descriptors and 2048 rx descriptors ix1: Using 8 rx queues 8 tx queues ix1: Using MSI-X interrupts with 9 vectors ix1: allocated for 8 queues ix1: allocated for 8 rx queues ix1: Ethernet address: 90:e2:ba:f7:48:75 ix1: PCI Express Bus: Speed 5.0GT/s Width x8 jhb@ said that this is related to some PCI memory allocation limitation on arm64, if I remember it correctly. I think that ref12-aarch64.freebsd.org uses an igb card. But I can't login to verify... Best regards Michael > So far, r343934 isn't in stable/12 either (I'll probably merge it > tomorrow), fixing the problem with non-working 82583V a bunch of > people ran into judging PRs. Last time I checked, there also were > some other iflib(4)-related changes, e. g. to converted drivers, > not done by me still missing in stable/12. > > As for the iflib(4) status in head, I'm aware of two remaining > user-visible regressions I ran myself into when trying to use > em(4) in production. 1) TX UDP performance is abysmal even when > using multiple queues and, thus, MSI-X. In a quick test with > netperf I see ~690 Mbits/s with 9216 bytes and 282 Mbits/s with > 42080 bytes on a Xeon E3-1245V2 and 82574 with GigE connection > (stable/11 e1000 drivers forward-ported to 12+ achieve 957 Mbit/s > in both cases). 2) TX TCP performance is abysmal when using MSI > or INTx (that's likely also PR 235031). > I have an upcoming iflib(4) fix for 2) but don't have an idea > what's causing 1) so far. I've identified two bugs in iflib(4) > that likely have a minimal (probably more so with ixl(4), though) > impact on UDP performance but don't explain the huge drop. > > Moreover, I have no idea so far how these relate to PR 234550. > Regarding the latter, one obvious difference is that prior to > the iflib(4)-conversions, the Intel Ethernet MAC drivers didn't > engage software LRO when a
svn commit: r344091 - in stable: 10/sbin/recoverdisk 11/sbin/recoverdisk 12/sbin/recoverdisk
Author: avos Date: Wed Feb 13 09:28:48 2019 New Revision: 344091 URL: https://svnweb.freebsd.org/changeset/base/344091 Log: MFC r343871: recoverdisk(1): fclose() file supplied via '-r readlist' parameter when it's no longer needed PR: 204952 Reported by: David Binderman Modified: stable/12/sbin/recoverdisk/recoverdisk.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sbin/recoverdisk/recoverdisk.c stable/11/sbin/recoverdisk/recoverdisk.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sbin/recoverdisk/recoverdisk.c == --- stable/12/sbin/recoverdisk/recoverdisk.cWed Feb 13 09:03:23 2019 (r344090) +++ stable/12/sbin/recoverdisk/recoverdisk.cWed Feb 13 09:28:48 2019 (r344091) @@ -125,6 +125,7 @@ read_worklist(off_t t) new_lump(s, l, state); d -= l; } + fclose(file); (void)fprintf(stderr, " done.\n"); /* * Return the number of bytes already read ___ 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: r344091 - in stable: 10/sbin/recoverdisk 11/sbin/recoverdisk 12/sbin/recoverdisk
Author: avos Date: Wed Feb 13 09:28:48 2019 New Revision: 344091 URL: https://svnweb.freebsd.org/changeset/base/344091 Log: MFC r343871: recoverdisk(1): fclose() file supplied via '-r readlist' parameter when it's no longer needed PR: 204952 Reported by: David Binderman Modified: stable/11/sbin/recoverdisk/recoverdisk.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sbin/recoverdisk/recoverdisk.c stable/12/sbin/recoverdisk/recoverdisk.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sbin/recoverdisk/recoverdisk.c == --- stable/11/sbin/recoverdisk/recoverdisk.cWed Feb 13 09:03:23 2019 (r344090) +++ stable/11/sbin/recoverdisk/recoverdisk.cWed Feb 13 09:28:48 2019 (r344091) @@ -123,6 +123,7 @@ read_worklist(off_t t) new_lump(s, l, state); d -= l; } + fclose(file); (void)fprintf(stderr, " done.\n"); /* * Return the number of bytes already read ___ 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: r344092 - stable/12/sys/net
Author: marius Date: Wed Feb 13 13:09:16 2019 New Revision: 344092 URL: https://svnweb.freebsd.org/changeset/base/344092 Log: MFC: r342749 mp_ring: avoid items offset difference between iflib and mp_ring on architectures without 64-bit atomics Reported by: Augustin Cavalier Modified: stable/12/sys/net/mp_ring.c stable/12/sys/net/mp_ring.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/mp_ring.c == --- stable/12/sys/net/mp_ring.c Wed Feb 13 09:28:48 2019(r344091) +++ stable/12/sys/net/mp_ring.c Wed Feb 13 13:09:16 2019(r344092) @@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__powerpc__) || defined(__mips__) || defined(__i386__) -#define NO_64BIT_ATOMICS -#endif - #if defined(__i386__) #define atomic_cmpset_acq_64 atomic_cmpset_64 #define atomic_cmpset_rel_64 atomic_cmpset_64 @@ -101,7 +97,7 @@ state_to_flags(union ring_state s, int abdicate) return (BUSY); } -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS static void drain_ring_locked(struct ifmp_ring *r, union ring_state os, uint16_t prev, int budget) { @@ -291,7 +287,7 @@ ifmp_ring_alloc(struct ifmp_ring **pr, int size, void } *pr = r; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS mtx_init(>lock, "mp_ring lock", NULL, MTX_DEF); #endif return (0); @@ -325,7 +321,7 @@ ifmp_ring_free(struct ifmp_ring *r) * * Returns an errno. */ -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS int ifmp_ring_enqueue(struct ifmp_ring *r, void **items, int n, int budget, int abdicate) { @@ -503,7 +499,7 @@ ifmp_ring_check_drainage(struct ifmp_ring *r, int budg ns.flags = BUSY; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS mtx_lock(>lock); if (r->state != os.state) { mtx_unlock(>lock); Modified: stable/12/sys/net/mp_ring.h == --- stable/12/sys/net/mp_ring.h Wed Feb 13 09:28:48 2019(r344091) +++ stable/12/sys/net/mp_ring.h Wed Feb 13 13:09:16 2019(r344092) @@ -40,6 +40,10 @@ typedef u_int (*mp_ring_drain_t)(struct ifmp_ring *, u typedef u_int (*mp_ring_can_drain_t)(struct ifmp_ring *); typedef void (*mp_ring_serial_t)(struct ifmp_ring *); +#if defined(__powerpc__) || defined(__mips__) || defined(__i386__) +#define MP_RING_NO_64BIT_ATOMICS +#endif + struct ifmp_ring { volatile uint64_t state __aligned(CACHE_LINE_SIZE); @@ -54,7 +58,7 @@ struct ifmp_ring { counter_u64_t stalls; counter_u64_t restarts; /* recovered after stalling */ counter_u64_t abdications; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS struct mtx lock; #endif void * volatile items[] __aligned(CACHE_LINE_SIZE); ___ 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: r344097 - in stable/12/sys/dev: e1000 ixgbe ixl
Author: marius Date: Wed Feb 13 14:36:24 2019 New Revision: 344097 URL: https://svnweb.freebsd.org/changeset/base/344097 Log: MFC: r343369 intel iflib drivers: correct initialization of tx_cidx_processed From Jake: In r341156 ("Fix first-packet completion", 2018-11-28) a hack to work around a delta calculation determining how many descriptors were used was added to ixl_isc_tx_credits_update_dwb. The same fix was also applied to the em and igb drivers in r340310, and to ix in r341156. The hack checked the case where prev and cur were equal, and then added one. This works, because by the time we do the delta check, we already know there is at least one packet available, so the delta should be at least one. However, it's not a complete fix, and as indicated by the comment is really a hack to work around the real bug. The real problem is that the first time that we transmit a packet, tx_cidx_processed will be set to point to the start of the ring. Ultimately, the credits_update function expects it to point to the *last* descriptor that was processed. Since we haven't yet processed any descriptors, pointing it to 0 results in this incorrect calculation. Fix the initialization code to have it point to the end of the ring instead. One way to think about this, is that we are setting the value to be one prior to the first available descriptor. Doing so, corrects the delta calculation in all cases. The original fix only works if the first packet has exactly one descriptor. Otherwise, we will report 1 less than the correct value. As part of this fix, also update the MPASS assertions to match the real expectations. First, ensure that prev is not equal to cur, since this should never happen. Second, remove the assertion about prev==0 || delta != 0. It looks like that originated from when the em driver was converted to iflib. It seems like it was supposed to ensure that delta was non-zero. However, because we originally returned 0 delta for the first calculation, the "prev == 0" was tacked on. Instead, replace this with a check that delta is greater than zero, after the correction necessary when the ring pointers wrap around. This new solution should fix the same bug as r341156 did, but in a more robust way. Submitted by: Jacob Keller Reviewed by: shurd@ Differential Revision:https://reviews.freebsd.org/D18545 Modified: stable/12/sys/dev/e1000/em_txrx.c stable/12/sys/dev/e1000/if_em.c stable/12/sys/dev/e1000/igb_txrx.c stable/12/sys/dev/ixgbe/if_ix.c stable/12/sys/dev/ixgbe/if_ixv.c stable/12/sys/dev/ixgbe/ix_txrx.c stable/12/sys/dev/ixl/ixl_txrx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/e1000/em_txrx.c == --- stable/12/sys/dev/e1000/em_txrx.c Wed Feb 13 14:32:14 2019 (r344096) +++ stable/12/sys/dev/e1000/em_txrx.c Wed Feb 13 14:36:24 2019 (r344097) @@ -457,16 +457,11 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, b prev = txr->tx_cidx_processed; ntxd = scctx->isc_ntxd[0]; do { + MPASS(prev != cur); delta = (int32_t)cur - (int32_t)prev; - /* -* XXX This appears to be a hack for first-packet. -* A correct fix would prevent prev == cur in the first place. -*/ - MPASS(prev == 0 || delta != 0); - if (prev == 0 && cur == 0) - delta += 1; if (delta < 0) delta += ntxd; + MPASS(delta > 0); DPRINTF(iflib_get_dev(adapter->ctx), "%s: cidx_processed=%u cur=%u clear=%d delta=%d\n", __FUNCTION__, prev, cur, clear, delta); Modified: stable/12/sys/dev/e1000/if_em.c == --- stable/12/sys/dev/e1000/if_em.c Wed Feb 13 14:32:14 2019 (r344096) +++ stable/12/sys/dev/e1000/if_em.c Wed Feb 13 14:36:24 2019 (r344097) @@ -1210,6 +1210,7 @@ static void em_if_init(if_ctx_t ctx) { struct adapter *adapter = iflib_get_softc(ctx); + if_softc_ctx_t scctx = adapter->shared; struct ifnet *ifp = iflib_get_ifp(ctx); struct em_tx_queue *tx_que; int i; @@ -1242,7 +1243,14 @@ em_if_init(if_ctx_t ctx) for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) { struct tx_ring *txr = _que->txr; - txr->tx_rs_cidx = txr->tx_rs_pidx = txr->tx_cidx_processed = 0; + txr->tx_rs_cidx = txr->tx_rs_pidx; + + /* Initialize the last processed descriptor to be the end of +* the ring, rather than the start, so that we avoid an +*
svn commit: r344093 - stable/11/sys/net
Author: marius Date: Wed Feb 13 14:25:05 2019 New Revision: 344093 URL: https://svnweb.freebsd.org/changeset/base/344093 Log: MFC: r333879, r342749 - Even though 64-bit atomics are supported on i386 there are panics indicating that the code does not work correctly there. Switch to mutex based variant (and fix that while we're here). Reported by:pho, kib - mp_ring: avoid items offset difference between iflib and mp_ring on architectures without 64-bit atomics Reported by:Augustin Cavalier Modified: stable/11/sys/net/mp_ring.c stable/11/sys/net/mp_ring.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/mp_ring.c == --- stable/11/sys/net/mp_ring.c Wed Feb 13 13:09:16 2019(r344092) +++ stable/11/sys/net/mp_ring.c Wed Feb 13 14:25:05 2019(r344093) @@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__powerpc__) || defined(__mips__) -#define NO_64BIT_ATOMICS -#endif - #if defined(__i386__) #define atomic_cmpset_acq_64 atomic_cmpset_64 #define atomic_cmpset_rel_64 atomic_cmpset_64 @@ -101,7 +97,7 @@ state_to_flags(union ring_state s, int abdicate) return (BUSY); } -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS static void drain_ring_locked(struct ifmp_ring *r, union ring_state os, uint16_t prev, int budget) { @@ -291,7 +287,7 @@ ifmp_ring_alloc(struct ifmp_ring **pr, int size, void } *pr = r; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS mtx_init(>lock, "mp_ring lock", NULL, MTX_DEF); #endif return (0); @@ -325,7 +321,7 @@ ifmp_ring_free(struct ifmp_ring *r) * * Returns an errno. */ -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS int ifmp_ring_enqueue(struct ifmp_ring *r, void **items, int n, int budget) { @@ -345,6 +341,7 @@ ifmp_ring_enqueue(struct ifmp_ring *r, void **items, i if (n >= space_available(r, os)) { counter_u64_add(r->drops, n); MPASS(os.flags != IDLE); + mtx_unlock(>lock); if (os.flags == STALLED) ifmp_ring_check_drainage(r, 0); return (ENOBUFS); @@ -480,7 +477,7 @@ ifmp_ring_check_drainage(struct ifmp_ring *r, int budg ns.flags = BUSY; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS mtx_lock(>lock); if (r->state != os.state) { mtx_unlock(>lock); Modified: stable/11/sys/net/mp_ring.h == --- stable/11/sys/net/mp_ring.h Wed Feb 13 13:09:16 2019(r344092) +++ stable/11/sys/net/mp_ring.h Wed Feb 13 14:25:05 2019(r344093) @@ -40,6 +40,10 @@ typedef u_int (*mp_ring_drain_t)(struct ifmp_ring *, u typedef u_int (*mp_ring_can_drain_t)(struct ifmp_ring *); typedef void (*mp_ring_serial_t)(struct ifmp_ring *); +#if defined(__powerpc__) || defined(__mips__) || defined(__i386__) +#define MP_RING_NO_64BIT_ATOMICS +#endif + struct ifmp_ring { volatile uint64_t state __aligned(CACHE_LINE_SIZE); @@ -54,7 +58,7 @@ struct ifmp_ring { counter_u64_t stalls; counter_u64_t restarts; /* recovered after stalling */ counter_u64_t abdications; -#ifdef NO_64BIT_ATOMICS +#ifdef MP_RING_NO_64BIT_ATOMICS struct mtx lock; #endif void * volatile items[] __aligned(CACHE_LINE_SIZE); ___ 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: r344095 - stable/11/sys/dev/ixgbe
Author: marius Date: Wed Feb 13 14:28:02 2019 New Revision: 344095 URL: https://svnweb.freebsd.org/changeset/base/344095 Log: MFC: r343203 ixgbe: this statement may fall through warnings with gcc The recent gcc versions (7 and 8 at least) can check for switch case statements for fall through (implicit-fallthrough). When fall through is intentional, the default method for warning suppression is to place comment /* FALLTHROUGH */ exactly before next case statement. Differential Revision:https://reviews.freebsd.org/D18577 Modified: stable/11/sys/dev/ixgbe/ixgbe_82599.c stable/11/sys/dev/ixgbe/ixgbe_common.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ixgbe/ixgbe_82599.c == --- stable/11/sys/dev/ixgbe/ixgbe_82599.c Wed Feb 13 14:27:59 2019 (r344094) +++ stable/11/sys/dev/ixgbe/ixgbe_82599.c Wed Feb 13 14:28:02 2019 (r344095) @@ -1746,7 +1746,7 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *h case 0x: /* mask VLAN ID */ fdirm |= IXGBE_FDIRM_VLANID; - /* fall through */ + /* FALLTHROUGH */ case 0x0FFF: /* mask VLAN priority */ fdirm |= IXGBE_FDIRM_VLANP; @@ -2032,7 +2032,7 @@ s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_h DEBUGOUT(" Error on src/dst port\n"); return IXGBE_ERR_CONFIG; } - /* fall through */ + /* FALLTHROUGH */ case IXGBE_ATR_FLOW_TYPE_TCPV4: case IXGBE_ATR_FLOW_TYPE_TUNNELED_TCPV4: case IXGBE_ATR_FLOW_TYPE_UDPV4: Modified: stable/11/sys/dev/ixgbe/ixgbe_common.c == --- stable/11/sys/dev/ixgbe/ixgbe_common.c Wed Feb 13 14:27:59 2019 (r344094) +++ stable/11/sys/dev/ixgbe/ixgbe_common.c Wed Feb 13 14:28:02 2019 (r344095) @@ -267,7 +267,8 @@ s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw) if (ret_val != IXGBE_SUCCESS) goto out; - /* fall through - only backplane uses autoc */ + /* only backplane uses autoc */ + /* FALLTHROUGH */ case ixgbe_media_type_fiber_fixed: case ixgbe_media_type_fiber_qsfp: case ixgbe_media_type_fiber: @@ -4732,7 +4733,8 @@ void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int rxpktsize <<= IXGBE_RXPBSIZE_SHIFT; for (; i < (num_pb / 2); i++) IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); - /* fall through - configure remaining packet buffers */ + /* configure remaining packet buffers */ + /* FALLTHROUGH */ case PBA_STRATEGY_EQUAL: rxpktsize = (pbsize / (num_pb - i)) << IXGBE_RXPBSIZE_SHIFT; for (; i < num_pb; i++) ___ 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: r344098 - stable/12/sys/dev/e1000
Author: marius Date: Wed Feb 13 14:39:16 2019 New Revision: 344098 URL: https://svnweb.freebsd.org/changeset/base/344098 Log: MFC: r343934 - Remove the redundant device disabled hint handling; ever since r241119 that's performed globally by device_attach(9). - As for the EM-class of devices, em(4) supports multiple queues and MSI-X respectively only with 82574 devices. However, since the conversion to iflib(4), em(4) relies on the interrupt type fallback mechanism, i. e. MSI-X -> MSI -> INTx, of iflib(4) to figure out the interrupt type to use for the EM-class (as well as the IGB-class) of MACs. Moreover, despite the datasheet for 82583V not mentioning any support of MSI-X, there actually are 82583V devices out there that report a varying number of MSI-X messages as supported. The interrupt type fallback of iflib(4) is causing two failure modes depending on the actual number of MSI-X messages supported for such instances of 82583V: 1) With only one MSI-X message supported, none is left for the RX/TX queues as that one message gets assigned to the admin interrupt. Worse, later on - which will be addressed with a separate fix - iflib(4) interprets that one messages as MSI or INTx to be set up, but fails to actually do so as it has previously called pci_alloc_msix(9). [1, 2] 2) With more message supported, their distribution is okay but then em_if_msix_intr_assign() doesn't work for 82583V, with the interface being left in a non-working state, too. [3] Thus, let em_if_attach_pre() indicate to iflib(4) to try MSI-X with 82574 only, and at most MSI for the remainder of EM-class devices. While at it, remove "try_second_bar" as it's polarity inverted and not actually needed. - Remove code from em_if_timer() that effectively is a NOP since the conversion to iflib(4) ("trigger" is no longer read). While at it, let the comment for em_if_timer() reflect reality after said conversion. - Implement an ifdi_watchdog_reset method which only updates the em(4) "watchdog_events" counter but doesn't perform any reset, so that the em(4) "watchdog_timeouts" SYSCTL (iflib(4) doesn't provide a counterpart) reflects reality and these timeouts add to IFCOUNTER_OERRORS again after the iflib(4) conversion. - Remove the "mbuf_defrag_fail" and "tx_dma_fail" SYSCTLS; since the iflib(4) conversion, associated counters are disconnected, but iflib(4) provides "mbuf_defrag_failed" and "tx_map_failed" respectively as equivalents. - Move the description preceding lem_smartspeed() to the correct spot before em_reset() and bring back appropriate comments for {igb,em}_initialize_rss_mapping() and lem_smartspeed() lost in the iflib(4) conversion. - Adapt some other function descriptions and INIT_DEBUGOUT() use to match reality after the iflib(4) conversion. - Put the debugging message of em_enable_vectors_82574() (missed in r343578) under bootverbose, too. PR: 219428 [1], 235246 [2], 235147 [3] Reviewed by: erj (previous version) Differential Revision:https://reviews.freebsd.org/D19108 Modified: stable/12/sys/dev/e1000/if_em.c stable/12/sys/dev/e1000/if_em.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/e1000/if_em.c == --- stable/12/sys/dev/e1000/if_em.c Wed Feb 13 14:36:24 2019 (r344097) +++ stable/12/sys/dev/e1000/if_em.c Wed Feb 13 14:39:16 2019 (r344098) @@ -249,6 +249,7 @@ static int em_if_mtu_set(if_ctx_t ctx, uint32_t mtu); static voidem_if_timer(if_ctx_t ctx, uint16_t qid); static voidem_if_vlan_register(if_ctx_t ctx, u16 vtag); static voidem_if_vlan_unregister(if_ctx_t ctx, u16 vtag); +static voidem_if_watchdog_reset(if_ctx_t ctx); static voidem_identify_hardware(if_ctx_t ctx); static int em_allocate_pci_resources(if_ctx_t ctx); @@ -386,6 +387,7 @@ static device_method_t em_if_methods[] = { DEVMETHOD(ifdi_mtu_set, em_if_mtu_set), DEVMETHOD(ifdi_promisc_set, em_if_set_promisc), DEVMETHOD(ifdi_timer, em_if_timer), + DEVMETHOD(ifdi_watchdog_reset, em_if_watchdog_reset), DEVMETHOD(ifdi_vlan_register, em_if_vlan_register), DEVMETHOD(ifdi_vlan_unregister, em_if_vlan_unregister), DEVMETHOD(ifdi_get_counter, em_if_get_counter), @@ -721,7 +723,6 @@ em_set_num_queues(if_ctx_t ctx) * * return 0 on success, positive on failure */ - static int em_if_attach_pre(if_ctx_t ctx) { @@ -731,15 +732,10 @@ em_if_attach_pre(if_ctx_t ctx) struct e1000_hw *hw; int error = 0; - INIT_DEBUGOUT("em_if_attach_pre begin"); + INIT_DEBUGOUT("em_if_attach_pre: begin"); dev = iflib_get_dev(ctx);
svn commit: r344094 - stable/12/sys/dev/ixgbe
Author: marius Date: Wed Feb 13 14:27:59 2019 New Revision: 344094 URL: https://svnweb.freebsd.org/changeset/base/344094 Log: MFC: r343203 ixgbe: this statement may fall through warnings with gcc The recent gcc versions (7 and 8 at least) can check for switch case statements for fall through (implicit-fallthrough). When fall through is intentional, the default method for warning suppression is to place comment /* FALLTHROUGH */ exactly before next case statement. Differential Revision:https://reviews.freebsd.org/D18577 Modified: stable/12/sys/dev/ixgbe/ixgbe_82599.c stable/12/sys/dev/ixgbe/ixgbe_common.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixgbe/ixgbe_82599.c == --- stable/12/sys/dev/ixgbe/ixgbe_82599.c Wed Feb 13 14:25:05 2019 (r344093) +++ stable/12/sys/dev/ixgbe/ixgbe_82599.c Wed Feb 13 14:27:59 2019 (r344094) @@ -1750,7 +1750,7 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *h case 0x: /* mask VLAN ID */ fdirm |= IXGBE_FDIRM_VLANID; - /* fall through */ + /* FALLTHROUGH */ case 0x0FFF: /* mask VLAN priority */ fdirm |= IXGBE_FDIRM_VLANP; @@ -2039,7 +2039,7 @@ s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_h DEBUGOUT(" Error on src/dst port\n"); return IXGBE_ERR_CONFIG; } - /* fall through */ + /* FALLTHROUGH */ case IXGBE_ATR_FLOW_TYPE_TCPV4: case IXGBE_ATR_FLOW_TYPE_TUNNELED_TCPV4: case IXGBE_ATR_FLOW_TYPE_UDPV4: Modified: stable/12/sys/dev/ixgbe/ixgbe_common.c == --- stable/12/sys/dev/ixgbe/ixgbe_common.c Wed Feb 13 14:25:05 2019 (r344093) +++ stable/12/sys/dev/ixgbe/ixgbe_common.c Wed Feb 13 14:27:59 2019 (r344094) @@ -269,7 +269,8 @@ s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw) if (ret_val != IXGBE_SUCCESS) goto out; - /* fall through - only backplane uses autoc */ + /* only backplane uses autoc */ + /* FALLTHROUGH */ case ixgbe_media_type_fiber_fixed: case ixgbe_media_type_fiber_qsfp: case ixgbe_media_type_fiber: @@ -4756,7 +4757,8 @@ void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int rxpktsize <<= IXGBE_RXPBSIZE_SHIFT; for (; i < (num_pb / 2); i++) IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); - /* fall through - configure remaining packet buffers */ + /* configure remaining packet buffers */ + /* FALLTHROUGH */ case PBA_STRATEGY_EQUAL: rxpktsize = (pbsize / (num_pb - i)) << IXGBE_RXPBSIZE_SHIFT; for (; i < num_pb; i++) ___ 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: r344096 - in stable/12: tools/build/mk usr.sbin/bluetooth usr.sbin/bluetooth/bluetooth-config
Author: lme (ports committer) Date: Wed Feb 13 14:32:14 2019 New Revision: 344096 URL: https://svnweb.freebsd.org/changeset/base/344096 Log: MFC r342945, r342947, r343020 Add `bluetooth-config` script to simplify setting up bluetooth connections to devices like mice, keyboards, bt-audio, ... This script currently allows scanning for nearby devices, adds one to /etc/bluetooth/hosts, adds an entry to hcsecd's conf and if it is a HID, add an entry to bthidd's configs, as well. Submitted by: erdgeist Approved by:bapt MFC after: 2 weeks Differential Revision: D3778 Reviewers: bapt, emax Added: stable/12/usr.sbin/bluetooth/bluetooth-config/ - copied from r342945, head/usr.sbin/bluetooth/bluetooth-config/ Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc stable/12/usr.sbin/bluetooth/Makefile stable/12/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.8 stable/12/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.sh Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc == --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Feb 13 14:28:02 2019(r344095) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Feb 13 14:32:14 2019(r344096) @@ -486,6 +486,7 @@ OLD_FILES+=usr/lib32/libsdp_p.a .endif OLD_FILES+=usr/sbin/ath3kfw OLD_FILES+=usr/sbin/bcmfw +OLD_FILES+=usr/sbin/bluetooth-config OLD_FILES+=usr/sbin/bt3cfw OLD_FILES+=usr/sbin/bthidcontrol OLD_FILES+=usr/sbin/bthidd @@ -562,6 +563,7 @@ OLD_FILES+=usr/share/man/man5/bluetooth.protocols.5.gz OLD_FILES+=usr/share/man/man5/hcsecd.conf.5.gz OLD_FILES+=usr/share/man/man8/ath3kfw.8.gz OLD_FILES+=usr/share/man/man8/bcmfw.8.gz +OLD_FILES+=usr/share/man/man8/bluetooth-config.8.gz OLD_FILES+=usr/share/man/man8/bt3cfw.8.gz OLD_FILES+=usr/share/man/man8/bthidcontrol.8.gz OLD_FILES+=usr/share/man/man8/bthidd.8.gz Modified: stable/12/usr.sbin/bluetooth/Makefile == --- stable/12/usr.sbin/bluetooth/Makefile Wed Feb 13 14:28:02 2019 (r344095) +++ stable/12/usr.sbin/bluetooth/Makefile Wed Feb 13 14:32:14 2019 (r344096) @@ -4,6 +4,7 @@ .include SUBDIR= \ + bluetooth-config \ bt3cfw \ btpand \ hccontrol \ Modified: stable/12/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.8 == --- head/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.8 Fri Jan 11 15:52:09 2019(r342945) +++ stable/12/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.8Wed Feb 13 14:32:14 2019(r344096) @@ -109,114 +109,3 @@ utility first appeared in .An Dirk Engling Aq Mt erdge...@erdgeist.org .Sh THANKS TO Lars Engels and Warren Block for suggestions, help, and testing. -.\" Copyright (c) 2019 Dirk Engling -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\"notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\"notice, this list of conditions and the following disclaimer in the -.\"documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 7, 2019 -.Dt BLUETOOTH-CONFIG 8 -.Os -.Sh NAME -.Nm bluetooth-config -.Nd a script to manage config files for the bluetooth sub system -.Sh SYNOPSIS -.Nm -.Ar scan -.Op Fl d Ar device -.Op Fl n Ar node -.Sh DESCRIPTION -The -.Nm -utility is an interactive script to provide a frontend to the complex bluetooth sub system daemons. -.Pp -The following options are available: -.Bl -tag -width indent+ -.It Fl d -Scan for a specific bluetooth device address. -.It Fl n -Limit scan to a specific host controller. Hint: List all netgraph nodes with -.Ql /usr/sbin/ngctl list . -.El -.Pp -.Nm -will help
svn commit: r344099 - head/sys/net
Author: rrs Date: Wed Feb 13 14:57:59 2019 New Revision: 344099 URL: https://svnweb.freebsd.org/changeset/base/344099 Log: This commit adds the missing release mechanism for the ratelimiting code. The two modules (lagg and vlan) did have allocation routines, and even though they are indirect (and vector down to the underlying interfaces) they both need to have a free routine (that also vectors down to the actual interface). Sponsored by: Netflix Inc. Differential Revision:https://reviews.freebsd.org/D19032 Modified: head/sys/net/if_lagg.c head/sys/net/if_vlan.c Modified: head/sys/net/if_lagg.c == --- head/sys/net/if_lagg.c Wed Feb 13 14:39:16 2019(r344098) +++ head/sys/net/if_lagg.c Wed Feb 13 14:57:59 2019(r344099) @@ -133,6 +133,7 @@ static int lagg_ioctl(struct ifnet *, u_long, caddr_t) static int lagg_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); +static voidlagg_snd_tag_free(struct m_snd_tag *); #endif static int lagg_setmulti(struct lagg_port *); static int lagg_clrmulti(struct lagg_port *); @@ -514,6 +515,7 @@ lagg_clone_create(struct if_clone *ifc, int unit, cadd ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; #ifdef RATELIMIT ifp->if_snd_tag_alloc = lagg_snd_tag_alloc; + ifp->if_snd_tag_free = lagg_snd_tag_free; #endif ifp->if_capenable = ifp->if_capabilities = IFCAP_HWSTATS; @@ -1568,6 +1570,13 @@ lagg_snd_tag_alloc(struct ifnet *ifp, /* forward allocation request */ return (ifp->if_snd_tag_alloc(ifp, params, ppmt)); } + +static void +lagg_snd_tag_free(struct m_snd_tag *tag) +{ + tag->ifp->if_snd_tag_free(tag); +} + #endif static int Modified: head/sys/net/if_vlan.c == --- head/sys/net/if_vlan.c Wed Feb 13 14:39:16 2019(r344098) +++ head/sys/net/if_vlan.c Wed Feb 13 14:57:59 2019(r344099) @@ -267,6 +267,7 @@ static int vlan_ioctl(struct ifnet *ifp, u_long cmd, c #ifdef RATELIMIT static int vlan_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); +static void vlan_snd_tag_free(struct m_snd_tag *); #endif static void vlan_qflush(struct ifnet *ifp); static int vlan_setflag(struct ifnet *ifp, int flag, int status, @@ -1047,6 +1048,7 @@ vlan_clone_create(struct if_clone *ifc, char *name, si ifp->if_ioctl = vlan_ioctl; #ifdef RATELIMIT ifp->if_snd_tag_alloc = vlan_snd_tag_alloc; + ifp->if_snd_tag_free = vlan_snd_tag_free; #endif ifp->if_flags = VLAN_IFFLAGS; ether_ifattach(ifp, eaddr); @@ -1933,5 +1935,11 @@ vlan_snd_tag_alloc(struct ifnet *ifp, return (EOPNOTSUPP); /* forward allocation request */ return (ifp->if_snd_tag_alloc(ifp, params, ppmt)); +} + +static void +vlan_snd_tag_free(struct m_snd_tag *tag) +{ + tag->ifp->if_snd_tag_free(tag); } #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r344027 - in stable/12/sys: dev/vmware/vmxnet3 modules/vmware/vmxnet3 net
On Wed, 13 Feb 2019, Marius Strobl wrote: As for the iflib(4) status in head, I'm aware of two remaining user-visible regressions I ran myself into when trying to use em(4) in production. I am aware of a few more: - tx throughput loss for minimal packets of about 10% on my low end/1 queue NICs (I218-V, older I2*, and 82541PI). This hasn't changed much in the 2+ years since em(4) was converted to iflib , except some versions were another 10-20% slower and some of the slowness can be recovered using the tx_abdicate sysctl - average ping latency loss of about 13% on I218V. This has only been there for 6-12 months. Of course this is with tuning for latency by turning off interrupt moderation as much as possible - errors on rx are recovered from badly in [l]em_isc_rxd_pkt_get() by incrementing the dropped packet count and returning EBADMSG. This leaves the hardware queues in a bad state which is recovered from after a long time by resetting. Many more packets are dropped, but the dropped packet count is only incremented by 1. The pre-iflib driver handled this by dropping just 1 packet and continuing. This is now hard to do, since iflib wants to build a list of packets and seems to have no way of handling bad packets in the list. I use the quick fix of printing a message and putting the bad packet in the list. I have only seen this problem on 82541PI. I haven't checked that the EBADMSG return is still mishandled by resetting. - the NIC is not stopped for media changes. This causes the same lockups as not stopping it for resume, but is less often a problem since you usually don't change the media for an active NIC. 1) TX UDP performance is abysmal even when using multiple queues and, thus, MSI-X. In a quick test with netperf I see ~690 Mbits/s with 9216 bytes and 282 Mbits/s with 42080 bytes on a Xeon E3-1245V2 and 82574 with GigE connection (stable/11 e1000 drivers forward-ported to 12+ achieve 957 Mbit/s in both cases). 2) TX TCP performance is abysmal when using MSI or INTx (that's likely also PR 235031). I have an upcoming iflib(4) fix for 2) but don't have an idea what's causing 1) so far. I've identified two bugs in iflib(4) that likely have a minimal (probably more so with ixl(4), though) impact on UDP performance but don't explain the huge drop. I don't see bad performance for large packets (except for the 82541PI -- it is PCI and can't get near saturating the network at any size). Other problems: I mostly use i386, and its performance is now abysmal due to its slow syscalls. Its slowdowns also makes comparison with old benchmark results more difficult. Typical numbers for netblast tests for I218-V on i386 on Haswell i4790K 4.08GHz are: 1500 kpps (line rate) for tuned FreeBSD-11using 1.5 CPUs 1400+ kpps for untuned FreeBSD-11using 1 CPU 1400- kpps for -current-before-iflib using 1 CPU 1300- kpps for -current-after-iflib using 1.5 CPUs The tuning for FreeBSD-11 is just EM_MULTIQUEUE. The NIC has only 1 CPU, but using another CPU to manage the queue seems to work right. For iflib, the corresponding tuning seems to be to set the tx_abdicate sysctl to 1. This doesn't work so well. It causes iflib to mostly waste CPU by trying to do 2 context switches per packet (mostly from an idle thread to an iflib thread). The Haswell CPU can only do about 1 context switch per microsecond, so the context switches are worse than useless for achieving packet rates above 1000 kpps. In old versions of iflib, tx_abdicate is not a sysctl and is always enabled. This is why iflib takes an extra 0.5 CPUs in the above benchmark. Then for -current after both iflib and 4+4 address space changes: 533 kpps worst ever observed in -current (config unknown) 800 kkps typical result before pae_mode changes Then for -current now (after iflib, 4+4 and pae changes) 500 kkps pae_mode=1 (default) tx_abdicate=0 (default) 1 CPU 780 kpps pae_mode=0 tx_abdicate=0 (default) 1 CPU 591 kpps pae_mode=0 tx_abdicate=1 1.5 CPUs On amd64, the speed of syscalls hasn't changed much, so it still gets about 1200 kpps in untuned configurations, and tx_abdicate works better so it can almost reach line rate using a bit more CPU than tuned FreeBSD-11. The extra context switches can also be avoided by not using SMP or by binding the netblast thread to the same CPU as the main iflib thread. This only helps when tx_adbicate=1: 975 kpps pae_mode=0 tx_abdicate=1 cpuset -l5 1 CPU I.e., cpusetting improves the speed from 591 to 995 kpps! I now seem to remember that amd64 needed that too to get near line rate. The context switch counts for some cases are: - tx_abdicate=1, no cpuset: 1100+ k/sec (1 to and 1 from iflib thread per pkt) - tx_abdicate=0, no cpuset:8 k/sec (this is from the corrected itr=125) -
svn commit: r344113 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet
Author: cy Date: Thu Feb 14 00:52:03 2019 New Revision: 344113 URL: https://svnweb.freebsd.org/changeset/base/344113 Log: MFC r343591: Do not obtain an already held read lock. This causes a witness panic when ipfs is invoked. This is the second of two panics resolving PR 235110. PR: 235110 Reported by: david.boy...@twc.com Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c == --- stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Wed Feb 13 20:13:40 2019(r344112) +++ stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Thu Feb 14 00:52:03 2019(r344113) @@ -1909,20 +1909,16 @@ ipf_nat_getent(softc, data, getlock) } } if (error == 0) { - if (getlock) { - READ_ENTER(>ipf_nat); - getlock = 0; - } error = ipf_outobjsz(softc, data, ipn, IPFOBJ_NATSAVE, ipns.ipn_dsize); } finished: - if (getlock) { - READ_ENTER(>ipf_nat); - } if (ipn != NULL) { KFREES(ipn, ipns.ipn_dsize); + } + if (getlock) { + RWLOCK_EXIT(>ipf_nat); } return 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: r344113 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet
Author: cy Date: Thu Feb 14 00:52:03 2019 New Revision: 344113 URL: https://svnweb.freebsd.org/changeset/base/344113 Log: MFC r343591: Do not obtain an already held read lock. This causes a witness panic when ipfs is invoked. This is the second of two panics resolving PR 235110. PR: 235110 Reported by: david.boy...@twc.com Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_nat.c == --- stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Wed Feb 13 20:13:40 2019(r344112) +++ stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Thu Feb 14 00:52:03 2019(r344113) @@ -1904,20 +1904,16 @@ ipf_nat_getent(softc, data, getlock) } } if (error == 0) { - if (getlock) { - READ_ENTER(>ipf_nat); - getlock = 0; - } error = ipf_outobjsz(softc, data, ipn, IPFOBJ_NATSAVE, ipns.ipn_dsize); } finished: - if (getlock) { - READ_ENTER(>ipf_nat); - } if (ipn != NULL) { KFREES(ipn, ipns.ipn_dsize); + } + if (getlock) { + RWLOCK_EXIT(>ipf_nat); } return 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: r344113 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet
Author: cy Date: Thu Feb 14 00:52:03 2019 New Revision: 344113 URL: https://svnweb.freebsd.org/changeset/base/344113 Log: MFC r343591: Do not obtain an already held read lock. This causes a witness panic when ipfs is invoked. This is the second of two panics resolving PR 235110. PR: 235110 Reported by: david.boy...@twc.com Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c stable/11/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_nat.c == --- stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Wed Feb 13 20:13:40 2019(r344112) +++ stable/12/sys/contrib/ipfilter/netinet/ip_nat.c Thu Feb 14 00:52:03 2019(r344113) @@ -1904,20 +1904,16 @@ ipf_nat_getent(softc, data, getlock) } } if (error == 0) { - if (getlock) { - READ_ENTER(>ipf_nat); - getlock = 0; - } error = ipf_outobjsz(softc, data, ipn, IPFOBJ_NATSAVE, ipns.ipn_dsize); } finished: - if (getlock) { - READ_ENTER(>ipf_nat); - } if (ipn != NULL) { KFREES(ipn, ipns.ipn_dsize); + } + if (getlock) { + RWLOCK_EXIT(>ipf_nat); } return 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"
Re: svn commit: r343030 - in head/sys: cam conf dev/md dev/nvme fs/fuse fs/nfsclient fs/smbfs kern sys ufs/ffs vm
On Tue, 15 Jan 2019 01:02:17 + (UTC) Gleb Smirnoff wrote: > Author: glebius > Date: Tue Jan 15 01:02:16 2019 > New Revision: 343030 > URL: https://svnweb.freebsd.org/changeset/base/343030 > > Log: > Allocate pager bufs from UMA instead of 80-ish mutex protected > linked list. > o In vm_pager_bufferinit() create pbuf_zone and start accounting on > how many pbufs are we going to have set. > In various subsystems that are going to utilize pbufs create > private zones via call to pbuf_zsecond_create(). The latter calls > uma_zsecond_create(), and sets a limit on created zone. After startup > preallocate pbufs according to requirements of all pbuf zones. > > Subsystems that used to have a private limit with old allocator > now have private pbuf zones: md(4), fusefs, NFS client, smbfs, VFS > cluster, FFS, swap, vnode pager. > > The following subsystems use shared pbuf zone: cam(4), nvme(4), > physio(9), aio(4). They should have their private limits, but > changing that is out of scope of this commit. > > o Fetch tunable value of kern.nswbuf from init_param2() and while > here move NSWBUF_MIN to opt_param.h and eliminate opt_swap.h, that > was holding only this option. > Default values aren't touched by this commit, but they probably > should be reviewed wrt to modern hardware. > > This change removes a tight bottleneck from sendfile(2) operation, > that uses pbufs in vnode pager. Other pagers also would benefit from > faster allocation. > > Together with: gallatin > Tested by: pho > > Modified: > head/sys/cam/cam_periph.c > head/sys/conf/options > head/sys/dev/md/md.c > head/sys/dev/nvme/nvme_ctrlr.c > head/sys/fs/fuse/fuse_main.c > head/sys/fs/fuse/fuse_vnops.c > head/sys/fs/nfsclient/nfs_clbio.c > head/sys/fs/nfsclient/nfs_clport.c > head/sys/fs/smbfs/smbfs_io.c > head/sys/fs/smbfs/smbfs_vfsops.c > head/sys/kern/kern_physio.c > head/sys/kern/subr_param.c > head/sys/kern/vfs_aio.c > head/sys/kern/vfs_bio.c > head/sys/kern/vfs_cluster.c > head/sys/sys/buf.h > head/sys/ufs/ffs/ffs_rawread.c > head/sys/vm/swap_pager.c > head/sys/vm/vm_pager.c > head/sys/vm/vnode_pager.c > Hi Gleb, This seems to break 32-bit platforms, or at least 32-bit book-e powerpc, which has a limited KVA space (~500MB). It preallocates I've seen over 2500 pbufs, at 128kB each, eating up over 300MB KVA, leaving very little left for the rest of runtime. I spent a couple hours earlier today debugging with Mark Johnston, and his consensus is that the vnode_pbuf_zone is too big on 32-bit platforms. Unfortunately I know very little about this area, so can't provide much extra insight, but can readily reproduce the issues I see triggered by this change, so am willing to help where I can. - Justin ___ 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: r344099 - head/sys/net
I disagree. If you define an alloc it is only reciprocal that you should define a free. The code in question that hit this was changed (its in a version of rack that has the rate-limit and TLS code).. but I think these things *should* be balanced.. if you provide an Allocate, you should also provide a Free… R > On Feb 13, 2019, at 12:09 PM, John Baldwin wrote: > > On 2/13/19 6:57 AM, Randall Stewart wrote: >> Author: rrs >> Date: Wed Feb 13 14:57:59 2019 >> New Revision: 344099 >> URL: https://svnweb.freebsd.org/changeset/base/344099 >> >> Log: >> This commit adds the missing release mechanism for the >> ratelimiting code. The two modules (lagg and vlan) did have >> allocation routines, and even though they are indirect (and >> vector down to the underlying interfaces) they both need to >> have a free routine (that also vectors down to the actual interface). >> >> Sponsored by: Netflix Inc. >> Differential Revision: https://reviews.freebsd.org/D19032 > > Hmm, I don't understand why you'd ever invoke if_snd_tag_free from anything > but 'tag->ifp' rather than some other ifp. What if the route for a connection > moves so that a tag allocated on cc0 is now on a route that goes over em0? > You can't expect em0 to have an if_snd_tag_free routine that will know to > go invoke cxgbe's snd_tag_free. I think you should always be using > 'tag->ifp->if_snd_tag_free' to free tags and never using any other ifp. > > That is, I think this should be reverted and that instead you need to fix > the code invoking if_snd_tag_free to invoke it on the tag's ifp instead of > some random other ifp. > > -- > John Baldwin > > -- Randall Stewart r...@netflix.com ___ 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: r344111 - stable/12/sys/dev/acpica
Author: bwidawsk Date: Wed Feb 13 19:00:06 2019 New Revision: 344111 URL: https://svnweb.freebsd.org/changeset/base/344111 Log: MFC r339577: acpi: Add an interface to obtain DSM information The Device Specific Method (_DSM) is on optional object that defines device specific controls. This will be useful for our power management controller in upcoming patches. More information can be found in ACPI spec 6.2 section 9.1.1 https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf This patch had a minor modification changing ENOMEM to AE_NO_MEMORY after it got review and approval but before committing. Test Plan: Tested in my s0ix branch Reviewed by: kib Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D17121 Modified: stable/12/sys/dev/acpica/acpi.c stable/12/sys/dev/acpica/acpivar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi.c == --- stable/12/sys/dev/acpica/acpi.c Wed Feb 13 18:55:47 2019 (r344110) +++ stable/12/sys/dev/acpica/acpi.c Wed Feb 13 19:00:06 2019 (r344111) @@ -2576,6 +2576,98 @@ acpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOU return (AE_OK); } +UINT8 +acpi_DSMQuery(ACPI_HANDLE h, uint8_t *uuid, int revision) +{ +/* + * ACPI spec 9.1.1 defines this. + * + * "Arg2: Function Index Represents a specific function whose meaning is + * specific to the UUID and Revision ID. Function indices should start + * with 1. Function number zero is a query function (see the special + * return code defined below)." + */ +ACPI_BUFFER buf; +ACPI_OBJECT *obj; +UINT8 ret = 0; + +if (!ACPI_SUCCESS(acpi_EvaluateDSM(h, uuid, revision, 0, NULL, ))) { + ACPI_INFO(("Failed to enumerate DSM functions\n")); + return (0); +} + +obj = (ACPI_OBJECT *)buf.Pointer; +KASSERT(obj, ("Object not allowed to be NULL\n")); + +/* + * From ACPI 6.2 spec 9.1.1: + * If Function Index = 0, a Buffer containing a function index bitfield. + * Otherwise, the return value and type depends on the UUID and revision + * ID (see below). + */ +switch (obj->Type) { +case ACPI_TYPE_BUFFER: + ret = *(uint8_t *)obj->Buffer.Pointer; + break; +case ACPI_TYPE_INTEGER: + ACPI_BIOS_WARNING((AE_INFO, + "Possibly buggy BIOS with ACPI_TYPE_INTEGER for function enumeration\n")); + ret = obj->Integer.Value & 0xFF; + break; +default: + ACPI_WARNING((AE_INFO, "Unexpected return type %u\n", obj->Type)); +}; + +AcpiOsFree(obj); +return ret; +} + +/* + * DSM may return multiple types depending on the function. It is therefore + * unsafe to use the typed evaluation. It is highly recommended that the caller + * check the type of the returned object. + */ +ACPI_STATUS +acpi_EvaluateDSM(ACPI_HANDLE handle, uint8_t *uuid, int revision, +uint64_t function, union acpi_object *package, ACPI_BUFFER *out_buf) +{ +ACPI_OBJECT arg[4]; +ACPI_OBJECT_LIST arglist; +ACPI_BUFFER buf; +ACPI_STATUS status; + +if (out_buf == NULL) + return (AE_NO_MEMORY); + +arg[0].Type = ACPI_TYPE_BUFFER; +arg[0].Buffer.Length = ACPI_UUID_LENGTH; +arg[0].Buffer.Pointer = uuid; +arg[1].Type = ACPI_TYPE_INTEGER; +arg[1].Integer.Value = revision; +arg[2].Type = ACPI_TYPE_INTEGER; +arg[2].Integer.Value = function; +if (package) { + arg[3] = *package; +} else { + arg[3].Type = ACPI_TYPE_PACKAGE; + arg[3].Package.Count = 0; + arg[3].Package.Elements = NULL; +} + +arglist.Pointer = arg; +arglist.Count = 4; +buf.Pointer = NULL; +buf.Length = ACPI_ALLOCATE_BUFFER; +status = AcpiEvaluateObject(handle, "_DSM", , ); +if (ACPI_FAILURE(status)) + return (status); + +KASSERT(ACPI_SUCCESS(status), ("Unexpected status")); + +*out_buf = buf; +return (status); +} + ACPI_STATUS acpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid, int revision, int count, uint32_t *caps_in, uint32_t *caps_out, bool query) Modified: stable/12/sys/dev/acpica/acpivar.h == --- stable/12/sys/dev/acpica/acpivar.h Wed Feb 13 18:55:47 2019 (r344110) +++ stable/12/sys/dev/acpica/acpivar.h Wed Feb 13 19:00:06 2019 (r344111) @@ -349,6 +349,10 @@ ACPI_STATUSacpi_FindIndexedResource(ACPI_BUFFER *buf, ACPI_RESOURCE **resp); ACPI_STATUSacpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOURCE *res); +UINT8 acpi_DSMQuery(ACPI_HANDLE h, uint8_t *uuid, int revision); +ACPI_STATUSacpi_EvaluateDSM(ACPI_HANDLE handle, uint8_t *uuid, + int revision, uint64_t function, union acpi_object *package, + ACPI_BUFFER
Re: svn commit: r344099 - head/sys/net
On 2/13/19 10:03 AM, Randall Stewart wrote: > oh and one other thing.. > > It was *not* a random IFP.. it was the IFP to the lagg. > > I.e. an alloc() was done to the lagg.. and the free was > done back to the same IFP (that provided the allocate). Yes, that's wrong. Suppose the route changes so that my traffic is now over em0 instead of lagg0 (where em0 isn't a member of the lagg), how do you expect if_lagg_free to invoke em0's free routine? In your case it does, but only by accident. It doesn't work in the other case I described which is if you have non-lagg interfaces and a route moves from cc0 to em0. In that case your existing code that is using the wrong ifp will just panic. These aren't real alloc routines as the lagg and vlan ones don't allocate anything, they pass along the request to the child and the child allocates the tag. Only ifnet's that actually allocate tags should need to free them, and you should be using tag->ifp to as the ifp whose if_snd_tag_free works. > R > >> On Feb 13, 2019, at 1:02 PM, Randall Stewart wrote: >> >> I disagree. If you define an alloc it is only >> reciprocal that you should define a free. >> >> The code in question that hit this was changed (its in a version >> of rack that has the rate-limit and TLS code).. but I think these >> things *should* be balanced.. if you provide an Allocate, you >> should also provide a Free… >> >> R >> >> >>> On Feb 13, 2019, at 12:09 PM, John Baldwin wrote: >>> >>> On 2/13/19 6:57 AM, Randall Stewart wrote: Author: rrs Date: Wed Feb 13 14:57:59 2019 New Revision: 344099 URL: https://svnweb.freebsd.org/changeset/base/344099 Log: This commit adds the missing release mechanism for the ratelimiting code. The two modules (lagg and vlan) did have allocation routines, and even though they are indirect (and vector down to the underlying interfaces) they both need to have a free routine (that also vectors down to the actual interface). Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D19032 >>> >>> Hmm, I don't understand why you'd ever invoke if_snd_tag_free from anything >>> but 'tag->ifp' rather than some other ifp. What if the route for a >>> connection >>> moves so that a tag allocated on cc0 is now on a route that goes over em0? >>> You can't expect em0 to have an if_snd_tag_free routine that will know to >>> go invoke cxgbe's snd_tag_free. I think you should always be using >>> 'tag->ifp->if_snd_tag_free' to free tags and never using any other ifp. >>> >>> That is, I think this should be reverted and that instead you need to fix >>> the code invoking if_snd_tag_free to invoke it on the tag's ifp instead of >>> some random other ifp. >>> >>> -- >>> John Baldwin >>> >>> >> >> -- >> Randall Stewart >> r...@netflix.com >> >> >> > > -- > Randall Stewart > r...@netflix.com > > > -- John Baldwin ___ 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: r344099 - head/sys/net
oh and one other thing.. It was *not* a random IFP.. it was the IFP to the lagg. I.e. an alloc() was done to the lagg.. and the free was done back to the same IFP (that provided the allocate). R > On Feb 13, 2019, at 1:02 PM, Randall Stewart wrote: > > I disagree. If you define an alloc it is only > reciprocal that you should define a free. > > The code in question that hit this was changed (its in a version > of rack that has the rate-limit and TLS code).. but I think these > things *should* be balanced.. if you provide an Allocate, you > should also provide a Free… > > R > > >> On Feb 13, 2019, at 12:09 PM, John Baldwin wrote: >> >> On 2/13/19 6:57 AM, Randall Stewart wrote: >>> Author: rrs >>> Date: Wed Feb 13 14:57:59 2019 >>> New Revision: 344099 >>> URL: https://svnweb.freebsd.org/changeset/base/344099 >>> >>> Log: >>> This commit adds the missing release mechanism for the >>> ratelimiting code. The two modules (lagg and vlan) did have >>> allocation routines, and even though they are indirect (and >>> vector down to the underlying interfaces) they both need to >>> have a free routine (that also vectors down to the actual interface). >>> >>> Sponsored by: Netflix Inc. >>> Differential Revision: https://reviews.freebsd.org/D19032 >> >> Hmm, I don't understand why you'd ever invoke if_snd_tag_free from anything >> but 'tag->ifp' rather than some other ifp. What if the route for a >> connection >> moves so that a tag allocated on cc0 is now on a route that goes over em0? >> You can't expect em0 to have an if_snd_tag_free routine that will know to >> go invoke cxgbe's snd_tag_free. I think you should always be using >> 'tag->ifp->if_snd_tag_free' to free tags and never using any other ifp. >> >> That is, I think this should be reverted and that instead you need to fix >> the code invoking if_snd_tag_free to invoke it on the tag's ifp instead of >> some random other ifp. >> >> -- >> John Baldwin >> >> > > -- > Randall Stewart > r...@netflix.com > > > -- Randall Stewart r...@netflix.com ___ 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: r344108 - in head/sys/riscv: include riscv
Author: markj Date: Wed Feb 13 17:50:01 2019 New Revision: 344108 URL: https://svnweb.freebsd.org/changeset/base/344108 Log: Implement per-CPU pmap activation tracking for RISC-V. This reduces the overhead of TLB invalidations by ensuring that we only interrupt CPUs which are using the given pmap. Tracking is performed in pmap_activate(), which gets called during context switches: from cpu_throw(), if a thread is exiting or an AP is starting, or cpu_switch() for a regular context switch. For now, pmap_sync_icache() still must interrupt all CPUs. Reviewed by: kib (earlier version), jhb Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18874 Modified: head/sys/riscv/include/pcb.h head/sys/riscv/include/pcpu.h head/sys/riscv/include/pmap.h head/sys/riscv/riscv/genassym.c head/sys/riscv/riscv/machdep.c head/sys/riscv/riscv/mp_machdep.c head/sys/riscv/riscv/pmap.c head/sys/riscv/riscv/swtch.S head/sys/riscv/riscv/vm_machdep.c Modified: head/sys/riscv/include/pcb.h == --- head/sys/riscv/include/pcb.hWed Feb 13 17:38:47 2019 (r344107) +++ head/sys/riscv/include/pcb.hWed Feb 13 17:50:01 2019 (r344108) @@ -55,7 +55,6 @@ struct pcb { #definePCB_FP_STARTED 0x1 #definePCB_FP_USERMASK 0x1 uint64_tpcb_sepc; /* Supervisor exception pc */ - vm_offset_t pcb_l1addr; /* L1 page tables base address */ vm_offset_t pcb_onfault;/* Copyinout fault handler */ }; Modified: head/sys/riscv/include/pcpu.h == --- head/sys/riscv/include/pcpu.h Wed Feb 13 17:38:47 2019 (r344107) +++ head/sys/riscv/include/pcpu.h Wed Feb 13 17:50:01 2019 (r344108) @@ -45,6 +45,7 @@ #defineALT_STACK_SIZE 128 #definePCPU_MD_FIELDS \ + struct pmap *pc_curpmap;/* Currently active pmap */ \ uint32_t pc_pending_ipis; /* IPIs pending to this CPU */ \ char __pad[61] Modified: head/sys/riscv/include/pmap.h == --- head/sys/riscv/include/pmap.h Wed Feb 13 17:38:47 2019 (r344107) +++ head/sys/riscv/include/pmap.h Wed Feb 13 17:50:01 2019 (r344108) @@ -41,6 +41,7 @@ #ifndef LOCORE #include +#include #include #include @@ -80,6 +81,8 @@ struct pmap { struct mtx pm_mtx; struct pmap_statistics pm_stats; /* pmap statictics */ pd_entry_t *pm_l1; + u_long pm_satp;/* value for SATP register */ + cpuset_tpm_active; /* active on cpus */ TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ LIST_ENTRY(pmap)pm_list;/* List of all pmaps */ struct vm_radix pm_root; @@ -137,6 +140,10 @@ extern vm_offset_t virtual_end; #defineL1_MAPPABLE_P(va, pa, size) \ va) | (pa)) & L1_OFFSET) == 0 && (size) >= L1_SIZE) +struct thread; + +void pmap_activate_boot(pmap_t); +void pmap_activate_sw(struct thread *); void pmap_bootstrap(vm_offset_t, vm_paddr_t, vm_size_t); void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); vm_paddr_t pmap_kextract(vm_offset_t va); Modified: head/sys/riscv/riscv/genassym.c == --- head/sys/riscv/riscv/genassym.c Wed Feb 13 17:38:47 2019 (r344107) +++ head/sys/riscv/riscv/genassym.c Wed Feb 13 17:50:01 2019 (r344108) @@ -63,7 +63,6 @@ ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); -ASSYM(PCB_L1ADDR, offsetof(struct pcb, pcb_l1addr)); ASSYM(PCB_SIZE, sizeof(struct pcb)); ASSYM(PCB_RA, offsetof(struct pcb, pcb_ra)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); Modified: head/sys/riscv/riscv/machdep.c == --- head/sys/riscv/riscv/machdep.c Wed Feb 13 17:38:47 2019 (r344107) +++ head/sys/riscv/riscv/machdep.c Wed Feb 13 17:50:01 2019 (r344108) @@ -871,10 +871,6 @@ initriscv(struct riscv_bootparams *rvbp) init_proc0(rvbp->kern_stack); - /* set page table base register for thread0 */ - thread0.td_pcb->pcb_l1addr = \ - (rvbp->kern_l1pt - KERNBASE + rvbp->kern_phys); - msgbufinit(msgbufp, msgbufsize); mutex_init(); init_param2(physmem); Modified: head/sys/riscv/riscv/mp_machdep.c == ---
svn commit: r344109 - head/lib/libthr/arch/powerpc/include
Author: luporl Date: Wed Feb 13 18:28:53 2019 New Revision: 344109 URL: https://svnweb.freebsd.org/changeset/base/344109 Log: silence cast-align warnings from clang on powerpc64 silence the following warning when compiling libthr with clang 8 for powerpc64 architecture: usr/src/lib/libthr/arch/powerpc/include/pthread_md.h:82:10: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'struct tcb *' increases required alignment from 1 to 8 [-Werror,-Wcast-align] 82: return ((struct tcb *)(_tp - TP_OFFSET)); Submitted by: alfredo.junior_eldorado.org.br Reviewed by: git_bdragon.rtk0.net, emaste, kib, jhibbits, luporl Differential Revision:https://reviews.freebsd.org/D18807 Modified: head/lib/libthr/arch/powerpc/include/pthread_md.h Modified: head/lib/libthr/arch/powerpc/include/pthread_md.h == --- head/lib/libthr/arch/powerpc/include/pthread_md.h Wed Feb 13 17:50:01 2019(r344108) +++ head/lib/libthr/arch/powerpc/include/pthread_md.h Wed Feb 13 18:28:53 2019(r344109) @@ -72,14 +72,15 @@ _tcb_set(struct tcb *tcb) static __inline struct tcb * _tcb_get(void) { - register uint8_t *_tp; +register struct tcb *tcb; + #ifdef __powerpc64__ - __asm __volatile("mr %0,13" : "=r"(_tp)); + __asm __volatile("addi %0,13,%1" : "=r"(tcb) : "i"(-TP_OFFSET)); #else - __asm __volatile("mr %0,2" : "=r"(_tp)); + __asm __volatile("addi %0,2,%1" : "=r"(tcb) : "i"(-TP_OFFSET)); #endif - return ((struct tcb *)(_tp - TP_OFFSET)); + return (tcb); } static __inline struct pthread * ___ 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: r344110 - stable/12/sys/compat/linuxkpi/common/include/linux
Author: bwidawsk Date: Wed Feb 13 18:55:47 2019 New Revision: 344110 URL: https://svnweb.freebsd.org/changeset/base/344110 Log: MFC r34: linuxkpi: Add GFP flags needed for ttm drivers Submitted by: Johannes Lundberg Requested by: bwidawsk Approved by: emaste (mentor) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/gfp.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/gfp.h == --- stable/12/sys/compat/linuxkpi/common/include/linux/gfp.hWed Feb 13 18:28:53 2019(r344109) +++ stable/12/sys/compat/linuxkpi/common/include/linux/gfp.hWed Feb 13 18:55:47 2019(r344110) @@ -52,6 +52,7 @@ #define__GFP_RETRY_MAYFAIL 0 #define__GFP_MOVABLE 0 #define__GFP_COMP 0 +#define__GFP_KSWAPD_RECLAIM 0 #define__GFP_IO0 #define__GFP_NO_KSWAPD 0 @@ -73,6 +74,7 @@ #defineGFP_TEMPORARY M_NOWAIT #defineGFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO) #defineGFP_TRANSHUGE 0 +#defineGFP_TRANSHUGE_LIGHT 0 CTASSERT((__GFP_DMA32 & GFP_NATIVE_MASK) == 0); CTASSERT((__GFP_BITS_MASK & GFP_NATIVE_MASK) == GFP_NATIVE_MASK); ___ 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: r344112 - head/contrib/llvm/lib/MC
Author: dim Date: Wed Feb 13 20:13:40 2019 New Revision: 344112 URL: https://svnweb.freebsd.org/changeset/base/344112 Log: Pull in r353907 from upstream llvm trunk (by Reid Kleckner): [MC] Make symbol version errors non-fatal We stil don't have a source location, which is pretty lame, but at least we won't tell the user to file a clang bug report anymore. Fixes PR40712 This will make errors for symbols with @@ versions that are not defined non-fatal. For example: void f(void) { __asm__(".symver foo,bar@@baz"); } will now result in: error: versioned symbol bar@@baz must be defined instead of clang crashing with a diagnostic report. PR: 234671 Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40712 MFC after:3 days Modified: head/contrib/llvm/lib/MC/ELFObjectWriter.cpp Modified: head/contrib/llvm/lib/MC/ELFObjectWriter.cpp == --- head/contrib/llvm/lib/MC/ELFObjectWriter.cppWed Feb 13 19:00:06 2019(r344111) +++ head/contrib/llvm/lib/MC/ELFObjectWriter.cppWed Feb 13 20:13:40 2019(r344112) @@ -1258,14 +1258,20 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssem if (!Symbol.isUndefined() && !Rest.startswith("@@@")) continue; -// FIXME: produce a better error message. +// FIXME: Get source locations for these errors or diagnose them earlier. if (Symbol.isUndefined() && Rest.startswith("@@") && -!Rest.startswith("@@@")) - report_fatal_error("A @@ version cannot be undefined"); +!Rest.startswith("@@@")) { + Asm.getContext().reportError(SMLoc(), "versioned symbol " + AliasName + +" must be defined"); + continue; +} -if (Renames.count() && Renames[] != Alias) - report_fatal_error(llvm::Twine("Multiple symbol versions defined for ") + - Symbol.getName()); +if (Renames.count() && Renames[] != Alias) { + Asm.getContext().reportError( + SMLoc(), llvm::Twine("multiple symbol versions defined for ") + + Symbol.getName()); + continue; +} Renames.insert(std::make_pair(, Alias)); } ___ 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: r343030 - in head/sys: cam conf dev/md dev/nvme fs/fuse fs/nfsclient fs/smbfs kern sys ufs/ffs vm
On Wed, 13 Feb 2019, Justin Hibbits wrote: On Tue, 15 Jan 2019 01:02:17 + (UTC) Gleb Smirnoff wrote: Author: glebius Date: Tue Jan 15 01:02:16 2019 New Revision: 343030 URL: https://svnweb.freebsd.org/changeset/base/343030 Log: Allocate pager bufs from UMA instead of 80-ish mutex protected linked list. ... This seems to break 32-bit platforms, or at least 32-bit book-e powerpc, which has a limited KVA space (~500MB). It preallocates I've seen over 2500 pbufs, at 128kB each, eating up over 300MB KVA, leaving very little left for the rest of runtime. Hrmph. I complained other things in this commit this when it was committed, but not this largest bug since preallocation was broken then so I thought that it wasn't done, so that problems are smaller unless the excessive limits are actually reached. Now i386 does it: XX ITEM SIZE LIMIT USED FREE REQ FAIL SLEEP XX XX swrbuf: 336,128, 0, 0, 0, 0, 0 XX swwbuf: 336, 64, 0, 0, 0, 0, 0 XX nfspbuf:336,128, 0, 0, 0, 0, 0 XX mdpbuf: 336, 25, 0, 0, 0, 0, 0 XX clpbuf: 336,128, 0, 5, 4, 0, 0 XX vnpbuf: 336, 2048, 0, 0, 0, 0, 0 XX pbuf: 336, 16, 0,2535, 0, 0, 0 but i386 now has 4GB of KVA, with almost 3GB to waste, so the bug is not noticed there. The preallocation wasn't there in my last mail to the author about nearby bugs, on 24 Jan 2019: YY vnpbuf: 568, 2048, 0, 0, 0, 0, 0 YY clpbuf: 568,128, 0, 128,8750, 0, 1 YY pbuf: 568, 16, 0, 4, 0, 0, 0 This output is on amd64 where the SIZE is larger and everything else was the same as on i386. Now amd64 shows the large preallocation too. There seems to be another bug for the especially small LIMIT of 16 to turn into a preallocation of 2535 and not cause immediate reduction to the limit. I happen to have kernels from 24 and 25 Jan handy. The first one is amd64 r343346M built on Jan 23, and it doesn't do the large preallocation. The second one is i386 r343388:343418M built on Jan 25, and it does the large preallocation. Both call uma_prealloc() to ask for nswbuf_max = 0x9e9 buffers, but the old version only allocates 4 buffers while later version allocate 0x9e9 buffers. The only relevant commit between the good and bad versions seems to be r343453. This fixes uma_prealloc() to actually work. But it is a feature for it to not work when its caller asks for too much. 0x9e9 is the sum of the LIMITs of all pbuf pools. The main bug in r343030 is that it expands nswbuf, which is supposed to give the combined limit, from its normal value of 256 to 0x9e9. (r343030 actually used nswbuf before it was properly initialized, so used its maximum value of 256 even on small systems with nswbuf = 16. Only this has been fixed.) On i386, nbuf is excessively limited so as to give a maxbufspace of about 100MB so as to fit in 1GB of kva even with infinite RAM and -current's actual 4GB of kva. nbuf is correctly limited to give a much smaller maxbufspace when RAM is small (kva scaling for this is not done so well). nswbuf is restricted if nbuf is restricted, but not enough (except in my version). It is normally 256, so the pbuf allocation used to be 32MB, and this is already a bit large compared with 100MB for maxbufspace. Expanding pbufs by a factor of 0x9e9/0x100 gives the silly combination of 100MB for maxbufspace and 317MB for pbufs. If kva is only 512MB instead of 1GB, then maxbufspace should be only 50MB and nswbuf should be smaller too. Similarly for PAE on i386 back when it was configured with 1GB kva by default. Only about 512MB are left after allocating space for page table metadata. I have fixes that scale most of this better. Large subsystems starting with kmem get a hard-coded fraction of the usable kva. E.g., kmem gets about 60% of usable kva instead of about 40% of nominal kva. Most other large subsystems including the buffer cache get about 1/8 of the remaining 40% of usable kva. Scaling for other subsystems is mostly worse than for kmem. pbufs are part of the buffer cache allocation. The expansion factor of 0x9e9/0x100 breaks this. I don't understand how pbuf_preallocate() allocates for the other pbuf pools. When I debugged this for clpbufs, the preallocation was not used. pbuf types other than clpbufs seem to be unused in my configurations. I thought that pbufs were used during initialization, since they end up with a nonzero FREE count, but their only use seems to be to preallocate them. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To
Re: svn commit: r344099 - head/sys/net
On 2/13/19 6:57 AM, Randall Stewart wrote: > Author: rrs > Date: Wed Feb 13 14:57:59 2019 > New Revision: 344099 > URL: https://svnweb.freebsd.org/changeset/base/344099 > > Log: > This commit adds the missing release mechanism for the > ratelimiting code. The two modules (lagg and vlan) did have > allocation routines, and even though they are indirect (and > vector down to the underlying interfaces) they both need to > have a free routine (that also vectors down to the actual interface). > > Sponsored by: Netflix Inc. > Differential Revision: https://reviews.freebsd.org/D19032 Hmm, I don't understand why you'd ever invoke if_snd_tag_free from anything but 'tag->ifp' rather than some other ifp. What if the route for a connection moves so that a tag allocated on cc0 is now on a route that goes over em0? You can't expect em0 to have an if_snd_tag_free routine that will know to go invoke cxgbe's snd_tag_free. I think you should always be using 'tag->ifp->if_snd_tag_free' to free tags and never using any other ifp. That is, I think this should be reverted and that instead you need to fix the code invoking if_snd_tag_free to invoke it on the tag's ifp instead of some random other ifp. -- John Baldwin ___ 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: r344106 - in head/sys: riscv/include riscv/riscv vm
Author: markj Date: Wed Feb 13 17:19:37 2019 New Revision: 344106 URL: https://svnweb.freebsd.org/changeset/base/344106 Log: Implement transparent 2MB superpage promotion for RISC-V. This includes support for pmap_enter(..., psind=1) as described in the commit log message for r321378. The changes are largely modelled after amd64. arm64 has more stringent requirements around superpage creation to avoid the possibility of TLB conflict aborts, and these requirements do not apply to RISC-V, which like amd64 permits simultaneous caching of 4KB and 2MB translations for a given page. RISC-V's PTE format includes only two software bits, and as these are already consumed we do not have an analogue for amd64's PG_PROMOTED. Instead, pmap_remove_l2() always invalidates the entire 2MB address range. pmap_ts_referenced() is modified to clear PTE_A, now that we support both hardware- and software-managed reference and dirty bits. Also fix pmap_fault_fixup() so that it does not set PTE_A or PTE_D on kernel mappings. Reviewed by: kib (earlier version) Discussed with: jhb Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18863 Differential Revision:https://reviews.freebsd.org/D18864 Differential Revision:https://reviews.freebsd.org/D18865 Differential Revision:https://reviews.freebsd.org/D18866 Differential Revision:https://reviews.freebsd.org/D18867 Differential Revision:https://reviews.freebsd.org/D18868 Modified: head/sys/riscv/include/param.h head/sys/riscv/include/pmap.h head/sys/riscv/include/pte.h head/sys/riscv/include/vmparam.h head/sys/riscv/riscv/pmap.c head/sys/vm/vm_fault.c Modified: head/sys/riscv/include/param.h == --- head/sys/riscv/include/param.h Wed Feb 13 16:02:55 2019 (r344105) +++ head/sys/riscv/include/param.h Wed Feb 13 17:19:37 2019 (r344106) @@ -82,7 +82,7 @@ #definePAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ #definePAGE_MASK (PAGE_SIZE - 1) -#defineMAXPAGESIZES1 /* maximum number of supported page sizes */ +#defineMAXPAGESIZES3 /* maximum number of supported page sizes */ #ifndef KSTACK_PAGES #defineKSTACK_PAGES4 /* pages of kernel stack (with pcb) */ Modified: head/sys/riscv/include/pmap.h == --- head/sys/riscv/include/pmap.h Wed Feb 13 16:02:55 2019 (r344105) +++ head/sys/riscv/include/pmap.h Wed Feb 13 17:19:37 2019 (r344106) @@ -44,6 +44,8 @@ #include #include +#include + #ifdef _KERNEL #definevtophys(va) pmap_kextract((vm_offset_t)(va)) @@ -80,6 +82,7 @@ struct pmap { pd_entry_t *pm_l1; TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ LIST_ENTRY(pmap)pm_list;/* List of all pmaps */ + struct vm_radix pm_root; }; typedef struct pv_entry { @@ -139,6 +142,7 @@ voidpmap_kenter_device(vm_offset_t, vm_size_t, vm_pad vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); void pmap_kremove_device(vm_offset_t, vm_size_t); +bool pmap_ps_enabled(pmap_t); void *pmap_mapdev(vm_offset_t, vm_size_t); void *pmap_mapbios(vm_paddr_t, vm_size_t); Modified: head/sys/riscv/include/pte.h == --- head/sys/riscv/include/pte.hWed Feb 13 16:02:55 2019 (r344105) +++ head/sys/riscv/include/pte.hWed Feb 13 17:19:37 2019 (r344106) @@ -62,7 +62,8 @@ typedef uint64_tpn_t; /* page number */ #defineL3_SIZE (1 << L3_SHIFT) #defineL3_OFFSET (L3_SIZE - 1) -#defineLn_ENTRIES (1 << 9) +#defineLn_ENTRIES_SHIFT 9 +#defineLn_ENTRIES (1 << Ln_ENTRIES_SHIFT) #defineLn_ADDR_MASK(Ln_ENTRIES - 1) /* Bits 9:8 are reserved for software */ @@ -79,6 +80,8 @@ typedef uint64_tpn_t; /* page number */ #definePTE_RWX (PTE_R | PTE_W | PTE_X) #definePTE_RX (PTE_R | PTE_X) #definePTE_KERN(PTE_V | PTE_R | PTE_W | PTE_A | PTE_D) +#definePTE_PROMOTE (PTE_V | PTE_RWX | PTE_D | PTE_A | PTE_G | PTE_U | \ +PTE_SW_MANAGED | PTE_SW_WIRED) #definePTE_PPN0_S 10 #definePTE_PPN1_S 19 Modified: head/sys/riscv/include/vmparam.h == --- head/sys/riscv/include/vmparam.hWed Feb 13 16:02:55 2019 (r344105) +++ head/sys/riscv/include/vmparam.hWed Feb 13 17:19:37 2019
svn commit: r344107 - head/sys/riscv/riscv
Author: markj Date: Wed Feb 13 17:38:47 2019 New Revision: 344107 URL: https://svnweb.freebsd.org/changeset/base/344107 Log: Implement pmap_clear_modify() for RISC-V. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D18875 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c == --- head/sys/riscv/riscv/pmap.c Wed Feb 13 17:19:37 2019(r344106) +++ head/sys/riscv/riscv/pmap.c Wed Feb 13 17:38:47 2019(r344107) @@ -4074,6 +4074,14 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t void pmap_clear_modify(vm_page_t m) { + struct md_page *pvh; + struct rwlock *lock; + pmap_t pmap; + pv_entry_t next_pv, pv; + pd_entry_t *l2, oldl2; + pt_entry_t *l3, oldl3; + vm_offset_t va; + int md_gen, pvh_gen; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); @@ -4088,8 +4096,78 @@ pmap_clear_modify(vm_page_t m) */ if ((m->aflags & PGA_WRITEABLE) == 0) return; - - /* RISCVTODO: We lack support for tracking if a page is modified */ + pvh = (m->flags & PG_FICTITIOUS) != 0 ? _dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + rw_rlock(_global_lock); + rw_wlock(lock); +restart: + TAILQ_FOREACH_SAFE(pv, >pv_list, pv_next, next_pv) { + pmap = PV_PMAP(pv); + if (!PMAP_TRYLOCK(pmap)) { + pvh_gen = pvh->pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (pvh_gen != pvh->pv_gen) { + PMAP_UNLOCK(pmap); + goto restart; + } + } + va = pv->pv_va; + l2 = pmap_l2(pmap, va); + oldl2 = pmap_load(l2); + if ((oldl2 & PTE_W) != 0) { + if (pmap_demote_l2_locked(pmap, l2, va, )) { + if ((oldl2 & PTE_SW_WIRED) == 0) { + /* +* Write protect the mapping to a +* single page so that a subsequent +* write access may repromote. +*/ + va += VM_PAGE_TO_PHYS(m) - + PTE_TO_PHYS(oldl2); + l3 = pmap_l2_to_l3(l2, va); + oldl3 = pmap_load(l3); + if ((oldl3 & PTE_V) != 0) { + while (!atomic_fcmpset_long(l3, + , oldl3 & ~(PTE_D | + PTE_W))) + cpu_spinwait(); + vm_page_dirty(m); + pmap_invalidate_page(pmap, va); + } + } + } + } + PMAP_UNLOCK(pmap); + } + TAILQ_FOREACH(pv, >md.pv_list, pv_next) { + pmap = PV_PMAP(pv); + if (!PMAP_TRYLOCK(pmap)) { + md_gen = m->md.pv_gen; + pvh_gen = pvh->pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (pvh_gen != pvh->pv_gen || md_gen != m->md.pv_gen) { + PMAP_UNLOCK(pmap); + goto restart; + } + } + l2 = pmap_l2(pmap, pv->pv_va); + KASSERT((pmap_load(l2) & PTE_RWX) == 0, + ("pmap_clear_modify: found a 2mpage in page %p's pv list", + m)); + l3 = pmap_l2_to_l3(l2, pv->pv_va); + if ((pmap_load(l3) & (PTE_D | PTE_W)) == (PTE_D | PTE_W)) { + pmap_clear_bits(l3, PTE_D); + pmap_invalidate_page(pmap, pv->pv_va); + } + PMAP_UNLOCK(pmap); + } + rw_wunlock(lock); + rw_runlock(_global_lock); } void * ___ 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: r344101 - stable/12/sys/dev/ixgbe
Author: marius Date: Wed Feb 13 15:27:17 2019 New Revision: 344101 URL: https://svnweb.freebsd.org/changeset/base/344101 Log: MFC: r343622 ix(4),ixv(4): Fix TSO offloads when TXCSUM is disabled This patch and commit message are based on r340256 created by Jacob Keller: The iflib stack does not disable TSO automatically when TXCSUM is disabled, instead assuming that the driver will correctly handle TSOs even when CSUM_IP is not set. This results in iflib calling ixgbe_isc_txd_encap with packets which have CSUM_IP_TSO, but do not have CSUM_IP or CSUM_IP_TCP set. Because of this, ixgbe_tx_ctx_setup will not setup the IPv4 checksum offloading. This results in bad TSO packets being sent if a user disables TXCSUM without disabling TSO. Fix this by updating the ixgbe_tx_ctx_setup function to check both CSUM_IP and CSUM_IP_TSO when deciding whether to enable checksums. Once this is corrected, another issue for TSO packets is revealed. The driver sets IFLIB_NEED_ZERO_CSUM in order to enable a work around that causes the ip->sum field to be zero'd. This is necessary for ix hardware to correctly perform TSOs. However, if TXCSUM is disabled, then the work around is not enabled, as CSUM_IP will not be set when the iflib stack checks to see if it should clear the sum field. Fix this by adding IFLIB_TSO_INIT_IP to the iflib flags for the ix and ixv interface files. Once both of these changes are made, the ix and ixv drivers should correctly offload TSO packets when TSO offload is enabled, regardless of whether TXCSUM is enabled or disabled. Submitted by: Piotr Pietruszewski Reviewed by: IntelNetworking Differential Revision:https://reviews.freebsd.org/D18470 Modified: stable/12/sys/dev/ixgbe/if_ix.c stable/12/sys/dev/ixgbe/if_ixv.c stable/12/sys/dev/ixgbe/ix_txrx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixgbe/if_ix.c == --- stable/12/sys/dev/ixgbe/if_ix.c Wed Feb 13 15:19:31 2019 (r344100) +++ stable/12/sys/dev/ixgbe/if_ix.c Wed Feb 13 15:27:17 2019 (r344101) @@ -379,6 +379,7 @@ static struct if_shared_ctx ixgbe_sctx_init = { .isc_vendor_info = ixgbe_vendor_info_array, .isc_driver_version = ixgbe_driver_version, .isc_driver = _if_driver, + .isc_flags = IFLIB_TSO_INIT_IP, .isc_nrxd_min = {MIN_RXD}, .isc_ntxd_min = {MIN_TXD}, Modified: stable/12/sys/dev/ixgbe/if_ixv.c == --- stable/12/sys/dev/ixgbe/if_ixv.cWed Feb 13 15:19:31 2019 (r344100) +++ stable/12/sys/dev/ixgbe/if_ixv.cWed Feb 13 15:27:17 2019 (r344101) @@ -222,6 +222,7 @@ static struct if_shared_ctx ixv_sctx_init = { .isc_vendor_info = ixv_vendor_info_array, .isc_driver_version = ixv_driver_version, .isc_driver = _if_driver, + .isc_flags = IFLIB_TSO_INIT_IP, .isc_nrxd_min = {MIN_RXD}, .isc_ntxd_min = {MIN_TXD}, Modified: stable/12/sys/dev/ixgbe/ix_txrx.c == --- stable/12/sys/dev/ixgbe/ix_txrx.c Wed Feb 13 15:19:31 2019 (r344100) +++ stable/12/sys/dev/ixgbe/ix_txrx.c Wed Feb 13 15:27:17 2019 (r344101) @@ -131,7 +131,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *T switch (pi->ipi_ipproto) { case IPPROTO_TCP: - if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) + if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP | CSUM_TSO)) type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP; else offload = FALSE; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344102 - stable/12/sys/dev/ixl
Author: marius Date: Wed Feb 13 15:30:06 2019 New Revision: 344102 URL: https://svnweb.freebsd.org/changeset/base/344102 Log: MFC: r339459 ixl/iavf(4): Fix GCC 6.4.0 build Don't define redundant prototypes. Modified: stable/12/sys/dev/ixl/if_iavf.c stable/12/sys/dev/ixl/ixl_pf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixl/if_iavf.c == --- stable/12/sys/dev/ixl/if_iavf.c Wed Feb 13 15:27:17 2019 (r344101) +++ stable/12/sys/dev/ixl/if_iavf.c Wed Feb 13 15:30:06 2019 (r344102) @@ -126,7 +126,6 @@ static int iavf_sysctl_queue_interrupt_table(SYSCTL_HA static int iavf_sysctl_vf_reset(SYSCTL_HANDLER_ARGS); static int iavf_sysctl_vflr_reset(SYSCTL_HANDLER_ARGS); -char *iavf_vc_speed_to_string(enum virtchnl_link_speed link_speed); static voidiavf_save_tunables(struct iavf_sc *); static enum i40e_status_code iavf_process_adminq(struct iavf_sc *, u16 *); Modified: stable/12/sys/dev/ixl/ixl_pf.h == --- stable/12/sys/dev/ixl/ixl_pf.h Wed Feb 13 15:27:17 2019 (r344101) +++ stable/12/sys/dev/ixl/ixl_pf.h Wed Feb 13 15:30:06 2019 (r344102) @@ -267,9 +267,6 @@ char * ixl_switch_element_string(struct sbuf *, struct i40e_aqc_switch_config_element_resp *); void ixl_add_sysctls_mac_stats(struct sysctl_ctx_list *, struct sysctl_oid_list *, struct i40e_hw_port_stats *); -void ixl_add_sysctls_eth_stats(struct sysctl_ctx_list *, - struct sysctl_oid_list *, - struct i40e_eth_stats *); voidixl_media_status(struct ifnet *, struct ifmediareq *); int ixl_media_change(struct ifnet *); ___ 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: r344105 - stable/11/sys/dev/ixl
Author: marius Date: Wed Feb 13 16:02:55 2019 New Revision: 344105 URL: https://svnweb.freebsd.org/changeset/base/344105 Log: MFC: r343372 ixl(4): Fix handling data passed with ioctl from NVM update tool From Krzysztof: Ensure that the entire data buffer passed from the NVM update tool is copied in to kernel space and copied back out to user space using copyin() and copyout(). PR: 234104 Submitted by: Krzysztof Galazka Reported by: Finn Differential Revision:https://reviews.freebsd.org/D18817 Modified: stable/11/sys/dev/ixl/ixl_pf_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ixl/ixl_pf_main.c == --- stable/11/sys/dev/ixl/ixl_pf_main.c Wed Feb 13 16:02:52 2019 (r344104) +++ stable/11/sys/dev/ixl/ixl_pf_main.c Wed Feb 13 16:02:55 2019 (r344105) @@ -4989,23 +4989,34 @@ ixl_handle_nvmupd_cmd(struct ixl_pf *pf, struct ifdrv struct i40e_nvm_access *nvma; device_t dev = pf->dev; enum i40e_status_code status = 0; - int perrno; + size_t nvma_size, ifd_len, exp_len; + int err, perrno; DEBUGFUNC("ixl_handle_nvmupd_cmd"); /* Sanity checks */ - if (ifd->ifd_len < sizeof(struct i40e_nvm_access) || + nvma_size = sizeof(struct i40e_nvm_access); + ifd_len = ifd->ifd_len; + + if (ifd_len < nvma_size || ifd->ifd_data == NULL) { device_printf(dev, "%s: incorrect ifdrv length or data pointer\n", __func__); device_printf(dev, "%s: ifdrv length: %zu, sizeof(struct i40e_nvm_access): %zu\n", - __func__, ifd->ifd_len, sizeof(struct i40e_nvm_access)); + __func__, ifd_len, nvma_size); device_printf(dev, "%s: data pointer: %p\n", __func__, ifd->ifd_data); return (EINVAL); } - nvma = (struct i40e_nvm_access *)ifd->ifd_data; + nvma = malloc(ifd_len, M_DEVBUF, M_WAITOK); + err = copyin(ifd->ifd_data, nvma, ifd_len); + if (err) { + device_printf(dev, "%s: Cannot get request from user space\n", + __func__); + free(nvma, M_DEVBUF); + return (err); + } if (pf->dbg_mask & IXL_DBG_NVMUPD) ixl_print_nvm_cmd(dev, nvma); @@ -5019,12 +5030,48 @@ ixl_handle_nvmupd_cmd(struct ixl_pf *pf, struct ifdrv } } - if (!(pf->state & IXL_PF_STATE_EMPR_RESETTING)) { - IXL_PF_LOCK(pf); - status = i40e_nvmupd_command(hw, nvma, nvma->data, ); - IXL_PF_UNLOCK(pf); - } else { - perrno = -EBUSY; + if (pf->state & IXL_PF_STATE_EMPR_RESETTING) { + free(nvma, M_DEVBUF); + return (-EBUSY); + } + + if (nvma->data_size < 1 || nvma->data_size > 4096) { + device_printf(dev, "%s: invalid request, data size not in supported range\n", + __func__); + free(nvma, M_DEVBUF); + return (EINVAL); + } + + /* +* Older versions of the NVM update tool don't set ifd_len to the size +* of the entire buffer passed to the ioctl. Check the data_size field +* in the contained i40e_nvm_access struct and ensure everything is +* copied in from userspace. +*/ + exp_len = nvma_size + nvma->data_size - 1; /* One byte is kept in struct */ + + if (ifd_len < exp_len) { + ifd_len = exp_len; + nvma = realloc(nvma, ifd_len, M_DEVBUF, M_WAITOK); + err = copyin(ifd->ifd_data, nvma, ifd_len); + if (err) { + device_printf(dev, "%s: Cannot get request from user space\n", + __func__); + free(nvma, M_DEVBUF); + return (err); + } + } + + IXL_PF_LOCK(pf); + status = i40e_nvmupd_command(hw, nvma, nvma->data, ); + IXL_PF_UNLOCK(pf); + + err = copyout(nvma, ifd->ifd_data, ifd_len); + free(nvma, M_DEVBUF); + if (err) { + device_printf(dev, "%s: Cannot return data to user space\n", + __func__); + return (err); } /* Let the nvmupdate report errors, show them only when debug is enabled */ ___ 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: r344100 - stable/12/sys/dev/ixgbe
Author: marius Date: Wed Feb 13 15:19:31 2019 New Revision: 344100 URL: https://svnweb.freebsd.org/changeset/base/344100 Log: MFC: r343621 ix(4): Run {mod,msf,mbx,fdir,phy}_task in if_update_admin_status From Piotr: This patch introduces adapter->task_requests register responsible for recording requests for mod_task, msf_task, mbx_task, fdir_task and phy_task calls. Instead of enqueueing these tasks with GROUPTASK_ENQUEUE, handlers will be called directly from ixgbe_if_update_admin_status() while holding ctx lock. SIOCGIFXMEDIA ioctl() call reads adapter->media list. The list is deleted and rewritten in ixgbe_handle_msf() task without holding ctx lock. This change is needed to maintain data coherency when sharing adapter info via ioctl() calls. Patch co-authored by Krzysztof Galazka . PR: 221317 Submitted by: Piotr Pietruszewski Reviewed by: sbruno@, IntelNetworking Differential Revision:https://reviews.freebsd.org/D18468 Modified: stable/12/sys/dev/ixgbe/if_ix.c stable/12/sys/dev/ixgbe/ixgbe.h stable/12/sys/dev/ixgbe/ixgbe_type.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixgbe/if_ix.c == --- stable/12/sys/dev/ixgbe/if_ix.c Wed Feb 13 14:57:59 2019 (r344099) +++ stable/12/sys/dev/ixgbe/if_ix.c Wed Feb 13 15:19:31 2019 (r344100) @@ -120,6 +120,7 @@ static int ixgbe_if_resume(if_ctx_t ctx); static void ixgbe_if_stop(if_ctx_t ctx); void ixgbe_if_enable_intr(if_ctx_t ctx); static void ixgbe_if_disable_intr(if_ctx_t ctx); +static void ixgbe_link_intr_enable(if_ctx_t ctx); static int ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t qid); static void ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr); static int ixgbe_if_media_change(if_ctx_t ctx); @@ -173,7 +174,7 @@ static void ixgbe_init_device_features(struct adapter static void ixgbe_check_fan_failure(struct adapter *, u32, bool); static void ixgbe_add_media_types(if_ctx_t ctx); static void ixgbe_update_stats_counters(struct adapter *adapter); -static void ixgbe_config_link(struct adapter *adapter); +static void ixgbe_config_link(if_ctx_t ctx); static void ixgbe_get_slot_info(struct adapter *); static void ixgbe_check_wol_support(struct adapter *adapter); static void ixgbe_enable_rx_drop(struct adapter *); @@ -254,6 +255,7 @@ static device_method_t ixgbe_if_methods[] = { DEVMETHOD(ifdi_msix_intr_assign, ixgbe_if_msix_intr_assign), DEVMETHOD(ifdi_intr_enable, ixgbe_if_enable_intr), DEVMETHOD(ifdi_intr_disable, ixgbe_if_disable_intr), + DEVMETHOD(ifdi_link_intr_enable, ixgbe_link_intr_enable), DEVMETHOD(ifdi_tx_queue_intr_enable, ixgbe_if_rx_queue_intr_enable), DEVMETHOD(ifdi_rx_queue_intr_enable, ixgbe_if_rx_queue_intr_enable), DEVMETHOD(ifdi_tx_queues_alloc, ixgbe_if_tx_queues_alloc), @@ -446,19 +448,6 @@ ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs } - iflib_config_gtask_init(ctx, >mod_task, ixgbe_handle_mod, - "mod_task"); - iflib_config_gtask_init(ctx, >msf_task, ixgbe_handle_msf, - "msf_task"); - iflib_config_gtask_init(ctx, >phy_task, ixgbe_handle_phy, - "phy_task"); - if (adapter->feat_cap & IXGBE_FEATURE_SRIOV) - iflib_config_gtask_init(ctx, >mbx_task, - ixgbe_handle_mbx, "mbx_task"); - if (adapter->feat_en & IXGBE_FEATURE_FDIR) - iflib_config_gtask_init(ctx, >fdir_task, - ixgbe_reinit_fdir, "fdir_task"); - device_printf(iflib_get_dev(ctx), "allocated for %d queues\n", adapter->num_tx_queues); @@ -1362,8 +1351,9 @@ ixgbe_is_sfp(struct ixgbe_hw *hw) * ixgbe_config_link / static void -ixgbe_config_link(struct adapter *adapter) +ixgbe_config_link(if_ctx_t ctx) { + struct adapter *adapter = iflib_get_softc(ctx); struct ixgbe_hw *hw = >hw; u32 autoneg, err = 0; boolsfp, negotiate; @@ -1371,7 +1361,8 @@ ixgbe_config_link(struct adapter *adapter) sfp = ixgbe_is_sfp(hw); if (sfp) { - GROUPTASK_ENQUEUE(>mod_task); + adapter->task_requests |= IXGBE_REQUEST_TASK_MOD; + iflib_admin_intr_deferred(ctx); } else { if (hw->mac.ops.check_link) err = ixgbe_check_link(hw, >link_speed, @@ -1388,7 +1379,6 @@ ixgbe_config_link(struct adapter *adapter) err = hw->mac.ops.setup_link(hw, autoneg, adapter->link_up); } - } /* ixgbe_config_link */ / @@ -2096,8 +2086,6 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq
svn commit: r344103 - head/sys/netinet
Author: ae Date: Wed Feb 13 15:46:05 2019 New Revision: 344103 URL: https://svnweb.freebsd.org/changeset/base/344103 Log: In r335015 PCB destroing was made deferred using epoch_call(). But ipsec_delete_pcbpolicy() uses some VNET-virtualized variables, and thus it needs VNET context, that is missing during gtaskqueue executing. Use inp_vnet context to set curvnet in in_pcbfree_deferred(). PR: 235684 MFC after:1 week Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c == --- head/sys/netinet/in_pcb.c Wed Feb 13 15:30:06 2019(r344102) +++ head/sys/netinet/in_pcb.c Wed Feb 13 15:46:05 2019(r344103) @@ -1565,6 +1565,7 @@ in_pcbfree_deferred(epoch_context_t ctx) inp = __containerof(ctx, struct inpcb, inp_epoch_ctx); INP_WLOCK(inp); + CURVNET_SET(inp->inp_vnet); #ifdef INET struct ip_moptions *imo = inp->inp_moptions; inp->inp_moptions = NULL; @@ -1597,6 +1598,7 @@ in_pcbfree_deferred(epoch_context_t ctx) #ifdef INET inp_freemoptions(imo); #endif + 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: r344104 - stable/12/sys/dev/ixl
Author: marius Date: Wed Feb 13 16:02:52 2019 New Revision: 344104 URL: https://svnweb.freebsd.org/changeset/base/344104 Log: MFC: r343372 ixl(4): Fix handling data passed with ioctl from NVM update tool From Krzysztof: Ensure that the entire data buffer passed from the NVM update tool is copied in to kernel space and copied back out to user space using copyin() and copyout(). PR: 234104 Submitted by: Krzysztof Galazka Reported by: Finn Differential Revision:https://reviews.freebsd.org/D18817 Modified: stable/12/sys/dev/ixl/ixl_pf_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixl/ixl_pf_main.c == --- stable/12/sys/dev/ixl/ixl_pf_main.c Wed Feb 13 15:46:05 2019 (r344103) +++ stable/12/sys/dev/ixl/ixl_pf_main.c Wed Feb 13 16:02:52 2019 (r344104) @@ -3664,23 +3664,34 @@ ixl_handle_nvmupd_cmd(struct ixl_pf *pf, struct ifdrv struct i40e_nvm_access *nvma; device_t dev = pf->dev; enum i40e_status_code status = 0; - int perrno; + size_t nvma_size, ifd_len, exp_len; + int err, perrno; DEBUGFUNC("ixl_handle_nvmupd_cmd"); /* Sanity checks */ - if (ifd->ifd_len < sizeof(struct i40e_nvm_access) || + nvma_size = sizeof(struct i40e_nvm_access); + ifd_len = ifd->ifd_len; + + if (ifd_len < nvma_size || ifd->ifd_data == NULL) { device_printf(dev, "%s: incorrect ifdrv length or data pointer\n", __func__); device_printf(dev, "%s: ifdrv length: %zu, sizeof(struct i40e_nvm_access): %zu\n", - __func__, ifd->ifd_len, sizeof(struct i40e_nvm_access)); + __func__, ifd_len, nvma_size); device_printf(dev, "%s: data pointer: %p\n", __func__, ifd->ifd_data); return (EINVAL); } - nvma = (struct i40e_nvm_access *)ifd->ifd_data; + nvma = malloc(ifd_len, M_DEVBUF, M_WAITOK); + err = copyin(ifd->ifd_data, nvma, ifd_len); + if (err) { + device_printf(dev, "%s: Cannot get request from user space\n", + __func__); + free(nvma, M_DEVBUF); + return (err); + } if (pf->dbg_mask & IXL_DBG_NVMUPD) ixl_print_nvm_cmd(dev, nvma); @@ -3694,13 +3705,49 @@ ixl_handle_nvmupd_cmd(struct ixl_pf *pf, struct ifdrv } } - if (!(pf->state & IXL_PF_STATE_ADAPTER_RESETTING)) { - // TODO: Might need a different lock here - // IXL_PF_LOCK(pf); - status = i40e_nvmupd_command(hw, nvma, nvma->data, ); - // IXL_PF_UNLOCK(pf); - } else { - perrno = -EBUSY; + if (pf->state & IXL_PF_STATE_ADAPTER_RESETTING) { + free(nvma, M_DEVBUF); + return (-EBUSY); + } + + if (nvma->data_size < 1 || nvma->data_size > 4096) { + device_printf(dev, "%s: invalid request, data size not in supported range\n", + __func__); + free(nvma, M_DEVBUF); + return (EINVAL); + } + + /* +* Older versions of the NVM update tool don't set ifd_len to the size +* of the entire buffer passed to the ioctl. Check the data_size field +* in the contained i40e_nvm_access struct and ensure everything is +* copied in from userspace. +*/ + exp_len = nvma_size + nvma->data_size - 1; /* One byte is kept in struct */ + + if (ifd_len < exp_len) { + ifd_len = exp_len; + nvma = realloc(nvma, ifd_len, M_DEVBUF, M_WAITOK); + err = copyin(ifd->ifd_data, nvma, ifd_len); + if (err) { + device_printf(dev, "%s: Cannot get request from user space\n", + __func__); + free(nvma, M_DEVBUF); + return (err); + } + } + + // TODO: Might need a different lock here + // IXL_PF_LOCK(pf); + status = i40e_nvmupd_command(hw, nvma, nvma->data, ); + // IXL_PF_UNLOCK(pf); + + err = copyout(nvma, ifd->ifd_data, ifd_len); + free(nvma, M_DEVBUF); + if (err) { + device_printf(dev, "%s: Cannot return data to user space\n", + __func__); + return (err); } /* Let the nvmupdate report errors, show them only when debug is enabled */ ___ 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"