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 4090AC4345F for ; Tue, 16 Apr 2024 13:51:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B50A881E54; Tue, 16 Apr 2024 13:51:40 +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 c6b5ihgWEObK; Tue, 16 Apr 2024 13:51:40 +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 CF53181E66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1713275499; bh=La+ROYGCifhM3uHvdH9Bis6+6xM5L5k30IUJ2OhUHno=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=5fEZ4P5DnA1hjUXkIPVqVijgjAw1dlTLR/LP8ygRdBdAt+haxPX0gZOBc0xFyrZTX do9K4FLH4XWdypFnm/9oI1H2JpuDlxHWfubKirJFAfz45zIPxXPYAFOAH8iquzT9a1 KmuJw3o234JZtE7QwPLUSQgSNdRD8FxqbRWG8/jdfYviBuN7SKqTPy+z/v1ZqfAXZj qo/cC4sg4h2xfirm7s4+15BIjcI7n8SyuTBKbevZ221qg86vCa0RDDpJgj77H+c34S PYVLGZmaEiXoBpOwRIMgRGZ/AyXaboISKyKS6enzyu1NYmpuNyAoOkpRzzope248Rn X/is70YFxUu2w== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id CF53181E66; Tue, 16 Apr 2024 13:51:39 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 8B6431BF41B for ; Tue, 16 Apr 2024 13:51:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 750C881E66 for ; Tue, 16 Apr 2024 13:51:37 +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 EgvoX6Q7w6td for ; Tue, 16 Apr 2024 13:51:36 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 8C19581E54 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 8C19581E54 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8C19581E54 for ; Tue, 16 Apr 2024 13:51:36 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4EF8D61230; Tue, 16 Apr 2024 13:51:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECBB7C2BD10; Tue, 16 Apr 2024 13:51:31 +0000 (UTC) Date: Tue, 16 Apr 2024 14:51:29 +0100 From: Simon Horman To: Kurt Kanzenbach Message-ID: <20240416135129.GA3769813@kernel.org> References: <20240411-igc_led_deadlock-v2-1-b758c0c88b2b@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240411-igc_led_deadlock-v2-1-b758c0c88b2b@linutronix.de> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713275495; bh=4otepq24ibU/BFgkCAGDDODzhJI1QplbGSgPPr0bnNA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h5QRW70WEVB/gjlxQF34XfHI8FAXbbwHnSKkZJgaVQnUEtTNThMJb97o0PD9IaeNK efdNoubBn/DS6cPrFYrxB8DbMRoNtUPBy1SS2cduKNPdK11oUwRyjbcmrX6PmL0Mev KiJ36YAHFDoyUbYswGVn5Ykj5UuDf4IR3Rixacty6DfYfS+gVPVPRakyNlou3CJIFa Rcbbj4ZdOeN7aCuwC6qntXqUuPZTBQxT54F58YyPYrR3H3nnkyFC7CUd5WL3PctA/R D5zuGwWEucz1vQ059yTlnSlrfviH32XR0U869Gi8ZkvpZNC+ilcYzgA2bGnNUyfT+e 7kEDVHjToYhIA== 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, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=h5QRW70W Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2] igc: Fix deadlock on module removal 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 , Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= , Eric Dumazet , Lukas Wunner , Tony Nguyen , intel-wired-lan@lists.osuosl.org, Jakub Kicinski , netdev@vger.kernel.org, Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Mon, Apr 15, 2024 at 12:59:37PM +0200, Kurt Kanzenbach wrote: > From: Lukas Wunner > > The removal of the igc module leads to a deadlock: > > |[Mon Apr 8 17:38:55 2024] __mutex_lock.constprop.0+0x3e5/0x7a0 > |[Mon Apr 8 17:38:55 2024] ? preempt_count_add+0x85/0xd0 > |[Mon Apr 8 17:38:55 2024] __mutex_lock_slowpath+0x13/0x20 > |[Mon Apr 8 17:38:55 2024] mutex_lock+0x3b/0x50 > |[Mon Apr 8 17:38:55 2024] rtnl_lock+0x19/0x20 > |[Mon Apr 8 17:38:55 2024] unregister_netdevice_notifier+0x2a/0xc0 > |[Mon Apr 8 17:38:55 2024] netdev_trig_deactivate+0x25/0x70 > |[Mon Apr 8 17:38:55 2024] led_trigger_set+0xe2/0x2d0 > |[Mon Apr 8 17:38:55 2024] led_classdev_unregister+0x4f/0x100 > |[Mon Apr 8 17:38:55 2024] devm_led_classdev_release+0x15/0x20 > |[Mon Apr 8 17:38:55 2024] release_nodes+0x47/0xc0 > |[Mon Apr 8 17:38:55 2024] devres_release_all+0x9f/0xe0 > |[Mon Apr 8 17:38:55 2024] device_del+0x272/0x3c0 > |[Mon Apr 8 17:38:55 2024] netdev_unregister_kobject+0x8c/0xa0 > |[Mon Apr 8 17:38:55 2024] unregister_netdevice_many_notify+0x530/0x7c0 > |[Mon Apr 8 17:38:55 2024] unregister_netdevice_queue+0xad/0xf0 > |[Mon Apr 8 17:38:55 2024] unregister_netdev+0x21/0x30 > |[Mon Apr 8 17:38:55 2024] igc_remove+0xfb/0x1f0 [igc] > |[Mon Apr 8 17:38:55 2024] pci_device_remove+0x42/0xb0 > |[Mon Apr 8 17:38:55 2024] device_remove+0x43/0x70 > > unregister_netdev() acquires the RNTL lock and releases the LEDs bound > to that netdevice. However, netdev_trig_deactivate() and later > unregister_netdevice_notifier() try to acquire the RTNL lock again. > > Avoid this situation by not using the device-managed LED class > functions. > > Link: https://lore.kernel.org/r/CAEhC_B=ksywxCG_+aQqXUrGEgKq+4mqnSV8EBHOKbC3-Obj9+Q@mail.gmail.com/ > Link: https://lore.kernel.org/r/ZhRD3cOtz5i-61PB@mail-itl/ > Reported-by: Roman Lozko > Reported-by: "Marek Marczykowski-Górecki" > Fixes: ea578703b03d ("igc: Add support for LEDs on i225/i226") > Signed-off-by: Lukas Wunner > [Kurt: Wrote commit message and tested on i225] > Signed-off-by: Kurt Kanzenbach I am aware that this patch seems to have also been submitted by Lucas himself. I'd like to suggest that we focus on review of that submission. https://lore.kernel.org/netdev/2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@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 7435712C531 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=DHCl2qf4yAOfayJYa+jO/UtLPdHhsHprN63OvhCl3vo8Mn4Y0lBi8RMyfZ9+u6owKGXI0DU/IHOMdYUVyjC5mp4Cudr5QVyGuZcPI625HfZ4fHxPAjWjhS6NmX3cHopjL2N2OQ4j4G/rNDU+Otl1hhR8sZK14d7gEC0G1M+3oxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713275495; c=relaxed/simple; bh=4otepq24ibU/BFgkCAGDDODzhJI1QplbGSgPPr0bnNA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OuXIqQGFyde6rKdE57zU/2/TQuMY1Uh+MZmLqd1yVH2V5Q5nhf/B8Em+DHoIUplVTV3RUwDLjTL4WLsT1fIaRyLTFTnf8OVP7CI/l9IbJmZwQQcD28wxeryeNVFIdTcrkXi/fypmuY2jB7onPjMHbBf7XE/wp8Np/4Gy72qkjt8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h5QRW70W; 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="h5QRW70W" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECBB7C2BD10; 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=1713275495; bh=4otepq24ibU/BFgkCAGDDODzhJI1QplbGSgPPr0bnNA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h5QRW70WEVB/gjlxQF34XfHI8FAXbbwHnSKkZJgaVQnUEtTNThMJb97o0PD9IaeNK efdNoubBn/DS6cPrFYrxB8DbMRoNtUPBy1SS2cduKNPdK11oUwRyjbcmrX6PmL0Mev KiJ36YAHFDoyUbYswGVn5Ykj5UuDf4IR3Rixacty6DfYfS+gVPVPRakyNlou3CJIFa Rcbbj4ZdOeN7aCuwC6qntXqUuPZTBQxT54F58YyPYrR3H3nnkyFC7CUd5WL3PctA/R D5zuGwWEucz1vQ059yTlnSlrfviH32XR0U869Gi8ZkvpZNC+ilcYzgA2bGnNUyfT+e 7kEDVHjToYhIA== Date: Tue, 16 Apr 2024 14:51:29 +0100 From: Simon Horman To: Kurt Kanzenbach Cc: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Lukas Wunner , Sasha Neftin , Roman Lozko , Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: Re: [PATCH iwl-net v2] igc: Fix deadlock on module removal Message-ID: <20240416135129.GA3769813@kernel.org> References: <20240411-igc_led_deadlock-v2-1-b758c0c88b2b@linutronix.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240411-igc_led_deadlock-v2-1-b758c0c88b2b@linutronix.de> On Mon, Apr 15, 2024 at 12:59:37PM +0200, Kurt Kanzenbach wrote: > From: Lukas Wunner > > The removal of the igc module leads to a deadlock: > > |[Mon Apr 8 17:38:55 2024] __mutex_lock.constprop.0+0x3e5/0x7a0 > |[Mon Apr 8 17:38:55 2024] ? preempt_count_add+0x85/0xd0 > |[Mon Apr 8 17:38:55 2024] __mutex_lock_slowpath+0x13/0x20 > |[Mon Apr 8 17:38:55 2024] mutex_lock+0x3b/0x50 > |[Mon Apr 8 17:38:55 2024] rtnl_lock+0x19/0x20 > |[Mon Apr 8 17:38:55 2024] unregister_netdevice_notifier+0x2a/0xc0 > |[Mon Apr 8 17:38:55 2024] netdev_trig_deactivate+0x25/0x70 > |[Mon Apr 8 17:38:55 2024] led_trigger_set+0xe2/0x2d0 > |[Mon Apr 8 17:38:55 2024] led_classdev_unregister+0x4f/0x100 > |[Mon Apr 8 17:38:55 2024] devm_led_classdev_release+0x15/0x20 > |[Mon Apr 8 17:38:55 2024] release_nodes+0x47/0xc0 > |[Mon Apr 8 17:38:55 2024] devres_release_all+0x9f/0xe0 > |[Mon Apr 8 17:38:55 2024] device_del+0x272/0x3c0 > |[Mon Apr 8 17:38:55 2024] netdev_unregister_kobject+0x8c/0xa0 > |[Mon Apr 8 17:38:55 2024] unregister_netdevice_many_notify+0x530/0x7c0 > |[Mon Apr 8 17:38:55 2024] unregister_netdevice_queue+0xad/0xf0 > |[Mon Apr 8 17:38:55 2024] unregister_netdev+0x21/0x30 > |[Mon Apr 8 17:38:55 2024] igc_remove+0xfb/0x1f0 [igc] > |[Mon Apr 8 17:38:55 2024] pci_device_remove+0x42/0xb0 > |[Mon Apr 8 17:38:55 2024] device_remove+0x43/0x70 > > unregister_netdev() acquires the RNTL lock and releases the LEDs bound > to that netdevice. However, netdev_trig_deactivate() and later > unregister_netdevice_notifier() try to acquire the RTNL lock again. > > Avoid this situation by not using the device-managed LED class > functions. > > Link: https://lore.kernel.org/r/CAEhC_B=ksywxCG_+aQqXUrGEgKq+4mqnSV8EBHOKbC3-Obj9+Q@mail.gmail.com/ > Link: https://lore.kernel.org/r/ZhRD3cOtz5i-61PB@mail-itl/ > Reported-by: Roman Lozko > Reported-by: "Marek Marczykowski-Górecki" > Fixes: ea578703b03d ("igc: Add support for LEDs on i225/i226") > Signed-off-by: Lukas Wunner > [Kurt: Wrote commit message and tested on i225] > Signed-off-by: Kurt Kanzenbach I am aware that this patch seems to have also been submitted by Lucas himself. I'd like to suggest that we focus on review of that submission. https://lore.kernel.org/netdev/2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de/