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] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1101241105180.31219@router.home>
Date:	Mon, 24 Jan 2011 11:05:54 -0600 (CST)
From:	Christoph Lameter <cl@...ux.com>
To:	"H. Peter Anvin" <hpa@...or.com>
cc:	Tejun Heo <tj@...nel.org>, Pekka Enbeerg <penberg@...helsinki.fi>,
	linux-kernel@...r.kernel.org,
	Eric Dumazet <eric.dumazet@...il.com>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	akpm@...ux-foundation.org
Subject: Re: x86: A fast way to check capabilities of the current cpu

On Fri, 21 Jan 2011, H. Peter Anvin wrote:

> On 01/21/2011 09:46 AM, Christoph Lameter wrote:
> >> Oh, you're right.  Sorry about that.  Can you please then add a
> >> comment noting that the operation is x86 only?  Maybe prefix it with
> >> x86_?
> >
> > For a function defined in an specific include file and only used in arch
> > specific code?
>
> Yes, x86_ prefix to indicate it's an x86-specific interface, as opposed
> to arch_ which is a architecture-specific component of the
> implementation of a generic interface.

Subject: x86,percpu: Add x86_ prefix to this_cpu_test_bit and do not use percpu_read_stable

Add a prefix to this_cpu_test_bit and friends and do not use percpu_read_stable for
checking per cpu features.

Signed-off-by: Christoph Lameter <cl@...ux.com>


---
 arch/x86/include/asm/cpufeature.h |    2 +-
 arch/x86/include/asm/percpu.h     |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

Index: linux-2.6/arch/x86/include/asm/cpufeature.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/cpufeature.h	2011-01-24 09:18:53.000000000 -0600
+++ linux-2.6/arch/x86/include/asm/cpufeature.h	2011-01-24 09:19:02.000000000 -0600
@@ -224,7 +224,7 @@ extern const char * const x86_power_flag

 #define this_cpu_has(bit)						\
 	(__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : 	\
-	 this_cpu_test_bit(bit, (unsigned long *)&cpu_info.x86_capability))
+	 x86_this_cpu_test_bit(bit, (unsigned long *)&cpu_info.x86_capability))

 #define boot_cpu_has(bit)	cpu_has(&boot_cpu_data, bit)

Index: linux-2.6/arch/x86/include/asm/percpu.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/percpu.h	2011-01-24 09:18:53.000000000 -0600
+++ linux-2.6/arch/x86/include/asm/percpu.h	2011-01-24 09:24:21.000000000 -0600
@@ -492,15 +492,15 @@ do {									\
 	old__;								\
 })

-static __always_inline int this_cpu_constant_test_bit(unsigned int nr,
+static __always_inline int x86_this_cpu_constant_test_bit(unsigned int nr,
                         const unsigned long __percpu *addr)
 {
 	unsigned long __percpu *a = (unsigned long *)addr + nr / BITS_PER_LONG;

-	return ((1UL << (nr % BITS_PER_LONG)) & percpu_read_stable(*a)) != 0;
+	return ((1UL << (nr % BITS_PER_LONG)) & percpu_read(*a)) != 0;
 }

-static inline int this_cpu_variable_test_bit(int nr,
+static inline int x86_this_cpu_variable_test_bit(int nr,
                         const unsigned long __percpu *addr)
 {
 	int oldbit;
@@ -513,10 +513,10 @@ static inline int this_cpu_variable_test
 	return oldbit;
 }

-#define this_cpu_test_bit(nr, addr)			\
+#define x86_this_cpu_test_bit(nr, addr)			\
 	(__builtin_constant_p((nr))			\
-	 ? this_cpu_constant_test_bit((nr), (addr))	\
-	 : this_cpu_variable_test_bit((nr), (addr)))
+	 ? x86_this_cpu_constant_test_bit((nr), (addr))	\
+	 : x86_this_cpu_variable_test_bit((nr), (addr)))


 #include <asm-generic/percpu.h>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ