Netdev List
 help / color / mirror / Atom feed
From: Eli Cohen <eli@dev.mellanox.co.il>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ogerlitz@mellanox.com,
	Eli Cohen <eli@mellanox.com>
Subject: [PATCH for-net 1/2] net/mlx5_core: Call synchronize_irq() before freeing EQ buffer
Date: Thu, 23 Oct 2014 15:57:26 +0300	[thread overview]
Message-ID: <1414069047-30865-2-git-send-email-eli@mellanox.com> (raw)
In-Reply-To: <1414069047-30865-1-git-send-email-eli@mellanox.com>

After destroying the EQ, the object responsible for generating interrupts, call
synchronize_irq() to ensure that any handler routines running on other CPU
cores finish execution. Only then free the EQ buffer. This patch solves a very
rare case when we get panic on driver unload.
The same thing is done when we destroy a CQ which is one of the sources
generating interrupts. In the case of CQ we want to avoid completion handlers
on a CQ that was destroyed. In the case we do the same to avoid receiving
asynchronous events after the EQ has been destroyed and its buffers freed.

Signed-off-by: Eli Cohen <eli@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index ed53291468f3..a278238a2db6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -420,6 +420,7 @@ int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
 	if (err)
 		mlx5_core_warn(dev, "failed to destroy a previously created eq: eqn %d\n",
 			       eq->eqn);
+	synchronize_irq(table->msix_arr[eq->irqn].vector);
 	mlx5_buf_free(dev, &eq->buf);
 
 	return err;
-- 
2.1.2

  reply	other threads:[~2014-10-23 12:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 12:57 [PATCH for-net 0/2] irq sync fixes Eli Cohen
2014-10-23 12:57 ` Eli Cohen [this message]
2014-10-23 12:57 ` [PATCH for-net 2/2] net/mlx4_core: Call synchronize_irq() before freeing EQ buffer Eli Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414069047-30865-2-git-send-email-eli@mellanox.com \
    --to=eli@dev.mellanox.co.il \
    --cc=davem@davemloft.net \
    --cc=eli@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox