freebsd-dev/sys/amd64
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
..
acpica sys/amd64: Small spelling fixes. 2016-05-03 22:13:04 +00:00
amd64 Handle broadcast NMIs. 2016-10-24 16:40:27 +00:00
cloudabi32 Make execution of 32-bit CloudABI executables work on amd64. 2016-08-24 10:51:33 +00:00
cloudabi64 Convert pointers obtained from the threadattr_t structure with TO_PTR(). 2016-08-24 10:13:18 +00:00
conf In the TCP stack, the hhook(9) framework provides hooks for kernel modules 2016-10-12 02:16:42 +00:00
ia32 Convert ss_sp in stack_t and sigstack to void *. 2016-01-27 17:55:01 +00:00
include Re-apply r306516 (by cem): 2016-10-04 17:01:24 +00:00
linux Regenerate syscall provider argument strings. 2016-09-22 04:50:03 +00:00
linux32 Regenerate syscall provider argument strings. 2016-09-22 04:50:03 +00:00
pci
vmm Reset PCI pass through devices via PCI-e FLR during VM start and end. 2016-09-06 21:15:35 +00:00
Makefile Bring the tags and links entries for amd64 up to date. 2015-10-27 22:59:24 +00:00