From patchwork Thu Oct 23 12:57:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 402469 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A9EC71400D6 for ; Thu, 23 Oct 2014 23:57:44 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755761AbaJWM5j (ORCPT ); Thu, 23 Oct 2014 08:57:39 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:38053 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755751AbaJWM5g (ORCPT ); Thu, 23 Oct 2014 08:57:36 -0400 Received: by mail-wg0-f42.google.com with SMTP id z12so1304805wgg.1 for ; Thu, 23 Oct 2014 05:57:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nV+Bs5EOs9KqNcGV8heqRySe7dYurFzoBhW+fh4DVkk=; b=dG8DTChvT5ihYNWIoSNv/OeVzzICmmELsgSMnrBKtsp4Hs/jn8WIqmktGgDbmA12bg OexCHKU2ayz1JUEdxJcmLxrTQFxrwwI4qXfFifjCORqKaI3jIU6jazcl/Q3D5dhy0AVH +zwbtYBgkEOpCgBOfrhwfD/xcpornDiKer+0IR289tfr3Xk9M2IvMoopRb4Q6a3w4o5W C9LOGzEwG3kWRx1yTpn6cEQULq2Nm5mfjgb5DJrewlNLBgwejJGKFt2WyCPxjwudXatZ KsZpc6nJN7PWqWOKLuA0sYijYlvymEEBLNLBc+PmYPXrX8dUICFwha16enBlBzUkcvaO RWAg== X-Gm-Message-State: ALoCoQlIriglzW8iITSzSXMrwrylU1D78jXbX9ojNysdX0Se3adWpQxeIatknnqt9h7Yx49w6DJm X-Received: by 10.194.82.74 with SMTP id g10mr3271440wjy.116.1414069054558; Thu, 23 Oct 2014 05:57:34 -0700 (PDT) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id u5sm2520831wiz.9.2014.10.23.05.57.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Oct 2014 05:57:34 -0700 (PDT) From: Eli Cohen X-Google-Original-From: Eli Cohen To: davem@davemloft.net Cc: netdev@vger.kernel.org, ogerlitz@mellanox.com, Eli Cohen 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 Message-Id: <1414069047-30865-2-git-send-email-eli@mellanox.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1414069047-30865-1-git-send-email-eli@mellanox.com> References: <1414069047-30865-1-git-send-email-eli@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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;