linux_dsm_epyc7002/arch/x86/kernel
Thomas Gleixner 1f50ddb4f4 x86/speculation: Handle HT correctly on AMD
The AMD64_LS_CFG MSR is a per core MSR on Family 17H CPUs. That means when
hyperthreading is enabled the SSBD bit toggle needs to take both cores into
account. Otherwise the following situation can happen:

CPU0		CPU1

disable SSB
		disable SSB
		enable  SSB <- Enables it for the Core, i.e. for CPU0 as well

So after the SSB enable on CPU1 the task on CPU0 runs with SSB enabled
again.

On Intel the SSBD control is per core as well, but the synchronization
logic is implemented behind the per thread SPEC_CTRL MSR. It works like
this:

  CORE_SPEC_CTRL = THREAD0_SPEC_CTRL | THREAD1_SPEC_CTRL

i.e. if one of the threads enables a mitigation then this affects both and
the mitigation is only disabled in the core when both threads disabled it.

Add the necessary synchronization logic for AMD family 17H. Unfortunately
that requires a spinlock to serialize the access to the MSR, but the locks
are only shared between siblings.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2018-05-17 17:09:18 +02:00
..
acpi x86/acpi: Prevent X2APIC id 0xffffffff from being accounted 2018-04-17 11:56:31 +02:00
apic Merge branch 'WIP.x86/asm' into x86/urgent, because the topic is ready 2018-04-12 09:42:34 +02:00
cpu x86/cpufeatures: Add FEATURE_ZEN 2018-05-17 17:09:18 +02:00
fpu Merge commit 'upstream-x86-entry' into WIP.x86/mm 2017-12-17 12:58:53 +01:00
kprobes x86/kprobes: Fix kernel crash when probing .entry_trampoline code 2018-03-09 09:58:36 +01:00
.gitignore
alternative.c x86/paravirt: Remove 'noreplace-paravirt' cmdline option 2018-01-31 10:37:45 +01:00
amd_gart_64.c x86/dma/amd_gart: Use dma_direct_{alloc,free}() 2018-03-20 10:01:57 +01:00
amd_nb.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-15 01:15:52 +01:00
apb_timer.c
aperture_64.c x86/gart: Exclude GART aperture from vmcore 2018-01-11 15:09:24 +01:00
apm_32.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
asm-offsets_32.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-15 01:15:52 +01:00
asm-offsets_64.c x86/entry/64: Separate cpu_current_top_of_stack from TSS.sp0 2017-12-17 13:59:56 +01:00
asm-offsets.c x86/mm: Use/Fix PCID to optimize user/kernel switches 2017-12-23 21:13:00 +01:00
audit_64.c
bootflag.c
check.c
cpuid.c x86/cpuid: Allow cpuid_read() to schedule 2018-03-27 12:01:48 +02:00
crash_dump_32.c
crash_dump_64.c
crash.c kexec_file, x86: move re-factored code to generic side 2018-04-13 17:10:27 -07:00
devicetree.c Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-04-02 16:15:32 -07:00
doublefault.c x86/entry: Fix assumptions that the HW TSS is at the beginning of cpu_tss 2017-12-17 13:59:55 +01:00
dumpstack_32.c x86/dumpstack: Unify show_regs() 2018-03-08 12:04:59 +01:00
dumpstack_64.c x86/dumpstack: Unify show_regs() 2018-03-08 12:04:59 +01:00
dumpstack.c x86/dumpstack: Unify show_regs() 2018-03-08 12:04:59 +01:00
e820.c x86/boot/e820: Implement a range manipulation operator 2018-02-26 08:44:52 +01:00
early_printk.c
early-quirks.c x86/gpu: add CFL to early quirks 2017-12-15 13:18:00 -08:00
ebda.c
eisa.c
espfix_64.c x86/espfix: Document use of _PAGE_GLOBAL 2018-04-09 18:27:33 +02:00
ftrace_32.S x86/retpoline/ftrace: Convert ftrace assembler indirect jumps 2018-01-12 00:14:30 +01:00
ftrace_64.S Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-01-28 12:19:23 -08:00
ftrace.c
head32.c
head64.c x86/mm: Do not auto-massage page protections 2018-04-12 09:04:22 +02:00
head_32.S x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-15 01:15:52 +01:00
head_64.S x86/mm: Comment _PAGE_GLOBAL mystery 2018-04-12 09:05:58 +02:00
hpet.c
hw_breakpoint.c
i8237.c
i8253.c
i8259.c
idt.c Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-03-31 07:50:30 -10:00
io_delay.c
ioport.c x86/ioport: add ksys_ioperm() helper; remove in-kernel calls to sys_ioperm() 2018-04-02 20:16:12 +02:00
irq_32.c x86/retpoline/irq32: Convert assembler indirect jumps 2018-01-12 00:14:32 +01:00
irq_64.c x86/irq/64: Print the offending IP in the stack overflow warning 2017-12-17 13:59:53 +01:00
irq_work.c
irq.c Drivers: hv: vmbus: Implement Direct Mode for stimer0 2018-03-06 09:57:17 -08:00
irqinit.c x86/apic: Simplify init_bsp_APIC() usage 2018-02-13 17:30:38 +01:00
itmt.c x86/headers: Remove duplicate #includes 2017-12-12 11:32:24 +01:00
jailhouse.c x86/jailhouse: Fix incorrect SPDX identifier 2018-04-23 10:17:28 +02:00
jump_label.c
kdebugfs.c
kexec-bzimage64.c kexec_file: do not add extra alignment to efi memmap 2018-04-20 17:18:36 -07:00
kgdb.c
ksysfs.c
kvm.c ARM: 2018-04-09 11:42:31 -07:00
kvmclock.c xen: features and fixes for v4.15-rc1 2017-11-16 13:06:27 -08:00
ldt.c x86/ldt: Fix support_pte_mask filtering in map_ldt_struct() 2018-04-16 11:20:34 -07:00
livepatch.c
machine_kexec_32.c x86/apic: Remove the (now) unused disable_IO_APIC() function 2018-02-17 11:47:45 +01:00
machine_kexec_64.c kernel/kexec_file.c: remove mis-use of sh_offset field during purgatory load 2018-04-13 17:10:28 -07:00
Makefile Merge branch 'x86-dma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-04-02 17:18:45 -07:00
mmconf-fam10h_64.c
module.c x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 2018-02-22 09:01:10 -08:00
mpparse.c Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-02-14 17:02:15 -08:00
msr.c
nmi_selftest.c
nmi.c
paravirt_patch_32.c
paravirt_patch_64.c x86/paravirt: Dont patch flush_tlb_single 2017-12-17 14:27:52 +01:00
paravirt-spinlocks.c
paravirt.c x86/mm: Rename flush_tlb_single() and flush_tlb_one() to __flush_tlb_one_[user|kernel]() 2018-02-15 01:15:52 +01:00
pci-calgary_64.c x86/dma: Remove dma_alloc_coherent_gfp_flags() 2018-03-20 10:01:58 +01:00
pci-dma.c headers: untangle kmemleak.h from mm.h 2018-04-05 21:36:27 -07:00
pci-iommu_table.c
pci-swiotlb.c x86/dma: Use generic swiotlb_ops 2018-03-20 10:01:57 +01:00
pcspeaker.c
perf_regs.c
platform-quirks.c x86/platform: Control warm reset setup via legacy feature flag 2018-01-14 21:11:53 +01:00
pmem.c
probe_roms.c
process_32.c x86/entry/64: Make cpu_entry_area.tss read-only 2017-12-17 14:27:52 +01:00
process_64.c x86/kvm/vmx: read MSR_{FS,KERNEL_GS}_BASE from current->thread 2018-03-16 22:03:53 +01:00
process.c x86/speculation: Handle HT correctly on AMD 2018-05-17 17:09:18 +02:00
ptrace.c x86/asm: Move 'status' from thread_struct to thread_info 2018-01-30 15:30:36 +01:00
pvclock.c
quirks.c
reboot_fixups_32.c
reboot.c x86/apic: Fix restoring boot IRQ mode in reboot and kexec/kdump 2018-02-17 11:47:45 +01:00
relocate_kernel_32.S
relocate_kernel_64.S x86/kexec: Make kexec (mostly) work in 5-level paging mode 2018-01-31 08:39:40 +01:00
resource.c
rtc.c x86/rtc: Stop using deprecated functions 2018-03-15 09:47:24 +01:00
setup_percpu.c x86/cpu_entry_area: Sync cpu_entry_area to initial_page_table 2018-03-01 09:48:27 +01:00
setup.c x86/setup: Do not reserve a crash kernel region if booted on Xen PV 2018-04-27 17:06:28 +02:00
signal_compat.c parisc/signal: Add FPE_CONDTRAP for conditional trap handling 2018-04-11 11:40:35 +02:00
signal.c x86/sigreturn: use SYSCALL_DEFINE0 2018-04-02 20:16:14 +02:00
smp.c
smpboot.c x86/speculation: Handle HT correctly on AMD 2018-05-17 17:09:18 +02:00
stacktrace.c Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-01-03 16:41:07 -08:00
step.c
sys_x86_64.c mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff() 2018-04-02 20:16:11 +02:00
sysfb_efi.c
sysfb_simplefb.c
sysfb.c
tboot.c x86/pti: Make unpoison of pgd for trusted boot work for real 2018-01-11 23:36:59 +01:00
tce_64.c
time.c x86/time: Unconditionally register legacy timer interrupt 2018-01-14 20:18:23 +01:00
tls.c x86/ldt: Make the LDT mapping RO 2017-12-23 21:13:01 +01:00
tls.h
topology.c
trace_clock.c
tracepoint.c
traps.c x86/entry/64: Don't use IST entry for #BP stack 2018-03-23 21:10:36 +01:00
tsc_msr.c
tsc_sync.c
tsc.c x86/tsc: Prevent 32bit truncation in calc_hpet_ref() 2018-04-17 11:50:42 +02:00
umip.c x86/umip: Fix insn_get_code_seg_params()'s return value 2017-11-23 20:17:59 +01:00
unwind_frame.c
unwind_guess.c
unwind_orc.c extable: Make init_kernel_text() global 2018-02-21 16:54:06 +01:00
uprobes.c uprobes/x86: Emulate push insns for uprobe on x86 2017-12-11 18:42:11 +01:00
verify_cpu.S
vm86_32.c x86/vm86/32: Fix POPF emulation 2018-03-14 09:21:01 +01:00
vmlinux.lds.S Merge branch 'linus' into x86/build to pick up dependencies 2018-03-20 10:56:18 +01:00
vsmp_64.c
x86_init.c xen, mm: allow deferred page initialization for xen pv domains 2018-04-11 10:28:38 -07:00