Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740138 > unrolled thread

[PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

Started byVivien Didelot <vivien.didelot@savoirfairelinux.com>
First post2017-09-26 21:10 +0200
Last post2017-09-28 19:30 +0200
Articles 6 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-26 21:10 +0200
    Re: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs Florian Fainelli <f.fainelli@gmail.com> - 2017-09-26 21:10 +0200
    RE: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs David Laight <David.Laight@ACULAB.COM> - 2017-09-27 11:10 +0200
      Re: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs Andrew Lunn <andrew@lunn.ch> - 2017-09-27 15:10 +0200
        RE: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs David Laight <David.Laight@ACULAB.COM> - 2017-09-27 18:50 +0200
    Re: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing  IRQs David Miller <davem@davemloft.net> - 2017-09-28 19:30 +0200

#1740138 — [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2017-09-26 21:10 +0200
Subject[PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs
Message-ID<uu3p0-jm-19@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1740141

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2017-09-26 21:10 +0200
Message-ID<uu3p1-jm-27@gated-at.bofh.it>
In reply to#1740138
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

[toc] | [prev] | [next] | [standalone]


#1740531

FromDavid Laight <David.Laight@ACULAB.COM>
Date2017-09-27 11:10 +0200
Message-ID<uugvU-kx-31@gated-at.bofh.it>
In reply to#1740138
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

[toc] | [prev] | [next] | [standalone]


#1740701

FromAndrew Lunn <andrew@lunn.ch>
Date2017-09-27 15:10 +0200
Message-ID<uukga-35a-15@gated-at.bofh.it>
In reply to#1740531
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

[toc] | [prev] | [next] | [standalone]


#1740881

FromDavid Laight <David.Laight@ACULAB.COM>
Date2017-09-27 18:50 +0200
Message-ID<uunH4-5Cm-5@gated-at.bofh.it>
In reply to#1740701
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

[toc] | [prev] | [next] | [standalone]


#1741721 — Re: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

FromDavid Miller <davem@davemloft.net>
Date2017-09-28 19:30 +0200
SubjectRe: [PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs
Message-ID<uuKNj-3o9-3@gated-at.bofh.it>
In reply to#1740138
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web