Arjan van de Ven | 1 Jun 2008 05:11
Favicon

PATCH] net: b44.c fix sleeping-with-spinlock-helt during resume

From: Arjan van de Ven <arjan <at> linux.intel.com>
Subject: [PATCH] net: b44.c fix sleeping-with-spinlock-helt during resume
CC: Michael Buesch <mb <at> bu3sch.de>

The b44.c driver calls b44_chip_reset() from the resume path,
with the device spinlock held.
Unfortunately, b44_chip_reset() calls ssb_pcicore_dev_irqvecs_enable()
which is a sleeping function (and calls might_sleep), if and only if
the device hasn't been enabled yet.

Not having this hardware, the safest solution seems to be to enable
the irqvec before taking the spinlock...

http://www.kerneloops.org/search.php?search=ssb_pcicore_dev_irqvecs_enable

Reported-by: www.kerneloops.org
Signed-off-by: Arjan van de Ven
---
 drivers/net/b44.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 59dce6a..6028129 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
 <at>  <at>  -1278,6 +1278,7  <at>  <at>  static void b44_chip_reset(struct b44 *bp, int reset_kind)
 		bw32(bp, B44_DMARX_CTRL, 0);
 		bp->rx_prod = bp->rx_cons = 0;
 	} else
+		/* this function sleeps! */
(Continue reading)

Michael Buesch | 1 Jun 2008 12:03
Picon
Favicon

Re: PATCH] net: b44.c fix sleeping-with-spinlock-helt during resume

On Sunday 01 June 2008 05:11:30 Arjan van de Ven wrote:
> From: Arjan van de Ven <arjan <at> linux.intel.com>
> Subject: [PATCH] net: b44.c fix sleeping-with-spinlock-helt during resume
> CC: Michael Buesch <mb <at> bu3sch.de>
> 
> The b44.c driver calls b44_chip_reset() from the resume path,
> with the device spinlock held.
> Unfortunately, b44_chip_reset() calls ssb_pcicore_dev_irqvecs_enable()
> which is a sleeping function (and calls might_sleep), if and only if
> the device hasn't been enabled yet.
> 
> Not having this hardware, the safest solution seems to be to enable
> the irqvec before taking the spinlock...
> 
> http://www.kerneloops.org/search.php?search=ssb_pcicore_dev_irqvecs_enable
> 
> Reported-by: www.kerneloops.org
> Signed-off-by: Arjan van de Ven
> ---
>  drivers/net/b44.c |   12 ++++++++++--
>  1 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/b44.c b/drivers/net/b44.c
> index 59dce6a..6028129 100644
> --- a/drivers/net/b44.c
> +++ b/drivers/net/b44.c
>  <at>  <at>  -1278,6 +1278,7  <at>  <at>  static void b44_chip_reset(struct b44 *bp, int reset_kind)
>  		bw32(bp, B44_DMARX_CTRL, 0);
>  		bp->rx_prod = bp->rx_cons = 0;
>  	} else
(Continue reading)

Arjan van de Ven | 1 Jun 2008 18:01
Favicon

Re: PATCH] net: b44.c fix sleeping-with-spinlock-helt during resume

On Sun, 1 Jun 2008 12:03:40 +0200
Michael Buesch <mb <at> bu3sch.de> wrote:

> Index: wireless-testing/drivers/ssb/driver_pcicore.c
> ===================================================================
> --- wireless-testing.orig/drivers/ssb/driver_pcicore.c
> 2008-04-23 16:06:56.000000000 +0200 +++
> wireless-testing/drivers/ssb/driver_pcicore.c	2008-06-01
> 12:02:33.000000000 +0200  <at>  <at>  -537,12 +537,12  <at>  <at>  int
> ssb_pcicore_dev_irqvecs_enable(struc int err = 0; u32 tmp;
>  
> -	might_sleep();
> -
>  	if (!pdev)
>  		goto out;
>  	bus = pdev->bus;
>  
> +	might_sleep_if(pdev->id.coreid != SSB_DEV_PCI);
> +
>  	/* Enable interrupts for this device. */
>  	if (bus->host_pci &&
>  	    ((pdev->id.revision >= 6) || (pdev->id.coreid ==
> SSB_DEV_PCIE))) {
> 
> 
> 

fair enough.... can we get something like this into 2.6.26 still? Quite
a few people are hitting this (even though the warning is harmless, it
still is better to silence it)
(Continue reading)

Willy Tarreau | 7 Jun 2008 08:01
Picon
Favicon

Re: PATCH] net: b44.c fix sleeping-with-spinlock-helt during resume

Hi Arjan, Michael,

On Sun, Jun 01, 2008 at 09:01:07AM -0700, Arjan van de Ven wrote:
> On Sun, 1 Jun 2008 12:03:40 +0200
> Michael Buesch <mb <at> bu3sch.de> wrote:
> 
> > Index: wireless-testing/drivers/ssb/driver_pcicore.c
> > ===================================================================
> > --- wireless-testing.orig/drivers/ssb/driver_pcicore.c
> > 2008-04-23 16:06:56.000000000 +0200 +++
> > wireless-testing/drivers/ssb/driver_pcicore.c	2008-06-01
> > 12:02:33.000000000 +0200  <at>  <at>  -537,12 +537,12  <at>  <at>  int
> > ssb_pcicore_dev_irqvecs_enable(struc int err = 0; u32 tmp;
> >  
> > -	might_sleep();
> > -
> >  	if (!pdev)
> >  		goto out;
> >  	bus = pdev->bus;
> >  
> > +	might_sleep_if(pdev->id.coreid != SSB_DEV_PCI);
> > +
> >  	/* Enable interrupts for this device. */
> >  	if (bus->host_pci &&
> >  	    ((pdev->id.revision >= 6) || (pdev->id.coreid ==
> > SSB_DEV_PCIE))) {
> > 
> > 
> > 
> 
(Continue reading)


Gmane