From patchwork Tue Oct 27 13:51:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 311975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C4D9C61DD8 for ; Tue, 27 Oct 2020 17:35:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8617208B8 for ; Tue, 27 Oct 2020 17:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603820155; bh=v4Faxe2oFWT9FGrJ/a98D50w3xZNO2pxrwsgAbFuMII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=G0qB3fxC8x6+xtL/vgus82h47fgB89IVU6bgElEJaQscOdVWLZWmVKILY3r8SiC9R yC753sWZqzzgHRo31PWOXeFsGc2l/IwjTK0Lj+Flam8j/a3Y3PLV7CH4su4r1i41yV Sl+rLH36YZcy4VBXOc1KPhDygGAgcW5Wv90WtdIQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1819962AbgJ0Rfw (ORCPT ); Tue, 27 Oct 2020 13:35:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:35804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760875AbgJ0Ogy (ORCPT ); Tue, 27 Oct 2020 10:36:54 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9CFED2222C; Tue, 27 Oct 2020 14:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809414; bh=v4Faxe2oFWT9FGrJ/a98D50w3xZNO2pxrwsgAbFuMII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NsQepco3o2IL0i3S2y9Fceeja1wpa87rUg26T0wryQeFwZwf+BtfgY2KqUEH7JDTS g1sjYQ/WUOPjLMaznd0w+TSl3mgpmQRHG00Smtgp5bO6lMnFmstvjQqVl3VxvXgkP2 qb18bDhQB39UyzY4OiubQp1GSE9ruvXDO1buWbKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sreekanth Reddy , Tomas Henzl , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 146/408] scsi: mpt3sas: Fix sync irqs Date: Tue, 27 Oct 2020 14:51:24 +0100 Message-Id: <20201027135501.871004885@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tomas Henzl [ Upstream commit 45181eab8ba79ed7a41b549f00500c0093828521 ] _base_process_reply_queue() called from _base_interrupt() may schedule a new irq poll. Fix this by calling synchronize_irq() first. Also ensure that enable_irq() is called only when necessary to avoid "Unbalanced enable for IRQ..." errors. Link: https://lore.kernel.org/r/20200910142126.8147-1-thenzl@redhat.com Fixes: 320e77acb327 ("scsi: mpt3sas: Irq poll to avoid CPU hard lockups") Acked-by: Sreekanth Reddy Signed-off-by: Tomas Henzl Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/mpt3sas/mpt3sas_base.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index b7e44634d0dc2..3d58d24de6b61 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1708,18 +1708,22 @@ mpt3sas_base_sync_reply_irqs(struct MPT3SAS_ADAPTER *ioc) /* TMs are on msix_index == 0 */ if (reply_q->msix_index == 0) continue; + synchronize_irq(pci_irq_vector(ioc->pdev, reply_q->msix_index)); if (reply_q->irq_poll_scheduled) { /* Calling irq_poll_disable will wait for any pending * callbacks to have completed. */ irq_poll_disable(&reply_q->irqpoll); irq_poll_enable(&reply_q->irqpoll); - reply_q->irq_poll_scheduled = false; - reply_q->irq_line_enable = true; - enable_irq(reply_q->os_irq); - continue; + /* check how the scheduled poll has ended, + * clean up only if necessary + */ + if (reply_q->irq_poll_scheduled) { + reply_q->irq_poll_scheduled = false; + reply_q->irq_line_enable = true; + enable_irq(reply_q->os_irq); + } } - synchronize_irq(pci_irq_vector(ioc->pdev, reply_q->msix_index)); } }