netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs
@ 2017-09-26 18:57 Vivien Didelot
  2017-09-26 19:05 ` Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Vivien Didelot @ 2017-09-26 18:57 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

mv88e6xxx_g2_irq_free locks the registers mutex, but not
mv88e6xxx_g1_irq_free, which results in a stack trace from
assert_reg_lock when unloading the mv88e6xxx module. Fix this.

Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt")
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index c6678aa9b4ef..e7ff7483d2fb 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3947,7 +3947,9 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
 	if (chip->irq > 0) {
 		if (chip->info->g2_irqs > 0)
 			mv88e6xxx_g2_irq_free(chip);
+		mutex_lock(&chip->reg_lock);
 		mv88e6xxx_g1_irq_free(chip);
+		mutex_unlock(&chip->reg_lock);
 	}
 }
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs
  2017-09-26 18:57 [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs Vivien Didelot
@ 2017-09-26 19:05 ` Florian Fainelli
  2017-09-27  9:06 ` David Laight
  2017-09-28 17:29 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2017-09-26 19:05 UTC (permalink / raw)
  To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn

On 09/26/2017 11:57 AM, Vivien Didelot wrote:
> mv88e6xxx_g2_irq_free locks the registers mutex, but not
> mv88e6xxx_g1_irq_free, which results in a stack trace from
> assert_reg_lock when unloading the mv88e6xxx module. Fix this.
> 
> Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt")
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs
  2017-09-26 18:57 [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs Vivien Didelot
  2017-09-26 19:05 ` Florian Fainelli
@ 2017-09-27  9:06 ` David Laight
  2017-09-27 13:07   ` Andrew Lunn
  2017-09-28 17:29 ` David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: David Laight @ 2017-09-27  9:06 UTC (permalink / raw)
  To: 'Vivien Didelot', netdev@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
	David S. Miller, Florian Fainelli, Andrew Lunn

From: Vivien Didelot
> Sent: 26 September 2017 19:57
> mv88e6xxx_g2_irq_free locks the registers mutex, but not
> mv88e6xxx_g1_irq_free, which results in a stack trace from
> assert_reg_lock when unloading the mv88e6xxx module. Fix this.
> 
> Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt")
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
>  drivers/net/dsa/mv88e6xxx/chip.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index c6678aa9b4ef..e7ff7483d2fb 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -3947,7 +3947,9 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
>  	if (chip->irq > 0) {
>  		if (chip->info->g2_irqs > 0)
>  			mv88e6xxx_g2_irq_free(chip);
> +		mutex_lock(&chip->reg_lock);
>  		mv88e6xxx_g1_irq_free(chip);
> +		mutex_unlock(&chip->reg_lock);

Isn't the irq_free code likely to have to sleep waiting for any
ISR to complete??

	David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs
  2017-09-27  9:06 ` David Laight
@ 2017-09-27 13:07   ` Andrew Lunn
  2017-09-27 16:40     ` David Laight
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2017-09-27 13:07 UTC (permalink / raw)
  To: David Laight
  Cc: 'Vivien Didelot', netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
	David S. Miller, Florian Fainelli

On Wed, Sep 27, 2017 at 09:06:01AM +0000, David Laight wrote:
> From: Vivien Didelot
> > Sent: 26 September 2017 19:57
> > mv88e6xxx_g2_irq_free locks the registers mutex, but not
> > mv88e6xxx_g1_irq_free, which results in a stack trace from
> > assert_reg_lock when unloading the mv88e6xxx module. Fix this.
> > 
> > Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt")
> > Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> > ---
> >  drivers/net/dsa/mv88e6xxx/chip.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> > index c6678aa9b4ef..e7ff7483d2fb 100644
> > --- a/drivers/net/dsa/mv88e6xxx/chip.c
> > +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> > @@ -3947,7 +3947,9 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
> >  	if (chip->irq > 0) {
> >  		if (chip->info->g2_irqs > 0)
> >  			mv88e6xxx_g2_irq_free(chip);
> > +		mutex_lock(&chip->reg_lock);
> >  		mv88e6xxx_g1_irq_free(chip);
> > +		mutex_unlock(&chip->reg_lock);
> 
> Isn't the irq_free code likely to have to sleep waiting for any
> ISR to complete??

Hi David

Possibly. But this is a mutex, not a spinlock. So sleeping is O.K.
Or am i missing something?

	  Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs
  2017-09-27 13:07   ` Andrew Lunn
@ 2017-09-27 16:40     ` David Laight
  0 siblings, 0 replies; 6+ messages in thread
From: David Laight @ 2017-09-27 16:40 UTC (permalink / raw)
  To: 'Andrew Lunn'
  Cc: 'Vivien Didelot', netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
	David S. Miller, Florian Fainelli

From: Andrew Lunn
> Sent: 27 September 2017 14:07
> To: David Laight
> On Wed, Sep 27, 2017 at 09:06:01AM +0000, David Laight wrote:
> > From: Vivien Didelot
> > > Sent: 26 September 2017 19:57
> > > mv88e6xxx_g2_irq_free locks the registers mutex, but not
> > > mv88e6xxx_g1_irq_free, which results in a stack trace from
> > > assert_reg_lock when unloading the mv88e6xxx module. Fix this.
> > >
> > > Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt")
> > > Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> > > ---
> > >  drivers/net/dsa/mv88e6xxx/chip.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> > > index c6678aa9b4ef..e7ff7483d2fb 100644
> > > --- a/drivers/net/dsa/mv88e6xxx/chip.c
> > > +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> > > @@ -3947,7 +3947,9 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
> > >  	if (chip->irq > 0) {
> > >  		if (chip->info->g2_irqs > 0)
> > >  			mv88e6xxx_g2_irq_free(chip);
> > > +		mutex_lock(&chip->reg_lock);
> > >  		mv88e6xxx_g1_irq_free(chip);
> > > +		mutex_unlock(&chip->reg_lock);
> >
> > Isn't the irq_free code likely to have to sleep waiting for any
> > ISR to complete??
> 
> Hi David
> 
> Possibly. But this is a mutex, not a spinlock. So sleeping is O.K.
> Or am i missing something?

Looks like I was missing some coffee :-)

	David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs
  2017-09-26 18:57 [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs Vivien Didelot
  2017-09-26 19:05 ` Florian Fainelli
  2017-09-27  9:06 ` David Laight
@ 2017-09-28 17:29 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-09-28 17:29 UTC (permalink / raw)
  To: vivien.didelot; +Cc: netdev, linux-kernel, kernel, f.fainelli, andrew

From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Tue, 26 Sep 2017 14:57:21 -0400

> mv88e6xxx_g2_irq_free locks the registers mutex, but not
> mv88e6xxx_g1_irq_free, which results in a stack trace from
> assert_reg_lock when unloading the mv88e6xxx module. Fix this.
> 
> Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt")
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-28 17:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-26 18:57 [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs Vivien Didelot
2017-09-26 19:05 ` Florian Fainelli
2017-09-27  9:06 ` David Laight
2017-09-27 13:07   ` Andrew Lunn
2017-09-27 16:40     ` David Laight
2017-09-28 17:29 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).