linux/arch/x86_64/kernel
Fernando Luis VazquezCao 8339e9fba3 [PATCH] x86-64: safe_apic_wait_icr_idle - x86_64
apic_wait_icr_idle looks like this:

static __inline__ void apic_wait_icr_idle(void)
{
  while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
    cpu_relax();
}

The busy loop in this function would not be problematic if the
corresponding status bit in the ICR were always updated, but that does
not seem to be the case under certain crash scenarios. Kdump uses an IPI
to stop the other CPUs in the event of a crash, but when any of the
other CPUs are locked-up inside the NMI handler the CPU that sends the
IPI will end up looping forever in the ICR check, effectively
hard-locking the whole system.

Quoting from Intel's "MultiProcessor Specification" (Version 1.4), B-3:

"A local APIC unit indicates successful dispatch of an IPI by
resetting the Delivery Status bit in the Interrupt Command
Register (ICR). The operating system polls the delivery status
bit after sending an INIT or STARTUP IPI until the command has
been dispatched.

A period of 20 microseconds should be sufficient for IPI dispatch
to complete under normal operating conditions. If the IPI is not
successfully dispatched, the operating system can abort the
command. Alternatively, the operating system can retry the IPI by
writing the lower 32-bit double word of the ICR. This “time-out”
mechanism can be implemented through an external interrupt, if
interrupts are enabled on the processor, or through execution of
an instruction or time-stamp counter spin loop."

Intel's documentation suggests the implementation of a time-out
mechanism, which, by the way, is already being open-coded in some parts
of the kernel that tinker with ICR.

Create a apic_wait_icr_idle replacement that implements the time-out
mechanism and that can be used to solve the aforementioned problem.

AK: moved both functions out of line
AK: Added improved loop from Keith Owens

Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: Andi Kleen <ak@suse.de>
2007-05-02 19:27:17 +02:00
..
acpi [PATCH] x86-64: Move cpu verification code to common file 2007-05-02 19:27:08 +02:00
cpufreq [PATCH] X86_P4_CLOCKMOD must select CPU_FREQ_TABLE 2007-03-18 11:35:07 -07:00
Makefile [PATCH] x86-64: Clean up asm-x86_64/bugs.h 2007-05-02 19:27:12 +02:00
aperture.c [PATCH] x86-64: x86-64 system crashes when no memory populating Node 0 2007-05-02 19:27:13 +02:00
apic.c [PATCH] x86-64: safe_apic_wait_icr_idle - x86_64 2007-05-02 19:27:17 +02:00
asm-offsets.c
audit.c
bugs.c [PATCH] x86: update for i386 and x86-64 check_bugs 2007-05-02 19:27:16 +02:00
crash.c [PATCH] Kexec / Kdump: Unify elf note code 2006-12-07 08:39:46 -08:00
crash_dump.c
e820.c [PATCH] x86: fix amd64-agp aperture validation 2007-05-02 19:27:11 +02:00
early-quirks.c [PATCH] x86: revert x86_64-mm-fix-the-irqbalance-quirk-for-e7320-e7520-e7525 2007-05-02 19:27:04 +02:00
early_printk.c [PATCH] x86-64: make simnow_init() static 2007-05-02 19:27:09 +02:00
entry.S [PATCH] x86-64: a few missing entry.S annotations 2007-05-02 19:27:05 +02:00
functionlist [NET]: Get rid of alloc_skb_from_cache 2007-04-17 13:13:16 -07:00
genapic.c [PATCH] x86: adjust inclusion of asm/fixmap.h 2007-05-02 19:27:04 +02:00
genapic_flat.c [PATCH] x86: adjust inclusion of asm/fixmap.h 2007-05-02 19:27:04 +02:00
head.S [PATCH] x86-64: Remove unused stext symbol 2007-05-02 19:27:10 +02:00
head64.c [PATCH] x86-64: build-time checking 2007-05-02 19:27:08 +02:00
hpet.c failsafe mechanism to HPET clock calibration 2007-04-14 21:44:03 -07:00
i387.c [PATCH] x86-64: use BUILD_BUG_ON in FPU code 2006-12-07 02:14:01 +01:00
i8259.c [PATCH] x86_64 irq: Fix comments after changing IRQ0_VECTOR from 0x20 to 0x30 2007-03-29 08:16:23 -07:00
init_task.c [PATCH] nsproxy: move init_nsproxy into kernel/nsproxy.c 2006-10-02 07:57:20 -07:00
io_apic.c [PATCH] x86: remove UNEXPECTED_IO_APIC() 2007-05-02 19:27:11 +02:00
ioport.c [PATCH] x86: sys_ioperm() prototype cleanup 2007-05-02 19:27:10 +02:00
irq.c [PATCH] x86-64: survive having no irq mapping for a vector 2007-02-13 13:26:25 +01:00
k8.c cache_k8_northbridges() overflows beyond allocation 2007-04-16 18:09:18 -07:00
kprobes.c [PATCH] kprobes: enable booster on the preemptible kernel 2006-12-07 08:39:38 -08:00
ldt.c
machine_kexec.c [PATCH] x86: __pa and __pa_symbol address space separation 2007-05-02 19:27:07 +02:00
mce.c [PATCH] x86-64: Allow to run a program when a machine check event is detected 2007-02-13 13:26:23 +01:00
mce_amd.c [PATCH] x86-64: Allow to run a program when a machine check event is detected 2007-02-13 13:26:23 +01:00
mce_intel.c
module.c [PATCH] Generic BUG for x86-64 2006-12-08 08:28:39 -08:00
mpparse.c [PATCH] x86: default to physical mode on hotplug CPU kernels 2007-05-02 19:27:04 +02:00
nmi.c [PATCH] x86-64: x86_64 make NMI use PERFCTR1 for architectural perfmon (take 2) 2007-05-02 19:27:05 +02:00
pci-calgary.c [PATCH] x86-64: dma_ops as const 2007-05-02 19:27:06 +02:00
pci-dma.c [PATCH] x86-64: improved iommu documentation 2007-02-13 13:26:21 +01:00
pci-gart.c [PATCH] x86-64: dma_ops as const 2007-05-02 19:27:06 +02:00
pci-nommu.c [PATCH] x86-64: dma_ops as const 2007-05-02 19:27:06 +02:00
pci-swiotlb.c [PATCH] x86-64: dma_ops as const 2007-05-02 19:27:06 +02:00
pmtimer.c [PATCH] time: x86_64: convert x86_64 to use GENERIC_TIME 2007-02-16 08:14:00 -08:00
process.c [PATCH] x86: Don't use MWAIT on AMD Family 10 2007-05-02 19:27:12 +02:00
ptrace.c [PATCH] x86-64: Check return value of putreg in PTRACE_SETREGS 2007-02-13 13:26:24 +01:00
reboot.c
relocate_kernel.S
setup.c [PATCH] x86: Don't use MWAIT on AMD Family 10 2007-05-02 19:27:12 +02:00
setup64.c [PATCH] x86: Allow percpu variables to be page-aligned 2007-05-02 19:27:12 +02:00
signal.c [PATCH] x86-64: Fix x86_64 compilation with DEBUG_SIG on 2007-05-02 19:27:13 +02:00
smp.c [PATCH] x86: __pa and __pa_symbol address space separation 2007-05-02 19:27:07 +02:00
smpboot.c [PATCH] x86: Save the MTRRs of the BSP before booting an AP 2007-05-02 19:27:17 +02:00
stacktrace.c [PATCH] x86-64: do not always end the stack trace with ULONG_MAX 2007-02-13 13:26:21 +01:00
suspend.c [PATCH] x86: Save and restore the fixed-range MTRRs of the BSP when suspending 2007-05-02 19:27:17 +02:00
suspend_asm.S [PATCH] x86-64: Relocatable Kernel Support 2007-05-02 19:27:07 +02:00
sys_x86_64.c [PATCH] namespaces: utsname: switch to using uts namespaces 2006-10-02 07:57:21 -07:00
syscall.c
tce.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
time.c [PATCH] x86-64: Fix "Section mismatch" compile warning 2007-05-02 19:27:11 +02:00
trampoline.S [PATCH] x86-64: Move cpu verification code to common file 2007-05-02 19:27:08 +02:00
traps.c [PATCH] x86-64: Minor white space cleanup in traps.c 2007-05-02 19:27:08 +02:00
tsc.c [PATCH] x86: Log reason why TSC was marked unstable 2007-05-02 19:27:08 +02:00
tsc_sync.c [PATCH] x86: Log reason why TSC was marked unstable 2007-05-02 19:27:08 +02:00
verify_cpu.S [PATCH] x86-64: Move cpu verification code to common file 2007-05-02 19:27:08 +02:00
vmlinux.lds.S [PATCH] x86: Allow percpu variables to be page-aligned 2007-05-02 19:27:12 +02:00
vsmp.c [PATCH] Fix build breakage with CONFIG_X86_VSMP 2006-10-12 12:25:27 -07:00
vsyscall.c [PATCH] x86-64: vsyscall_gtod_data diet and vgettimeofday() fix 2007-05-02 19:27:11 +02:00
x8664_ksyms.c [PATCH] x86: Export _proxy_pda for gcc 4.2 2007-03-16 21:07:36 +01:00