From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11AE5C4345F for ; Tue, 16 Apr 2024 13:51:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B76CA81E54; Tue, 16 Apr 2024 13:51:48 +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 FNxuQra7VBap; Tue, 16 Apr 2024 13:51:47 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org AFDCB81E6F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1713275507; bh=rN6bZ8uAxzpnZ4WPddNCXKe3jyD5MtvynTLudhE3GO8=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=sMgmCy1jxuaefQTVtqsQZFXiI+O7dNzOdPx9jdtHqsfOSQwdJ3iL+Wx52H79qyRiu lPkwwCvhGXdBHdk3nJmIfkSQrsO8nySMBXx1pt80F8pPtkzUo1c1slC1ju293wqS4W F+2sD2flO6PyltVKYiS0YHDv6m/aLq7y1BE2VilP+Fh4cepXWrnvAdcw3WwxeEzo9f kxx/Zbg48DUPxTfhZscwEeCpeuFLVzgG2ZK0cH4bMMagjbVTVREtheNmnwzm9JsfW4 DeMO750mtF7fhLYSwRb/k9zSIo/COItQ4Z78IB/+Gq/y39GJlNEqQi+YX2oJsGofVL QYe8me0YtPyIQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id AFDCB81E6F; Tue, 16 Apr 2024 13:51:47 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 817171BF41B for ; Tue, 16 Apr 2024 13:51:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6E55981E6F for ; Tue, 16 Apr 2024 13:51:46 +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 qs5TXf_V2RrW for ; Tue, 16 Apr 2024 13:51:45 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2604:1380:40e1:4800::1; helo=sin.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 2CF2C81E59 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2CF2C81E59 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2CF2C81E59 for ; Tue, 16 Apr 2024 13:51:44 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7ADF8CE105F; Tue, 16 Apr 2024 13:51:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9FD2C113CE; Tue, 16 Apr 2024 13:51:31 +0000 (UTC) Date: Tue, 16 Apr 2024 14:51:29 +0100 From: Simon Horman To: Lukas Wunner Message-ID: <20240416135129.GM2320920@kernel.org> References: <2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713275494; bh=yzjOk/XT1m/fqB5jnXhoNIDg6Ef7jDbuSx6EqGNgTWk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W0cqfBILIohuyYCKz1tkeVq/k4ktRDgW5CURsD1BRriJqR+l7N2ohQpxBU9O4Y6B7 2iYEAeMYyv4RkEcbPCZLsMFy/ZY4r8N26rigKuaGkv3iaw520Df8hujfgYrIAn/GQL /wJDwLxUsk2Yue7uP840qBTRg3axkji5mNfKj8CtHh3hsi5vs0Hwmn6+W+EBIBMQ5u S/hOYqwfr6RccLtSsZKLP2B/lLHBVSp4SpcbrnDzXhiHrHm32N4mKz+y1kS4T6XX59 cLw2jcrVScJAAU+uiih5OCi97s5/2s4hWz6JH4f8LBkAMnCGxETtqgfNCEnnDjn9wV wpy0vicjMPcPA== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=W0cqfBIL Subject: Re: [Intel-wired-lan] [PATCH net] igc: Fix LED-related deadlock on driver unbind X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Sasha Neftin , Roman Lozko , intel-wired-lan@lists.osuosl.org, Kurt Kanzenbach , Eric Dumazet , Tony Nguyen , netdev@vger.kernel.org, Jakub Kicinski , Paolo Abeni , "David S. Miller" , Heiner Kallweit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Mon, Apr 15, 2024 at 03:48:48PM +0200, Lukas Wunner wrote: > Roman reports a deadlock on unplug of a Thunderbolt docking station > containing an Intel I225 Ethernet adapter. > > 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: > > 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. > > Avoid by using non-device-managed LED registration. > > Stack trace for posterity: > > schedule+0x6e/0xf0 > schedule_preempt_disabled+0x15/0x20 > __mutex_lock+0x2a0/0x750 > unregister_netdevice_notifier+0x40/0x150 > netdev_trig_deactivate+0x1f/0x60 [ledtrig_netdev] > led_trigger_set+0x102/0x330 > led_classdev_unregister+0x4b/0x110 > release_nodes+0x3d/0xb0 > devres_release_all+0x8b/0xc0 > device_del+0x34f/0x3c0 > unregister_netdevice_many_notify+0x80b/0xaf0 > unregister_netdev+0x7c/0xd0 > igc_remove+0xd8/0x1e0 [igc] > pci_device_remove+0x3f/0xb0 > > Fixes: ea578703b03d ("igc: Add support for LEDs on i225/i226") > Reported-by: Roman Lozko > Closes: https://lore.kernel.org/r/CAEhC_B=ksywxCG_+aQqXUrGEgKq+4mqnSV8EBHOKbC3-Obj9+Q@mail.gmail.com/ > Signed-off-by: Kurt Kanzenbach > Signed-off-by: Lukas Wunner > Cc: Heiner Kallweit I am aware that Kurt has submitted what appears to be the same patch [1,2], which I'm inclined to put down to miscommunication (email based workflows are like that sometimes). FWIIW, it is my understanding is that the patch originated from Lukas[3], and thus it seems most appropriate to take his submission. As for the patch itself, I agree that it addresses the problem at hand. For the record, I have not tested it. Reviewed-by: Simon Horman [1] [PATCH iwl-net] igc: Fix deadlock on module removal https://lore.kernel.org/netdev/20240411-igc_led_deadlock-v1-1-0da98a3c68c5@linutronix.de/ [2] [PATCH iwl-net v2] igc: Fix deadlock on module removal https://lore.kernel.org/netdev/20240411-igc_led_deadlock-v2-1-b758c0c88b2b@linutronix.de/ [3] Re: Deadlock in pciehp on dock disconnect https://lore.kernel.org/all/ZhBN9p1yOyciXkzw@wunner.de/ From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7430E129A72 for ; Tue, 16 Apr 2024 13:51:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713275495; cv=none; b=Vl0AogWH41VW9MlKEWO8WSR5mtVIH3/6CzlsabAtFtOH56dmCcUjNbBnl/RPhXc8CnRG4yuk3ZjbO1YYFczxWlohZKRyFipe29FzmHaImQq4E3bw5GTx+ow5FTu1kawdSdS0zaMRRvH3kQShMsYz9oCpXTGwGV+ieJgg1gPly5c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713275495; c=relaxed/simple; bh=yzjOk/XT1m/fqB5jnXhoNIDg6Ef7jDbuSx6EqGNgTWk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ms0sJ3u5jZYqGBl5rqyhK7+yI8LAecLOauwQ70CLVhgC7YsKISKkxU6O2PvftspV0Clif9L/9NXYNJ1RQQdVaEEU/QcrmSMw4/umDkVcEvEygFgxnHXeJ7s+jAMHQFhQjBlwucfPtxknTX7EvGZJtVFgHD9wLa1JbsQeviyfhUY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W0cqfBIL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W0cqfBIL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9FD2C113CE; Tue, 16 Apr 2024 13:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713275494; bh=yzjOk/XT1m/fqB5jnXhoNIDg6Ef7jDbuSx6EqGNgTWk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W0cqfBILIohuyYCKz1tkeVq/k4ktRDgW5CURsD1BRriJqR+l7N2ohQpxBU9O4Y6B7 2iYEAeMYyv4RkEcbPCZLsMFy/ZY4r8N26rigKuaGkv3iaw520Df8hujfgYrIAn/GQL /wJDwLxUsk2Yue7uP840qBTRg3axkji5mNfKj8CtHh3hsi5vs0Hwmn6+W+EBIBMQ5u S/hOYqwfr6RccLtSsZKLP2B/lLHBVSp4SpcbrnDzXhiHrHm32N4mKz+y1kS4T6XX59 cLw2jcrVScJAAU+uiih5OCi97s5/2s4hWz6JH4f8LBkAMnCGxETtqgfNCEnnDjn9wV wpy0vicjMPcPA== Date: Tue, 16 Apr 2024 14:51:29 +0100 From: Simon Horman To: Lukas Wunner Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesse Brandeburg , Tony Nguyen , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Roman Lozko , Kurt Kanzenbach , Heiner Kallweit , Andrew Lunn , Sasha Neftin Subject: Re: [PATCH net] igc: Fix LED-related deadlock on driver unbind Message-ID: <20240416135129.GM2320920@kernel.org> References: <2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de> On Mon, Apr 15, 2024 at 03:48:48PM +0200, Lukas Wunner wrote: > Roman reports a deadlock on unplug of a Thunderbolt docking station > containing an Intel I225 Ethernet adapter. > > 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: > > 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. > > Avoid by using non-device-managed LED registration. > > Stack trace for posterity: > > schedule+0x6e/0xf0 > schedule_preempt_disabled+0x15/0x20 > __mutex_lock+0x2a0/0x750 > unregister_netdevice_notifier+0x40/0x150 > netdev_trig_deactivate+0x1f/0x60 [ledtrig_netdev] > led_trigger_set+0x102/0x330 > led_classdev_unregister+0x4b/0x110 > release_nodes+0x3d/0xb0 > devres_release_all+0x8b/0xc0 > device_del+0x34f/0x3c0 > unregister_netdevice_many_notify+0x80b/0xaf0 > unregister_netdev+0x7c/0xd0 > igc_remove+0xd8/0x1e0 [igc] > pci_device_remove+0x3f/0xb0 > > Fixes: ea578703b03d ("igc: Add support for LEDs on i225/i226") > Reported-by: Roman Lozko > Closes: https://lore.kernel.org/r/CAEhC_B=ksywxCG_+aQqXUrGEgKq+4mqnSV8EBHOKbC3-Obj9+Q@mail.gmail.com/ > Signed-off-by: Kurt Kanzenbach > Signed-off-by: Lukas Wunner > Cc: Heiner Kallweit I am aware that Kurt has submitted what appears to be the same patch [1,2], which I'm inclined to put down to miscommunication (email based workflows are like that sometimes). FWIIW, it is my understanding is that the patch originated from Lukas[3], and thus it seems most appropriate to take his submission. As for the patch itself, I agree that it addresses the problem at hand. For the record, I have not tested it. Reviewed-by: Simon Horman [1] [PATCH iwl-net] igc: Fix deadlock on module removal https://lore.kernel.org/netdev/20240411-igc_led_deadlock-v1-1-0da98a3c68c5@linutronix.de/ [2] [PATCH iwl-net v2] igc: Fix deadlock on module removal https://lore.kernel.org/netdev/20240411-igc_led_deadlock-v2-1-b758c0c88b2b@linutronix.de/ [3] Re: Deadlock in pciehp on dock disconnect https://lore.kernel.org/all/ZhBN9p1yOyciXkzw@wunner.de/