diff mbox

Intel I350 mini-PCIe card (igb) on Mirabox (mvebu / Armada 370)

Message ID alpine.DEB.2.10.1404061631130.4683@vroombuntu (mailing list archive)
State New, archived
Headers show

Commit Message

Neil Greatorex April 6, 2014, 3:34 p.m. UTC
Thomas,

On Sat, 5 Apr 2014, Neil Greatorex wrote:

> I will redo the patch with a local variable tomorrow and resend it.
>

As promised, here is the updated patch. As before, I would appreciate 
comments and/or Tested-bys...

Cheers,
Neil

From e5698a4ae6b21c7e78538e16d293123903abbb40 Mon Sep 17 00:00:00 2001
From: Neil Greatorex <neil@fatboyfat.co.uk>
Date: Sun, 6 Apr 2014 16:10:43 +0100
Subject: [PATCH] irqchip: armada-370-xp: Fix releasing of MSIs

Store the value of d->hwirq in a local variable as the real value is wiped out
by calling irq_dispose_mapping. Without this patch, the armada_370_xp_free_msi
function would always free MSI#0, no matter what was passed to it.

Signed-off-by: Neil Greatorex <neil@fatboyfat.co.uk>
---
  drivers/irqchip/irq-armada-370-xp.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Willy Tarreau April 6, 2014, 5:43 p.m. UTC | #1
Hi Neil,

On Sun, Apr 06, 2014 at 04:34:08PM +0100, Neil Greatorex wrote:
> Thomas,
> 
> On Sat, 5 Apr 2014, Neil Greatorex wrote:
> 
> >I will redo the patch with a local variable tomorrow and resend it.
> >
> 
> As promised, here is the updated patch. As before, I would appreciate 
> comments and/or Tested-bys...

OK still works on XP-GP.

   Tested-by: Willy Tarreau <w@1wt.eu>

Willy
Thomas Petazzoni April 8, 2014, 3:13 p.m. UTC | #2
Hello all,

On Sun, 6 Apr 2014 16:34:08 +0100 (BST), Neil Greatorex wrote:

> From e5698a4ae6b21c7e78538e16d293123903abbb40 Mon Sep 17 00:00:00 2001
> From: Neil Greatorex <neil@fatboyfat.co.uk>
> Date: Sun, 6 Apr 2014 16:10:43 +0100
> Subject: [PATCH] irqchip: armada-370-xp: Fix releasing of MSIs
> 
> Store the value of d->hwirq in a local variable as the real value is wiped out
> by calling irq_dispose_mapping. Without this patch, the armada_370_xp_free_msi
> function would always free MSI#0, no matter what was passed to it.
> 
> Signed-off-by: Neil Greatorex <neil@fatboyfat.co.uk>
> ---
>   drivers/irqchip/irq-armada-370-xp.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
> index 5409564..916fae2 100644
> --- a/drivers/irqchip/irq-armada-370-xp.c
> +++ b/drivers/irqchip/irq-armada-370-xp.c
> @@ -157,8 +157,10 @@ static void armada_370_xp_teardown_msi_irq(struct msi_chip *chip,
>   					   unsigned int irq)
>   {
>   	struct irq_data *d = irq_get_irq_data(irq);
> +	unsigned long hwirq = d->hwirq;
> +
>   	irq_dispose_mapping(irq);
> -	armada_370_xp_free_msi(d->hwirq);
> +	armada_370_xp_free_msi(hwirq);
>   }
> 
>   static struct irq_chip armada_370_xp_msi_irq_chip = {

Unfortunately here your patch is not sufficient to solve the problem
apparently. I've fixed another problem where the return value of
armada_370_xp_alloc_msi() (which is signed) is casted into an unsigned
irq_hw_number_t in armada_370_xp_setup_msi_irq(), but I'm still seeing
many MSIs allocated, then some freed, and finally a kernel panic.

 * Log: https://gist.github.com/tpetazzoni/10140012

 * Diff against v3.14: https://gist.github.com/tpetazzoni/10140121

Ideas? If some of you are interested in discussing this live, I'm on
#mvlinux on Freenode.

Thomas
Willy Tarreau April 8, 2014, 3:53 p.m. UTC | #3
On Tue, Apr 08, 2014 at 05:13:09PM +0200, Thomas Petazzoni wrote:
> Unfortunately here your patch is not sufficient to solve the problem
> apparently. I've fixed another problem where the return value of
> armada_370_xp_alloc_msi() (which is signed) is casted into an unsigned
> irq_hw_number_t in armada_370_xp_setup_msi_irq(), but I'm still seeing
> many MSIs allocated, then some freed, and finally a kernel panic.

I thought we already fixed that one months ago ?

Willy
Thomas Petazzoni April 8, 2014, 4 p.m. UTC | #4
Dear Willy Tarreau,

On Tue, 8 Apr 2014 17:53:45 +0200, Willy Tarreau wrote:
> On Tue, Apr 08, 2014 at 05:13:09PM +0200, Thomas Petazzoni wrote:
> > Unfortunately here your patch is not sufficient to solve the problem
> > apparently. I've fixed another problem where the return value of
> > armada_370_xp_alloc_msi() (which is signed) is casted into an unsigned
> > irq_hw_number_t in armada_370_xp_setup_msi_irq(), but I'm still seeing
> > many MSIs allocated, then some freed, and finally a kernel panic.
> 
> I thought we already fixed that one months ago ?

Well, I don't see it fixed in mainline:

 http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/irqchip/irq-armada-370-xp.c#n130

Thomas
Willy Tarreau April 8, 2014, 4:05 p.m. UTC | #5
On Tue, Apr 08, 2014 at 06:00:32PM +0200, Thomas Petazzoni wrote:
> Dear Willy Tarreau,
> 
> On Tue, 8 Apr 2014 17:53:45 +0200, Willy Tarreau wrote:
> > On Tue, Apr 08, 2014 at 05:13:09PM +0200, Thomas Petazzoni wrote:
> > > Unfortunately here your patch is not sufficient to solve the problem
> > > apparently. I've fixed another problem where the return value of
> > > armada_370_xp_alloc_msi() (which is signed) is casted into an unsigned
> > > irq_hw_number_t in armada_370_xp_setup_msi_irq(), but I'm still seeing
> > > many MSIs allocated, then some freed, and finally a kernel panic.
> > 
> > I thought we already fixed that one months ago ?
> 
> Well, I don't see it fixed in mainline:
> 
>  http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/irqchip/irq-armada-370-xp.c#n130

No, I just found, I sent it to you on 23/dec/2013 as part of a private
conversation during my long debugging session on the PCIe regressions,
and since one of the patches was incorrect (revert of the mask), the
other one was lost in the noise. No problem anyway, the most important
thing is that everything is now fixed :-)

Cheers,
Willy
diff mbox

Patch

diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 5409564..916fae2 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -157,8 +157,10 @@  static void armada_370_xp_teardown_msi_irq(struct msi_chip *chip,
  					   unsigned int irq)
  {
  	struct irq_data *d = irq_get_irq_data(irq);
+	unsigned long hwirq = d->hwirq;
+
  	irq_dispose_mapping(irq);
-	armada_370_xp_free_msi(d->hwirq);
+	armada_370_xp_free_msi(hwirq);
  }

  static struct irq_chip armada_370_xp_msi_irq_chip = {