Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3651940pxb; Mon, 24 Jan 2022 14:29:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHk2zJuVCqTiGMbVzq18zQ+hfcSoFQV5NUXDLD/dwwm1kiNnNjPiwZN/pNaLPc7d1uileW X-Received: by 2002:a17:90a:bb0e:: with SMTP id u14mr440593pjr.149.1643063347318; Mon, 24 Jan 2022 14:29:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063347; cv=none; d=google.com; s=arc-20160816; b=fBZ6Dl/RzP/2AJhSnPoi63QSWUPYiFxKEabe1T0vyp0AE4wdzfiAgOY4njUM5RTR0v O9DgzRJJvSPOuUo8dx0W7GA/MRxtSEermM6yrg+4mucIFFs2Z386AVy0WpLnqmvn28TT 6fqiqnO5QfphbmM7FMyVvlQS9QKB/8XTNp7cHDLCT1K0wlN32PEx6uzBTO+Dmt6/Ucc8 nPSekyCuuc/az+cyJl735yMyt8SlmAy52A2d4a8f1w1vzz3CceQs8yxg2kZO3aaLaHrY eKKj8fyFtmAWSD86K+mCUtQmjDQ3DhOC17tMBMkaftVRcM+lmo0/spRX2w+FM7+pexhm M06g== 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=FqzOFAGoqiarGZI3wvIr0L6nnfXp2ICFDfXfr4vu4Jw=; b=WDtJexMvuySlQkIxPC41T0i9rVufJi1d1bya+m3KLPro5dGJ71U44mvUQh0s9CWPSt Bqhx13GJEM5Vxu8LBw9YYKPaeEuk8tOy++QTljSMfYE2nNbHIq+h3Lzww4Hr6jqYLdmQ eMUQ1PUD6u8S+32oacxc0rYXsksD8mDA9LVcsNjwz53nLaKasjKoQcg9/6aMJpm+Ydzz I+RadN8G5hCuG1Jo0Fv4iBonxVW5eAKWYFzD8fce/gvMabG8Lcy594XPMShzRWGm6CB/ getFgWyLl/hFaj0Ev63p3NpMxKkqmRp1XIM49YsT1jaPsuRQb74FKkvCZN9ladoFkamB wLCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SOhF7xS8; 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=pass (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 t12si14065491pgm.258.2022.01.24.14.28.55; Mon, 24 Jan 2022 14:29:07 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=SOhF7xS8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582230AbiAXWSx (ORCPT + 99 others); Mon, 24 Jan 2022 17:18:53 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45652 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454033AbiAXVbd (ORCPT ); Mon, 24 Jan 2022 16:31:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CFA31B81233; Mon, 24 Jan 2022 21:31:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D55DC340E4; Mon, 24 Jan 2022 21:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059886; bh=SCgLEX0Kh7icKYxXAHJBDyBvz8vlCwfQ+JaNq8HYN6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SOhF7xS8wJxYAkrWC+6q6qMya6VLFnqVYIcbQ4ExHb8lzKNq1C8svLNm+j2fb10/y 4mWaVgiUkdXV6IooQ9oGC/uTPTdwJ/YlP9djBD/8zD7cbpdEd6/6PESB1lctCpJ0+M SfaxRg6WlLx/Hrq6ccwla8rsR5+9UUGlWUFmu+JE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Hari Bathini , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0760/1039] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option Date: Mon, 24 Jan 2022 19:42:29 +0100 Message-Id: <20220124184150.870815207@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Hari Bathini [ Upstream commit 219572d2fc4135b5ce65c735d881787d48b10e71 ] Kdump can be triggered after panic_notifers since commit f06e5153f4ae2 ("kernel/panic.c: add "crash_kexec_post_notifiers" option for kdump after panic_notifers") introduced crash_kexec_post_notifiers option. But using this option would mean smp_send_stop(), that marks all other CPUs as offline, gets called before kdump is triggered. As a result, kdump routines fail to save other CPUs' registers. To fix this, kdump friendly crash_smp_send_stop() function was introduced with kernel commit 0ee59413c967 ("x86/panic: replace smp_send_stop() with kdump friendly version in panic path"). Override this kdump friendly weak function to handle crash_kexec_post_notifiers option appropriately on powerpc. Reported-by: kernel test robot Signed-off-by: Hari Bathini [Fixed signature of crash_stop_this_cpu() - reported by lkp@intel.com] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211207103719.91117-1-hbathini@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/smp.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index aee3a7119f977..7201fdcf02f1c 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -620,6 +620,36 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) } #endif +#ifdef CONFIG_NMI_IPI +static void crash_stop_this_cpu(struct pt_regs *regs) +#else +static void crash_stop_this_cpu(void *dummy) +#endif +{ + /* + * Just busy wait here and avoid marking CPU as offline to ensure + * register data is captured appropriately. + */ + while (1) + cpu_relax(); +} + +void crash_smp_send_stop(void) +{ + static bool stopped = false; + + if (stopped) + return; + + stopped = true; + +#ifdef CONFIG_NMI_IPI + smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000); +#else + smp_call_function(crash_stop_this_cpu, NULL, 0); +#endif /* CONFIG_NMI_IPI */ +} + #ifdef CONFIG_NMI_IPI static void nmi_stop_this_cpu(struct pt_regs *regs) { -- 2.34.1