Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
src: Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" whil...
details: https://anonhg.NetBSD.org/src/rev/c722875c028d
branches: trunk
changeset: 318262:c722875c028d
user: knakahara <knakahara%NetBSD.org@localhost>
date: Tue Apr 17 05:23:58 2018 +0000
description:
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:
sys/dev/pci/ixgbe/ixgbe.c | 25 +++++++++++++++++++++++--
sys/dev/pci/ixgbe/ixgbe.h | 3 ++-
2 files changed, 25 insertions(+), 3 deletions(-)
diffs (77 lines):
diff -r b9b58748901c -r c722875c028d sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue Apr 17 04:22:58 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Tue Apr 17 05:23:58 2018 +0000
@@ -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 @@
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_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 @@
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 @@
}
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 -r b9b58748901c -r c722875c028d sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Tue Apr 17 04:22:58 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Tue Apr 17 05:23:58 2018 +0000
@@ -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 @@
* > 0 : this queue is disabled
* the value is ixgbe_disable_queue() called count
*/
+ bool txrx_use_workqueue;
};
/*
Home |
Main Index |
Thread Index |
Old Index