From patchwork Wed Nov 30 15:36:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 13060043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA3D0C433FE for ; Wed, 30 Nov 2022 15:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=WiqoJIWXon/wgc1VJNfIJMoiG9fe7GMEXV9vvDBkCAs=; b=Tp+nTNf8tUHaN1 Do3RUYg1QWNEgvG4+qMmIgn4127HVTaIQrsVzDRCkv1RFJTXdaRZMcEIloBO0D6xTrP+QegJSkeVX 6NEN0zO+VOVqxFnvxSAv3zJHx2gqJeapA6UnmAwiIlXdCTzQamwFJSvGsLWp4vfuuGMZZaAqlKpIS gCKpj/znrv9sx8jRFM7V1WFkYhJoqIubBiLNmGJgqYn0GtETXyWezmtVwraiIxTyv+jMsiiZwFzaZ 3fWPAL6q1Zewv6A9HFP+K2jE+TabtPMLrVqKesdgDNb1ErEH/iccFyM7mZn36TLQIK1rJZ4RqaF2t c+4dfkfAWZZmyhlJMIaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0P8r-00HXa6-BJ; Wed, 30 Nov 2022 15:36:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0P8l-00HXV3-IO for linux-arm-kernel@lists.infradead.org; Wed, 30 Nov 2022 15:36:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 30EE4D6E; Wed, 30 Nov 2022 07:36:52 -0800 (PST) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C77E33F67D; Wed, 30 Nov 2022 07:36:44 -0800 (PST) From: Robin Murphy To: will@kernel.org, mark.rutland@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Geoff Blake Subject: [PATCH 1/2] perf/arm-cmn: Cope with spurious IRQs better Date: Wed, 30 Nov 2022 15:36:38 +0000 Message-Id: X-Mailer: git-send-email 2.36.1.dirty MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221130_073651_689378_68D90D64 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Although we reset the CMN state during probe before requesting our interrupt(s), a pending IRQ could already have been latched at the interrupt controller, and thus be delivered spuriously as soon as the IRQ is enabled. Not handling that can then lead to the IRQ layer disabling it again, and things subseuqently going wonky. Since we can't support shared IRQs anyway for affinity-management reasons, the only time we should concievably return IRQ_NONE is for a spurious interrupt which did somehow originate from our CMN, so there should be no harm in removing the problem by simply claiming to have handled those as well. Reported-by: Geoff Blake Signed-off-by: Robin Murphy --- drivers/perf/arm-cmn.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index b80a9b74662b..9e8be5586423 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -1798,7 +1798,6 @@ static int arm_cmn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *cpuhp_no static irqreturn_t arm_cmn_handle_irq(int irq, void *dev_id) { struct arm_cmn_dtc *dtc = dev_id; - irqreturn_t ret = IRQ_NONE; for (;;) { u32 status = readl_relaxed(dtc->base + CMN_DT_PMOVSR); @@ -1807,7 +1806,6 @@ static irqreturn_t arm_cmn_handle_irq(int irq, void *dev_id) for (i = 0; i < CMN_DTM_NUM_COUNTERS; i++) { if (status & (1U << i)) { - ret = IRQ_HANDLED; if (WARN_ON(!dtc->counters[i])) continue; delta = (u64)arm_cmn_read_counter(dtc, i) << 16; @@ -1816,7 +1814,6 @@ static irqreturn_t arm_cmn_handle_irq(int irq, void *dev_id) } if (status & (1U << CMN_DT_NUM_COUNTERS)) { - ret = IRQ_HANDLED; if (dtc->cc_active && !WARN_ON(!dtc->cycles)) { delta = arm_cmn_read_cc(dtc); local64_add(delta, &dtc->cycles->count); @@ -1826,7 +1823,7 @@ static irqreturn_t arm_cmn_handle_irq(int irq, void *dev_id) writel_relaxed(status, dtc->base + CMN_DT_PMOVSR_CLR); if (!dtc->irq_friend) - return ret; + return IRQ_HANDLED; dtc += dtc->irq_friend; } }