Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp497193pxx; Wed, 28 Oct 2020 09:39:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyiS82zIyepEqE7pRqQSXMx5Oo+Gzg+iQCfG8Ldhb59R3H19n6iVqW7EKG+kKxlMgO7fXk X-Received: by 2002:a17:906:370e:: with SMTP id d14mr8884032ejc.259.1603903159737; Wed, 28 Oct 2020 09:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903159; cv=none; d=google.com; s=arc-20160816; b=YIi1CblURE1HpJzWr1yJhAcJmiqxDefuJmttomPzQa3C3xb8GjjnR2nr4wzRo7+8wy OazxFg36Li+XBADbSLB07NKrY95XH4as9jPX/eu9q7jugN14So/4LYJ9lBem3p7hBwlV 8beDEaUHwJqBzHmJlR5n8TX7geYR4/yrQ/ZCCMh0CubjAD29/fjx94cIfj8pLSBQWfmY 6I4UPwDH5jVkvZdbNCaB4P9adM9vJIbAFmfjaJBlLg5XSjL8iZKKcEHkuWBhBf2aGMHc 9BY8tcqRCGFcp6EbkmE0LG2swHn8vXIZFqAX/dJdG1ojqYpzEoUk/BSpwgd105x2e12g LF7Q== 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=Tcm+kk2fYweIqIDD0L1naAFGsP0GerX/yK71zAHs6uM=; b=0ZI6MABnecSle3rJh/R8mR+xzBQk+YGU0Al1lwU2zyucch1xnarbo4PRh0DvFRpeIS ATMUZD+u85aiGouP+IcxjL4vol7oozNma8QOsICimUPyYgZCvySS1iNQgZ+waFnKvE1b YCR6bOO+fH40hcR1GHLtL/EgQDXGnHunN4rfh+UREQ6ZLLoJ10vV/AnD3sslZ81QcSM8 0Dj2BQbQ5KvGY/6vPfDa7SXb+XfYo70OI314NBqyHfkdwS4tg1BY5oSWS+4/4TrKJEqI 9o6LPk/JY2YlXgPWV5STCdhGcfg+QBcfFUJZ2hme7GSioNqx9NXyxMEct/6688a+XIBt 84Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=orvyAMcY; 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 bu23si3659073ejb.83.2020.10.28.09.38.56; Wed, 28 Oct 2020 09:39:19 -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=orvyAMcY; 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 S1818148AbgJ0RRl (ORCPT + 99 others); Tue, 27 Oct 2020 13:17:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:58734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1782913AbgJ0O5l (ORCPT ); Tue, 27 Oct 2020 10:57:41 -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 B7D5B20714; Tue, 27 Oct 2020 14:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810660; bh=MO537yTZlawsZwUmLjXenwfiZhbXE6ENO0mjI/ZuZ2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orvyAMcYG/pCFOiocNrYRDU9Q8v1UHOvNqvvR29MXimGNcldyYSCQd4ugacOsXZs3 4qKPn3iYLokaaZemhx5tp3u0pgHQ+AoTHS2Rx6doEl2BaiUsABzxzIRUQIssRjzKKk YDW1BOQB1BIPsXYysFmDnEE4fqNQhvh7/N2pwqW8= 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.8 219/633] scsi: mpt3sas: Fix sync irqs Date: Tue, 27 Oct 2020 14:49:22 +0100 Message-Id: <20201027135532.959168099@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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 a85c9672c6ea3..a67749c8f4ab3 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1808,18 +1808,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