Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3687398imm; Mon, 18 Jun 2018 02:17:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKHl+wbuWdw1Hv4DscVnRQmucBgnpfbkH4oQs/HyRijtie0CYaRG5X+2yij7OYFnO7Qhwf8 X-Received: by 2002:aa7:80cf:: with SMTP id a15-v6mr12557907pfn.19.1529313475172; Mon, 18 Jun 2018 02:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529313475; cv=none; d=google.com; s=arc-20160816; b=pTq1yXEkmxrkzttf14HDCqGIKOAb+NzYxZGZiGjafa4uKZ/X3qcGmbcBLrH0rBMXkJ hu4ruKaMXOtxXsC++ZPfk3NKvh/8pMwZIO7h3pJj84B2+RL6YxYCe8Q731YHKKwwws7L t2xs1gfYY7h7D5hBmii3LnyINpycbF2LGR/YOPtI8km8Lm7xnHi9z08gmLnxEJt3TNbA RIkHG4vIWyCAwUhfPA9ZNTggdCgfGbCbmiHow4chRVEagfI3TxiZlyXqLOE6ek/goyd4 qRmOXBNk0kQJ/JWhQAPwuOX303KxDlJdlMXDYvl/4npE0YXF5dzFHSnn24MVGu/mxmYt EoJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=b/353yGkq1jIVHJChpMm4iWKGER4fJtUXK78rSlerNk=; b=iGbq3fGXEOMcxYlVRgor4YNf7lzdP3fmqayuqTOCyyNB7w/GbpE1Nr4UcYkNoG/FaB BVa9OKzGAuQM8I/u++tIl9WxGEvXw6Ps0bx4q0YuWj7l7P5BD9dcXnUSLH++ZC50R1iQ NZ4Vu4QQQ0WUMF39xjxZ97mIsIzF17YO+EN9F15vTO+kZbf70FAqSvnPABUpZ32gDFHq i4yDVi7Q/7w8Irmy2ea9RSFJ2kQHMRXyS5RW9sRoJPQk3F9a4t3RrP+N+LTiuNSbYIhq IuSZErxduT5v3eGC2yNCZANFNf+BWneyawyEEUzTwG2gPXpiFic7PFI7xP/hFdTlPpfF fFYg== ARC-Authentication-Results: i=1; mx.google.com; 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 p2-v6si11658314pgs.67.2018.06.18.02.17.41; Mon, 18 Jun 2018 02:17:55 -0700 (PDT) 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; 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 S966740AbeFRJRG (ORCPT + 99 others); Mon, 18 Jun 2018 05:17:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59162 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966613AbeFRI2W (ORCPT ); Mon, 18 Jun 2018 04:28:22 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 11857D1E; Mon, 18 Jun 2018 08:28:21 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Sasha Levin Subject: [PATCH 4.16 277/279] ARM: kexec: fix kdump register saving on panic() Date: Mon, 18 Jun 2018 10:14:22 +0200 Message-Id: <20180618080620.133552872@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618080608.851973560@linuxfoundation.org> References: <20180618080608.851973560@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Russell King [ Upstream commit 2d7b3c64431245c95b05a441669c074da10db943 ] When a panic() occurs, the kexec code uses smp_send_stop() to stop the other CPUs, but this results in the CPU register state not being saved, and gdb is unable to inspect the state of other CPUs. Commit 0ee59413c967 ("x86/panic: replace smp_send_stop() with kdump friendly version in panic path") addressed the issue on x86, but ignored other architectures. Address the issue on ARM by splitting out the crash stop implementation to crash_smp_send_stop() and adding the necessary protection. Signed-off-by: Russell King Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/arm/kernel/machine_kexec.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c @@ -95,6 +95,27 @@ void machine_crash_nonpanic_core(void *u cpu_relax(); } +void crash_smp_send_stop(void) +{ + static int cpus_stopped; + unsigned long msecs; + + if (cpus_stopped) + return; + + atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); + smp_call_function(machine_crash_nonpanic_core, NULL, false); + msecs = 1000; /* Wait at most a second for the other cpus to stop */ + while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { + mdelay(1); + msecs--; + } + if (atomic_read(&waiting_for_crash_ipi) > 0) + pr_warn("Non-crashing CPUs did not react to IPI\n"); + + cpus_stopped = 1; +} + static void machine_kexec_mask_interrupts(void) { unsigned int i; @@ -120,19 +141,8 @@ static void machine_kexec_mask_interrupt void machine_crash_shutdown(struct pt_regs *regs) { - unsigned long msecs; - local_irq_disable(); - - atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); - smp_call_function(machine_crash_nonpanic_core, NULL, false); - msecs = 1000; /* Wait at most a second for the other cpus to stop */ - while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { - mdelay(1); - msecs--; - } - if (atomic_read(&waiting_for_crash_ipi) > 0) - pr_warn("Non-crashing CPUs did not react to IPI\n"); + crash_smp_send_stop(); crash_save_cpu(regs, smp_processor_id()); machine_kexec_mask_interrupts();