linux-stable/arch/x86
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
..
boot x86/build: Specify elf_i386 linker emulation explicitly for i386 objects 2019-04-05 22:31:39 +02:00
configs x86/unwind: Rename unwinder config options to 'CONFIG_UNWINDER_*' 2017-12-25 14:26:13 +01:00
crypto crypto: x86/crct10dif-pcl - fix use via crypto_shash_digest() 2019-05-21 18:50:15 +02:00
entry x86_64: Add gap to int3 to allow for call emulation 2019-05-25 18:25:23 +02:00
events perf/x86/intel/ds: Fix EVENT vs. UEVENT PEBS constraints 2019-06-22 08:16:15 +02:00
hyperv x86/hyperv: Check for required priviliges in hyperv_init() 2018-04-26 11:02:13 +02:00
ia32 x86/ia32: Fix ia32_restore_sigcontext() AC leak 2019-05-31 06:47:31 -07:00
include x86: Hide the int3_emulate_call/jmp functions from UML 2019-05-31 06:47:10 -07:00
kernel x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor 2019-06-22 08:16:16 +02:00
kvm KVM: x86/pmu: do not mask the value that is written to fixed PMUs 2019-06-19 08:20:58 +02:00
lib x86/mm/mem_encrypt: Disable all instrumentation for early SME setup 2019-05-25 18:25:36 +02:00
math-emu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mm x86/kasan: Fix boot with 5-level paging and KASAN 2019-06-19 08:21:00 +02:00
net bpf, x64: fix memleak when not converging after image 2018-06-21 04:02:52 +09:00
oprofile x86/oprofile: Fix bogus GCC-8 warning in nmi_setup() 2018-02-28 10:19:41 +01:00
pci x86/PCI: Fix PCI IRQ routing table memory leak 2019-06-15 11:54:54 +02:00
platform x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:18:42 +02:00
power x86/power: Fix 'nosmt' vs hibernation triple fault during resume 2019-06-11 12:21:48 +02:00
purgatory License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ras License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
realmode x86/build: Specify elf_i386 linker emulation explicitly for i386 objects 2019-04-05 22:31:39 +02:00
tools x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 2018-03-19 08:42:44 +01:00
um um: Drop own definition of PTRACE_SYSEMU/_SINGLESTEP 2018-11-21 09:24:06 +01:00
video
xen xen: fix dom0 boot on huge systems 2019-03-23 14:35:19 +01:00
.gitignore
Kbuild Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-07 09:25:15 -07:00
Kconfig x86/smp: Enforce CONFIG_HOTPLUG_CPU when SMP=y 2019-04-03 06:25:20 +02:00
Kconfig.cpu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig.debug x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit 2017-12-25 14:26:14 +01:00
Makefile x86/build: Keep local relocations with ld.lld 2019-05-31 06:47:29 -07:00
Makefile.um License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile_32.cpu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00