freebsd-dev/sys/x86/include
Konstantin Belousov 835c2787be Handle broadcast NMIs.
On several Intel chipsets, diagnostic NMIs sent from BMC or NMIs
reporting hardware errors are broadcasted to all CPUs.

When kernel is configured to enter kdb on NMI, the outcome is
problematic, because each CPU tries to enter kdb.  All CPUs are
executing NMI handlers, which set the latches disabling the nested NMI
delivery; this means that stop_cpus_hard(), used by kdb_enter() to
stop other cpus by broadcasting IPI_STOP_HARD NMI, cannot work.  One
indication of this is the harmless but annoying diagnostic "timeout
stopping cpus".

Much more harming behaviour is that because all CPUs try to enter kdb,
and if ddb is used as debugger, all CPUs issue prompt on console and
race for the input, not to mention the simultaneous use of the ddb
shared state.

Try to fix this by introducing a pseudo-lock for simultaneous attempts
to handle NMIs.  If one core happens to enter NMI trap handler, other
cores see it and simulate reception of the IPI_STOP_HARD.  More,
generic_stop_cpus() avoids sending IPI_STOP_HARD and avoids waiting
for the acknowledgement, relying on the nmi handler on other cores
suspending and then restarting the CPU.

Since it is impossible to detect at runtime whether some stray NMI is
broadcast or unicast, add a knob for administrator (really developer)
to configure debugging NMI handling mode.

The updated patch was debugged with the help from Andrey Gapon (avg)
and discussed with him.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D8249
2016-10-24 16:40:27 +00:00
..
xen xen: Code cleanup and small bug fixes 2015-10-21 10:44:07 +00:00
_align.h Implement _ALIGN() using internal integer types. 2016-05-31 13:31:19 +00:00
_inttypes.h
_limits.h
_stdint.h Add missing dependency on <machine/_limits.h>. 2016-05-31 08:38:24 +00:00
_types.h Add missing dependency on <machine/_limits.h>. 2016-05-31 08:36:39 +00:00
acpica_machdep.h
apicreg.h Add defines for the LAPIC TSC deadline timer mode. The LVT timer mode 2016-03-28 09:43:40 +00:00
apicvar.h Detect x2APIC mode on boot and obey it. 2016-09-19 15:58:45 +00:00
apm_bios.h
bus.h Better support memory mapped console devices, such as VGA and EFI 2015-08-12 15:26:32 +00:00
busdma_impl.h
cputypes.h Remove 'cpu' and 'cpu_class' on amd64. 2016-09-15 17:05:54 +00:00
dump.h
elf.h
endian.h
fdt.h
float.h Rationalize BSD license on sys/*/include/float.h 2015-08-05 17:05:35 +00:00
fpu.h
frame.h Fix decoding of tf_rsp on amd64, and move TF_HAS_STACKREGS() to the 2016-09-16 07:09:35 +00:00
init.h
legacyvar.h Convert rman to use rman_res_t instead of u_long 2016-01-27 02:23:54 +00:00
mca.h
metadata.h Move amd64 metadata.h to x86 and share with i386 2016-01-07 19:47:26 +00:00
mptable.h
ofw_machdep.h Add missing ofw_machdep.h. Make x86 ofw_machdep.h work pc98 too. 2015-08-28 15:41:09 +00:00
pci_cfgreg.h Convert rman to use rman_res_t instead of u_long 2016-01-27 02:23:54 +00:00
psl.h
ptrace.h
pvclock.h
reg.h
segments.h
setjmp.h
sigframe.h
signal.h
specialreg.h Add x86 CPU features definitions published in the Intel SDM rev. 58. 2016-04-16 06:07:13 +00:00
stack.h Add stack_save_td_running(), a function to trace the kernel stack of a 2015-09-11 03:54:37 +00:00
stdarg.h
sysarch.h
trap.h
ucontext.h POSIX states that #include <signal.h> shall make both mcontext_t and 2016-02-12 07:38:19 +00:00
vdso.h Implement userspace gettimeofday(2) with HPET timecounter. 2016-08-17 09:52:09 +00:00
vmware.h
x86_smp.h Handle broadcast NMIs. 2016-10-24 16:40:27 +00:00
x86_var.h Handle broadcast NMIs. 2016-10-24 16:40:27 +00:00