From: Peter Zijlstra <peterz@infradead.org>
To: Waiman Long <longman@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Tim Chen <tim.c.chen@linux.intel.com>,
Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [PATCH 2/2] x86/speculation: switch_to_cond_stibp on is the likely case
Date: Thu, 6 Dec 2018 09:41:41 +0100 [thread overview]
Message-ID: <20181206084141.GA13538@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1544039368-9009-2-git-send-email-longman@redhat.com>
On Wed, Dec 05, 2018 at 02:49:28PM -0500, Waiman Long wrote:
> 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.
So now you're making kernels on 'fixed' or unaffected hardware slower.
> 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-06 8:41 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 ` [PATCH 2/2] x86/speculation: switch_to_cond_stibp on is the likely case Waiman Long
2018-12-06 8:41 ` Peter Zijlstra [this message]
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=20181206084141.GA13538@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--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