* [2.6.37-rc1, patch] r8169: fix sleeping while holding spinlock...
@ 2010-11-01 21:35 Daniel J Blueman
2010-11-01 23:46 ` Francois Romieu
0 siblings, 1 reply; 4+ messages in thread
From: Daniel J Blueman @ 2010-11-01 21:35 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Kernel
Recent changes to the r8169 driver cause it to call
device_set_wakeup_enable under spinlock, which may sleep.
Locking isn't necessary around the call to device_set_wakeup_enable,
so drop the spinlock before calling it, to address this.
Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index d88ce9f..894e7c7 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -846,10 +846,10 @@ static int rtl8169_set_wol(struct net_device
*dev, struct ethtool_wolinfo *wol)
else
tp->features &= ~RTL_FEATURE_WOL;
__rtl8169_set_wol(tp, wol->wolopts);
- device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
-
spin_unlock_irq(&tp->lock);
+ device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
+
return 0;
}
--
Daniel J Blueman
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6.37-rc1, patch] r8169: fix sleeping while holding spinlock...
2010-11-01 21:35 [2.6.37-rc1, patch] r8169: fix sleeping while holding spinlock Daniel J Blueman
@ 2010-11-01 23:46 ` Francois Romieu
2010-11-02 0:17 ` [2.6.37-rc1, patch v2] " Daniel J Blueman
0 siblings, 1 reply; 4+ messages in thread
From: Francois Romieu @ 2010-11-01 23:46 UTC (permalink / raw)
To: Daniel J Blueman; +Cc: David S. Miller, Linux Kernel
Daniel J Blueman <daniel.blueman@gmail.com> :
> Recent changes to the r8169 driver cause it to call
> device_set_wakeup_enable under spinlock, which may sleep.
The change is fine but the description is misleading : the r8169
driver has been issuing device_set_wakeup_enable under spinlock since
october 2008. device_set_wakeup_enable did not sleep until recently
(see f2dc0d1809ab7e0147c7e4ac837be1682f706538 for instance).
drivers/net/gianfar_ethtool.c::gfar_set_wol is broken as well when
CONFIG_PM is set.
--
Ueimor
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6.37-rc1, patch v2] r8169: fix sleeping while holding spinlock...
2010-11-01 23:46 ` Francois Romieu
@ 2010-11-02 0:17 ` Daniel J Blueman
2010-11-02 3:45 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Daniel J Blueman @ 2010-11-02 0:17 UTC (permalink / raw)
To: Francois Romieu, David S. Miller; +Cc: Linux Kernel
Hi Francois,
On 1 November 2010 23:46, Francois Romieu <romieu@fr.zoreil.com> wrote:
> Daniel J Blueman <daniel.blueman@gmail.com> :
>> Recent changes to the r8169 driver cause it to call
>> device_set_wakeup_enable under spinlock, which may sleep.
>
> The change is fine but the description is misleading : the r8169
> driver has been issuing device_set_wakeup_enable under spinlock since
> october 2008. device_set_wakeup_enable did not sleep until recently
> (see f2dc0d1809ab7e0147c7e4ac837be1682f706538 for instance).
Good catch; I also find that only the gainfar is the other driver
needing fixing; I'll follow up with this.
Patch with updated description for David:
As device_set_wakeup_enable can now sleep, move the call to outside
the critical section.
Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index d88ce9f..894e7c7 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -846,10 +846,10 @@ static int rtl8169_set_wol(struct net_device
*dev, struct ethtool_wolinfo *wol)
else
tp->features &= ~RTL_FEATURE_WOL;
__rtl8169_set_wol(tp, wol->wolopts);
- device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
-
spin_unlock_irq(&tp->lock);
+ device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
+
return 0;
}
--
Daniel J Blueman
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6.37-rc1, patch v2] r8169: fix sleeping while holding spinlock...
2010-11-02 0:17 ` [2.6.37-rc1, patch v2] " Daniel J Blueman
@ 2010-11-02 3:45 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2010-11-02 3:45 UTC (permalink / raw)
To: Daniel J Blueman; +Cc: Francois Romieu, David S. Miller, Linux Kernel
On Tuesday, November 02, 2010, Daniel J Blueman wrote:
> Hi Francois,
>
> On 1 November 2010 23:46, Francois Romieu <romieu@fr.zoreil.com> wrote:
> > Daniel J Blueman <daniel.blueman@gmail.com> :
> >> Recent changes to the r8169 driver cause it to call
> >> device_set_wakeup_enable under spinlock, which may sleep.
> >
> > The change is fine but the description is misleading : the r8169
> > driver has been issuing device_set_wakeup_enable under spinlock since
> > october 2008. device_set_wakeup_enable did not sleep until recently
> > (see f2dc0d1809ab7e0147c7e4ac837be1682f706538 for instance).
Yes, sorry about that. I overlooked the fact that these drivers called
device_set_wakeup_enable() under spinlocks.
> Good catch; I also find that only the gainfar is the other driver
> needing fixing; I'll follow up with this.
Thanks a lot for taking care of this!
> Patch with updated description for David:
>
> As device_set_wakeup_enable can now sleep, move the call to outside
> the critical section.
>
> Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
> index d88ce9f..894e7c7 100644
> --- a/drivers/net/r8169.c
> +++ b/drivers/net/r8169.c
> @@ -846,10 +846,10 @@ static int rtl8169_set_wol(struct net_device
> *dev, struct ethtool_wolinfo *wol)
> else
> tp->features &= ~RTL_FEATURE_WOL;
> __rtl8169_set_wol(tp, wol->wolopts);
> - device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
> -
> spin_unlock_irq(&tp->lock);
>
> + device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
> +
> return 0;
> }
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-02 3:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-01 21:35 [2.6.37-rc1, patch] r8169: fix sleeping while holding spinlock Daniel J Blueman
2010-11-01 23:46 ` Francois Romieu
2010-11-02 0:17 ` [2.6.37-rc1, patch v2] " Daniel J Blueman
2010-11-02 3:45 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome