From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D76FCC282C8 for ; Mon, 28 Jan 2019 17:08:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A396621741 for ; Mon, 28 Jan 2019 17:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548695285; bh=wqXNegV9MFzEc5qxKL9gVRk6L/SGlickkzZpmgR3tFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KWM1Qm7tPb2BE+L+/OWvQ8GszWLYMJtsXHc6Dzp1c4AsqZAhO8W7cKet+MPiEfc6I mECiu0tyQujq6LgtOW7Bp4chpb2IgLNehUEL73kw/dU4XddeMlVIiXF1pUdw8Ysjj/ 3g0b9RspnxcZUtQHL/55N9nn4pbYXMqAlXNwvEYg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387778AbfA1RIE (ORCPT ); Mon, 28 Jan 2019 12:08:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:40756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733171AbfA1QMb (ORCPT ); Mon, 28 Jan 2019 11:12:31 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 055D32148E; Mon, 28 Jan 2019 16:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691951; bh=wqXNegV9MFzEc5qxKL9gVRk6L/SGlickkzZpmgR3tFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y2v6PnTtUMIsKWyK63wXTzJZrGLeondOpTYf2G+AK/z03EtUgIm+xvv1sdkqGMo8/ 4w4hk5zgZEV3VfCGFi6yVgCYTdyRRwewFoRo70hm6mF+6NvepEPP0hKJMuH4C7VerH mJjuE5mRMju5UYphqSrnNc1k/LeETHTJU5yjuzoo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yufen Wang , Russell King , Sasha Levin Subject: [PATCH AUTOSEL 4.14 012/170] ARM: 8808/1: kexec:offline panic_smp_self_stop CPU Date: Mon, 28 Jan 2019 11:09:22 -0500 Message-Id: <20190128161200.55107-12-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128161200.55107-1-sashal@kernel.org> References: <20190128161200.55107-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yufen Wang [ Upstream commit 82c08c3e7f171aa7f579b231d0abbc1d62e91974 ] In case panic() and panic() called at the same time on different CPUS. For example: CPU 0: panic() __crash_kexec machine_crash_shutdown crash_smp_send_stop machine_kexec BUG_ON(num_online_cpus() > 1); CPU 1: panic() local_irq_disable panic_smp_self_stop If CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop(), kdump fails. CPU1 can't receive the ipi irq, CPU1 will be always online. To fix this problem, this patch split out the panic_smp_self_stop() and add set_cpu_online(smp_processor_id(), false). Signed-off-by: Yufen Wang Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/kernel/smp.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index e61af0600133..5e31c62127a0 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -691,6 +691,21 @@ void smp_send_stop(void) pr_warn("SMP: failed to stop secondary CPUs\n"); } +/* In case panic() and panic() called at the same time on CPU1 and CPU2, + * and CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop() + * CPU1 can't receive the ipi irqs from CPU2, CPU1 will be always online, + * kdump fails. So split out the panic_smp_self_stop() and add + * set_cpu_online(smp_processor_id(), false). + */ +void panic_smp_self_stop(void) +{ + pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n", + smp_processor_id()); + set_cpu_online(smp_processor_id(), false); + while (1) + cpu_relax(); +} + /* * not supported here */ -- 2.19.1