x86 kdump: extract kdump-specific code from crash_nmi_callback()
Impact: cleanup The NMI CPU-halting code will be used on non-kdump cases, also (e.g. emergency_reboot when virtualization is enabled). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
eb42c75878
commit
a7d41820f6
@@ -35,19 +35,34 @@ static int crashing_cpu;
|
|||||||
#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
|
#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
|
||||||
static atomic_t waiting_for_crash_ipi;
|
static atomic_t waiting_for_crash_ipi;
|
||||||
|
|
||||||
static int crash_nmi_callback(struct notifier_block *self,
|
static void kdump_nmi_callback(int cpu, struct die_args *args)
|
||||||
unsigned long val, void *data)
|
|
||||||
{
|
{
|
||||||
struct pt_regs *regs;
|
struct pt_regs *regs;
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
struct pt_regs fixed_regs;
|
struct pt_regs fixed_regs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
regs = args->regs;
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
|
if (!user_mode_vm(regs)) {
|
||||||
|
crash_fixup_ss_esp(&fixed_regs, regs);
|
||||||
|
regs = &fixed_regs;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
crash_save_cpu(regs, cpu);
|
||||||
|
|
||||||
|
disable_local_APIC();
|
||||||
|
}
|
||||||
|
|
||||||
|
static int crash_nmi_callback(struct notifier_block *self,
|
||||||
|
unsigned long val, void *data)
|
||||||
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
if (val != DIE_NMI_IPI)
|
if (val != DIE_NMI_IPI)
|
||||||
return NOTIFY_OK;
|
return NOTIFY_OK;
|
||||||
|
|
||||||
regs = ((struct die_args *)data)->regs;
|
|
||||||
cpu = raw_smp_processor_id();
|
cpu = raw_smp_processor_id();
|
||||||
|
|
||||||
/* Don't do anything if this handler is invoked on crashing cpu.
|
/* Don't do anything if this handler is invoked on crashing cpu.
|
||||||
@@ -58,14 +73,8 @@ static int crash_nmi_callback(struct notifier_block *self,
|
|||||||
return NOTIFY_STOP;
|
return NOTIFY_STOP;
|
||||||
local_irq_disable();
|
local_irq_disable();
|
||||||
|
|
||||||
#ifdef CONFIG_X86_32
|
kdump_nmi_callback(cpu, (struct die_args *)data);
|
||||||
if (!user_mode_vm(regs)) {
|
|
||||||
crash_fixup_ss_esp(&fixed_regs, regs);
|
|
||||||
regs = &fixed_regs;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
crash_save_cpu(regs, cpu);
|
|
||||||
disable_local_APIC();
|
|
||||||
atomic_dec(&waiting_for_crash_ipi);
|
atomic_dec(&waiting_for_crash_ipi);
|
||||||
/* Assume hlt works */
|
/* Assume hlt works */
|
||||||
halt();
|
halt();
|
||||||
|
Reference in New Issue
Block a user