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: 27861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1001021wrr; Wed, 30 Nov 2022 07:44:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf7B8rr2xpVlK0qfxZdpTzqPDNgg+D0FJzE8a9+dhpfG+v0Uyp+oxMkYO3RCuUNLAyIW3pVd X-Received: by 2002:a17:906:a259:b0:7ad:ccae:a30d with SMTP id bi25-20020a170906a25900b007adccaea30dmr38252024ejb.704.1669823070843; Wed, 30 Nov 2022 07:44:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669823070; cv=none; d=google.com; s=arc-20160816; b=IvVtygE2FN8KsnPbkcoB9a1y0ZAPT5lmLO3oErWsP+By6B8JVEvGthVMfF/nJ5rM1l srieOXmjXkrYf4BPXCN0FQYUT89BkogQleKgUcC0fJucrgzuCIkihZV1GmBu+U+1MyU2 QMBATiYhNKcIXSciPhe1RSpaK2505JRyguuntIWEkqmirC/W1MUzO7Wq3br4FIj1428A V4AMWegc501MEQi+qfMB9NoyWrHCGyfEKGAYztQTwWorBiDL5g/DVvR8FdNiRaNNf1u1 wPa10eJ6xwQIDBA6N/Y7tgFMH/LcymRsn9J7KtlNCva0wvSjKXj2aURdh+PC4uaCFfWb dZMw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8Xh1mcFRB70ympUi8YGHKeKDxHQRz5a9G2FTMGOdg2I=; b=LBzrZzGywO0hmCKdaKwFUxOyZI02em96uxYFARbOOYG0MjmgKVdy7FJkqwqCf7dxpR 6Pl9NwRl4haSmTFl+99MWGiA1ydyC3hFG3fBRrvWyyWzYdPU5/aWSKCDXQVR4Lmh7ube YpJcrFB3t25FPh6acS0clYy9WxGgOwmrLdr/8KFsazxOIijZN/qeFvYzXA32WF4F8sQX GucBaCMaRBBPaFBLVdKcMagoi7nzopLTqmKuFvbx+POoGSkF9sppAxuhK9IMFYZu/Yta tb6PihgdsENGHE2azrygemV5vKHMVqisLNmvs78ySHoiS/Bva2dxa+FtCcqJfAY48Q4/ 3suw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ha13-20020a170906a88d00b007bf9dd57b5csi1103614ejb.645.2022.11.30.07.44.05; Wed, 30 Nov 2022 07:44:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229937AbiK3PhT (ORCPT + 99 others); Wed, 30 Nov 2022 10:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbiK3Pgu (ORCPT ); Wed, 30 Nov 2022 10:36:50 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 52C5A1C43D for ; Wed, 30 Nov 2022 07:36:49 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750936396429710694?= X-GMAIL-MSGID: =?utf-8?q?1750936396429710694?= 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)