From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) (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 942191C287 for ; Mon, 22 Apr 2024 23:37:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713829061; cv=none; b=BPbZpwlAvNPOKStp06CD2nG8Rmzn5g6hTXt4369VMliUdF9myTX3FYrWODTV7jf3sLEdM1R9TW4kvbGdDpRPwWceyXfetacQI7DtWWdto2A1X4tuycfBABSwf4NQwBql1MQyQO9C7YtVGO2TtsMeWCEi+gtL6H814hotT+ZVg3E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713829061; c=relaxed/simple; bh=5I/S7pW6SovQgvIa/uG08wwMVmaD4ojyv+Zzh91UIKQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Id5rLTpUlUP1hgEWkZETeLpqjpJZ31ekH0ToMoL/iH+kklxMb0JIE1AcaRJwAJxBGC1F+GlxUxV7Keb3fQW9EgdGGriX1ToBq18tibxLf/OVehIRRveI8ZChTRu7KyfASpYDWWeZa6YzyXiRjvS3WAu0K4r3CPnE8UZ6euI0nqA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.com; spf=none smtp.mailfrom=invisiblethingslab.com; dkim=pass (2048-bit key) header.d=invisiblethingslab.com header.i=@invisiblethingslab.com header.b=mslzyq0F; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=SDJ/EHHC; arc=none smtp.client-ip=103.168.172.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=invisiblethingslab.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=invisiblethingslab.com header.i=@invisiblethingslab.com header.b="mslzyq0F"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="SDJ/EHHC" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 71C351380159; Mon, 22 Apr 2024 19:37:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 22 Apr 2024 19:37:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1713829058; x=1713915458; bh=Vzcli0zyq82s9TDwPdvMJHbQvnNT0eFN+sB/uS7f00g=; b= mslzyq0FUHG/1FhpIjQPBLScNzfbfgZySxe9Pls7PS2F8uXu8qaSDixBGPjo3zjD fIV1Ajl27q+rTcRBcQrP8b5jiLx4yo0Kul50ptpDkBI7jrf1WdJck9LHbwlUMe5g XzRMeJFCLpmhcch1uyw/QpCEvm2XM+CkHQrrpeM9FRJtw1JnAcPnsB9QXo8AeaVb YtlWtaDn9GfmwEKXQz25/M0aBsH2hW5uanL20Irj1cOw8CWz65hSSK6Nj5VKyU1N ouOvThMgawolndFeQPFRSCPRxA6sw/jydc5oi+zeNKemYw/4ul4+5DMjt+qdmHaR 7YmDe5izpcY2Od8MZYpV2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1713829058; x=1713915458; bh=Vzcli0zyq82s9TDwPdvMJHbQvnNT 0eFN+sB/uS7f00g=; b=SDJ/EHHCvoC3hyyJHjOGuk8d0bGI9iqtyNuN8jcwyqiX P3ISe7/vaBwG3cDP61s5w503EEShYI3k8wybKL2GnqWlSBwPpWeP9zO8SaX8q0T1 1JhcwVRsVS561yiQ+/5pDC/lAgrHG0/wBWkfpsftTUafr6SzchyFVdmM38n600ki wEUAs14DYE+rRxvCjDxcb0gZ2z1fmNmOujjWMDFkI6vbXfBZOZxFQr6nnj2cIT8B pqIHZnBukNg3LONsDIV/XQGVkQqhxMueToJiKK0LP1tsP4JBX+GBd2sL3qnoe4hd lAw/fH0laU2VQRAZjY16BqabO+mqmI2xZQzbs/ofzw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeltddgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepofgrrhgv khcuofgrrhgtiiihkhhofihskhhiqdfikphrvggtkhhiuceomhgrrhhmrghrvghksehinh hvihhsihgslhgvthhhihhnghhslhgrsgdrtghomheqnecuggftrfgrthhtvghrnhepgfdu leetfeevhfefheeiteeliefhjefhleduveetteekveettddvgeeuteefjedunecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghk sehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomh X-ME-Proxy: Feedback-ID: i1568416f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 22 Apr 2024 19:37:35 -0400 (EDT) Date: Tue, 23 Apr 2024 01:37:33 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Jacob Keller Cc: Tony Nguyen , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org, Lukas Wunner , sasha.neftin@intel.com, Roman Lozko , Kurt Kanzenbach , Heiner Kallweit , Simon Horman , Naama Meir Subject: Re: [PATCH net] igc: Fix LED-related deadlock on driver unbind Message-ID: References: <20240422204503.225448-1-anthony.l.nguyen@intel.com> <96939b80-b789-41a6-bea6-78f16833bbc9@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qZGNviBJH3QVfuS4" Content-Disposition: inline In-Reply-To: <96939b80-b789-41a6-bea6-78f16833bbc9@intel.com> --qZGNviBJH3QVfuS4 Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Tue, 23 Apr 2024 01:37:33 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Jacob Keller Cc: Tony Nguyen , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org, Lukas Wunner , sasha.neftin@intel.com, Roman Lozko , Kurt Kanzenbach , Heiner Kallweit , Simon Horman , Naama Meir Subject: Re: [PATCH net] igc: Fix LED-related deadlock on driver unbind On Mon, Apr 22, 2024 at 04:32:01PM -0700, Jacob Keller wrote: > On 4/22/2024 1:45 PM, Tony Nguyen wrote: > > From: Lukas Wunner > >=20 > > Roman reports a deadlock on unplug of a Thunderbolt docking station > > containing an Intel I225 Ethernet adapter. > >=20 > > The root cause is that led_classdev's for LEDs on the adapter are > > registered such that they're device-managed by the netdev. That > > results in recursive acquisition of the rtnl_lock() mutex on unplug: > >=20 > > When the driver calls unregister_netdev(), it acquires rtnl_lock(), > > then frees the device-managed resources. Upon unregistering the LEDs, > > netdev_trig_deactivate() invokes unregister_netdevice_notifier(), > > which tries to acquire rtnl_lock() again. > >=20 > > Avoid by using non-device-managed LED registration. >=20 > Could we instead switch to using devm with the PCI device struct instead > of the netdev struct? That would make it still get automatically cleaned > up, but by cleaning it up only when the PCIe device goes away, which > should be after rtnl_lock() is released.. Wouldn't that effectively leak memory if driver is unbound from the device and then bound back (and possibly repeated multiple times)? --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab --qZGNviBJH3QVfuS4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmYm9L0ACgkQ24/THMrX 1yzI7Af/fIY9mlFrcBazZoZfYF6WN5ItdZRmhK1Sj6o5LZdkQfysHXarwCYPjahn 7Puzyy/Nk7S46OmNLpTUsY+757p7p3FQTuGZ/n8fstFpMPXJphdi+WCiB74NJBrE nN8Mv+WYkNc6bhivEsoEMEkO1MPPD3ciEizgD5qxewncKzFLKlaLurH5xF43crlD 1sTt1RPIWAb9b38H7hXmCaZ5oiKvUJmMxP9y4LymtN2xslfq2P/Vzw0E4VAXQT3L f3xozQjv8YG647yKeJnjILRQJ5dJmuZ4SofePIQi0un0WRFmuJNEH5gDqZRI0uW8 CupNByOea9tE28D4dIx8Rm5+jEFA8w== =7nCY -----END PGP SIGNATURE----- --qZGNviBJH3QVfuS4--