All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] sfc: fix calling of free_irq with already free vector
@ 2014-05-08 10:44 Nikolay Aleksandrov
  2014-05-09  1:04 ` Ben Hutchings
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Aleksandrov @ 2014-05-08 10:44 UTC (permalink / raw)
  To: netdev
  Cc: Nikolay Aleksandrov, Zenghui Shi, Ben Hutchings,
	linux-net-drivers, Shradha Shah, David S. Miller

If the sfc driver is in legacy interrupt mode (either explicitly by
using interrupt_mode module param or by falling back to it) it will
hit a warning at kernel/irq/manage.c because it will try to free an irq
which wasn't allocated by it in the first place because the MSI(X) irqs are
zero and it'll try to free them unconditionally. So fix it by checking if
we're in legacy mode and freeing the appropriate irqs.

CC: Zenghui Shi <zshi@redhat.com>
CC: Ben Hutchings <ben@decadent.org.uk>
CC: <linux-net-drivers@solarflare.com>
CC: Shradha Shah <sshah@solarflare.com>
CC: David S. Miller <davem@davemloft.net>

Fixes: 1899c111a535 ("sfc: Fix IRQ cleanup in case of a probe failure")
Reported-by: Zenghui Shi <zshi@redhat.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
v2: Change the fix to check for the interrupt mode and adjust the
commit message.

 drivers/net/ethernet/sfc/nic.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
index 32d969e857f7..43761d3b8651 100644
--- a/drivers/net/ethernet/sfc/nic.c
+++ b/drivers/net/ethernet/sfc/nic.c
@@ -156,13 +156,15 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
 	efx->net_dev->rx_cpu_rmap = NULL;
 #endif
 
-	/* Disable MSI/MSI-X interrupts */
-	efx_for_each_channel(channel, efx)
-		free_irq(channel->irq, &efx->msi_context[channel->channel]);
-
-	/* Disable legacy interrupt */
-	if (efx->legacy_irq)
+	if (efx->interrupt_mode != EFX_INT_MODE_LEGACY) {
+		/* Disable MSI/MSI-X interrupts */
+		efx_for_each_channel(channel, efx)
+			free_irq(channel->irq,
+				 &efx->msi_context[channel->channel]);
+	} else {
+		/* Disable legacy interrupt */
 		free_irq(efx->legacy_irq, efx);
+	}
 }
 
 /* Register dump */
-- 
1.8.5.3

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

* Re: [PATCH net v2] sfc: fix calling of free_irq with already free vector
  2014-05-08 10:44 [PATCH net v2] sfc: fix calling of free_irq with already free vector Nikolay Aleksandrov
@ 2014-05-09  1:04 ` Ben Hutchings
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2014-05-09  1:04 UTC (permalink / raw)
  To: Nikolay Aleksandrov
  Cc: netdev, Zenghui Shi, linux-net-drivers, Shradha Shah, David S. Miller

[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]

On Thu, 2014-05-08 at 12:44 +0200, Nikolay Aleksandrov wrote:
> If the sfc driver is in legacy interrupt mode (either explicitly by
> using interrupt_mode module param or by falling back to it) it will
> hit a warning at kernel/irq/manage.c because it will try to free an irq
> which wasn't allocated by it in the first place because the MSI(X) irqs are
> zero and it'll try to free them unconditionally. So fix it by checking if
> we're in legacy mode and freeing the appropriate irqs.

Oops, I think we had given up regular testing legacy interrupts by this
point as there seemed to be no real need for them.

> CC: Zenghui Shi <zshi@redhat.com>
> CC: Ben Hutchings <ben@decadent.org.uk>
> CC: <linux-net-drivers@solarflare.com>
> CC: Shradha Shah <sshah@solarflare.com>
> CC: David S. Miller <davem@davemloft.net>
> 
> Fixes: 1899c111a535 ("sfc: Fix IRQ cleanup in case of a probe failure")
> Reported-by: Zenghui Shi <zshi@redhat.com>
> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
> ---
> v2: Change the fix to check for the interrupt mode and adjust the
> commit message.
> 
>  drivers/net/ethernet/sfc/nic.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
> index 32d969e857f7..43761d3b8651 100644
> --- a/drivers/net/ethernet/sfc/nic.c
> +++ b/drivers/net/ethernet/sfc/nic.c
> @@ -156,13 +156,15 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
>  	efx->net_dev->rx_cpu_rmap = NULL;
>  #endif
>  
> -	/* Disable MSI/MSI-X interrupts */
> -	efx_for_each_channel(channel, efx)
> -		free_irq(channel->irq, &efx->msi_context[channel->channel]);
> -
> -	/* Disable legacy interrupt */
> -	if (efx->legacy_irq)
> +	if (efx->interrupt_mode != EFX_INT_MODE_LEGACY) {

Minor nit: this could use EFX_INT_MODE_USE_MSI(efx), same as in
efx_nic_init_interrupt().

> +		/* Disable MSI/MSI-X interrupts */
> +		efx_for_each_channel(channel, efx)
> +			free_irq(channel->irq,
> +				 &efx->msi_context[channel->channel]);
> +	} else {
> +		/* Disable legacy interrupt */
>  		free_irq(efx->legacy_irq, efx);
> +	}
>  }
>  
>  /* Register dump */

Ben.

-- 
Ben Hutchings
Beware of programmers who carry screwdrivers. - Leonard Brandwein

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

end of thread, other threads:[~2014-05-09  1:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-08 10:44 [PATCH net v2] sfc: fix calling of free_irq with already free vector Nikolay Aleksandrov
2014-05-09  1:04 ` Ben Hutchings

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.