]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
r8169: don't take RTNL lock in rtl_task()
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 16 Oct 2024 20:05:57 +0000 (22:05 +0200)
committerAndrew Lunn <andrew@lunn.ch>
Sun, 20 Oct 2024 15:20:42 +0000 (10:20 -0500)
There's not really a benefit here in taking the RTNL lock. The task
handler does exception handling only, so we're in trouble anyway when
we come here, and there's no need to protect against e.g. a parallel
ethtool call.
A benefit of removing the RTNL lock here is that we now can
synchronously cancel the workqueue from a context holding the RTNL mutex.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
drivers/net/ethernet/realtek/r8169_main.c

index c3678c4420225cfc80922a6f31dc23f135143cab..cd0d9ecca5c95b0c8b558b33cf069e2210d07be7 100644 (file)
@@ -4799,10 +4799,8 @@ static void rtl_task(struct work_struct *work)
                container_of(work, struct rtl8169_private, wk.work);
        int ret;
 
-       rtnl_lock();
-
        if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
-               goto out_unlock;
+               return;
 
        if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) {
                /* if chip isn't accessible, reset bus to revive it */
@@ -4811,7 +4809,7 @@ static void rtl_task(struct work_struct *work)
                        if (ret < 0) {
                                netdev_err(tp->dev, "Can't reset secondary PCI bus, detach NIC\n");
                                netif_device_detach(tp->dev);
-                               goto out_unlock;
+                               return;
                        }
                }
 
@@ -4830,8 +4828,6 @@ reset:
        } else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) {
                rtl_reset_work(tp);
        }
-out_unlock:
-       rtnl_unlock();
 }
 
 static int rtl8169_poll(struct napi_struct *napi, int budget)