x86/cpu: Use SERIALIZE in sync_core() when available
authorRicardo Neri <ricardo.neri-calderon@linux.intel.com>
Fri, 7 Aug 2020 03:28:33 +0000 (20:28 -0700)
committerBorislav Petkov <bp@suse.de>
Mon, 17 Aug 2020 15:23:04 +0000 (17:23 +0200)
commitbf9c912f9a649776c2d741310486a6984edaac72
treebd117b159ac58aa892922bbcbb98a992ef3bb4c6
parent9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
x86/cpu: Use SERIALIZE in sync_core() when available

The SERIALIZE instruction gives software a way to force the processor to
complete all modifications to flags, registers and memory from previous
instructions and drain all buffered writes to memory before the next
instruction is fetched and executed. Thus, it serves the purpose of
sync_core(). Use it when available.

Suggested-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20200807032833.17484-1-ricardo.neri-calderon@linux.intel.com
arch/x86/include/asm/special_insns.h
arch/x86/include/asm/sync_core.h