linux_dsm_epyc7002/arch/x86/kernel/cpu
Thomas Gleixner 07f07f55a2 x86/speculation/mds: Conditionally clear CPU buffers on idle entry
Add a static key which controls the invocation of the CPU buffer clear
mechanism on idle entry. This is independent of other MDS mitigations
because the idle entry invocation to mitigate the potential leakage due to
store buffer repartitioning is only necessary on SMT systems.

Add the actual invocations to the different halt/mwait variants which
covers all usage sites. mwaitx is not patched as it's not available on
Intel CPUs.

The buffer clear is only invoked before entering the C-State to prevent
that stale data from the idling CPU is spilled to the Hyper-Thread sibling
after the Store buffer got repartitioned and all entries are available to
the non idle sibling.

When coming out of idle the store buffer is partitioned again so each
sibling has half of it available. Now CPU which returned from idle could be
speculatively exposed to contents of the sibling, but the buffers are
flushed either on exit to user space or on VMENTER.

When later on conditional buffer clearing is implemented on top of this,
then there is no action required either because before returning to user
space the context switch will set the condition flag which causes a flush
on the return to user path.

Note, that the buffer clearing on idle is only sensible on CPUs which are
solely affected by MSBDS and not any other variant of MDS because the other
MDS variants cannot be mitigated when SMT is enabled, so the buffer
clearing on idle would be a window dressing exercise.

This intentionally does not handle the case in the acpi/processor_idle
driver which uses the legacy IO port interface for C-State transitions for
two reasons:

 - The acpi/processor_idle driver was replaced by the intel_idle driver
   almost a decade ago. Anything Nehalem upwards supports it and defaults
   to that new driver.

 - The legacy IO port interface is likely to be used on older and therefore
   unaffected CPUs or on systems which do not receive microcode updates
   anymore, so there is no point in adding that.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Jon Masters <jcm@redhat.com>
Tested-by: Jon Masters <jcm@redhat.com>
2019-03-06 21:52:13 +01:00
..
mce x86/MCE: Initialize mce.bank in the case of a fatal error in mce_no_way_out() 2019-02-03 13:24:24 +01:00
microcode x86/microcode/amd: Don't falsely trick the late loading mechanism 2019-01-31 16:54:32 +01:00
mtrr x86/mtrr: Don't copy uninitialized gentry fields back to userspace 2018-12-19 00:00:16 +01:00
resctrl x86/resctrl: Avoid confusion over the new X86_RESCTRL config 2019-02-02 10:34:52 +01:00
.gitignore
amd.c x86/kernel: Fix more -Wmissing-prototypes warnings 2018-12-08 12:24:35 +01:00
aperfmperf.c x86/kernel: Fix more -Wmissing-prototypes warnings 2018-12-08 12:24:35 +01:00
bugs.c x86/speculation/mds: Conditionally clear CPU buffers on idle entry 2019-03-06 21:52:13 +01:00
cacheinfo.c x86/kernel: Fix more -Wmissing-prototypes warnings 2018-12-08 12:24:35 +01:00
centaur.c x86/CPU: Move x86_cpuinfo::x86_max_cores assignment to detect_num_cpu_cores() 2018-05-13 16:14:24 +02:00
common.c x86/speculation/mds: Add BUG_MSBDS_ONLY 2019-03-06 21:52:11 +01:00
cpu.h x86/cpufeatures: Remove get_scattered_cpuid_leaf() 2018-11-05 20:54:20 +01:00
cpuid-deps.c
cyrix.c x86/CPU: Use correct macros for Cyrix calls 2018-09-22 11:46:56 +02:00
hygon.c x86/cpu: Get cache info and setup cache cpumap for Hygon Dhyana 2018-09-27 18:28:57 +02:00
hypervisor.c
intel_pconfig.c
intel.c x86/spectre: Add missing family 6 check to microcode check 2018-08-27 10:29:14 +02:00
Makefile x86/resctrl: Avoid confusion over the new X86_RESCTRL config 2019-02-02 10:34:52 +01:00
match.c
mkcapflags.sh
mshyperv.c x86/hyper-v: Enable PIT shutdown quirk 2018-11-04 11:04:46 +01:00
perfctr-watchdog.c x86/events: Add Hygon Dhyana support to PMU infrastructure 2018-09-27 18:28:57 +02:00
powerflags.c
proc.c
rdrand.c
scattered.c Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-12-26 17:35:41 -08:00
topology.c x86/kernel: Fix more -Wmissing-prototypes warnings 2018-12-08 12:24:35 +01:00
transmeta.c
umc.c
vmware.c x86/cpu/vmware: Do not trace vmware_sched_clock() 2018-11-09 21:39:14 +01:00