From patchwork Thu Dec 1 08:33:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Hui X-Patchwork-Id: 28235 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp146225wrr; Thu, 1 Dec 2022 00:44:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf456735IMmPMjxAQbdjVzTyodwPTQm8LSiZv5OHzZNeUF5gtEljwiOJ895Qw+6kexs5PePk X-Received: by 2002:a17:902:ab89:b0:17d:8a77:518f with SMTP id f9-20020a170902ab8900b0017d8a77518fmr47296980plr.22.1669884246130; Thu, 01 Dec 2022 00:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669884246; cv=none; d=google.com; s=arc-20160816; b=mVrNHZmAg+/INN1grTqGowoamqK9wMcTXLBUPGpRz3X+WHJpIPwA7xuJaVCFU039hG TjwIZleRzlYZEixE4fusWh4lh7r7VZNNX6XJ5H09x5wU1B9dCF3NVcvzJV4B2/TYyQuz lfkDYQKDK5ThQ9qxmkt3WFxe8CbWZ8pADZaU8QyYtN7SLmzIVicopTcsjvBakH7fCH6g GRk4VMpsaMwBdnHNnFsxUU7F/GrH7ZJt6XpLMmTQexK65AIzBBHvgRDKi2zuliQrsSbu RFYJnC61QsiXn8UvNxZb2qTXtX5JYZitBHNtrFs4Hi8TNSsNBV5REtpludZQCjkJGNlI 6Etw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=1a++8qEzp/AhYmogOROWzLGgWdIQDZcYlref0nXQooU=; b=T325sVWQxMCMkKwV9zw5D2XT2UFhFKOon+yBFI73iAd2JObMR58GQrBgfAPCcbfpgQ cKXW+m6p00BuITpx9BNvAKOQmPLd8iP36iNffw6F+8GRGTyrFKN/XWXeUTA2zUK2IIEs EraYc8DkrkXi2fUKuw4mzjS+m1zJln4CdbC/cTJgk+52aDeJyQ7Mr2rBUnPkR9yQcRSe BuxM8y4XlRRoed/B76zQpKgRajTNlT4RJj9Gk8Aj4teUuY1UQoCadE8/CPAdGhBnYgHM SJT4ut/fjCcRUN1MqHgui+a4B17CC/5w2Uf9gaJMjUTIEc6lNRX8E802IdrxCPakq5K7 Nd4w== 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=sangfor.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i1-20020a170902c94100b0017841de491fsi4247782pla.361.2022.12.01.00.43.53; Thu, 01 Dec 2022 00:44:06 -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=sangfor.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbiLAImR (ORCPT + 99 others); Thu, 1 Dec 2022 03:42:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbiLAImP (ORCPT ); Thu, 1 Dec 2022 03:42:15 -0500 X-Greylist: delayed 514 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 01 Dec 2022 00:42:13 PST Received: from mail-m12746.qiye.163.com (mail-m12746.qiye.163.com [115.236.127.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 889EB865BB for ; Thu, 1 Dec 2022 00:42:13 -0800 (PST) Received: from localhost.localdomain (unknown [IPV6:240e:3b7:327b:59a0:748d:aafb:564e:dca6]) by mail-m12746.qiye.163.com (Hmail) with ESMTPA id F1FD9BC04CD; Thu, 1 Dec 2022 16:33:35 +0800 (CST) From: Ding Hui To: catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Ding Hui Subject: [RFC PATCH] arch/arm64: put crash_save_cpu() at last before die Date: Thu, 1 Dec 2022 16:33:13 +0800 Message-Id: <20221201083313.11734-1-dinghui@sangfor.com.cn> X-Mailer: git-send-email 2.17.1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkaSh5NVklKTk1JSkxMT01LSlUTARMWGhIXJBQOD1 lXWRgSC1lBWUlPSx5BSBlMQUhJTBlBTkIaS0FMT0MfQRoaHRlBTk1PHkEfGBpNWVdZFhoPEhUdFF lBWU9LSFVKSktISkxVSktLVUtZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MCI6LDo*ND0eSxYuDDAJCCkQ H04wFB9VSlVKTU1CQ0NITUpNTUlNVTMWGhIXVR8SFRwTDhI7CBoVHB0UCVUYFBZVGBVFWVdZEgtZ QVlJT0seQUgZTEFISUwZQU5CGktBTE9DH0EaGh0ZQU5NTx5BHxgaTVlXWQgBWUFJSkJDNwY+ X-HM-Tid: 0a84ccd1db81b219kuuuf1fd9bc04cd X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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?1751000543616192904?= X-GMAIL-MSGID: =?utf-8?q?1751000543616192904?= When we debug a vmcore by crash utility, sometimes we got backtraces on non-panic core like this: crash> bt -c 1 PID: 0 TASK: ffff80014107a000 CPU: 1 COMMAND: "swapper/1" #0 [1ffff0002f73c7dc] crash_save_cpu at ffff20002031cb68 The crash utility do backtrace by search LR from stack, which pushed by callee of crash_save_cpu(). So the LR is easier to be destroyed by subsequent invoking other functions, and lead to crash failed to backtrace on non-panic core I tried to put crash_save_cpu() after sdei_mask_local_cpu(), and it turns out bt is working to me. But I'm not sure the order of crash_save_cpu() is whether strictly required, so I send this RFC patch to get some suggestion. Signed-off-by: Ding Hui --- arch/arm64/kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index ffc5d76cf695..5f1defe76f3d 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -842,13 +842,13 @@ static atomic_t waiting_for_crash_ipi = ATOMIC_INIT(0); static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs) { #ifdef CONFIG_KEXEC_CORE - crash_save_cpu(regs, cpu); - atomic_dec(&waiting_for_crash_ipi); local_irq_disable(); sdei_mask_local_cpu(); + crash_save_cpu(regs, cpu); + if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) __cpu_try_die(cpu);