Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3711797imu; Mon, 28 Jan 2019 09:27:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN6AexUbZJT9hjZYTrW1JD4UnSimurFjZnUo57qLxIHtk402vA9evSLtbiasaK/4nUii1NE8 X-Received: by 2002:a63:5026:: with SMTP id e38mr20656311pgb.123.1548696438711; Mon, 28 Jan 2019 09:27:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696438; cv=none; d=google.com; s=arc-20160816; b=gXU3VnnUwiz0RaBfHz9iit5/ArSALMKYA/nThLCPP4tzGYe3/JvKxgliRIfeB7K98O MvTZsMy5mOLO2G5NqD5rC4FT8G5wCrmWUfPEtZtjDDkY8Hv+n2kD3zvKwGQKObKWJqv3 6BZO96GbE6NA2oLhrfEkV3Ms8WPWXq349b/7Q1h3jEgOVgMA6R0osCGp9ASRxWs3bnLR 8/UuZdMEh1U2jEdxW2DM6QJNwYbFeWRneVCM+wC9bnXWmqa9Nv3LjFD5i7azBYIblSK/ S6gdS8LCZ4j56hbc9S3mnh+ukAua9dhjttAQXIWOugPaplmG9G0Nli7Nm5nVd2xZPGN4 P5NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tb3hL4s6hGwsMwapCwZxJ7+Vm3EP2mNr8FnwCZBSEWk=; b=TsM/rrVL/onBZjUud/Tb8N0jrSkk48RF3Mp9NwhAesh3DfT7IJ1QJWsEFsiMpffvmx V0qIPMmdvfDY4pYr3c+ubkzzM5kgvGyf3OG84LGfpVwmrXLLVD6eW7NCKLsz16FLae5s Hc3W/3aPRIhE7PrKxC83dppubWpxx+G6++I+JTL133B+GB9OcVeYOMmgYKRpWm1EgkAe 7z0MHAkGW/k3lCSI/9bHxXO4Yoh+ECIYRmCwX5WgVKwvCDg0+64+I4YHjtkCm2YI5NYB bub053TtBjjKek7/PEopT5CHiM64CCHovPLlnEJCw+Zl7cv05QE7Elv0O5FgeSTVYKLS ZumA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hDgRWPSr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j191si12219242pgd.31.2019.01.28.09.27.03; Mon, 28 Jan 2019 09:27:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hDgRWPSr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730773AbfA1QAX (ORCPT + 99 others); Mon, 28 Jan 2019 11:00:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:45600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730754AbfA1QAT (ORCPT ); Mon, 28 Jan 2019 11:00:19 -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 49C752175B; Mon, 28 Jan 2019 16:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691218; bh=GuOmRTVYwAQZrQq3J55a/M6SPcFuQ7wUl5h9OT9pTzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDgRWPSro4HCppdxP4p9LVkHR1Oya5Dkv44NbKC92RlEZYhm2UIPSQYNQv9VFpOxl 7uUB5iuOb3/PiXuZt1/EPooRpy9xnKweKc1jdQ2G66zrJCDIZtJOKw3XgwNP1s46tn QexIJoQ6c8bYUhSrAlzgDvFNQJKDNDKvFdSNdLG0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yufen Wang , Russell King , Sasha Levin Subject: [PATCH AUTOSEL 4.19 019/258] ARM: 8808/1: kexec:offline panic_smp_self_stop CPU Date: Mon, 28 Jan 2019 10:55:25 -0500 Message-Id: <20190128155924.51521-19-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-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 0978282d5fc2..f574a5e0d589 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -693,6 +693,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