Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3576733pxb; Mon, 24 Jan 2022 12:38:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2BW/hrk1l7lsyjYwGuoOa0PvMbE6kJgvNY3G2fzabyE617mIiUF71DZ5eUDw23AB3yGoR X-Received: by 2002:a17:903:2446:b0:14a:7f24:4da1 with SMTP id l6-20020a170903244600b0014a7f244da1mr16157950pls.112.1643056683119; Mon, 24 Jan 2022 12:38:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056683; cv=none; d=google.com; s=arc-20160816; b=HZFnnRX4RPEMyopkMThvKLv4w+cpwZkltIaDnjQLebE1HeuUrB8KnDLkMMw0q2kg+L IeExo933YnTf8tqpRlOfrtiVwbWGkBd1Eag+4ZrcJRLsYwlpPav2sOhyovE/XPhPTTiK u/JqF+9Kx0ySEpvlE8QF1Vq7rdxdPPygrtkHJ16UuDOsCFj3CY9P+HpQZAS2HlrpN8gY xRm/IzvFj6bUo0JeYJAaAEFJgsbtnZBpzQ7mcDw3X/4Oq1mzxweJbDqodNdJCrQcmg6H BsWn5OtxV033PP/Izk3njJDHhcUu0i36FkgynIw2ZE/1UVn/WHUchaLuh4SWGcOP6Qbd feMg== 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=e1BtQGbYQdn0Geao3GUnsq9f6/BX5BwJGApM1bO5N8Y=; b=VxHHeVRGTrBRgROlmOwZlcvRbGTsNcs8yT4OsRQsmoSnAckPCn9mnx/Ay0WiUUFtgz xZdNZWlLioY+LOFZ8s2+ckbEzdUK9+gOYKd/suhllwiAJSh09zEsT1GzHsgf93iZ96hB p2xAaEHCkJ+5M74GEqk2S5GX5AvoQWXq7ofpl8yW1vO/jHs9GqfCM25Ho08lhjMPploD NTeAVA/Ek9oJtXaYuowsGTXAosPlATFHUovX2Kb1vAo5mRsS0oOFmkRBAPf8BynPGJnA Jjx3jF4H5c7QU1PHbNWaJ5hkl0651ldI8DDcJIOBmjUXGFl2JsOnxZOpDn9YdDYHZp1A +smg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IkT13YGt; 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 w10si294433pjk.113.2022.01.24.12.37.49; Mon, 24 Jan 2022 12:38:03 -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=IkT13YGt; 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 S239679AbiAXTrv (ORCPT + 99 others); Mon, 24 Jan 2022 14:47:51 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58390 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354593AbiAXTgu (ORCPT ); Mon, 24 Jan 2022 14:36:50 -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 C7F4FB81229; Mon, 24 Jan 2022 19:36:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E17A4C340E5; Mon, 24 Jan 2022 19:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053007; bh=+4Y45NR2lyzG41zk6KY232Sml1e0lHoiQZKzYnmhRPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IkT13YGt2JSQZs78+o4bBK6HiXy0YMsbysQIhIv9A7ddgjNMJaqchQxSXcWCED2R1 UhWsPlJzYfK8eQUpjb3J4DALJbF7/Y5O+6rpMWa9dcVZcuinALaORJj3p2t4WbgPm9 zTe6/je2d6IlCwmaFe79vC6RtJ85NcUXmkArh5bw= 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.4 238/320] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option Date: Mon, 24 Jan 2022 19:43:42 +0100 Message-Id: <20220124184002.088618195@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 82dff003a7fd6..4de63ec2e1551 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -582,6 +582,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