From: Waiman Long <longman@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Tim Chen <tim.c.chen@linux.intel.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Waiman Long <longman@redhat.com>
Subject: [PATCH 2/2] x86/speculation: switch_to_cond_stibp on is the likely case
Date: Wed, 5 Dec 2018 14:49:28 -0500 [thread overview]
Message-ID: <1544039368-9009-2-git-send-email-longman@redhat.com> (raw)
In-Reply-To: <1544039368-9009-1-git-send-email-longman@redhat.com>
Since conditional STIBP is the default, it should be treated as
the likely case. Changes the use of static_branch_unlikely() to
static_branch_likely() for switch_to_cond_stibp.
Signed-off-by: Waiman Long <longman@redhat.com>
---
arch/x86/kernel/cpu/bugs.c | 2 +-
arch/x86/kernel/process.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index a68b32c..bd11119 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -153,7 +153,7 @@ void __init check_bugs(void)
hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
/* Conditional STIBP enabled? */
- if (static_branch_unlikely(&switch_to_cond_stibp))
+ if (static_branch_likely(&switch_to_cond_stibp))
hostval |= stibp_tif_to_spec_ctrl(ti->flags);
if (hostval != guestval) {
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 7d31192..39a21ae 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -434,7 +434,7 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp,
* otherwise avoid the MSR write.
*/
if (IS_ENABLED(CONFIG_SMP) &&
- static_branch_unlikely(&switch_to_cond_stibp)) {
+ static_branch_likely(&switch_to_cond_stibp)) {
updmsr |= !!(tif_diff & _TIF_SPEC_IB);
msr |= stibp_tif_to_spec_ctrl(tifn);
}
--
1.8.3.1
next prev parent reply other threads:[~2018-12-05 19:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 19:49 [PATCH 1/2] x86/speculation: Change STIPB to STIBP Waiman Long
2018-12-05 19:49 ` Waiman Long [this message]
2018-12-06 8:41 ` [PATCH 2/2] x86/speculation: switch_to_cond_stibp on is the likely case Peter Zijlstra
2018-12-06 15:38 ` Waiman Long
2018-12-07 8:52 ` Peter Zijlstra
2018-12-07 9:33 ` Thomas Gleixner
2018-12-06 11:06 ` [tip:x86/pti] x86/speculation: Change misspelled STIPB to STIBP tip-bot for Waiman Long
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=1544039368-9009-2-git-send-email-longman@redhat.com \
--to=longman@redhat.com \
--cc=bp@alien8.de \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--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).