lkml.org 
[lkml]   [2018]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] x86/speculation: switch_to_cond_stibp on is the likely case
Date
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
\
 
 \ /
  Last update: 2018-12-05 20:51    [W:0.050 / U:0.996 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site