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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 90EAEC4345F for ; Thu, 18 Apr 2024 09:13:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 364724026E; Thu, 18 Apr 2024 09:13:50 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id U4OPorNA_dBi; Thu, 18 Apr 2024 09:13:49 +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 smtp2.osuosl.org 5451D41597 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1713431629; bh=K/KzzeU25/s0xz/auM3Oi5MCh7TSjDVlwvMCr/DgP48=; h=Date:To:References:From:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=k5/oDea1AYUnb/+ujc81im6heNsbeguXGD33n9m8yvfSAMX0xMxqSMmde5tP+4nIC KR9R86zzJEsr2qjbddeV3W7qjFeUDwLg+nx5eyw2pD/TzgFfEMmzHN56M0MdTOkq2O Q31PymazTvAtEmFbhJFgxAwTrIw1C+CCNHlJr/WtzH32q7JjShZ+HR5nRn1hyztgao IyTS8b0vNDBGEPvthohattSqgHwALaB8B4u9yUvKPe9gZDCyTpFw/LyPjxz9GhaIu7 a4BAJGry9g0tmFK1R6MEmjumF7lnMbucrosX4w7+uKs7qA/GlN5Us3XquDQqq165Wd OXVgguot8jm1g== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 5451D41597; Thu, 18 Apr 2024 09:13:49 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 8E0D01BF32E for ; Thu, 18 Apr 2024 09:13:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7967040126 for ; Thu, 18 Apr 2024 09:13:47 +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 t6kl7TzRSfV6 for ; Thu, 18 Apr 2024 09:13:46 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=198.175.65.9; helo=mgamail.intel.com; envelope-from=naamax.meir@linux.intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 18B874011E DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 18B874011E Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by smtp4.osuosl.org (Postfix) with ESMTPS id 18B874011E for ; Thu, 18 Apr 2024 09:13:45 +0000 (UTC) X-CSE-ConnectionGUID: 8ii03wsDR++ZYauGyWAj0Q== X-CSE-MsgGUID: PMfrgsE6QZutwyx+VuPlCA== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="31446461" X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="31446461" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 02:13:41 -0700 X-CSE-ConnectionGUID: Q80yaZIkSROABstXCsNY9g== X-CSE-MsgGUID: q9OQ6LECSp20L9+ZHhLUXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="53852345" Received: from naamamex-mobl.ger.corp.intel.com (HELO [10.245.136.172]) ([10.245.136.172]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 02:13:37 -0700 Message-ID: Date: Thu, 18 Apr 2024 12:13:17 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Lukas Wunner , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesse Brandeburg , Tony Nguyen References: <2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de> Content-Language: en-US From: "naamax.meir" In-Reply-To: <2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713431626; x=1744967626; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=rQGVQURqecrBOAPb1l2hVI6jUgQPxnMOVRcXI3wTpIM=; b=DnUXUTKQ/SJjWfRvGTyIzM0pnyG3pLYXncfLylWFSvRPdBj4SJRtuAK+ EKCeXAN/phe0SLzEh8tDagjV/h/K5NNfGDgq+2y58WUxUTJuk3DIBmBEf eEzC/GLoEVOvCRcbhz6dpBBlHmJHJaSPtP+uT/7yUIipt85WurPN6Qa/P eoZ/kIL8MgsFTQt0cpEd5H41uTnWTdWdtSVEzoEDASLqhJvJhsad8qteu 8hrE8x+KOhTF5ZwZPaghpeQBvuV2TDdkU6TsJjMIBNnuKZUKYlfwiQNiI xwfTj2VBM42H3HWnxIaHEpvxy7hamOhCUcEmXYhViS88ZnlT6Wo44xIAk A==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=none (p=none dis=none) header.from=linux.intel.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=DnUXUTKQ 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 , Kurt Kanzenbach , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Heiner Kallweit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On 4/15/2024 16:48, 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 > --- > drivers/net/ethernet/intel/igc/igc.h | 2 ++ > drivers/net/ethernet/intel/igc/igc_leds.c | 38 ++++++++++++++++++++++++------- > drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ > 3 files changed, 35 insertions(+), 8 deletions(-) Tested-by: Naama Meir From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 16C1B6F53D for ; Thu, 18 Apr 2024 09:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713431626; cv=none; b=Ur0wcYGpzHfGVzcFQTNXAKaV2vaE1jXiL/LuMHLP62YXFQtq4dVnlMuK6MPTDNpxTh20BkLAT3nMwnPz/Ah9hocbvgeKVI5Y/fuKunYee1Z+nF5nBXktBD9GuSk70CleQAECdP0ReDe/iEbNlso65QwdEwNRFNTUdugxhmylvgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713431626; c=relaxed/simple; bh=rQGVQURqecrBOAPb1l2hVI6jUgQPxnMOVRcXI3wTpIM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=e7eq4r3QNR/1UZmbz7DaU9dHTwSG7GehRYbDZ94NtvZJRjokkJhwEcEjWMjuwy86APqf8bsUqgjSTgAVHF6xKcDXrxd+I1jgg9jK29OgWVPBKOdX2QYQieAbjGLxkLG7F8OYp/HzpVHhavHnwp2LQVyQ6Sh20bwKctC5Qf9oGFk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=DnUXUTKQ; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DnUXUTKQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713431626; x=1744967626; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=rQGVQURqecrBOAPb1l2hVI6jUgQPxnMOVRcXI3wTpIM=; b=DnUXUTKQ/SJjWfRvGTyIzM0pnyG3pLYXncfLylWFSvRPdBj4SJRtuAK+ EKCeXAN/phe0SLzEh8tDagjV/h/K5NNfGDgq+2y58WUxUTJuk3DIBmBEf eEzC/GLoEVOvCRcbhz6dpBBlHmJHJaSPtP+uT/7yUIipt85WurPN6Qa/P eoZ/kIL8MgsFTQt0cpEd5H41uTnWTdWdtSVEzoEDASLqhJvJhsad8qteu 8hrE8x+KOhTF5ZwZPaghpeQBvuV2TDdkU6TsJjMIBNnuKZUKYlfwiQNiI xwfTj2VBM42H3HWnxIaHEpvxy7hamOhCUcEmXYhViS88ZnlT6Wo44xIAk A==; X-CSE-ConnectionGUID: nEb0oQswTIGj73cHu3r0kQ== X-CSE-MsgGUID: foapRs5tRgy4tPzvlJxStA== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="31446458" X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="31446458" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 02:13:41 -0700 X-CSE-ConnectionGUID: Q80yaZIkSROABstXCsNY9g== X-CSE-MsgGUID: q9OQ6LECSp20L9+ZHhLUXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="53852345" Received: from naamamex-mobl.ger.corp.intel.com (HELO [10.245.136.172]) ([10.245.136.172]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 02:13:37 -0700 Message-ID: Date: Thu, 18 Apr 2024 12:13:17 +0300 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Intel-wired-lan] [PATCH net] igc: Fix LED-related deadlock on driver unbind To: Lukas Wunner , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesse Brandeburg , Tony Nguyen Cc: Andrew Lunn , Sasha Neftin , netdev@vger.kernel.org, Kurt Kanzenbach , intel-wired-lan@lists.osuosl.org, Roman Lozko , Heiner Kallweit References: <2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de> Content-Language: en-US From: "naamax.meir" In-Reply-To: <2f1be6b1cf2b3346929b0049f2ac7d7d79acb5c9.1713188539.git.lukas@wunner.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/15/2024 16:48, 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 > --- > drivers/net/ethernet/intel/igc/igc.h | 2 ++ > drivers/net/ethernet/intel/igc/igc_leds.c | 38 ++++++++++++++++++++++++------- > drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ > 3 files changed, 35 insertions(+), 8 deletions(-) Tested-by: Naama Meir