Article View: linux.kernel.netdev
Article #25455[PATCH net-next 1/2] r8169: hold runtime PM reference while link is up
From: 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
Technical Details
Message-ID:
<20261201115920.net-next.1.Idb20d02896f15f4a79b68a9fee4f3bed1ea49543@changeid>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375339-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375339-linux-kernel-netdev=dewy.ru
From: briannorris@chromium.org (Brian Norris)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 1/2] r8169: hold runtime PM reference while link is up
Date: Tue, 1 Dec 2026 11:59:19 -0800
Organization: Usenet Network
Message-ID: <20261201115920.net-next.1.Idb20d02896f15f4a79b68a9fee4f3bed1ea49543@changeid>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1809124"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nIkPXJIqXuxiWfdPFAdSi6cHoQA= sha256:EwbtKU67UNDe8xdXSMFIqZdcIxntKx/+XL5//XRN/p8=
sha1:Y1j+5252n4ZN57Sgz2pckPqEe4Y= sha256:5w70YgF0xrj6LC5D0iyKLxZZeeKhtS6x4v29HeZ+Auw=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id C60D711748A; Tue, 1 Dec 2026 23:01:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=chromium.org
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id W97E_ex5DLIq;
Tue, 1 Dec 2026 23:01:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375339-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=chromium.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id D6A1411741B; Tue, 1 Dec 2026 23:01:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 76F852BC19; Tue, 1 Dec 2026 20:01:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796155275;
b=JoAJMlhwuhk7jcQ6XRK1fLVJFWjjuAGRToRBFGlE8uuDL+N3BPMQR2/0kDggylpTMIj4
RRVPXeuy5/BCb7j8W9AQF/nOqzztOKMUNlMXhBCxAOQWzifZnKkZ0OMIalKoZKWriIgnC
wV5GhISBeKr6Aq+c3tjLgABWlVWxa/BUvHkNoCTbwdtadAb+RRrHAeTLFfuSP5JNXgVY0
ns+ZwHiXJPjA6UzMZZdMrbED/OGa5yBIsIpNNMLfb2vhrNo+DAHPDOewqWfvojSb7IJaf
TM0m5bWCm/TMr2pJhJFZBFnBVM2YlcxzBVKRn9SRYPH/fe9QzUexABVyl+tVPXpYaAg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796155275;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=fcbsqC4WbGlSS9+iCMDCSLSG/cDhamcmV06we1y2fv8=;
b=y3xNhuB8/Fie8Asu0Zhfm7r4fZ/4/WSKPiROgZsBt6qro6lv8PHf5pi5yj5v9sMa3ES9
uLWKp9ejzpmO/6bqcOg4nzKr65wLAUbuYFXw1mIRZ4GIFJwNmo1AFZlgpWPyCfRbAt3J7
pae2BISfZ9s/BwA0fGqkDhL1j3poOEgwYIcuKt8VIihMvdB5eqcK+vwR7P9lyI+gZJlJU
iCy/086oKlOi4hGvwE1GjYH8nLMOFVvO5io2XbfLGY+U5o8e8T0P+neeZgXhuV9wMITMB
MmeqRWXauV7CoK3+RSkDw6s/wtxt3oMNnBo+MegvEwnJ1PWPxM6XLfazZi/ZyjvgD0w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=YtvPjha4;
dmarc=pass header.from=chromium.org;
spf=pass smtp.mailfrom=chromium.org;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D373D606A32E;
Tue, 1 Dec 2026 20:01:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=YtvPjha4
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.49
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796155275;
b=09Eur07D1QdCLa7GsaIxdvGfdUDYYzI+gK44fkz4D/HJ/KRiVrOLM3zrmKgGlKH6R09B
Y6z7p+wJPpMqGTdB/i9mH6GZvw+2elDTRdOLFtR0cj4iufweVxl+OWoQSCJw1/qd9Q6JS
VxYQllvMfl/+WDa+nYTrXKZ6DJd5uKg+teKSoH2flS+/4I033K1eujEKpVVLBKQ40lGnt
yugB8FeCtbaO4HIAuDNN3YHw8/RsdPDK1VnzNqynbqcCKz8wytPbI5oZBNGHvx4JrWq4q
6/RYZXe6jOnMxlmVebKR22WKYGQXXlqi2DiBCviIesd5R9VM2iu48CyZ3F/to6neFHA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796155275;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
Content-Transfer-Encoding;
bh=fcbsqC4WbGlSS9+iCMDCSLSG/cDhamcmV06we1y2fv8=;
b=KnsRKhXLQgqWDLyKiJ5oSGX5LtzCJS2ETXsqfGzAPLuGGdI6VWVuix9gbfKuJpf8sP/X
iTewzokbzq5e4KvDqqr2UxYgGf9x76Tacy8FtW+QawzNwweA1toj/6o9WCNp+Nk+BNzbu
UDXOjhxkSNnySn0dnX6ozN4V8rEq1nsVINBcKH97c0s9nHXWwtkFrzA8c1tbtDOUlTwev
7trqvPWpYKz++Z/EMiIlqGQ/jRPiiWQ+HXZG6F9oDaUwkAuYScv5SSG7PftVEk0EbFmru
e4kEA8cxbt00KK5kQWSQ/RGShHrQWn1xqRf+GvtygtyV95bEGxYWYUAKB/D7i/sCuRA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=chromium.org;
spf=pass smtp.mailfrom=chromium.org;
dkim=pass header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=YtvPjha4;
arc=none smtp.remote-ip=74.125.82.49
X-Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 475DC606A31A
for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 20:01:14 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 475DC606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org
X-Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-1b563e32936so7805131c88.1
for <netdev@vger.kernel.org>; Tue, 01 Dec 2026 12:01:14 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=chromium.org; s=google; t=1796155273; x=1796760073; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=fcbsqC4WbGlSS9+iCMDCSLSG/cDhamcmV06we1y2fv8=;
b=YtvPjha4MYiu0zCqL6XTIF7TnLqQqqjWgEXqq6L1NlIyOIxHbcNa2/fXxIBbOSJ+vo
eOq2QXRAfxFrAngtwjMlvy4AG+r23/I5i33GUCV41w3XmEwTbym0p3Watec+EtojxDeQ
iWsQCtEqY9yNxPYQ/kHXXWyO7qP7VGtGiHKvs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796155273; x=1796760073;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=fcbsqC4WbGlSS9+iCMDCSLSG/cDhamcmV06we1y2fv8=;
b=Jw7LMUZcLSnaeDqf1VcaSWiqrjn1EuxZrL9AQOWw5razCo0er4ufjqg1wHNF4kdMFF
Fnw4wtvEf+h/rv6bOJ+OL8CzA1H6jz2nqFaYVXmyW/6GWlbDYVyfIn4d4WdY2AX3OWkq
fdax27TOPiofD5YqUkZIl0whnQgah3oNLWYl09wSkKD4m/gsV59Jl9kxHpUA5U+24aiK
qzV+z4yG02jsSrX8//fywMg2KABFaHlaJhgJHZWKGQ5RfqMyYLT9k1lhQ3lRFLp5LKhK
5hND1JTB3bT++KXRauETfvGMxhwtiDXQUP87WWhZ2mo3B2ti9eJxXGWhAqD5PcNRWDy6
57Jg==
X-Forwarded-Encrypted: i=1; AL+hErEVWKZtstp6l916gwAPypi4ryw7OkJK7a8Oh9fMr28WB8vTIb0kX+IsFCa1+HfX15CMOZaLb8I=@vger.kernel.org
X-Gm-Message-State: APuU4Z+zNcxAuBI9RlE15RqX54hRV1u7Vkzkwu3qQvlMNYirwZGK/cxa
ExT5X6wx6O3mJ2BhsbZ7j88+Pqa5Paz5llGR0jVqC7JfWm37Rbs07/Jsj2UegJni/g==
X-Gm-Gg: AZFdTZdsO8XSfnqakfkXx5eY2a3SeJ9f7tClc9vZ9TP5SrS8Rqq9aNTgwbXbC6/Rx+n
TL1rGqqrlbJrkkKAsfpxQkWsbecTiT9K3dtRwQrRu0ljf86sEcdXUp+03gM9eQAestanmqyHBng
+FXCcM8wKoo2pImJZcjV7I5zmvyo3UlmZ6hBLLFy0hUUQT2A6pbxw7eF9yzhfWfoSYPE62XwmS3
LmxJ0xl1kcyJz6wlkXvma9dvD4HpCKaxvMhuSpq+ouf4Q3SndGnPdFbc89NFNIRafCZlwPhJGkc
nqrmAd5DCZ8uMAZDafLQ6hIhBw3uOdSxo+F8wxay1hyvVTj2xIYa94k9Pb4tP9lKT6IJeYAx4+F
L+jrnUrl92GE9ksxaUsmPezqblgYCXMTJ1mXaX+ShZapo5vbKe0v347BRgMUFJ45Go6e1w5F8ZW
VU5RE8Z7C5ZPvzGYpoAhcta5Cr36GY4V0ARwqnaoSD2cXS6grGALv+UT7KU6q67rXttBP72sE97
72YtN216hKNl8zKLteGx7ap9YJxisYqCF7HdNVDV3KTmnO8QfgVpiu9nNB+nKhZ2o8lusPN4fRW
el6ubZ7/2eHxnm0Hm4mzbLYLJ1IP+oqeHONHtl5ruZ1LMgv//M1YZAufU/BCgY44h20=
X-Received: by 2002:a05:701b:4583:10b0:1b5:5915:bb34 with SMTP id a92af1059eb24-1b55915bd9amr32392534c88.4.1796155273184;
Tue, 01 Dec 2026 12:01:13 -0800 (PST)
X-Received: from localhost ([2a00:79e0:2e7c:8:4a1f:3e7:2ac1:9562])
by smtp.gmail.com with UTF8SMTPSA id a92af1059eb24-1b5566c3052sm86175502c88.1.2026.12.01.12.01.11
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Tue, 01 Dec 2026 12:01:12 -0800 (PST)
X-Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org,
Paolo Abeni <pabeni@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Eric Dumazet <edumazet@kernel.org>,
linux-pm@vger.kernel.org,
Javen Xu <javen_xu@realsil.com.cn>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Brian Norris <briannorris@chromium.org>
X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list