public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: move kvmclock initialization inside kvm_guest_init
@ 2008-04-16 16:59 Glauber Costa
  2008-04-16 17:29 ` Glauber de Oliveira Costa
  0 siblings, 1 reply; 2+ messages in thread
From: Glauber Costa @ 2008-04-16 16:59 UTC (permalink / raw)
  To: kvm-devel; +Cc: Glauber Costa, avi, virtualization

It makes no sense for the clock initialization to be
hanging around in setup_32.c when we have a generic kvm guest
initialization function available. So, we move kvmclock_init()
inside such a function, leading to a cleaner code.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 arch/x86/kernel/kvm.c      |    2 ++
 arch/x86/kernel/setup_32.c |    4 ----
 include/linux/kvm_para.h   |    5 +++++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index d9121f9..5cad368 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -210,6 +210,8 @@ static void paravirt_ops_setup(void)
 	pv_info.name = "KVM";
 	pv_info.paravirt_enabled = 1;
 
+	kvmclock_init();
+
 	if (kvm_para_has_feature(KVM_FEATURE_NOP_IO_DELAY))
 		pv_cpu_ops.io_delay = kvm_io_delay;
 
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 65f3a23..029350c 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -771,10 +771,6 @@ void __init setup_arch(char **cmdline_p)
 
 	max_low_pfn = setup_memory();
 
-#ifdef CONFIG_KVM_CLOCK
-	kvmclock_init();
-#endif
-
 #ifdef CONFIG_VMI
 	/*
 	 * Must be after max_low_pfn is determined, and before kernel
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 3ddce03..c5e662c 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -28,6 +28,11 @@ void __init kvm_guest_init(void);
 #else
 #define kvm_guest_init() do { } while (0)
 #endif
+#ifdef CONFIG_KVM_CLOCK
+void kvmclock_init(void);
+#else
+#define kvmclock_init() do { } while (0)
+#endif
 
 static inline int kvm_para_has_feature(unsigned int feature)
 {
-- 
1.5.0.6


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

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

* Re: [PATCH] kvm: move kvmclock initialization inside kvm_guest_init
  2008-04-16 16:59 [PATCH] kvm: move kvmclock initialization inside kvm_guest_init Glauber Costa
@ 2008-04-16 17:29 ` Glauber de Oliveira Costa
  0 siblings, 0 replies; 2+ messages in thread
From: Glauber de Oliveira Costa @ 2008-04-16 17:29 UTC (permalink / raw)
  To: kvm-devel; +Cc: avi, virtualization

Glauber Costa wrote:
> It makes no sense for the clock initialization to be
> hanging around in setup_32.c when we have a generic kvm guest
> initialization function available. So, we move kvmclock_init()
> inside such a function, leading to a cleaner code.
>
> Signed-off-by: Glauber Costa <gcosta@redhat.com>
> ---
>  arch/x86/kernel/kvm.c      |    2 ++
>  arch/x86/kernel/setup_32.c |    4 ----
>  include/linux/kvm_para.h   |    5 +++++
>  3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index d9121f9..5cad368 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -210,6 +210,8 @@ static void paravirt_ops_setup(void)
>  	pv_info.name = "KVM";
>  	pv_info.paravirt_enabled = 1;
>  
> +	kvmclock_init();
> +
>  	if (kvm_para_has_feature(KVM_FEATURE_NOP_IO_DELAY))
>  		pv_cpu_ops.io_delay = kvm_io_delay;
>  
> diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
> index 65f3a23..029350c 100644
> --- a/arch/x86/kernel/setup_32.c
> +++ b/arch/x86/kernel/setup_32.c
> @@ -771,10 +771,6 @@ void __init setup_arch(char **cmdline_p)
>  
>  	max_low_pfn = setup_memory();
>  
> -#ifdef CONFIG_KVM_CLOCK
> -	kvmclock_init();
> -#endif
> -
>  #ifdef CONFIG_VMI
>  	/*
>  	 * Must be after max_low_pfn is determined, and before kernel
> diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
> index 3ddce03..c5e662c 100644
> --- a/include/linux/kvm_para.h
> +++ b/include/linux/kvm_para.h
> @@ -28,6 +28,11 @@ void __init kvm_guest_init(void);
>  #else
>  #define kvm_guest_init() do { } while (0)
>  #endif
> +#ifdef CONFIG_KVM_CLOCK
> +void kvmclock_init(void);
> +#else
> +#define kvmclock_init() do { } while (0)
> +#endif
>  
>  static inline int kvm_para_has_feature(unsigned int feature)
>  {
>   

Forget about it. Marelo just screamed to me (and somehow I heard it), 
that this create a bogus dependency between clock and the mmu functions. 
Duh.

I'll resend a better version

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

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

end of thread, other threads:[~2008-04-16 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-16 16:59 [PATCH] kvm: move kvmclock initialization inside kvm_guest_init Glauber Costa
2008-04-16 17:29 ` Glauber de Oliveira Costa

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