Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2649222imj; Mon, 11 Feb 2019 06:27:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IZnNWtrdOvnniV2i8f4Aie6ZFRyklRZgYCiD4OF91VSrdxf9EZccaYDYnAyJkSu/N7YqebJ X-Received: by 2002:a62:44d8:: with SMTP id m85mr37340545pfi.164.1549895255753; Mon, 11 Feb 2019 06:27:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895255; cv=none; d=google.com; s=arc-20160816; b=EeQDlCxMW1j6LJbK0eD05j2pLgKdzOjpu3BIHuqkMCm61zFVR5gIdzrlP5GWq0UD3g 2dYBoyva39FsB3flnl0PsEHs4c5fEGlUGs09d3fdSXilmtIkHI87xUZOJEhxRcqjH83h DfH8+DZNBd8wIHr1vo5hvXg4L7MZg3oxGVXG8HYM8ulsGkUJ//Rk5epq65RMYsXffPVx 7w730vubfPjfrlxjON+ff8B6AVs9HbzYs+KE55fy2f2eRbsNRDrfXUIYpic7G4zMOSAj qh6BaoXj3M15JGQ0URUlxBGfad9TF5bmbVPCMd3g1fKNrfcgVyye0mE4XrGeneZgYCTy iakA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MiosbnoZqSVnJlLQQIg4ApF/jJOdyahkiaGwmnRr49s=; b=0h/WX/D0Owfe6JynWkSn85d53Hwo0H18beMqSScl+qJha7mEh4+h98qYnkcTeQWd7l 9Q2HyYjmSc18U+3fKy+4hbSbdiPjCuFuzMgVCQ/ufRVFF4ClvcqEQTuInJKJXKaWDvCp zTYuH6/Izhlmt/1dMukAhgO9Pk5PpOXdkcnuCcCTthgPtr/S2PJex7o4iOGo5ojEiqTm cyZgkgswP0fy2mOgXfHOAeZTWvY9+uN7cOhVITSk4XDglabaOyMXvDD3y/dsvxLpr0Bw HMNT+3lLgaJ2BBwGuxPKwabM0PtPoiNMVB8HBTiwxHtbRSjkyrNr2uD+Od93zEjoYcVO xVFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZeFyWGJP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2si6475707pfe.111.2019.02.11.06.27.19; Mon, 11 Feb 2019 06:27:35 -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=ZeFyWGJP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728531AbfBKOVb (ORCPT + 99 others); Mon, 11 Feb 2019 09:21:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:54290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728518AbfBKOV1 (ORCPT ); Mon, 11 Feb 2019 09:21:27 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 75B9C20838; Mon, 11 Feb 2019 14:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894887; bh=Z8KCZZZgIz0jbVHoQKS4FkjQCfy6jg6H/66lPTKxOvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZeFyWGJPWXjYXwUr+54LCGs0elsCOGY25i5qwR3B+tMLqdYmlJqs70Ozd0yY4cFjO 1E0oM7DpbHKIWH9/5/dVPCHuXkTzTa5v+iFT1CNJFtjhkxLWl3MzEY9BEiGzJYM8Jx xkZsH7SF2L+INQm72rF8wgbTlX1RHvYH2rPlrYlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yufen Wang , Russell King , Sasha Levin Subject: [PATCH 4.20 022/352] ARM: 8808/1: kexec:offline panic_smp_self_stop CPU Date: Mon, 11 Feb 2019 15:14:09 +0100 Message-Id: <20190211141847.769777968@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 12a6172263c0..3bf82232b1be 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -724,6 +724,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