linux-stable/arch/x86/kernel/cpu
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
..
mcheck x86/mce: Fix machine_check_poll() tests for error types 2019-05-31 06:47:33 -07:00
microcode x86/microcode, cpuhotplug: Add a microcode loader CPU hotplug callback 2019-06-19 08:20:59 +02:00
mtrr x86/mtrr: Don't copy uninitialized gentry fields back to userspace 2018-12-29 13:39:10 +01:00
.gitignore
amd.c x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor 2019-06-22 08:16:16 +02:00
aperfmperf.c x86 / CPU: Always show current CPU frequency in /proc/cpuinfo 2018-01-10 09:31:20 +01:00
bugs.c x86/speculation/mds: Add 'mitigations=' support for MDS 2019-05-14 19:18:47 +02:00
centaur.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
common.c x86/speculation/mds: Add BUG_MSBDS_ONLY 2019-05-14 19:18:43 +02:00
cpu.h x86/cpu/topology: Provide detect_extended_topology_early() 2018-08-15 18:12:52 +02:00
cpuid-deps.c x86/cpuid: Replace set/clear_bit32() 2017-12-25 14:26:19 +01:00
cyrix.c x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors 2019-04-20 09:15:03 +02:00
hypervisor.c x86/virt: Add enum for hypervisors to replace x86_hyper 2017-12-25 14:26:20 +01:00
intel.c x86/spectre: Add missing family 6 check to microcode check 2018-09-05 09:26:39 +02:00
intel_cacheinfo.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
intel_rdt.c x86/intel_rdt: Enable CMT and MBM on new Skylake stepping 2018-06-26 08:06:32 +08:00
intel_rdt.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
intel_rdt_ctrlmondata.c x86/intel_rdt/mbm: Add mbm counter initialization 2017-08-01 22:41:29 +02:00
intel_rdt_monitor.c x86/intel_rdt/cqm: Improve limbo list processing 2017-08-16 12:05:41 +02:00
intel_rdt_rdtgroup.c x86/intel_rdt: Fix incorrect returned value when creating rdgroup sub-directory in resctrl file system 2018-05-30 07:52:02 +02:00
Makefile x86 / CPU: Always show current CPU frequency in /proc/cpuinfo 2018-01-10 09:31:20 +01:00
match.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mkcapflags.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mshyperv.c x86/hyper-v: Enable PIT shutdown quirk 2018-11-21 09:24:10 +01:00
perfctr-watchdog.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
powerflags.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
proc.c x86/cpu: Change type of x86_cache_size variable to unsigned int 2018-02-22 15:42:24 +01:00
rdrand.c x86, asm: Use CC_SET()/CC_OUT() and static_cpu_has() in archrandom.h 2016-06-08 12:41:20 -07:00
scattered.c x86/cpufeatures: Add CPUID_7_EDX CPUID leaf 2018-02-07 11:12:18 -08:00
topology.c x86/cpu/topology: Provide detect_extended_topology_early() 2018-08-15 18:12:52 +02:00
transmeta.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
umc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmware.c x86/cpu/vmware: Do not trace vmware_sched_clock() 2018-11-21 09:24:10 +01:00