linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i386: Decouple PAE from CONFIG_CMPXCHG64
@ 2007-07-18 16:34 Avi Kivity
  2007-07-18 18:18 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2007-07-18 16:34 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: H. Peter Anvin, kvm-devel, linux-kernel, caglar, andi, Avi Kivity

Commit 9d9bbd4d247a674deb43565582151acdc22e90d1 makes CONFIG_CMPXCHG64
dependent on CONFIG_HIGHMEM64G, but KVM guest SMP support now also
requires CMPXCHG64 while not being tied to PAE.  So the effect of that patch
is to disable KVM on non-PAE configs.

Untangle those dependencies by:
 - having KVM select CMPXCHG64
 - having HIGHMEM64G select CMPXCHG64_REQUIRED, a variant that also
   checks for the feature at early boot

No processors that support KVM exist that also do not support CMPXCHG64,
so no additional check is necessary.  This setup allows for a single kernel
that will boot on i486 and also support KVM if available.

Signed-off-by: Avi Kivity <avi@qumranet.com>

diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index c7c9c2a..d894cb2 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -542,6 +542,7 @@ config HIGHMEM4G
 config HIGHMEM64G
 	bool "64GB"
 	depends on !M386 && !M486
+	select X86_CMPXCHG64_REQUIRED
 	help
 	  Select this if you have a 32-bit processor and more than 4
 	  gigabytes of physical RAM.
diff --git a/arch/i386/Kconfig.cpu b/arch/i386/Kconfig.cpu
index 9cbe76c..e11870b 100644
--- a/arch/i386/Kconfig.cpu
+++ b/arch/i386/Kconfig.cpu
@@ -299,8 +299,11 @@ config X86_POPAD_OK
 
 config X86_CMPXCHG64
 	bool
-	depends on X86_PAE
-	default y
+	depends on !M386 && !M486
+
+config X86_CMPXCHG64_REQUIRED
+	bool
+	select X86_CMPXCHG64
 
 config X86_ALIGNMENT_16
 	bool
diff --git a/drivers/kvm/Kconfig b/drivers/kvm/Kconfig
index 33fa28a..6d53316 100644
--- a/drivers/kvm/Kconfig
+++ b/drivers/kvm/Kconfig
@@ -11,7 +11,7 @@ if VIRTUALIZATION
 config KVM
 	tristate "Kernel-based Virtual Machine (KVM) support"
 	depends on X86 && EXPERIMENTAL
-	depends on X86_CMPXCHG64 || 64BIT
+	select X86_CMPXCHG64 if X86_32
 	---help---
 	  Support hosting fully virtualized guest machines using hardware
 	  virtualization extensions.  You will need a fairly recent
diff --git a/include/asm-i386/required-features.h b/include/asm-i386/required-features.h
index 65848a0..e4746fd 100644
--- a/include/asm-i386/required-features.h
+++ b/include/asm-i386/required-features.h
@@ -29,7 +29,7 @@
 # define NEED_CMOV	0
 #endif
 
-#ifdef CONFIG_X86_CMPXCHG64
+#ifdef CONFIG_X86_CMPXCHG64_REQUIRED
 # define NEED_CX8	(1<<(X86_FEATURE_CX8 & 31))
 #else
 # define NEED_CX8	0

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

* Re: [PATCH] i386: Decouple PAE from CONFIG_CMPXCHG64
  2007-07-18 16:34 [PATCH] i386: Decouple PAE from CONFIG_CMPXCHG64 Avi Kivity
@ 2007-07-18 18:18 ` Andi Kleen
  2007-07-19  1:20   ` H. Peter Anvin
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2007-07-18 18:18 UTC (permalink / raw)
  To: Avi Kivity
  Cc: Linus Torvalds, H. Peter Anvin, kvm-devel, linux-kernel, caglar,
	andi

On Wed, Jul 18, 2007 at 07:34:47PM +0300, Avi Kivity wrote:
> Commit 9d9bbd4d247a674deb43565582151acdc22e90d1 makes CONFIG_CMPXCHG64
> dependent on CONFIG_HIGHMEM64G, but KVM guest SMP support now also
> requires CMPXCHG64 while not being tied to PAE.  So the effect of that patch
> is to disable KVM on non-PAE configs.
> 
> Untangle those dependencies by:
>  - having KVM select CMPXCHG64
>  - having HIGHMEM64G select CMPXCHG64_REQUIRED, a variant that also
>    checks for the feature at early boot
> 
> No processors that support KVM exist that also do not support CMPXCHG64,
> so no additional check is necessary.  This setup allows for a single kernel
> that will boot on i486 and also support KVM if available.

The CONFIG should only control the early CPUID checks, which are needed for PAE
kernels.

But for something late like KVM the correct fix is really to drop
the ifdefs around the macro and check boot_cpu_has() yourself.

-Andi

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

* Re: [PATCH] i386: Decouple PAE from CONFIG_CMPXCHG64
  2007-07-18 18:18 ` Andi Kleen
@ 2007-07-19  1:20   ` H. Peter Anvin
  0 siblings, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2007-07-19  1:20 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Avi Kivity, Linus Torvalds, kvm-devel, linux-kernel, caglar

Andi Kleen wrote:
>>
>> No processors that support KVM exist that also do not support CMPXCHG64,
>> so no additional check is necessary.  This setup allows for a single kernel
>> that will boot on i486 and also support KVM if available.
> 
> The CONFIG should only control the early CPUID checks, which are needed for PAE
> kernels.
> 
> But for something late like KVM the correct fix is really to drop
> the ifdefs around the macro and check boot_cpu_has() yourself.
> 

He's checking for the appropriate functionality at runtime.  What this
does is makes it impossible to select KVM when you have already selected
a CPU that doesn't support CX8.

One can, of course, question the utility, since the CPU set that
supports KVM all support CX8, but not vice versa...

	-hpa

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

end of thread, other threads:[~2007-07-19  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-18 16:34 [PATCH] i386: Decouple PAE from CONFIG_CMPXCHG64 Avi Kivity
2007-07-18 18:18 ` Andi Kleen
2007-07-19  1:20   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).