diff options
| author | knakahara <knakahara@NetBSD.org> | 2018-04-17 05:23:58 +0000 |
|---|---|---|
| committer | knakahara <knakahara@NetBSD.org> | 2018-04-17 05:23:58 +0000 |
| commit | b2b3bb07c0c41e40b23aa4793691d2ecca3ddf3e (patch) | |
| tree | 23f2feb189e64b4d606e2da33e818e61bc02ea00 /sys/dev | |
| parent | b07dbdb089bef3bb0f2299d676c5fd9c493e37ba (diff) | |
Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" while there is traffic.
The operation is not supported, however causing panic is problem.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/ixgbe/ixgbe.c | 25 | ||||
| -rw-r--r-- | sys/dev/pci/ixgbe/ixgbe.h | 3 |
2 files changed, 25 insertions, 3 deletions
diff --git a/sys/dev/pci/ixgbe/ixgbe.c b/sys/dev/pci/ixgbe/ixgbe.c index ed8f82eb978..8d2d43e086a 100644 --- a/sys/dev/pci/ixgbe/ixgbe.c +++ b/sys/dev/pci/ixgbe/ixgbe.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.146 2018/04/12 08:03:55 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.147 2018/04/17 05:23:58 knakahara Exp $ */ /****************************************************************************** @@ -2487,7 +2487,7 @@ static inline void ixgbe_sched_handle_que(struct adapter *adapter, struct ix_queue *que) { - if (adapter->txrx_use_workqueue) { + if(que->txrx_use_workqueue) { /* * adapter->que_wq is bound to each CPU instead of * each NIC queue to reduce workqueue kthread. As we @@ -2531,6 +2531,12 @@ ixgbe_msix_que(void *arg) ixgbe_disable_queue(adapter, que->msix); ++que->irqs.ev_count; + /* + * Don't change "que->txrx_use_workqueue" from this point to avoid + * flip-flopping softint/workqueue mode in one deferred processing. + */ + que->txrx_use_workqueue = adapter->txrx_use_workqueue; + #ifdef __NetBSD__ /* Don't run ixgbe_rxeof in interrupt context */ more = true; @@ -3174,6 +3180,16 @@ ixgbe_add_device_sysctls(struct adapter *adapter) CTL_EOL) != 0) aprint_error_dev(dev, "could not create sysctl\n"); + /* + * If each "que->txrx_use_workqueue" is changed in sysctl handler, + * it causesflip-flopping softint/workqueue mode in one deferred + * processing. Therefore, preempt_disable()/preempt_enable() are + * required in ixgbe_sched_handle_que() to avoid + * KASSERT(ixgbe_sched_handle_que()) in softint_schedule(). + * I think changing "que->txrx_use_workqueue" in interrupt handler + * is lighter than doing preempt_disable()/preempt_enable() in every + * ixgbe_sched_handle_que(). + */ adapter->txrx_use_workqueue = ixgbe_txrx_workqueue; if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, CTLTYPE_BOOL, "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"), @@ -4798,6 +4814,11 @@ ixgbe_legacy_irq(void *arg) } if ((ifp->if_flags & IFF_RUNNING) != 0) { + /* + * The same as ixgbe_msix_que() about "que->txrx_use_workqueue". + */ + que->txrx_use_workqueue = adapter->txrx_use_workqueue; + #ifdef __NetBSD__ /* Don't run ixgbe_rxeof in interrupt context */ more = true; diff --git a/sys/dev/pci/ixgbe/ixgbe.h b/sys/dev/pci/ixgbe/ixgbe.h index 0ef7b5bb440..d6b28fdf773 100644 --- a/sys/dev/pci/ixgbe/ixgbe.h +++ b/sys/dev/pci/ixgbe/ixgbe.h @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.h,v 1.41 2018/04/04 08:13:07 msaitoh Exp $ */ +/* $NetBSD: ixgbe.h,v 1.42 2018/04/17 05:23:58 knakahara Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -346,6 +346,7 @@ struct ix_queue { * > 0 : this queue is disabled * the value is ixgbe_disable_queue() called count */ + bool txrx_use_workqueue; }; /* |
