From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752999AbcHOLhG (ORCPT ); Mon, 15 Aug 2016 07:37:06 -0400 Received: from mail7.hitachi.co.jp ([133.145.228.42]:39624 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752900AbcHOLhE (ORCPT ); Mon, 15 Aug 2016 07:37:04 -0400 From: =?utf-8?B?5rKz5ZCI6Iux5a6PIC8gS0FXQUnvvIxISURFSElSTw==?= To: "'Corey Minyard'" , Dave Young CC: Andrew Morton , "Eric W. Biederman" , Baoquan He , Ralf Baechle , "x86@kernel.org" , David Daney , Xunlei Pang , Aaro Koskinen , "kexec@lists.infradead.org" , "linux-kernel@vger.kernel.org" , HATAYAMA Daisuke , "linux-mips@linux-mips.org" , Masami Hiramatsu , "Steven J. Hill" , "xen-devel@lists.xenproject.org" , "Daniel Walker" , Vivek Goyal Subject: RE: Re: [V4 PATCH 2/2] mips/panic: Replace smp_send_stop() with kdump friendly version in panic path Thread-Topic: [!]Re: [V4 PATCH 2/2] mips/panic: Replace smp_send_stop() with kdump friendly version in panic path Thread-Index: AQHR9EgmyHF47/dCPk6LxnHx9PU55aBEwvyAgAUjD8A= Date: Mon, 15 Aug 2016 11:35:59 +0000 Deferred-Delivery: Mon, 15 Aug 2016 11:37:00 +0000 Message-ID: <04EAB7311EE43145B2D3536183D1A84454CBBB00@GSjpTKYDCembx31.service.hitachi.net> References: <20160810080946.11028.97686.stgit@sysi4-13.yrl.intra.hitachi.co.jp> <20160810080950.11028.28000.stgit@sysi4-13.yrl.intra.hitachi.co.jp> <20160812031755.GB2983@dhcp-128-65.nay.redhat.com> <57ADD55D.1050003@mvista.com> In-Reply-To: <57ADD55D.1050003@mvista.com> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.198.219.50] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u7FBbB50001189 Hi Corey, > From: Corey Minyard [mailto:cminyard@mvista.com] > Sent: Friday, August 12, 2016 10:56 PM > I'll try to test this, but I have one comment inline... Thank you very much! > On 08/11/2016 10:17 PM, Dave Young wrote: > > On 08/10/16 at 05:09pm, Hidehiro Kawai wrote: [snip] > >> diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c > >> index 610f0f3..1723b17 100644 > >> --- a/arch/mips/kernel/crash.c > >> +++ b/arch/mips/kernel/crash.c > >> @@ -47,9 +47,14 @@ static void crash_shutdown_secondary(void *passed_regs) > >> > >> static void crash_kexec_prepare_cpus(void) > >> { > >> + static int cpus_stopped; > >> unsigned int msecs; > >> + unsigned int ncpus; > >> > >> - unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ > >> + if (cpus_stopped) > >> + return; > > Wouldn't you want an atomic operation and some special handling here to > ensure that only one CPU does this? So if a CPU comes in here and > another CPU is already in the process stopping the CPUs it won't result in a > deadlock. Because this function can be called only one panicking CPU, there is no problem. There are two paths which crash_kexec_prepare_cpus is called. Path 1 (panic path): panic() crash_smp_send_stop() crash_kexec_prepare_cpus() Path 2 (oops path): crash_kexec() __crash_kexec() machine_crash_shutdown() default_machine_crash_shutdown() // for MIPS crash_kexec_prepare_cpus() Here, panic() and crash_kexec() run exclusively via panic_cpu atomic variable. So we can use cpus_stopped as normal variable. Best regards, Hidehiro Kawai