Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

src: Pull up following revision(s) (requested by knakahara in ti...



details:   https://anonhg.NetBSD.org/src/rev/e18a867a65cd
branches:  netbsd-8
changeset: 318276:e18a867a65cd
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Apr 17 08:20:06 2018 +0000
description:
Pull up following revision(s) (requested by knakahara in ticket #769):

        sys/dev/pci/ixgbe/ixgbe.c: revision 1.147
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.42

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 bf7040a9ffb2 -r e18a867a65cd sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue Apr 17 08:04:34 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Tue Apr 17 08:20:06 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.17 2018/04/14 10:25:11 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.18 2018/04/17 08:20:06 martin 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 bf7040a9ffb2 -r e18a867a65cd sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Tue Apr 17 08:04:34 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Tue Apr 17 08:20:06 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.10 2018/04/14 10:25:12 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.11 2018/04/17 08:20:06 martin 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