public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Borislav Petkov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, mingo@kernel.org, bp@suse.de,
	nadav.amit@gmail.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de
Subject: [tip:x86/asm] x86/asm: Clarify static_cpu_has()'s intended use
Date: Mon, 8 Apr 2019 07:29:02 -0700	[thread overview]
Message-ID: <tip-bfdd5a67c8cb02c147c6b012543e84cb1f5759ba@git.kernel.org> (raw)
In-Reply-To: <20190330112022.28888-2-bp@alien8.de>

Commit-ID:  bfdd5a67c8cb02c147c6b012543e84cb1f5759ba
Gitweb:     https://git.kernel.org/tip/bfdd5a67c8cb02c147c6b012543e84cb1f5759ba
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Fri, 29 Mar 2019 19:35:24 +0100
Committer:  Borislav Petkov <bp@suse.de>
CommitDate: Mon, 8 Apr 2019 12:02:55 +0200

x86/asm: Clarify static_cpu_has()'s intended use

Clarify when one should use static_cpu_has() and when one should use
boot_cpu_has().

Requested-by: Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: x86@kernel.org
Link: https://lkml.kernel.org/r/20190330112022.28888-2-bp@alien8.de
---
 arch/x86/include/asm/cpufeature.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 2fb791a1b479..6d6d5cc4302b 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -155,9 +155,12 @@ extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit);
 #else
 
 /*
- * Static testing of CPU features.  Used the same as boot_cpu_has().
- * These will statically patch the target code for additional
- * performance.
+ * Static testing of CPU features. Used the same as boot_cpu_has(). It
+ * statically patches the target code for additional performance. Use
+ * static_cpu_has() only in fast paths, where every cycle counts. Which
+ * means that the boot_cpu_has() variant is already fast enough for the
+ * majority of cases and you should stick to using it as it is generally
+ * only two instructions: a RIP-relative MOV and a TEST.
  */
 static __always_inline bool _static_cpu_has(u16 bit)
 {

  parent reply	other threads:[~2019-04-08 14:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30 11:20 [PATCH 0/5] x86/asm: Remove some static_cpu_has() usage Borislav Petkov
2019-03-30 11:20 ` [PATCH 1/5] x86/asm: Clarify static_cpu_has()'s intended use Borislav Petkov
2019-04-01  8:06   ` Peter Zijlstra
2019-04-08 14:29   ` tip-bot for Borislav Petkov [this message]
2019-03-30 11:20 ` [PATCH 2/5] x86: Convert some slow-path static_cpu_has() callers to boot_cpu_has() Borislav Petkov
2019-03-30 12:47   ` Rik van Riel
2019-03-30 12:50   ` Juergen Gross
2019-04-08 14:29   ` [tip:x86/asm] " tip-bot for Borislav Petkov
2019-03-30 11:20 ` [PATCH 3/5] x86/kvm: " Borislav Petkov
2019-03-31 14:20   ` Paolo Bonzini
2019-03-31 15:12     ` Borislav Petkov
2019-04-01  7:24       ` Paolo Bonzini
2019-04-01  7:33         ` Borislav Petkov
2019-03-30 11:20 ` [PATCH 4/5] x86/mm: " Borislav Petkov
2019-04-08 14:30   ` [tip:x86/asm] " tip-bot for Borislav Petkov
2019-03-30 11:20 ` [PATCH 5/5] drivers/cpufreq: " Borislav Petkov
2019-04-01  9:31   ` Rafael J. Wysocki
2019-04-01  9:32     ` Rafael J. Wysocki
2019-04-01 12:48       ` Borislav Petkov
2019-04-01 21:34         ` Rafael J. Wysocki

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=tip-bfdd5a67c8cb02c147c6b012543e84cb1f5759ba@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=tglx@linutronix.de \
    /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