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.0 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=unavailable 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 3641DC169C4 for ; Mon, 11 Feb 2019 16:14:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1FFC21B1C for ; Mon, 11 Feb 2019 16:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549901668; bh=Z8KCZZZgIz0jbVHoQKS4FkjQCfy6jg6H/66lPTKxOvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pSOQRmgX98r+00gC6k8csk/4d6HsxHqmN3Ifst+bunCQGw1PINGSANH+UMxr1TYDJ Xf//9hT8Fzg3C35CKvhC/g7fc4lBqr2tE11BxeJoOnPjPGcW1FFsJeC6GkXvCKli+I Yy+lv0K7W4yBqzsnYQ/kKDQSqG7ydVFWZ3Bsto8c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727625AbfBKOVa (ORCPT ); Mon, 11 Feb 2019 09:21:30 -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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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