android_kernel_xiaomi_sm8350/arch/x86/kernel
Dmitry Adamushko 280a9ca5d0 x86: fix resume (S2R) broken by Intel microcode module, on A110L
Impact: fix deadlock

This is in response to the following bug report:

Bug-Entry       : http://bugzilla.kernel.org/show_bug.cgi?id=12100
Subject         : resume (S2R) broken by Intel microcode module, on A110L
Submitter       : Andreas Mohr <andi@lisas.de>
Date            : 2008-11-25 08:48 (19 days old)
Handled-By      : Dmitry Adamushko <dmitry.adamushko@gmail.com>

[ The deadlock scenario has been discovered by Andreas Mohr ]

I think I might have a logical explanation why the system:

  (http://bugzilla.kernel.org/show_bug.cgi?id=12100)

might hang upon resuming, OTOH it should have likely hanged each and every time.

(1) possible deadlock in microcode_resume_cpu() if either 'if' section is
taken;

(2) now, I don't see it in spec. and can't experimentally verify it (newer
ucodes don't seem to be available for my Core2duo)... but logically-wise, I'd
think that when read upon resuming, the 'microcode revision' (MSR 0x8B) should
be back to its original one (we need to reload ucode anyway so it doesn't seem
logical if a cpu doesn't drop the version)... if so, the comparison with
memcmp() for the full 'struct cpu_signature' is wrong... and that's how one of
the aforementioned 'if' sections might have been triggered - leading to a
deadlock.

Obviously, in my tests I simulated loading/resuming with the ucode of the same
version (just to see that the file is loaded/re-loaded upon resuming) so this
issue has never popped up.

I'd appreciate if someone with an appropriate system might give a try to the
2nd patch (titled "fix a comparison && deadlock...").

In any case, the deadlock situation is a must-have fix.

Reported-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Tested-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>

Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-12-20 14:29:20 +01:00
..
acpi ACPI: pci_link: remove acpi_irq_balance_set() interface 2008-11-11 21:12:05 -05:00
cpu x86: re-enable MCE on secondary CPUS after suspend/resume 2008-12-16 23:03:02 +01:00
.gitignore
alternative.c
amd_iommu_init.c AMD IOMMU: set cmd buffer pointers to zero manually 2008-12-17 15:06:01 +01:00
amd_iommu.c AMD IOMMU: panic if completion wait loop fails 2008-12-17 16:36:44 +01:00
aperture_64.c
apic.c enable_IR_x2apic() needs to be __init 2008-11-30 10:03:37 -08:00
apm_32.c
asm-offsets_32.c
asm-offsets_64.c x86: Fix ASM_X86__ header guards 2008-10-22 22:55:23 -07:00
asm-offsets.c
audit_64.c
bios_uv.c x86: Add UV partition call v4 2008-10-16 16:53:13 +02:00
bootflag.c
cpuid.c device create: misc: convert device_create_drvdata to device_create 2008-10-16 09:24:43 -07:00
crash_dump_32.c kdump: make elfcorehdr_addr independent of CONFIG_PROC_VMCORE 2008-10-20 08:52:39 -07:00
crash_dump_64.c kdump: make elfcorehdr_addr independent of CONFIG_PROC_VMCORE 2008-10-20 08:52:39 -07:00
crash.c
doublefault_32.c
ds.c x86, bts: fix wrmsr and spinlock over kmalloc 2008-11-25 17:29:02 +01:00
dumpstack_32.c x86, kexec: fix hang on i386 when panic occurs while console_sem is held 2008-10-22 13:59:44 +02:00
dumpstack_64.c sysfs: crash debugging 2008-10-16 09:24:41 -07:00
e820.c x86: Clean up late e820 resource allocation 2008-11-01 10:17:22 -07:00
early_printk.c
early-quirks.c Revert "x86: blacklist DMAR on Intel G31/G33 chipsets" 2008-11-15 11:37:16 -08:00
efi_32.c
efi_64.c
efi_stub_32.S
efi_stub_64.S
efi.c x86: Add UV EFI table entry v4 2008-10-16 16:53:13 +02:00
entry_32.S Merge commit 'v2.6.28-rc2' into tracing/urgent 2008-10-27 10:50:54 +01:00
entry_64.S ftrace: rename FTRACE to FUNCTION_TRACER 2008-10-20 18:27:03 +02:00
es7000_32.c x86: fix es7000 compiling 2008-11-16 10:05:07 +01:00
ftrace.c ftrace: use a real variable for ftrace_nop in x86 2008-10-27 16:52:01 +01:00
genapic_64.c
genapic_flat_64.c x86: fix section mismatch warning - apic_physflat 2008-10-22 17:36:27 +02:00
genx2apic_cluster.c x86: fix section mismatch warning - apic_x2apic_cluster 2008-10-22 17:36:29 +02:00
genx2apic_phys.c x86: fix section mismatch warning - apic_x2apic_phys 2008-10-22 17:36:30 +02:00
genx2apic_uv_x.c x86/uv: memory allocation at initialization 2008-10-27 14:17:16 +01:00
geode_32.c
head32.c
head64.c
head_32.S
head_64.S
head.c
hpet.c x86: HPET: enter hpet_interrupt_handler with interrupts disabled 2008-11-10 17:38:07 +01:00
i386_ksyms_32.c ftrace: rename FTRACE to FUNCTION_TRACER 2008-10-20 18:27:03 +02:00
i387.c x86: fix __cpuinit/__init tangle in init_thread_xstate() 2008-11-20 16:43:41 +01:00
i8237.c
i8253.c
i8259.c
init_task.c
io_apic.c Merge branch 'irq-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-11-30 13:06:20 -08:00
io_delay.c
ioport.c
ipi.c
irq_32.c x86: move ack_bad_irq() to irq.c 2008-10-16 16:53:30 +02:00
irq_64.c x86: move ack_bad_irq() to irq.c 2008-10-16 16:53:30 +02:00
irq.c genirq: fix off by one and coding style 2008-10-21 15:54:40 +02:00
irqinit_32.c genirq: remove artifacts from sparseirq removal 2008-10-16 16:53:15 +02:00
irqinit_64.c genirq: remove irq_to_desc_alloc 2008-10-16 16:53:15 +02:00
k8.c x86, gart: fix gart detection for Fam11h CPUs 2008-10-28 17:10:27 +01:00
kdebugfs.c
kgdb.c
kprobes.c
kvm.c
kvmclock.c kvm_setup_secondary_clock() is cpuinit 2008-11-30 10:03:37 -08:00
ldt.c
machine_kexec_32.c x86, kdump: fix invalid access on i386 sparsemem 2008-10-28 16:48:24 +01:00
machine_kexec_64.c
Makefile x86, bts: exclude ds.c from build when disabled 2008-11-25 17:28:50 +01:00
mca_32.c
mfgpt_32.c
microcode_amd.c x86: AMD microcode patch loader author update 2008-10-28 16:41:28 +01:00
microcode_core.c x86: fix resume (S2R) broken by Intel microcode module, on A110L 2008-12-20 14:29:20 +01:00
microcode_intel.c x86: fix resume (S2R) broken by Intel microcode module, on A110L 2008-12-20 14:29:20 +01:00
mmconf-fam10h_64.c
module_32.c
module_64.c
mpparse.c x86: fix early panic with boot option "nosmp" 2008-12-04 16:33:51 +01:00
msr.c device create: misc: convert device_create_drvdata to device_create 2008-10-16 09:24:43 -07:00
nmi.c
numaq_32.c
olpc.c
paravirt_patch_32.c
paravirt_patch_64.c
paravirt-spinlocks.c x86: fix default_spin_lock_flags() prototype 2008-12-08 16:08:29 +01:00
paravirt.c
pci-calgary_64.c arch/x86/kernel/pci-calgary_64.c: change simple_strtol to simple_strtoul 2008-11-25 15:56:03 +01:00
pci-dma.c x86/PCI: build failure at x86/kernel/pci-dma.c with !CONFIG_PCI 2008-10-24 11:09:43 -07:00
pci-gart_64.c x86 gart: don't complain if no AMD GART found 2008-12-18 13:26:23 +01:00
pci-nommu.c
pci-swiotlb_64.c x86: restore the old swiotlb alloc_coherent behavior 2008-10-23 21:54:40 +02:00
pcspeaker.c
pmtimer_64.c
probe_roms_32.c
process_32.c
process_64.c Merge branch 'linus' into test 2008-10-23 00:11:07 -04:00
process.c
ptrace.c
pvclock.c x86: pvclock: fix shadowed variable warning 2008-10-15 14:25:14 +02:00
quirks.c x86: remove irqbalance in kernel for 32 bit 2008-10-16 16:52:52 +02:00
reboot_fixups_32.c
reboot.c x86: quirk for reboot stalls on a Dell Optiplex 330 2008-11-18 22:22:29 +01:00
relocate_kernel_32.S
relocate_kernel_64.S
rtc.c rtc: use bcd2bin/bin2bcd 2008-10-20 08:52:41 -07:00
scx200_32.c
setup_percpu.c x86: remove redundant KERN_DEBUG on pr_debug 2008-10-22 16:56:22 +02:00
setup.c x86 Fix VMI crash on boot in 2.6.28-rc8 2008-12-14 16:24:38 -08:00
sigframe.h
signal_32.c
signal_64.c
smp.c
smpboot.c x86 Fix VMI crash on boot in 2.6.28-rc8 2008-12-14 16:24:38 -08:00
smpcommon.c
stacktrace.c
step.c
summit_32.c
sys_i386_32.c
sys_x86_64.c
syscall_64.c x86: Fix ASM_X86__ header guards 2008-10-22 22:55:23 -07:00
syscall_table_32.S
tce_64.c
test_nx.c
test_rodata.c
time_32.c
time_64.c
tlb_32.c x86: add smp_mb() before sending INVALIDATE_TLB_VECTOR 2008-11-06 09:41:49 +01:00
tlb_64.c x86: add smp_mb() before sending INVALIDATE_TLB_VECTOR 2008-11-06 09:41:49 +01:00
tlb_uv.c x86/tlb_uv: remove strange mc146818rtc include 2008-10-22 16:56:23 +02:00
tls.c
tls.h
topology.c
trampoline_32.S
trampoline_64.S
trampoline.c
traps.c MCE: Don't run 32bit machine checks with interrupts on 2008-10-22 13:19:01 +02:00
tsc_sync.c x86: add rdtsc barrier to TSC sync check 2008-11-18 00:15:02 +01:00
tsc.c sched: optimize sched_clock() a bit 2008-11-08 17:05:38 +01:00
uv_irq.c x86, UV: add uv_setup_irq() and uv_teardown_irq() functions, v3, fix 2008-10-16 16:53:13 +02:00
uv_sysfs.c x86: Add sysfs entries for UV v4 2008-10-16 16:53:13 +02:00
verify_cpu_64.S
visws_quirks.c genirq: revert dynarray 2008-10-16 16:53:15 +02:00
vm86_32.c
vmi_32.c x86 Fix VMI crash on boot in 2.6.28-rc8 2008-12-14 16:24:38 -08:00
vmiclock_32.c x86: VMI, initialize IRQ vector 2008-10-16 16:52:59 +02:00
vmlinux_32.lds.S genirq: revert dynarray 2008-10-16 16:53:15 +02:00
vmlinux_64.lds.S genirq: remove artifacts from sparseirq removal 2008-10-16 16:53:15 +02:00
vmlinux.lds.S
vsmp_64.c x86: two trivial sparse annotations 2008-10-29 08:02:28 +01:00
vsyscall_64.c
x8664_ksyms_64.c ftrace: rename FTRACE to FUNCTION_TRACER 2008-10-20 18:27:03 +02:00
xsave.c x86: fixing __cpuinit/__init tangle, xsave_cntxt_init() 2008-11-20 16:43:42 +01:00