[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zib0veVgvgTg7Mq6@mail-itl>
Date: Tue, 23 Apr 2024 01:37:33 +0200
From: Marek Marczykowski-Górecki <marmarek@...isiblethingslab.com>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Tony Nguyen <anthony.l.nguyen@...el.com>, davem@...emloft.net,
kuba@...nel.org, pabeni@...hat.com, edumazet@...gle.com,
netdev@...r.kernel.org, Lukas Wunner <lukas@...ner.de>,
sasha.neftin@...el.com, Roman Lozko <lozko.roma@...il.com>,
Kurt Kanzenbach <kurt@...utronix.de>,
Heiner Kallweit <hkallweit1@...il.com>,
Simon Horman <horms@...nel.org>,
Naama Meir <naamax.meir@...ux.intel.com>
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 <lukas@...ner.de>
> >
> > 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.
>
> 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)?
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists