Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3579589pxb; Mon, 24 Jan 2022 12:42:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfJT55AfA/MCZQqvg+Yq2eckfVxzRPur2dRfX84zLW/wS6SajRuJYfFBBMdWBVPUzDMBZi X-Received: by 2002:a17:90a:bd81:: with SMTP id z1mr104868pjr.220.1643056932966; Mon, 24 Jan 2022 12:42:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056932; cv=none; d=google.com; s=arc-20160816; b=kHGWDtccAitz5YyvXuftwhsGvjrLXDRuMcopDeF3m9Q4Upf3flq2WF/x0CzRLMbbI3 VmUwDYva5XZ6Ax4q7PkdBPsCgCImi6CtNnAu7RyakrQHs16llK4Co5sUoYOWul2smPMC dvC6ZUNcA8fCgU7P7T89yLJC7OPIKZ/3SDVrpNxFQ0qPNBvUyuccGocvDg097OGRgnwQ bfufJ23DyfC3aLMlu2BCE//hrBKyC6vvWFtnMykA0+OgqYrVODGMiimnWIXMm53rRB+n CbBAH/Omcs1+qjWo+k7wNvzPEUpVHSuxAgWO2AW9gRDWvPg0mn6C8IYjpqt6O0BWjZzp um1Q== 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=aoaoDREdGZ9xJZdpnxckT2xbeZacUJE6DtzMcwSTq4g=; b=zXXBUyXh67N4X2FyIFaQGVydLzPenEDCk2Y0p3Jxi/+twgRZp3SB2E/vzpCEfYlntB Pdbt4RsavkkH8Wip9fuGUV/PzqNe8I6DsM937Exp7h0HOMTaQs3AKZdz1vAPswrtqCyv LmQmRxzkbVaLMiCyhAxr4MebxxGlHpqeyzy00uZXZDy/gq1Cpf/6zC6rNwXpTOBhQ092 kvmg1xGNLJUlEwMgtXJSEWzXG5wzpNk6XMDlFByTUvUnlkjgikpBXqI85y/GyFDLt5JN hSKRurMvULaTR1EsFiWx4+p1XT5iUAzHAfd4I4GUewno+TWpFTK7xD0AOMhotrukwJVG ih9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="r/3s7LCF"; 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 q26si15138176pgl.158.2022.01.24.12.42.00; Mon, 24 Jan 2022 12:42:12 -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="r/3s7LCF"; 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 S1359290AbiAXT7a (ORCPT + 99 others); Mon, 24 Jan 2022 14:59:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349339AbiAXTlc (ORCPT ); Mon, 24 Jan 2022 14:41:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D9FBC07A978; Mon, 24 Jan 2022 11:21:36 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id A1F8561361; Mon, 24 Jan 2022 19:21:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 717D3C340E5; Mon, 24 Jan 2022 19:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052095; bh=JSmRYlIV/nVbbICD6eiKf9M9QQghEUe51u2q/tZL6HI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r/3s7LCFJcJ3do0VdqJ3avlwrbb2ZvxhFkMAlNDk9HXV0TOFSm9AKHymxpzYZPT7a xIUbIEq9XsNon6JpGfAdy9Ny4jfdFVrFy5guIx/oGp/9M+3/qIP/cjEJaw3GnyB5TJ mESQzZHak6zeTaB9QgTVhah/RgsRE8sR45h82XqI= 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 4.19 188/239] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option Date: Mon, 24 Jan 2022 19:43:46 +0100 Message-Id: <20220124183949.085683045@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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 4853ac67cf21f..60fc3c71aa7b0 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -564,6 +564,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