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,HEADER_FROM_DIFFERENT_DOMAINS,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 E56FDC10F01 for ; Mon, 18 Feb 2019 14:18:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B89E52177E for ; Mon, 18 Feb 2019 14:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550499519; bh=3TLcunzvaty7vMQCH5ezlUG7mPU8Lm6jjSxQoP33T8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AtHrjX602oLfWoOYPY3ZOa3AoMbaFSCKuakeOenMA4NqnQzOco+ma5WcegxkiCkwC CKURJ3V76kGVTAQgKSgZ2p6lB3ctBLq69bxzTDTl1NaRfgZG/21UkuNnIkdV963h2A T9KADDbkpxc9W0mjY5WCfrjcbq+g+y55X46AusOg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391000AbfBROIp (ORCPT ); Mon, 18 Feb 2019 09:08:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:52032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390093AbfBROIm (ORCPT ); Mon, 18 Feb 2019 09:08:42 -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 3B15D21901; Mon, 18 Feb 2019 14:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498921; bh=3TLcunzvaty7vMQCH5ezlUG7mPU8Lm6jjSxQoP33T8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RD6Fe4pMe8H4rlzXURj5EVYoXgTHLTxWgkFJZWhBTfU6aqfs6sY52eL0cCDE13a9C lrvJlDdWyCCFeAqRoaytAasfyknDjX8+rzNQ84xOSS2pNhfETN5Y3n3jj+luk6Oecj r0ZxVEA+UwohN8CAdAzNeKevvwBAiCqxdQ31kWUE= 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 3.18 002/108] ARM: 8808/1: kexec:offline panic_smp_self_stop CPU Date: Mon, 18 Feb 2019 14:42:58 +0100 Message-Id: <20190218133519.639416387@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133519.525507231@linuxfoundation.org> References: <20190218133519.525507231@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 3.18-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 a8e32aaf0383..bae65844ff03 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -658,6 +658,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