From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1E48370599 for ; Wed, 17 Sep 2025 11:52:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758109976; cv=none; b=BQihVwS/fksNUTAJaLUkVRr9XKbljsIIHgRjfL8LQSWrGytiksqvZ+i9GGFTXoeTSG8hoRNv11vr9TtGdCJTZwyMFbcvmA8wUrZISPbqnU9YYN7twi8U/1vtaJIvRX+CvVNfQ9FJgWAZBauSoL5Bb2ZkmWmpjgu1GCrtSXYPqz8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758109976; c=relaxed/simple; bh=uqaJ1Aj4tgRkY2VxqYrivb+JAi9VHqoNbdDpXMjZ9oU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uMesZ9IMXF6L4w2ttTw438zfwKCxnrQ9E87h4op0Cd8wSHiEyf7s7ghdCnpwOIa6GFcnoikYD855JgnWCU20lXWa5DNRGiAxhDwVpY0+KZDHxtMy7FREKb2Gqy7Vr8ddn7UGY9wJiQnnpdw/UHFoY2WyBRQG7gYpxKMqHUuBtOM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uyqiG-0007bg-Rh; Wed, 17 Sep 2025 13:52:40 +0200 Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uyqiE-001kqb-0v; Wed, 17 Sep 2025 13:52:38 +0200 Received: from ore by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1uyqiE-00Dh2D-0U; Wed, 17 Sep 2025 13:52:38 +0200 Date: Wed, 17 Sep 2025 13:52:38 +0200 From: Oleksij Rempel To: Oliver Neukum Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Hubert =?utf-8?Q?Wi=C5=9Bniewski?= , Marek Szyprowski , stable@vger.kernel.org, kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Lukas Wunner , Russell King , Xu Yang , linux-usb@vger.kernel.org Subject: Re: [PATCH net v1 1/1] net: usb: asix: forbid runtime PM to avoid PM/MDIO + RTNL deadlock Message-ID: References: <20250917095457.2103318-1-o.rempel@pengutronix.de> <0f2fe17b-89bb-4464-890d-0b73ed1cf117@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0f2fe17b-89bb-4464-890d-0b73ed1cf117@suse.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Hi Oliver, On Wed, Sep 17, 2025 at 12:10:48PM +0200, Oliver Neukum wrote: > Hi, > > On 17.09.25 11:54, Oleksij Rempel wrote: > > > With autosuspend active, resume paths may require calling phylink/phylib > > (caller must hold RTNL) and doing MDIO I/O. Taking RTNL from a USB PM > > resume can deadlock (RTNL may already be held), and MDIO can attempt a > > runtime-wake while the USB PM lock is held. Given the lack of benefit > > and poor test coverage (autosuspend is usually disabled by default in > > distros), forbid runtime PM here to avoid these hazards. > > This reasoning depends on netif_running() returning false during system resume. > Is that guaranteed? You’re right - there is no guarantee that netif_running() is false during system resume. This change does not rely on that. If my wording suggested otherwise, I’ll reword the commit message to make it explicit. 1) Runtime PM (autosuspend/autoresume) Typical chain when user does ip link set dev up while autosuspended: rtnl_newlink (RTNL held) -> __dev_open -> usbnet_open -> usb_autopm_get_interface -> __pm_runtime_resume -> usb_resume_interface -> asix_resume Here resume happens synchronously under RTNL (and with USB PM locking). If the driver then calls phylink/phylib from resume (caller must hold RTNL; MDIO I/O), we can deadlock or hit PM-lock vs MDIO wake issues. Patch effect: I forbid runtime PM per-interface in ax88772_bind(). This removes the synchronous autoresume path. 2) System suspend/resume Typical chain: ... dpm_run_callback (workqueue) -> usb_resume_interface -> asix_resume This is not under RTNL, and no pm_runtime locking is involved. The patch does not change this path and makes no assumption about netif_running() here. If helpful, I can rework the commit message. Best Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |