[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7cfb1af7-3270-447a-a2cf-16c2af02ec29@lunn.ch>
Date: Fri, 5 Apr 2024 22:50:00 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Heiner Kallweit <hkallweit1@...il.com>
Cc: Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>,
David Miller <davem@...emloft.net>,
Realtek linux nic maintainers <nic_swsd@...ltek.com>,
Lukas Wunner <lukas@...ner.de>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net] r8169: fix LED-related deadlock on module removal
On Fri, Apr 05, 2024 at 10:29:15PM +0200, Heiner Kallweit wrote:
> Binding devm_led_classdev_register() to the netdev is problematic
> because on module removal we get a RTNL-related deadlock. Fix this
> by using the parent device instead for device-managed resources.
> This is cleaner anyway because then all device-managed resources in
> the driver use the same device (the one belonging to the PCI device).
I've been thinking a bit about devm for LEDs. At what point do the
entries in /sys/class/led disappears? When is the netdev trigger
removed? I think it is after the netdev has gone?
static int rtl8168_led_hw_control_set(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
Is this safe? I think the LED will only be destroyed after
rtl_remove_one() has completed.
I think to be safe, we cannot use devm_led_classdev_register(). The
LEDs need to be added and explicitly removed within the life cycle of
the netdev.
Andrew
Powered by blists - more mailing lists