From patchwork Wed Nov 30 15:36:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 13060042 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 BB96CC4332F for ; Wed, 30 Nov 2022 15:38:06 +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:References:In-Reply-To: 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: List-Owner; bh=Zrp2VPyUZAF8QPtUTsJOnx37vBZxhzmef1U1Wo0I+5M=; b=0HIaFEe61j7Tg0 rKifGw8SYxyxEFWCo4+zoDmHKRHb/2HZHIg4vQN1oKu3h0EueIhnOYW7BLSmJpCyoWfiN24A/jsJM EpigOtmh8th7pot1XC/aRZPRlMCLpIb9HQRCrsFwzZ9OA74Po0zqvulfGBc0EUsxcSyEGaS60AqA7 BEoooX2Saw61l5UHfBdNM46P4sooy0YaQJjPrrOlnLoTKNktZLiqR6lVbYaEv1juBlA1ucAGe5TKU 5rqSSOWYdrxzx9iFbXDic3sscrmPIeeVVHTZteEbE+BGDqxr2Q07CkgLBfoWPoiETUg0ERbynpAna UQDXBR3SaAdtGTdD40rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0P91-00HXeb-9n; Wed, 30 Nov 2022 15:37:07 +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-00HXWt-IQ 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 B43A91042; Wed, 30 Nov 2022 07:36:55 -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 56EB63F67D; Wed, 30 Nov 2022 07:36:48 -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 2/2] perf/arm-cmn: Implement shutdown method Date: Wed, 30 Nov 2022 15:36:39 +0000 Message-Id: <43fb90e6428d0a667deedd3726f462c3c71a8e94.1669822447.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.36.1.dirty In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221130_073651_689037_D1AE249C X-CRM114-Status: GOOD ( 14.01 ) 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 Apparently a kexec-induced shutdown does not manage to close perf events that processes still had open, and thus can leave the PMU running such that the next kernel may find an overflow interrupt already asserted. Although the next kernel should ideally be robust aganst that anyway, let's be polite and disable the PMU to match what we do on remove. Suggested-by: Geoff Blake Signed-off-by: Robin Murphy --- drivers/perf/arm-cmn.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 9e8be5586423..0b2df72cee9f 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -2309,11 +2309,18 @@ static int arm_cmn_probe(struct platform_device *pdev) return err; } -static int arm_cmn_remove(struct platform_device *pdev) +static void arm_cmn_shutdown(struct platform_device *pdev) { struct arm_cmn *cmn = platform_get_drvdata(pdev); writel_relaxed(0, cmn->dtc[0].base + CMN_DT_DTC_CTL); +} + +static int arm_cmn_remove(struct platform_device *pdev) +{ + struct arm_cmn *cmn = platform_get_drvdata(pdev); + + arm_cmn_shutdown(pdev); perf_pmu_unregister(&cmn->pmu); cpuhp_state_remove_instance_nocalls(arm_cmn_hp_state, &cmn->cpuhp_node); @@ -2350,6 +2357,7 @@ static struct platform_driver arm_cmn_driver = { }, .probe = arm_cmn_probe, .remove = arm_cmn_remove, + .shutdown = arm_cmn_shutdown, }; static int __init arm_cmn_init(void)