lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-bfdd5a67c8cb02c147c6b012543e84cb1f5759ba@git.kernel.org>
Date:   Mon, 8 Apr 2019 07:29:02 -0700
From:   tip-bot for Borislav Petkov <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     hpa@...or.com, mingo@...nel.org, bp@...e.de, nadav.amit@...il.com,
        linux-kernel@...r.kernel.org, tglx@...utronix.de
Subject: [tip:x86/asm] x86/asm: Clarify static_cpu_has()'s intended use

Commit-ID:  bfdd5a67c8cb02c147c6b012543e84cb1f5759ba
Gitweb:     https://git.kernel.org/tip/bfdd5a67c8cb02c147c6b012543e84cb1f5759ba
Author:     Borislav Petkov <bp@...e.de>
AuthorDate: Fri, 29 Mar 2019 19:35:24 +0100
Committer:  Borislav Petkov <bp@...e.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@...il.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Cc: x86@...nel.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)
 {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ