linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Corey Minyard <cminyard@mvista.com>
To: "河合英宏 / KAWAI,HIDEHIRO" <hidehiro.kawai.ez@hitachi.com>,
	"Dave Young" <dyoung@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Baoquan He <bhe@redhat.com>, Ralf Baechle <ralf@linux-mips.org>,
	"x86@kernel.org" <x86@kernel.org>,
	David Daney <david.daney@cavium.com>,
	Xunlei Pang <xpang@redhat.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>,
	"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"Steven J. Hill" <steven.hill@cavium.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Daniel Walker <dwalker@fifo99.com>,
	Vivek Goyal <vgoyal@redhat.com>
Subject: Re: [V4 PATCH 2/2] mips/panic: Replace smp_send_stop() with kdump friendly version in panic path
Date: Mon, 15 Aug 2016 12:06:50 -0500	[thread overview]
Message-ID: <a618ef9b-25d5-da8b-6829-ce124b76033e@mvista.com> (raw)
In-Reply-To: <04EAB7311EE43145B2D3536183D1A84454CBBB00@GSjpTKYDCembx31.service.hitachi.net>

On 08/15/2016 06:35 AM, 河合英宏 / KAWAI,HIDEHIRO wrote:
> 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.

Ok, if the code can only be entered once, what's the purpose of 
cpus_stopped?
I guess that's what confused me.  You are right, the panic_cpu atomic should
keep this on a single CPU.

Also, panic() will call panic_smp_self_stop() if it finds another CPU 
has already
called panic, which will just spin with interrupts off by default. I 
didn't see a
definition for it in MIPS, wouldn't it need to be overridden to avoid a 
deadlock?

-corey

>
> Best regards,
>
> Hidehiro Kawai
>

  reply	other threads:[~2016-08-15 17:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10  8:09 [V4 PATCH 0/2] kexec: crash_kexec_post_notifiers boot option related fixes Hidehiro Kawai
2016-08-10  8:09 ` [V4 PATCH 1/2] x86/panic: Replace smp_send_stop() with kdump friendly version in panic path Hidehiro Kawai
2016-08-12  3:16   ` Dave Young
2016-08-15 11:22     ` 河合英宏 / KAWAI,HIDEHIRO
2016-09-20  7:40       ` Xunlei Pang
2016-09-20  8:53         ` 河合英宏 / KAWAI,HIDEHIRO
2016-09-20 11:22           ` 河合英宏 / KAWAI,HIDEHIRO
2016-09-22  1:53             ` 'Dave Young'
2016-08-10  8:09 ` [V4 PATCH 2/2] mips/panic: " Hidehiro Kawai
2016-08-12  3:17   ` Dave Young
2016-08-12 13:55     ` Corey Minyard
2016-08-15 11:35       ` 河合英宏 / KAWAI,HIDEHIRO
2016-08-15 17:06         ` Corey Minyard [this message]
2016-08-15 18:01           ` Corey Minyard
2016-08-16 10:29             ` 河合英宏 / KAWAI,HIDEHIRO
2016-08-18 21:18   ` Corey Minyard
2016-09-20 11:37     ` 河合英宏 / KAWAI,HIDEHIRO

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a618ef9b-25d5-da8b-6829-ce124b76033e@mvista.com \
    --to=cminyard@mvista.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=d.hatayama@jp.fujitsu.com \
    --cc=david.daney@cavium.com \
    --cc=dwalker@fifo99.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mhiramat@kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=steven.hill@cavium.com \
    --cc=vgoyal@redhat.com \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xpang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).