mirror of
https://github.com/torvalds/linux.git
synced 2024-11-07 12:41:55 +00:00
9c48f1c629
Just convert all the files that have an nmi handler to the new routines. Most of it is straight forward conversion. A couple of places needed some tweaking like kgdb which separates the debug notifier from the nmi handler and mce removes a call to notify_die. [Thanks to Ying for finding out the history behind that mce call https://lkml.org/lkml/2010/5/27/114 And Boris responding that he would like to remove that call because of it https://lkml.org/lkml/2011/9/21/163] The things that get converted are the registeration/unregistration routines and the nmi handler itself has its args changed along with code removal to check which list it is on (most are on one NMI list except for kgdb which has both an NMI routine and an NMI Unknown routine). Signed-off-by: Don Zickus <dzickus@redhat.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Corey Minyard <minyard@acm.org> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Robert Richter <robert.richter@amd.com> Cc: Huang Ying <ying.huang@intel.com> Cc: Corey Minyard <minyard@acm.org> Cc: Jack Steiner <steiner@sgi.com> Link: http://lkml.kernel.org/r/1317409584-23662-4-git-send-email-dzickus@redhat.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
107 lines
2.3 KiB
C
107 lines
2.3 KiB
C
/*
|
|
* Architecture specific (i386/x86_64) functions for kexec based crash dumps.
|
|
*
|
|
* Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
|
|
*
|
|
* Copyright (C) IBM Corporation, 2004. All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/types.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/reboot.h>
|
|
#include <linux/kexec.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/elf.h>
|
|
#include <linux/elfcore.h>
|
|
|
|
#include <asm/processor.h>
|
|
#include <asm/hardirq.h>
|
|
#include <asm/nmi.h>
|
|
#include <asm/hw_irq.h>
|
|
#include <asm/apic.h>
|
|
#include <asm/hpet.h>
|
|
#include <linux/kdebug.h>
|
|
#include <asm/cpu.h>
|
|
#include <asm/reboot.h>
|
|
#include <asm/virtext.h>
|
|
|
|
int in_crash_kexec;
|
|
|
|
#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
|
|
|
|
static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
|
|
{
|
|
#ifdef CONFIG_X86_32
|
|
struct pt_regs fixed_regs;
|
|
#endif
|
|
|
|
#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 VMX or SVM if needed.
|
|
*
|
|
* We need to disable virtualization on all CPUs.
|
|
* Having VMX or SVM enabled on any CPU may break rebooting
|
|
* after the kdump kernel has finished its task.
|
|
*/
|
|
cpu_emergency_vmxoff();
|
|
cpu_emergency_svm_disable();
|
|
|
|
disable_local_APIC();
|
|
}
|
|
|
|
static void kdump_nmi_shootdown_cpus(void)
|
|
{
|
|
in_crash_kexec = 1;
|
|
nmi_shootdown_cpus(kdump_nmi_callback);
|
|
|
|
disable_local_APIC();
|
|
}
|
|
|
|
#else
|
|
static void kdump_nmi_shootdown_cpus(void)
|
|
{
|
|
/* There are no cpus to shootdown */
|
|
}
|
|
#endif
|
|
|
|
void native_machine_crash_shutdown(struct pt_regs *regs)
|
|
{
|
|
/* This function is only called after the system
|
|
* has panicked or is otherwise in a critical state.
|
|
* The minimum amount of code to allow a kexec'd kernel
|
|
* to run successfully needs to happen here.
|
|
*
|
|
* In practice this means shooting down the other cpus in
|
|
* an SMP system.
|
|
*/
|
|
/* The kernel is broken so disable interrupts */
|
|
local_irq_disable();
|
|
|
|
kdump_nmi_shootdown_cpus();
|
|
|
|
/* Booting kdump kernel with VMX or SVM enabled won't work,
|
|
* because (among other limitations) we can't disable paging
|
|
* with the virt flags.
|
|
*/
|
|
cpu_emergency_vmxoff();
|
|
cpu_emergency_svm_disable();
|
|
|
|
lapic_shutdown();
|
|
#if defined(CONFIG_X86_IO_APIC)
|
|
disable_IO_APIC();
|
|
#endif
|
|
#ifdef CONFIG_HPET_TIMER
|
|
hpet_disable();
|
|
#endif
|
|
crash_save_cpu(regs, safe_smp_processor_id());
|
|
}
|