Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp522885pxx; Wed, 28 Oct 2020 10:14:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDtGMNR9decOHu8fVbOTi3cUyQp/uWqi3/82+mEfWhKrtguwqWYMIWpWEA37Fai7Dgz9vJ X-Received: by 2002:a50:f0c4:: with SMTP id a4mr8544054edm.289.1603905263216; Wed, 28 Oct 2020 10:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603905263; cv=none; d=google.com; s=arc-20160816; b=btptNPs6o9EmeASEsE+YLV44V22z7DeANXEINgMd8ExRIgGN+hCEyZbBuqxYqw4v8/ 58b+ohjHJEv+U8DuzJIEvuYQm14FW5sXDNQkbzMd4YmhzV1jwT+Acgu8xEH6jUwPgTu/ SDC7k1FGd6c0lc7kbd6x9UafnH603KGu6sgmeECnowYeuNwRiJ+r/TgpniT+0dE/D7hh 1jiWHBD6fKBVtFilVUMWR3wr9RAf4O9U7W9aIK/mqCINyY1Ka40+NVfE2KEpmfh0JGfI TDjoqnzU4/EP5Ep4q3CqxhweTxon1AKmVU2aTVoC4Yn5N4NWfw1ES4sIjCLeTt/6Cr2L GM3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H2PFD5fOgJuBbEFBdqXDEKCVZqyRJ9m8Et38mAYv1s8=; b=GiRdQwc/zDHihB0jlM0NAQ11vygK9Q1ahmwojHA8EuxWqSYFVNPUuSjIbEN6ppMdsa m6Zx6WCdtdSy5eLDGUuUw8OSfQDYK8yQpbsmVtLdyxOORA3kAbcYUyATGrWJTpxGyky1 m97wJr0yJsF98RP50m+PcnU5ygbgsB8G7anS16tIpGu3NN+whJp/DAl0T+k+X2fvUFaR D3VTZ2D2MsZgm+0ge939KrMKGtAZ56ilYdrrPKr11cyEQE9GWSLOMVHF2bWfyTbrbyqZ cYJ1iPIlo/8hbOdNTUj5rMIlheEZPCTTgI8ALqwEw9/hEbG46eAaOl6vo6vKCvREZR80 G4Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NsQepco3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si1208edj.549.2020.10.28.10.14.00; Wed, 28 Oct 2020 10:14:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NsQepco3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1820119AbgJ0RgB (ORCPT + 99 others); Tue, 27 Oct 2020 13:36:01 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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)); } } -- 2.25.1