linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@suse.de>
Cc: linux-kernel@vger.kernel.org,
	Ricardo Neri <ricardo.neri@intel.com>,
	Ricardo Neri <ricardo.neri-calderon@linux.intel.com>,
	x86@kernel.org, "Ravi V. Shankar" <ravi.v.shankar@intel.com>
Subject: [PATCH] x86/cpufeatures: Add enumeration for serialize instruction
Date: Thu,  2 Apr 2020 18:40:26 -0700	[thread overview]
Message-ID: <20200403014026.19137-1-ricardo.neri-calderon@linux.intel.com> (raw)

The serialize instruction ensures that before the next instruction is
fetched and executed, all the modifications to flags, registers, and memory
made by previous instructions are completed, draining all buffered writes
to memory.

Importantly, the serialize instruction does not modify registers,
arithmetic flags or memory.

Hence, the serialize instructions provides a better way for software
to serialize execution than using instructions such as cpuid, which does
modify registers and, in virtual machines, causes a VM exit.

This instruction is supported by the CPU if CPUID.7H.EDX[bit 14] is
set.

Cc: x86@kernel.org
Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
This new instruction is documented in the latest version of the Intel
Architecture Instruction Set Extensions and Future Features Programming
Reference Chapter 2.1 located at
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
---
 arch/x86/include/asm/cpufeatures.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index db189945e9b0..cd9b1ec022ec 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -364,6 +364,7 @@
 #define X86_FEATURE_AVX512_VP2INTERSECT (18*32+ 8) /* AVX-512 Intersect for D/Q */
 #define X86_FEATURE_MD_CLEAR		(18*32+10) /* VERW clears CPU buffers */
 #define X86_FEATURE_TSX_FORCE_ABORT	(18*32+13) /* "" TSX_FORCE_ABORT */
+#define X86_FEATURE_SERIALIZE		(18*32+14) /* SERIALIZE instruction */
 #define X86_FEATURE_PCONFIG		(18*32+18) /* Intel PCONFIG */
 #define X86_FEATURE_SPEC_CTRL		(18*32+26) /* "" Speculation Control (IBRS + IBPB) */
 #define X86_FEATURE_INTEL_STIBP		(18*32+27) /* "" Single Thread Indirect Branch Predictors */
-- 
2.17.1


             reply	other threads:[~2020-04-03  1:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03  1:40 Ricardo Neri [this message]
2020-04-03  8:12 ` [PATCH] x86/cpufeatures: Add enumeration for serialize instruction Borislav Petkov
2020-04-04  5:20   ` Ricardo Neri
2020-04-04  8:28     ` Borislav Petkov
2020-04-07  1:36       ` Ricardo Neri
2020-04-04 21:15     ` Andy Lutomirski
2020-04-07  1:38       ` Ricardo Neri
2020-04-07  1:53         ` Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200403014026.19137-1-ricardo.neri-calderon@linux.intel.com \
    --to=ricardo.neri-calderon@linux.intel.com \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=ricardo.neri@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).