From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, ebiederm@xmission.com, vgoyal@redhat.com, kumagai-atsushi@mxc.nes.nec.co.jp Subject: [PATCH 2/2] Enter 2nd kernel with BSP Date: Mon, 16 Apr 2012 11:21:39 +0900 [thread overview] Message-ID: <20120416022139.9303.56284.stgit@localhost6.localdomain6> (raw) In-Reply-To: <20120416021951.9303.58568.stgit@localhost6.localdomain6> Split logic into BSP's and AP's: BSP waits for AP halting. Don't remove variable crashing_cpu for debugging use; useful for determining one what CPU crash happens. Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> --- arch/x86/kernel/crash.c | 15 ++++++++++++++- arch/x86/kernel/reboot.c | 16 ++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 13ad899..c5c19fa 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -83,9 +83,14 @@ void native_machine_crash_shutdown(struct pt_regs *regs) * In practice this means shooting down the other cpus in * an SMP system. */ + + int cpu; + /* The kernel is broken so disable interrupts */ local_irq_disable(); + crash_ipi_init(); + kdump_nmi_shootdown_cpus(); /* Booting kdump kernel with VMX or SVM enabled won't work, @@ -102,5 +107,13 @@ void native_machine_crash_shutdown(struct pt_regs *regs) #ifdef CONFIG_HPET_TIMER hpet_disable(); #endif - crash_save_cpu(regs, safe_smp_processor_id()); + cpu = safe_smp_processor_id(); + crash_save_cpu(regs, cpu); + + if (cpu_physical_id(cpu) == boot_cpu_physical_apicid) { + crash_ipi_wait_for_APs(); + return; + } + + crash_ipi_dec_and_halt(); } diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 6dd77a8..90354f9 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -7,6 +7,7 @@ #include <linux/sched.h> #include <linux/tboot.h> #include <linux/delay.h> +#include <linux/kexec.h> #include <acpi/reboot.h> #include <asm/io.h> #include <asm/apic.h> @@ -800,16 +801,15 @@ static int crash_nmi_callback(unsigned int val, struct pt_regs *regs) cpu = raw_smp_processor_id(); - /* Don't do anything if this handler is invoked on crashing cpu. - * Otherwise, system will completely hang. Crashing cpu can get - * an NMI if system was initially booted with nmi_watchdog parameter. - */ - if (cpu == crashing_cpu) - return NMI_HANDLED; local_irq_disable(); shootdown_callback(cpu, regs); + if (cpu_physical_id(cpu) == boot_cpu_physical_apicid) { + crash_ipi_wait_for_APs(); + machine_kexec(kexec_crash_image); + } + crash_ipi_dec_and_halt(); return NMI_HANDLED; @@ -835,8 +835,6 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback) shootdown_callback = callback; - crash_ipi_init(); - /* Would it be better to replace the trap vector here? */ if (register_nmi_handler(NMI_LOCAL, crash_nmi_callback, NMI_FLAG_FIRST, "crash")) @@ -848,8 +846,6 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback) smp_send_nmi_allbutself(); - crash_ipi_wait_for_APs(); - /* Leave the nmi callback set */ } #else /* !CONFIG_SMP */
WARNING: multiple messages have this Message-ID (diff)
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, ebiederm@xmission.com, vgoyal@redhat.com, kumagai-atsushi@mxc.nes.nec.co.jp Subject: [PATCH 2/2] Enter 2nd kernel with BSP Date: Mon, 16 Apr 2012 11:21:39 +0900 [thread overview] Message-ID: <20120416022139.9303.56284.stgit@localhost6.localdomain6> (raw) In-Reply-To: <20120416021951.9303.58568.stgit@localhost6.localdomain6> Split logic into BSP's and AP's: BSP waits for AP halting. Don't remove variable crashing_cpu for debugging use; useful for determining one what CPU crash happens. Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> --- arch/x86/kernel/crash.c | 15 ++++++++++++++- arch/x86/kernel/reboot.c | 16 ++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 13ad899..c5c19fa 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -83,9 +83,14 @@ void native_machine_crash_shutdown(struct pt_regs *regs) * In practice this means shooting down the other cpus in * an SMP system. */ + + int cpu; + /* The kernel is broken so disable interrupts */ local_irq_disable(); + crash_ipi_init(); + kdump_nmi_shootdown_cpus(); /* Booting kdump kernel with VMX or SVM enabled won't work, @@ -102,5 +107,13 @@ void native_machine_crash_shutdown(struct pt_regs *regs) #ifdef CONFIG_HPET_TIMER hpet_disable(); #endif - crash_save_cpu(regs, safe_smp_processor_id()); + cpu = safe_smp_processor_id(); + crash_save_cpu(regs, cpu); + + if (cpu_physical_id(cpu) == boot_cpu_physical_apicid) { + crash_ipi_wait_for_APs(); + return; + } + + crash_ipi_dec_and_halt(); } diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 6dd77a8..90354f9 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -7,6 +7,7 @@ #include <linux/sched.h> #include <linux/tboot.h> #include <linux/delay.h> +#include <linux/kexec.h> #include <acpi/reboot.h> #include <asm/io.h> #include <asm/apic.h> @@ -800,16 +801,15 @@ static int crash_nmi_callback(unsigned int val, struct pt_regs *regs) cpu = raw_smp_processor_id(); - /* Don't do anything if this handler is invoked on crashing cpu. - * Otherwise, system will completely hang. Crashing cpu can get - * an NMI if system was initially booted with nmi_watchdog parameter. - */ - if (cpu == crashing_cpu) - return NMI_HANDLED; local_irq_disable(); shootdown_callback(cpu, regs); + if (cpu_physical_id(cpu) == boot_cpu_physical_apicid) { + crash_ipi_wait_for_APs(); + machine_kexec(kexec_crash_image); + } + crash_ipi_dec_and_halt(); return NMI_HANDLED; @@ -835,8 +835,6 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback) shootdown_callback = callback; - crash_ipi_init(); - /* Would it be better to replace the trap vector here? */ if (register_nmi_handler(NMI_LOCAL, crash_nmi_callback, NMI_FLAG_FIRST, "crash")) @@ -848,8 +846,6 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback) smp_send_nmi_allbutself(); - crash_ipi_wait_for_APs(); - /* Leave the nmi callback set */ } #else /* !CONFIG_SMP */ _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2012-04-16 2:22 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-04-16 2:21 [PATCH 0/2] kdump: Enter 2nd kernel with BSP for enabling multiple CPUs HATAYAMA Daisuke 2012-04-16 2:21 ` HATAYAMA Daisuke 2012-04-16 2:21 ` [PATCH 1/2] Introduce crash ipi helpers to wait for APs to stop HATAYAMA Daisuke 2012-04-16 2:21 ` HATAYAMA Daisuke 2012-04-16 2:21 ` HATAYAMA Daisuke [this message] 2012-04-16 2:21 ` [PATCH 2/2] Enter 2nd kernel with BSP HATAYAMA Daisuke 2012-04-23 10:46 ` Andi Kleen 2012-04-23 10:49 ` Andi Kleen 2012-04-24 2:05 ` HATAYAMA Daisuke 2012-04-24 3:04 ` Yu, Fenghua 2012-04-24 8:04 ` Andi Kleen 2012-04-24 10:46 ` Eric W. Biederman [not found] ` <beaa8ade-b7af-4e71-b4e0-a418ceb83f1e@email.android.com> 2012-04-16 6:40 ` [PATCH 0/2] kdump: Enter 2nd kernel with BSP for enabling multiple CPUs HATAYAMA Daisuke 2012-04-16 6:40 ` HATAYAMA Daisuke 2012-05-14 8:29 ` Cong Wang 2013-04-18 11:41 ` Petr Tesarik 2013-04-18 11:41 ` Petr Tesarik 2013-04-19 8:45 ` HATAYAMA Daisuke 2013-04-19 8:45 ` 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=20120416022139.9303.56284.stgit@localhost6.localdomain6 \ --to=d.hatayama@jp.fujitsu.com \ --cc=ebiederm@xmission.com \ --cc=kexec@lists.infradead.org \ --cc=kumagai-atsushi@mxc.nes.nec.co.jp \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.