public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: Baoquan He <bhe@redhat.com>
Cc: hpa@linux.intel.com, kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org, vgoyal@redhat.com, bp@alien8.de,
	ebiederm@xmission.com, akpm@linux-foundation.org,
	fengguang.wu@intel.com, jingbai.ma@hp.com
Subject: Re: [PATCH v4 0/3] x86, apic, kexec: Add disable_cpu_apic kernel parameter
Date: Wed, 30 Oct 2013 18:48:52 +0900	[thread overview]
Message-ID: <5270D604.9020409@jp.fujitsu.com> (raw)
In-Reply-To: <20131030060643.GA24866@dhcp-16-105.nay.redhat.com>

(2013/10/30 15:06), Baoquan He wrote:
> On 10/30/13 at 09:44am, HATAYAMA Daisuke wrote:
>> (2013/10/29 23:21), Baoquan He wrote:
>>> Hi,
>>>
>>> I am reviewing this patchset, and found there's a cpu0 hotplug feature
>>> posted by intel which we can borrow an idea from. In that implementation,
>>> CPU0 is waken up by nmi not INIT to avoid the realmode bootstrap code
>>> execution. I tried it by below patch which includes one line of change.
>>>
>>> By console printing, I got the boot cpu is always 0(namely cpu=0),
>>> however the apicid related to each processor keeps the same as in 1st
>>> kernel. In my HP Z420 machine, the apicid for BSP is 0, so I just make a
>>> test patch which depends on the fact that apicid for BSP is 0. Maybe
>>> generally the apicid for BSP can't be guaranteed, then passing it from
>>> 1st kernel to 2nd kernel in cmdline is very helpful, just as you have
>>> done for disable_cpu_apic.
>>>
>>> On my HP z420, I add nr_cpus=4 in /etc/sysconfig/kdump, and then execute
>>> below command, then 3 APs (1 boot cpu and 2 AP) can be waken up
>>> correctly, but BSP failed because NMI received for unknown reason 21 on
>>> CPU0. I think I need further check why BSP failed to wake up by nmi. But
>>> 3 processors are brought up successfully and kdump is successful too.
>>>
>>> sudo taskset -c 1 sh -c "echo c >/proc/sysrq-trigger"
>>>
>>> [    0.296831] smpboot: Booting Node   0, Processors  #   1
>>> [    0.302095]
>>> *****************************************************cpu=1, apicid=0, wakeup_cpu_via_init_nmi
>>> [    0.311942] cpu=1, apicid=0, register_nmi_handlercpu=1, apicid=0, wakeup_secondary_cpu_via_nmi
>>> [    0.320826] Uhhuh. NMI received for unknown reason 21 on CPU 0.
>>> [    0.327129] Do you have a strange power saving mode enabled?
>>> [    0.333858] Dazed and confused, but trying to continue
>>> [    0.339290] cpu=1, apicid=0, wakeup_cpu_via_init_nmi
>>> [    2.409099] Uhhuh. NMI received for unknown reason 21 on CPU 0.
>>> [    2.415393] Do you have a strange power saving mode enabled?
>>> [    2.421142] Dazed and confused, but trying to continue
>>> [    5.379519] smpboot: CPU1: Not responding
>>> [    5.383692] NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.
>>>
>>
>> We've already discussed this approach and concluded this is not applicable
>> to our issue.
>> Follow http://lists.infradead.org/pipermail/kexec/2012-October/006905.html.
>>
>> The reason is:
>>
>> - The cpu0-hotplugging approach assumes BSP to be halting before initiating
>>    NMI to it while in our case, BSP is halting in the 1st kernel or is
>>    running in arbitrary position of the 1st kernel in catastrophic state.
>>
>> - In general, NMI modifies stack, which means if throwing NMI to the BSP
>>    in the 1st kernel, stack on the 1st kernel is modified. It's unpermissible
>>    from kdump's perspective.
>
> Hi HATAYAMA,
>
> All right. I didn't think of the stack issues NMI will bring. In fact
> without this NMI stack problem, using CPU0 Hotplug as a base and sending
> nmi to bsp will be good, because BSP failure can be acceptable, then
> (N-1)cpus can be used. Later on if possible the contexts modifying can
> be changed to let BSP wake up correctly. After all, from the user's
> point of view, multiple cpus can be waken up, why not waking up all cpus
> including BSP.
>
> Anyway, this issue has been discussed so long time, and it will be great
> to run multiple cpus in 2nd kernel. This evolution may be like CPU0 Hotplug,
> they let cpus except of BSP hot plug available, then hanle the last cpu -
> the BSP finally. From this perspective, I like your patch and hope it
> can be merged asap.
>

Considering again, I'm now beginning with thinking that making CPU halting
in the 1st kernel to execute the 2nd kernel's NMI handler is impossible.

The address of IDT is saved in IDTR and this is a per-cpu register, and
value of IDTR in the 2nd kernel and the one in the 1st kernel are different.
In other words, to wake up BSP from 2nd kernel using NMI, it's necessary to
tell the address of IDTR in the 2nd kernel to the BSP halting in the 1st
kernel.

-- 
Thanks.
HATAYAMA, Daisuke


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2013-10-30  9:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 15:01 [PATCH v4 0/3] x86, apic, kexec: Add disable_cpu_apic kernel parameter HATAYAMA Daisuke
2013-10-22 15:01 ` [PATCH v4 1/3] x86, apic: Don't count the CPU with BP flag from MP table as booting-up CPU HATAYAMA Daisuke
2013-11-08 16:08   ` Vivek Goyal
2013-11-11  2:52     ` HATAYAMA Daisuke
2013-11-11 16:52       ` Vivek Goyal
2013-11-12  0:40         ` HATAYAMA Daisuke
2013-11-12  9:58           ` HATAYAMA Daisuke
2013-10-22 15:01 ` [PATCH v4 2/3] x86, apic: Add disable_cpu_apicid kernel parameter HATAYAMA Daisuke
2013-10-22 15:01 ` [PATCH v4 3/3] Documentation, x86, apic, kexec: " HATAYAMA Daisuke
     [not found] ` <20131022220803.GA32387@anatevka.fc.hp.com>
2013-10-23  0:05   ` [PATCH v4 0/3] x86, apic, kexec: Add disable_cpu_apic " HATAYAMA Daisuke
2013-10-23 15:51     ` Vivek Goyal
2013-10-24  1:42       ` HATAYAMA Daisuke
2013-10-25 11:05         ` Petr Tesarik
2013-10-29  0:53           ` HATAYAMA Daisuke
2013-10-29  7:39             ` Petr Tesarik
2013-10-24  5:50       ` Eric W. Biederman
     [not found]     ` <20131031005812.GA15459@anatevka.fc.hp.com>
2013-10-31  4:43       ` HATAYAMA Daisuke
2013-10-31 13:27       ` Vivek Goyal
2013-11-01  0:31         ` Simon Horman
2013-11-04  7:08         ` HATAYAMA Daisuke
2013-10-29 14:21 ` Baoquan He
2013-10-30  0:44   ` HATAYAMA Daisuke
2013-10-30  6:06     ` Baoquan He
2013-10-30  9:48       ` HATAYAMA Daisuke [this message]
2013-10-30 15:27   ` Baoquan He
2013-11-08  3:30 ` Baoquan He
2013-11-08  4:13   ` HATAYAMA Daisuke
     [not found] ` <20131106190232.GA28119@anatevka.fc.hp.com>
2013-11-11  4:49   ` HATAYAMA Daisuke

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=5270D604.9020409@jp.fujitsu.com \
    --to=d.hatayama@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=ebiederm@xmission.com \
    --cc=fengguang.wu@intel.com \
    --cc=hpa@linux.intel.com \
    --cc=jingbai.ma@hp.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@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