linux-stable/arch/x86/kernel
Frank van der Linden 746b9c0c3e x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor
[ Upstream commit 2ac44ab608 ]

For F17h AMD CPUs, the CPB capability ('Core Performance Boost') is forcibly set,
because some versions of that chip incorrectly report that they do not have it.

However, a hypervisor may filter out the CPB capability, for good
reasons. For example, KVM currently does not emulate setting the CPB
bit in MSR_K7_HWCR, and unchecked MSR access errors will be thrown
when trying to set it as a guest:

	unchecked MSR access error: WRMSR to 0xc0010015 (tried to write 0x0000000001000011) at rIP: 0xffffffff890638f4 (native_write_msr+0x4/0x20)

	Call Trace:
	boost_set_msr+0x50/0x80 [acpi_cpufreq]
	cpuhp_invoke_callback+0x86/0x560
	sort_range+0x20/0x20
	cpuhp_thread_fun+0xb0/0x110
	smpboot_thread_fn+0xef/0x160
	kthread+0x113/0x130
	kthread_create_worker_on_cpu+0x70/0x70
	ret_from_fork+0x35/0x40

To avoid this issue, don't forcibly set the CPB capability for a CPU
when running under a hypervisor.

Signed-off-by: Frank van der Linden <fllinden@amazon.com>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bp@alien8.de
Cc: jiaxun.yang@flygoat.com
Fixes: 0237199186 ("x86/CPU/AMD: Set the CPB bit unconditionally on F17h")
Link: http://lkml.kernel.org/r/20190522221745.GA15789@dev-dsk-fllinden-2c-c1893d73.us-west-2.amazon.com
[ Minor edits to the changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-06-22 08:16:16 +02:00
..
acpi Revert "x86/apic: Ignore secondary threads if nosmt=force" 2018-08-15 18:12:53 +02:00
apic x86/smp: fix non-SMP broken build due to redefinition of apic_id_is_primary_thread 2018-08-15 18:13:01 +02:00
cpu x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor 2019-06-22 08:16:16 +02:00
fpu x86/fpu: Don't export __kernel_fpu_{begin,end}() 2019-05-16 19:42:31 +02:00
kprobes x86/kprobes: Avoid kretprobe recursion bug 2019-05-16 19:42:32 +02:00
.gitignore
Makefile x86/paravirt: Make native_save_fl() extern inline 2018-07-22 14:28:42 +02:00
alternative.c Revert "x86/alternative: Print unadorned pointers" 2018-02-13 10:19:49 +01:00
amd_gart_64.c x86: remove arch specific dma_supported implementation 2017-06-28 06:54:46 -07:00
amd_nb.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
apb_timer.c Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-25 14:30:04 -08:00
aperture_64.c x86/gart: Exclude GART aperture from vmcore 2018-04-12 12:32:20 +02:00
apm_32.c x86/apm: Don't access __preempt_count with zeroed fs 2018-07-25 11:25:07 +02:00
asm-offsets.c x86/mm: Use/Fix PCID to optimize user/kernel switches 2018-01-02 20:31:01 +01:00
asm-offsets_32.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
asm-offsets_64.c x86/entry/64: Separate cpu_current_top_of_stack from TSS.sp0 2017-12-25 14:26:23 +01:00
audit_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bootflag.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
check.c x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided 2018-11-13 11:14:47 -08:00
cpuid.c Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 19:25:04 -08:00
crash.c kexec: move vmcoreinfo out of the kernel's .bss section 2017-07-12 16:25:59 -07:00
crash_dump_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
crash_dump_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
devicetree.c x86/devicetree: Fix device IRQ settings in DT 2018-05-30 07:52:35 +02:00
doublefault.c x86/entry: Fix assumptions that the HW TSS is at the beginning of cpu_tss 2017-12-25 14:26:22 +01:00
dumpstack.c x86/entry/64: Wipe KASAN stack shadow before rewind_stack_do_exit() 2018-09-05 09:26:40 +02:00
dumpstack_32.c x86/entry: Rename SYSENTER_stack to CPU_ENTRY_AREA_entry_stack 2017-12-29 17:53:44 +01:00
dumpstack_64.c x86/entry: Rename SYSENTER_stack to CPU_ENTRY_AREA_entry_stack 2017-12-29 17:53:44 +01:00
e820.c x86/boot/e820: Add support to determine the E820 type of an address 2017-07-18 11:38:01 +02:00
early-quirks.c x86/gpu: add CFL to early quirks 2018-02-22 15:42:18 +01:00
early_printk.c x86/earlyprintk: Add a force option for pciserial device 2018-11-27 16:10:47 +01:00
ebda.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
eisa.c x86/EISA: Don't probe EISA bus for Xen PV guests 2018-09-26 08:38:08 +02:00
espfix_64.c kmemcheck: stop using GFP_NOTRACK and SLAB_NOTRACK 2018-02-22 15:42:23 +01:00
ftrace.c ftrace/x86_64: Emulate call function while updating in breakpoint handler 2019-05-25 18:25:24 +02:00
ftrace_32.S x86/retpoline/ftrace: Convert ftrace assembler indirect jumps 2018-01-17 09:45:29 +01:00
ftrace_64.S x86/retpoline/ftrace: Convert ftrace assembler indirect jumps 2018-01-17 09:45:29 +01:00
head32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head64.c x86/mm: Expand static page table for fixmap space 2018-10-03 17:00:54 -07:00
head_32.S x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
head_64.S x86/mm: Expand static page table for fixmap space 2018-10-03 17:00:54 -07:00
hpet.c x86/hpet: Prevent potential NULL pointer dereference 2019-04-20 09:15:03 +02:00
hw_breakpoint.c x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error 2019-04-20 09:15:03 +02:00
i8237.c
i8253.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
i8259.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-15 18:12:58 +02:00
idt.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-15 18:12:58 +02:00
io_delay.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ioport.c x86/entry/64: Make cpu_entry_area.tss read-only 2017-12-25 14:26:24 +01:00
irq.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-15 18:12:58 +02:00
irq_32.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-15 18:12:58 +02:00
irq_64.c x86/irq/64: Limit IST stack overflow check to #DB stack 2019-05-31 06:47:26 -07:00
irq_work.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irqflags.S x86/paravirt: Make native_save_fl() extern inline 2018-07-22 14:28:42 +02:00
irqinit.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-15 18:12:58 +02:00
itmt.c sched/x86: Remove unnecessary TBM3 check to update topology 2017-01-19 08:42:37 +01:00
jump_label.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kdebugfs.c x86, mpparse, x86/acpi, x86/PCI, x86/dmi, SFI: Use memremap() for RAM mappings 2017-07-18 11:37:58 +02:00
kexec-bzimage64.c x86/kexec: Don't setup EFI info if EFI runtime is not enabled 2019-03-13 14:03:17 -07:00
kgdb.c
ksysfs.c x86/sysfs: Fix off-by-one error in loop termination 2017-09-25 09:36:16 +02:00
kvm.c KVM: x86: fix backward migration with async_PF 2018-03-11 16:23:23 +01:00
kvmclock.c x86/pvclock: add setter for pvclock_pvti_cpu0_va 2019-01-31 08:13:47 +01:00
ldt.c x86/ldt: Unmap PTEs for the slot before freeing LDT pages 2018-11-27 16:10:50 +01:00
livepatch.c
machine_kexec_32.c x86/kexec: Avoid double free_page() upon do_kexec_load() failure 2018-05-25 16:17:35 +02:00
machine_kexec_64.c x86/kexec: Avoid double free_page() upon do_kexec_load() failure 2018-05-25 16:17:35 +02:00
mmconf-fam10h_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
module.c x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 2018-03-19 08:42:44 +01:00
mpparse.c x86/mm: Don't leak kernel addresses 2019-04-20 09:15:01 +02:00
msr.c x86/msr: Remove bogus cleanup from the error path 2016-12-25 10:47:41 +01:00
nmi.c x86/speculation/mds: Clear CPU buffers on exit to user 2019-05-14 19:18:43 +02:00
nmi_selftest.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
paravirt-spinlocks.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
paravirt.c x86/paravirt: Fix some warning messages 2018-11-04 14:52:45 +01:00
paravirt_patch_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
paravirt_patch_64.c x86/paravirt: Dont patch flush_tlb_single 2017-12-25 14:26:24 +01:00
pci-calgary_64.c x86: remove arch specific dma_supported implementation 2017-06-28 06:54:46 -07:00
pci-dma.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-iommu_table.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-nommu.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-swiotlb.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pcspeaker.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf_regs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
platform-quirks.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pmem.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
probe_roms.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
process.c x86/speculation: Prevent deadlock on ssb_state::lock 2019-04-27 09:35:39 +02:00
process.h x86/speculation: Avoid __switch_to_xtra() calls 2018-12-05 19:41:21 +01:00
process_32.c sched/x86: Save [ER]FLAGS on context switch 2019-05-21 18:50:14 +02:00
process_64.c sched/x86: Save [ER]FLAGS on context switch 2019-05-21 18:50:14 +02:00
ptrace.c x86/asm: Move 'status' from thread_struct to thread_info 2018-02-07 11:12:22 -08:00
pvclock.c x86/pvclock: add setter for pvclock_pvti_cpu0_va 2019-01-31 08:13:47 +01:00
quirks.c x86/mce: Check for alternate indication of machine check recovery on Skylake 2018-07-03 11:24:46 +02:00
reboot.c x86/reboot, efi: Use EFI reboot for Acer TravelMate X514-51T 2019-05-16 19:42:22 +02:00
reboot_fixups_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
relocate_kernel_32.S
relocate_kernel_64.S x86/kexec: Make kexec (mostly) work in 5-level paging mode 2018-02-22 15:42:18 +01:00
resource.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rtc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
setup.c x86, hibernate: Fix nosave_regions setup for hibernation 2018-11-10 07:48:36 -08:00
setup_percpu.c x86/cpu_entry_area: Sync cpu_entry_area to initial_page_table 2018-03-08 22:41:07 -08:00
signal.c x86/uaccess, signal: Fix AC=1 bloat 2019-05-31 06:47:30 -07:00
signal_compat.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smp.c x86/irq: Let interrupt handlers set kvm_cpu_l1tf_flush_l1d 2018-08-15 18:12:58 +02:00
smpboot.c x86/mm/32: Initialize the CR4 shadow before __flush_tlb_all() 2018-08-24 13:09:11 +02:00
stacktrace.c x86/stacktrace: Make zombie stack traces reliable 2018-03-03 10:24:25 +01:00
step.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sys_x86_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sysfb.c
sysfb_efi.c
sysfb_simplefb.c
tboot.c x86/pti: Make unpoison of pgd for trusted boot work for real 2018-01-17 09:45:28 +01:00
tce_64.c
time.c x86/time: Correct the attribute on jiffies' definition 2018-11-10 07:48:36 -08:00
tls.c x86/ldt: Make the LDT mapping RO 2018-01-02 20:31:02 +01:00
tls.h
topology.c
trace_clock.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tracepoint.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c x86/speculation/mds: Revert CPU buffer clear on double fault exit 2019-05-21 18:50:13 +02:00
tsc.c x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:18:42 +02:00
tsc_msr.c x86/tsc: Add missing header to tsc_msr.c 2018-10-03 17:00:48 -07:00
tsc_sync.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
unwind_frame.c x86/unwind: Handle NULL pointer calls better in frame unwinder 2019-03-27 14:13:54 +09:00
unwind_guess.c x86/unwind: Add the ORC unwinder 2017-07-26 13:18:20 +02:00
unwind_orc.c x86/unwind: Add hardcoded ORC entry for NULL 2019-03-27 14:13:54 +09:00
uprobes.c uprobes/x86: Remove incorrect WARN_ON() in uprobe_init_insn() 2018-07-17 11:39:31 +02:00
verify_cpu.S x86/boot: Annotate verify_cpu() as a callable function 2017-12-25 14:26:13 +01:00
vm86_32.c x86/vm86/32: Fix POPF emulation 2018-03-21 12:06:41 +01:00
vmlinux.lds.S Revert "x86/build: Move _etext to actual end of .text" 2019-06-09 09:18:20 +02:00
vsmp_64.c
x86_init.c x86/virt, x86/platform: Merge 'struct x86_hyper' into 'struct x86_platform' and 'struct x86_init' 2017-12-25 14:26:20 +01:00