android_kernel_xiaomi_sm8350/arch/i386
Fernando Luis VazquezCao f2b218dd61 [PATCH] i386: safe_apic_wait_icr_idle - i386
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
..
boot [PATCH] x86: deflate stack usage in lib/inflate.c 2007-05-02 19:27:15 +02:00
crypto [CRYPTO] api: Get rid of flags argument to setkey 2006-09-21 11:41:02 +10:00
kernel [PATCH] i386: safe_apic_wait_icr_idle - i386 2007-05-02 19:27:17 +02:00
lib [PATCH] i386: type cast clean up for find_next_zero_bit 2007-05-02 19:27:08 +02:00
mach-default [PATCH] clockevents: i386 drivers 2007-02-16 08:13:59 -08:00
mach-es7000 ACPICA: Remove duplicate table manager 2007-02-02 21:14:28 -05:00
mach-generic [PATCH] i386: modpost apic related warning fixes 2007-05-02 19:27:08 +02:00
mach-visws [PATCH] visws: sgivwfb as module needs exports 2006-12-08 08:29:07 -08:00
mach-voyager [PATCH] i386: Use per-cpu GDT immediately upon boot 2007-05-02 19:27:10 +02:00
math-emu [PATCH] i386: avoid gcc extension 2007-02-13 13:26:24 +01:00
mm [PATCH] i386: PARAVIRT: flush lazy mmu updates on kunmap_atomic 2007-05-02 19:27:15 +02:00
oprofile [PATCH] i386: Support Oprofile for AMD Family 10 CPUs 2007-05-02 19:27:06 +02:00
pci [PATCH] MSI-X: fix resume crash 2007-03-28 13:59:37 -07:00
power [PATCH] x86: Save and restore the fixed-range MTRRs of the BSP when suspending 2007-05-02 19:27:17 +02:00
defconfig [PATCH] i386: Update defconfig 2007-05-02 19:27:04 +02:00
Kconfig [PATCH] i386: Now that the VDSO can be relocated, we can support it in VMI configurations. 2007-05-02 19:27:16 +02:00
Kconfig.cpu [PATCH] i386: Add an option for the VIA C7 which sets appropriate L1 cache 2007-05-02 19:27:05 +02:00
Kconfig.debug [PATCH] i386: PARAVIRT: Remove CONFIG_DEBUG_PARAVIRT 2007-05-02 19:27:13 +02:00
Makefile [PATCH] x86: Drop cc-options call for all options supported in gcc 3.2+ 2007-05-02 19:27:06 +02:00
Makefile.cpu [PATCH] i386: Fix usage of -mtune when X86_GENERIC=y or CONFIG_MCORE2=y 2007-05-02 19:27:06 +02:00