netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded
@ 2018-03-19 21:16 Andrew Lunn
  2018-03-19 21:16 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Use the DT IRQ trigger mode Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrew Lunn @ 2018-03-19 21:16 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, u.kleine-koenig, Andrew Lunn

As reported by Uwe Kleine-K�nig, the interrupt trigger is first
configured by DT and then reconfigured to edge. This results in a
failure on EPROBE_DEFER, or if the module is unloaded and reloaded.

A second crash happens on module reload due to a missing call to the
common IRQ free code when using polled interrupts.

With these fixes in place, it becomes possible to load and unload the
kernel modules a few times without it crashing.

Andrew Lunn (2):
  net: dsa: mv88e6xxx: Use the DT IRQ trigger mode
  net: dsa: mv88e6xxx: Call the common IRQ free code

 drivers/net/dsa/mv88e6xxx/chip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.16.2

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

* [PATCH net-next 1/2] net: dsa: mv88e6xxx: Use the DT IRQ trigger mode
  2018-03-19 21:16 [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded Andrew Lunn
@ 2018-03-19 21:16 ` Andrew Lunn
  2018-03-20  9:20   ` Uwe Kleine-König
  2018-03-19 21:16 ` [PATCH net-next 2/2] net: dsa: mv88e6xxx: Call the common IRQ free code Andrew Lunn
  2018-03-22 15:33 ` [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2018-03-19 21:16 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, u.kleine-koenig, Andrew Lunn

By calling request_threaded_irq() with the flag IRQF_TRIGGER_FALLING
we override the trigger mode provided in device tree. And the
interrupt is actually active low, which is what all the current device
tree descriptions use.

Suggested-by: Uwe Kleine-K�nig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index fe46b40195fa..84e6febaf881 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -425,7 +425,7 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip)
 
 	err = request_threaded_irq(chip->irq, NULL,
 				   mv88e6xxx_g1_irq_thread_fn,
-				   IRQF_ONESHOT | IRQF_TRIGGER_FALLING,
+				   IRQF_ONESHOT,
 				   dev_name(chip->dev), chip);
 	if (err)
 		mv88e6xxx_g1_irq_free_common(chip);
-- 
2.16.2

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

* [PATCH net-next 2/2] net: dsa: mv88e6xxx: Call the common IRQ free code
  2018-03-19 21:16 [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded Andrew Lunn
  2018-03-19 21:16 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Use the DT IRQ trigger mode Andrew Lunn
@ 2018-03-19 21:16 ` Andrew Lunn
  2018-03-22 15:33 ` [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2018-03-19 21:16 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, u.kleine-koenig, Andrew Lunn

When free'ing the polled IRQs, call the common irq free code.
Otherwise the interrupts are left registered, and when we come to load
the driver a second time, we get an Opps.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 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 84e6febaf881..85de118c4838 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -467,6 +467,8 @@ static int mv88e6xxx_irq_poll_setup(struct mv88e6xxx_chip *chip)
 
 static void mv88e6xxx_irq_poll_free(struct mv88e6xxx_chip *chip)
 {
+	mv88e6xxx_g1_irq_free_common(chip);
+
 	kthread_cancel_delayed_work_sync(&chip->irq_poll_work);
 	kthread_destroy_worker(chip->kworker);
 }
-- 
2.16.2

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

* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Use the DT IRQ trigger mode
  2018-03-19 21:16 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Use the DT IRQ trigger mode Andrew Lunn
@ 2018-03-20  9:20   ` Uwe Kleine-König
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2018-03-20  9:20 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: David Miller, netdev

On Mon, Mar 19, 2018 at 10:16:20PM +0100, Andrew Lunn wrote:
> By calling request_threaded_irq() with the flag IRQF_TRIGGER_FALLING
> we override the trigger mode provided in device tree. And the
> interrupt is actually active low, which is what all the current device
> tree descriptions use.
> 
> Suggested-by: Uwe Kleine-K�nig <u.kleine-koenig@pengutronix.de>

Your locale setting seems broken. Can this please be fixed up during
commit?

> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index fe46b40195fa..84e6febaf881 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -425,7 +425,7 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip)
>  
>  	err = request_threaded_irq(chip->irq, NULL,
>  				   mv88e6xxx_g1_irq_thread_fn,
> -				   IRQF_ONESHOT | IRQF_TRIGGER_FALLING,
> +				   IRQF_ONESHOT,
>  				   dev_name(chip->dev), chip);

You could join the shortend line with the next here.

Other than that:

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded
  2018-03-19 21:16 [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded Andrew Lunn
  2018-03-19 21:16 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Use the DT IRQ trigger mode Andrew Lunn
  2018-03-19 21:16 ` [PATCH net-next 2/2] net: dsa: mv88e6xxx: Call the common IRQ free code Andrew Lunn
@ 2018-03-22 15:33 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-03-22 15:33 UTC (permalink / raw)
  To: andrew; +Cc: netdev, u.kleine-koenig

From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 19 Mar 2018 22:16:19 +0100

> As reported by Uwe Kleine-K�nig, the interrupt trigger is first
> configured by DT and then reconfigured to edge. This results in a
> failure on EPROBE_DEFER, or if the module is unloaded and reloaded.
> 
> A second crash happens on module reload due to a missing call to the
> common IRQ free code when using polled interrupts.
> 
> With these fixes in place, it becomes possible to load and unload the
> kernel modules a few times without it crashing.

Andrew, please respin this with the characters in Uwe's name fixed
up for patch #2.

Thank you.

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

end of thread, other threads:[~2018-03-22 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-19 21:16 [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded Andrew Lunn
2018-03-19 21:16 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Use the DT IRQ trigger mode Andrew Lunn
2018-03-20  9:20   ` Uwe Kleine-König
2018-03-19 21:16 ` [PATCH net-next 2/2] net: dsa: mv88e6xxx: Call the common IRQ free code Andrew Lunn
2018-03-22 15:33 ` [PATCH net-next 0/2] Fixes to allow mv88e6xxx module to be reloaded 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).