Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EB87606A31A for ; Wed, 2 Dec 2026 00:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=4lqLhET0; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=G3Pi3cZQ Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7E5D0811DB; Wed, 2 Dec 2026 00:23:28 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id yD0pvVcruqE6; Wed, 2 Dec 2026 00:23:27 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org C677E80D21 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796171007; b=B1nioH4d4dP66YT7u3zLJfWViRnvDTm2WrVul2kLqksKvwUi6GplJe6RPABqPRYQxIzo Wy2PO2/g967WgrfFxbBo/hlsUsLKbhSgeuIxK2kJ9DXLNFcIlUVmM5pjHU75d51+fvYSO T6EUczRe14Hg2duwJenRmDutitemgdGslEW34fan1FOyodKbZ9bbnLJ07BaoYVX/Z9xJH vGfiHIE9VvwVwF+7kgpLO+oAOKWvbux+6v2dBretEYaXrmfObRFogjjrjEi+aeBPAJPqW vWLBipY1MbOEvFg/snpIiYTOACtemuyx22B6Q8Up8A7N7+BYkwCZ3nq37GJTljcSYng== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796171007; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding: X-Rspamd-Queue-Id:X-BeenThere:X-Mailman-Version:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Errors-To; bh=mIw5D5Q9Igkk8ILht5E3gmo2MX4ZQAvgicn+9nh7AUo=; b=ciELfTeDMOQ1sIVlu7NVoSKF3d0kAIQ1Y9ILEbq4ieCY49kw5LE5L5/WWFPzzsnHC0Un y8Aw+qn8tURltuXToSinOUnFKtGgwocU29Nq3gq8EsCsxzWQ/MkQldb50gjYxESOHUQ6h pGyj0aY323pKDGvxU8ulIAgYf39bkZ8JsYxNo3P4pKzEUcsPE/6F9FzwjqB2HVvRp2DEH 68brR/wMS/TKcTuMOgQIcdpzCyhibfPh3x6+0DgFYEe7TyZue3gGVxOtRvAkva8tuCY4N hifyzPhxxTmfNz4wXSWJ0w7185UTh5CYE3nVQxv2nTKvKV71jvI7h8giuz+ubpigplQ== ARC-Authentication-Results: i=1; smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796171007; bh=mIw5D5Q9Igkk8ILht5E3gmo2MX4ZQAvgicn+9nh7AUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=4lqLhET0cSxAAEKISBoq70poNlH/Px/Avy90m4oKJcnED1acCpNbu8npncCt4pf9+ RmVicpdOVj0EdcbWszdrsKFts4/6euJ7pUitVKXPKRW1Oxx9V5noW+25hIJqxQWm8h l0MoPbJCo4FiXwVUOi3KuYfm4V1ecE1yBJvge7sqhGMia5jGxuozc7poUC1CMm45Ov B7/SUuXUZ4qZmLUfVo8TGKbsMZQECDrZb8TvIPnhZv2H76Hdx3yvDypOgOhuN+yTb9 51rtApBzzJopxs/9Ien4I0MaGJHRBd0XHgSfeLblvCdGhXPMfPuTXFYfFNx8fLLwZI iF/UwRW7x/iZw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id C677E80D21; Wed, 2 Dec 2026 00:23:27 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id 5A7AA472 for ; Wed, 2 Dec 2026 00:23:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 406EA40508 for ; Wed, 2 Dec 2026 00:23:26 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dpGytC6nMdew for ; Wed, 2 Dec 2026 00:23:25 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org 6A3204064A Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip=195.10.208.47 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=195.10.208.47; helo=mout-b-107.mailbox.org; envelope-from=antonio@mandelbit.com; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=mandelbit.com Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=G3Pi3cZQ Received: from mout-b-107.mailbox.org (mout-b-107.mailbox.org [195.10.208.47]) by smtp4.osuosl.org (Postfix) with ESMTPS id 6A3204064A for ; Wed, 2 Dec 2026 00:23:24 +0000 (UTC) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-107.mailbox.org (Postfix) with ESMTPS id 4jfJQ148Xgz3wd0; Wed, 02 Dec 2026 01:23:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796171001; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mIw5D5Q9Igkk8ILht5E3gmo2MX4ZQAvgicn+9nh7AUo=; b=G3Pi3cZQoCpKysQ3ZLkGXzdaMyl0807hsrLTp8o1qYwyGK8gy8C7lg5niRkhTI+eAXSpTp qgk2JQAS0u4/8twIgxU9Qg/1NhqpIV3Yp7VzAEQ3CDmL5nrXqF44SWmsGQkvpUimso7vR1 /bG0GMaGGlTlZf44MCZFhFSDeG2xUBBvUXENno9I2SaG1Ie059TQqlORO6MnpN0lU74AT2 s5Xv5QRPpd8sJR6vYgp911Mcf8RB8WsvfcPbvBhz00yTdnrkUvwruf5HcqSHxFMrksg1Qs 9T2uQVr9xSSRC49SMyEjyKb2jJT66GYYQeI3nsqqzOccheo4wL95oQI0xiBn4Q== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com From: Antonio Quartulli To: intel-wired-lan@lists.osuosl.org Cc: Antonio Quartulli , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Janis Edvarts Lacis , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Sriram Yagnaraman , Kurt Kanzenbach , Maciej Fijalkowski , Heiner Kallweit , Joe Damato , "Rafael J. Wysocki" , Sven Auhagen , netdev@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v7 1/7] igb: don't wait for RTNL when runtime suspending Date: Wed, 2 Dec 2026 01:23:09 +0100 Message-ID: <20261202002317.3140591-2-antonio@mandelbit.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202002317.3140591-1-antonio@mandelbit.com> References: <20261202002317.3140591-1-antonio@mandelbit.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4jfJQ148Xgz3wd0 X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The PM core marks the device as suspending before calling igb_runtime_suspend(), which takes RTNL. An RTNL holder that resumes the device meanwhile, e.g. ethtool, igb_open() or igb_close(), waits for the suspend to end, and the suspend waits for RTNL: both hang, with RTNL taken. The suspend still needs RTNL, as it closes the interface and frees the queues. When runtime suspending, only try to take it, and return -EBUSY if it's taken, which keeps the device active. Retry from a work item: resuming and releasing the device schedules a new suspend if the link is still down. Fixes: 9474933caf21 ("igb: close/suspend race in netif_device_detach") Cc: stable@vger.kernel.org Signed-off-by: Antonio Quartulli --- v7: no changes v6: new patch (Sashiko) drivers/net/ethernet/intel/igb/igb.h | 1 + drivers/net/ethernet/intel/igb/igb_main.c | 28 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 8c9b020..4250b4d 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h @@ -586,6 +586,7 @@ struct igb_adapter { struct work_struct reset_task; struct work_struct watchdog_task; + struct work_struct rpm_retry_task; bool fc_autoneg; u8 tx_timeout_factor; struct timer_list blink_timer; diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index d4a897a..fffcb31 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -119,6 +119,7 @@ static void igb_set_rx_mode(struct net_device *); static void igb_update_phy_info(struct timer_list *); static void igb_watchdog(struct timer_list *); static void igb_watchdog_task(struct work_struct *); +static void igb_rpm_retry_task(struct work_struct *); static netdev_tx_t igb_xmit_frame(struct sk_buff *skb, struct net_device *); static void igb_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats); @@ -3426,6 +3427,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) INIT_WORK(&adapter->reset_task, igb_reset_task); INIT_WORK(&adapter->watchdog_task, igb_watchdog_task); + INIT_WORK(&adapter->rpm_retry_task, igb_rpm_retry_task); /* Initialize link properties that are user-changeable */ adapter->fc_autoneg = true; @@ -3889,6 +3891,7 @@ static void igb_remove(struct pci_dev *pdev) cancel_work_sync(&adapter->reset_task); cancel_work_sync(&adapter->watchdog_task); + cancel_work_sync(&adapter->rpm_retry_task); #ifdef CONFIG_IGB_DCA if (adapter->flags & IGB_FLAG_DCA_ENABLED) { @@ -9501,7 +9504,18 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; bool wake; - rtnl_lock(); + /* The PM core marks the device as suspending before a runtime + * suspend, and an RTNL holder resuming it meanwhile (e.g. ethtool) + * waits for the suspend to end: waiting for RTNL here would deadlock. + * Only try to take it: -EBUSY keeps the device active, and + * igb_rpm_retry_task() schedules a new suspend. + */ + if (!runtime) { + rtnl_lock(); + } else if (!rtnl_trylock()) { + schedule_work(&adapter->rpm_retry_task); + return -EBUSY; + } netif_device_detach(netdev); if (netif_running(netdev)) @@ -9666,6 +9680,18 @@ static int igb_runtime_idle(struct device *dev) return -EBUSY; } +/* Resuming and releasing the device runs igb_runtime_idle(), which schedules + * a new suspend if the link is still down + */ +static void igb_rpm_retry_task(struct work_struct *work) +{ + struct igb_adapter *adapter = container_of(work, struct igb_adapter, + rpm_retry_task); + + pm_runtime_get_sync(&adapter->pdev->dev); + pm_runtime_put(&adapter->pdev->dev); +} + static int igb_runtime_suspend(struct device *dev) { return __igb_shutdown(to_pci_dev(dev), NULL, 1); -- 2.56.1