• Hidehiro Kawai's avatar
    x86/nmi: Save regs in crash dump on external NMI · b279d67d
    Hidehiro Kawai authored
    Now, multiple CPUs can receive an external NMI simultaneously by
    specifying the "apic_extnmi=all" command line parameter. When we take
    a crash dump by using external NMI with this option, we fail to save
    registers into the crash dump. This happens as follows:
      CPU 0                              CPU 1
      ================================   =============================
      receive an external NMI
      default_do_nmi()                   receive an external NMI
        spin_lock(&nmi_reason_lock)      default_do_nmi()
        io_check_error()                   spin_lock(&nmi_reason_lock)
          panic()                            busy loop
              issue NMI IPI -----------> blocked until IRET
                                             busy loop...
    Here, since CPU 1 is in NMI context, an additional NMI from CPU 0
    remains unhandled until CPU 1 IRETs. However, CPU 1 will never execute
    IRET so the NMI is not handled and the callback function to save
    registers is never called.
    To solve this issue, we check if the IPI for crash dumping was issued
    while waiting for nmi_reason_lock to be released, and if so, call its
    callback function directly. If the IPI is not issued (e.g. kdump is
    disabled), the actual behavior doesn't change.
    Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
    Acked-by: default avatarMichal Hocko <mhocko@suse.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Baoquan He <bhe@redhat.com>
    Cc: Dave Young <dyoung@redhat.com>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiang Liu <jiang.liu@linux.intel.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: kexec@lists.infradead.org
    Cc: linux-doc@vger.kernel.org
    Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stefan Lippers-Hollmann <s.l-h@gmx.de>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Cc: x86-ml <x86@kernel.org>
    Link: http://lkml.kernel.org/r/20151210065245.4587.39316.stgit@softrsSigned-off-by: default avatarBorislav Petkov <bp@suse.de>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
reboot.h 786 Bytes