Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Brian Norris
Tue, 01 Dec 2026 19:59
[PATCH net-next 1/2] r8169: hold runtime PM reference while link is up
Author: Brian Norris
Date: Tue, 01 Dec 2026 19:59
Date: Tue, 01 Dec 2026 19:59
76 lines
13761 bytes
13761 bytes
Commit 8a3c76523e44 ("r8169: add support for phylink") moved link
handling from phylib to phylink. Unlike phylib, which calls
netif_carrier_on() before adjust_link(), phylink_link_up() calls
.mac_link_up() before netif_carrier_on(). This can cause problems in the
following scenario:
1) phylink_link_up() -> rtl_mac_link_up() -> pm_request_resume()
(no runtime PM reference held)
2) rpm_resume() may immediately queue an idle notification
3) rtl8169_runtime_idle() observes !netif_carrier_ok() and schedules a
suspend for 10 seconds later
4) phylink_link_up() calls netif_carrier_on(), too late
(note: #3 and #4 race, as the rpm_idle() behavior here is async)
5) step 3 + 10 seconds: rpm_suspend() -> rtl8169_runtime_suspend()
suspends an active link
This whole construct relies on carefully written
.runtime_{idle,suspend}() callbacks. It's better to maintain runtime PM
reference counts if we can manage it. Phylink guarantees balanced
.mac_link_up()/.mac_link_down() pairing, including via phylink_stop() on
close, so they are an appropriate place for reference counts.
Use the asynchronous get/put helpers rather than the synchronous
variants to avoid lock-ordering deadlocks with rtnl_lock() taken in
rtl8169_runtime_suspend(). This imitates pre-commit-8a3c76523e44
behavior, where rtl8169_runtime_suspend() was never invoked
synchronously.
This issue was noticed by inspection [1], in part because I'm looking at
removing all .runtime_idle() support, as they tend to do one or more of:
1) duplicate core runtime PM features (such as autosuspend)
2) support strange, buggy, or fragile patterns
I have only compile-tested.
Fixes: 8a3c76523e44 ("r8169: add support for phylink")
Link: https://lore.kernel.org/all/aw4WwwCvh_cbkKpu@google.com/ [1]
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
Patch 1 is a 'net' candidate (the regression is in v7.4-rc). Patch 2 may
not be, but it is highly related. I'm not sure how that should be
handled, so I've kept the whole thing as 'net-next'.
drivers/net/ethernet/realtek/r8169_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index f151ab681393..79da7b72dfd2 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -6411,7 +6411,7 @@ static void rtl_mac_link_down(struct phylink_config *config, unsigned int mode,
phylink_config);
tp->speed = SPEED_UNKNOWN;
- pm_runtime_idle(tp_to_dev(tp));
+ pm_runtime_put(tp_to_dev(tp));
}
static void rtl_mac_link_up(struct phylink_config *config,
@@ -6437,7 +6437,7 @@ static void rtl_mac_link_up(struct phylink_config *config,
* handles it automatically based on PHY result; if autoneg is OFF,
* hardware forces pause to be disabled. No software override exists.
*/
- pm_request_resume(d);
+ pm_runtime_get(d);
}
static struct phylink_pcs *rtl_mac_select_pcs(struct phylink_config *config,
--
2.56.1.911.g883d8bcb20-goog
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads