public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86-64: Simplify cpu_has_invlpg
@ 2011-07-10 13:53 Brian Gerst
  2011-07-10 13:53 ` [PATCH 2/2] x86: Simplify X86_CMPXCHG, CMPXCHG_LOCAL, and X86_XADD Brian Gerst
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Brian Gerst @ 2011-07-10 13:53 UTC (permalink / raw)
  To: hpa; +Cc: x86, linux-kernel

Define CONFIG_X86_INVLPG for 64-bit too, which simplifies the code.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/Kconfig.cpu              |    2 +-
 arch/x86/include/asm/cpufeature.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 6a7cfdf..d801dfe 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -350,7 +350,7 @@ config X86_WP_WORKS_OK
 
 config X86_INVLPG
 	def_bool y
-	depends on X86_32 && !M386
+	depends on !M386
 
 config X86_BSWAP
 	def_bool y
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 71cc380..102b6f0 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -289,7 +289,7 @@ extern const char * const x86_power_flags[32];
 #define cpu_has_pclmulqdq	boot_cpu_has(X86_FEATURE_PCLMULQDQ)
 #define cpu_has_perfctr_core	boot_cpu_has(X86_FEATURE_PERFCTR_CORE)
 
-#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64)
+#ifdef CONFIG_X86_INVLPG
 # define cpu_has_invlpg		1
 #else
 # define cpu_has_invlpg		(boot_cpu_data.x86 > 3)
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] x86: Simplify X86_CMPXCHG, CMPXCHG_LOCAL, and X86_XADD
  2011-07-10 13:53 [PATCH 1/2] x86-64: Simplify cpu_has_invlpg Brian Gerst
@ 2011-07-10 13:53 ` Brian Gerst
  2011-07-10 16:35   ` Pekka Enberg
  2011-07-10 16:34 ` [PATCH 1/2] x86-64: Simplify cpu_has_invlpg Pekka Enberg
  2011-07-10 18:18 ` H. Peter Anvin
  2 siblings, 1 reply; 6+ messages in thread
From: Brian Gerst @ 2011-07-10 13:53 UTC (permalink / raw)
  To: hpa; +Cc: x86, linux-kernel

X86_64 and M386 can never be both set, so reduce the conditional to !M386.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/Kconfig.cpu |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index d801dfe..a913325 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -307,10 +307,10 @@ config X86_INTERNODE_CACHE_SHIFT
 	default X86_L1_CACHE_SHIFT
 
 config X86_CMPXCHG
-	def_bool X86_64 || (X86_32 && !M386)
+	def_bool !M386
 
 config CMPXCHG_LOCAL
-	def_bool X86_64 || (X86_32 && !M386)
+	def_bool !M386
 
 config X86_L1_CACHE_SHIFT
 	int
@@ -320,8 +320,7 @@ config X86_L1_CACHE_SHIFT
 	default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
 
 config X86_XADD
-	def_bool y
-	depends on X86_64 || !M386
+	def_bool !M386
 
 config X86_PPRO_FENCE
 	bool "PentiumPro memory ordering errata workaround"
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] x86-64: Simplify cpu_has_invlpg
  2011-07-10 13:53 [PATCH 1/2] x86-64: Simplify cpu_has_invlpg Brian Gerst
  2011-07-10 13:53 ` [PATCH 2/2] x86: Simplify X86_CMPXCHG, CMPXCHG_LOCAL, and X86_XADD Brian Gerst
@ 2011-07-10 16:34 ` Pekka Enberg
  2011-07-10 18:18 ` H. Peter Anvin
  2 siblings, 0 replies; 6+ messages in thread
From: Pekka Enberg @ 2011-07-10 16:34 UTC (permalink / raw)
  To: Brian Gerst; +Cc: hpa, x86, linux-kernel

On Sun, Jul 10, 2011 at 4:53 PM, Brian Gerst <brgerst@gmail.com> wrote:
> Define CONFIG_X86_INVLPG for 64-bit too, which simplifies the code.
>
> Signed-off-by: Brian Gerst <brgerst@gmail.com>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] x86: Simplify X86_CMPXCHG, CMPXCHG_LOCAL, and X86_XADD
  2011-07-10 13:53 ` [PATCH 2/2] x86: Simplify X86_CMPXCHG, CMPXCHG_LOCAL, and X86_XADD Brian Gerst
@ 2011-07-10 16:35   ` Pekka Enberg
  0 siblings, 0 replies; 6+ messages in thread
From: Pekka Enberg @ 2011-07-10 16:35 UTC (permalink / raw)
  To: Brian Gerst; +Cc: hpa, x86, linux-kernel

On Sun, Jul 10, 2011 at 4:53 PM, Brian Gerst <brgerst@gmail.com> wrote:
> X86_64 and M386 can never be both set, so reduce the conditional to !M386.
>
> Signed-off-by: Brian Gerst <brgerst@gmail.com>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] x86-64: Simplify cpu_has_invlpg
  2011-07-10 13:53 [PATCH 1/2] x86-64: Simplify cpu_has_invlpg Brian Gerst
  2011-07-10 13:53 ` [PATCH 2/2] x86: Simplify X86_CMPXCHG, CMPXCHG_LOCAL, and X86_XADD Brian Gerst
  2011-07-10 16:34 ` [PATCH 1/2] x86-64: Simplify cpu_has_invlpg Pekka Enberg
@ 2011-07-10 18:18 ` H. Peter Anvin
  2011-07-11 11:50   ` Brian Gerst
  2 siblings, 1 reply; 6+ messages in thread
From: H. Peter Anvin @ 2011-07-10 18:18 UTC (permalink / raw)
  To: Brian Gerst; +Cc: x86, linux-kernel

On 07/10/2011 06:53 AM, Brian Gerst wrote:
> Define CONFIG_X86_INVLPG for 64-bit too, which simplifies the code.
> 
> Signed-off-by: Brian Gerst <brgerst@gmail.com>

I think a much better way to do this kind of stuff is to define
Linux-specific CPU feature bits (which we already have quite a few of).
 That way they fall into the same mechanism as everything else that has
switches on CPU features, we can use alternatives, and so on.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] x86-64: Simplify cpu_has_invlpg
  2011-07-10 18:18 ` H. Peter Anvin
@ 2011-07-11 11:50   ` Brian Gerst
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Gerst @ 2011-07-11 11:50 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: x86, linux-kernel

On Sun, Jul 10, 2011 at 2:18 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 07/10/2011 06:53 AM, Brian Gerst wrote:
>> Define CONFIG_X86_INVLPG for 64-bit too, which simplifies the code.
>>
>> Signed-off-by: Brian Gerst <brgerst@gmail.com>
>
> I think a much better way to do this kind of stuff is to define
> Linux-specific CPU feature bits (which we already have quite a few of).
>  That way they fall into the same mechanism as everything else that has
> switches on CPU features, we can use alternatives, and so on.

I don't think it's worth getting too fancy with this.  Even if you
used alternatives, you'd want the config option to eliminate the
alternative when compiling for 486+.

--
Brian Gerst

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-07-11 11:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-10 13:53 [PATCH 1/2] x86-64: Simplify cpu_has_invlpg Brian Gerst
2011-07-10 13:53 ` [PATCH 2/2] x86: Simplify X86_CMPXCHG, CMPXCHG_LOCAL, and X86_XADD Brian Gerst
2011-07-10 16:35   ` Pekka Enberg
2011-07-10 16:34 ` [PATCH 1/2] x86-64: Simplify cpu_has_invlpg Pekka Enberg
2011-07-10 18:18 ` H. Peter Anvin
2011-07-11 11:50   ` Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox