public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* kvm: external module: do not hardcode tsc_khz
@ 2009-03-23 17:46 Marcelo Tosatti
  2009-03-24  9:36 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2009-03-23 17:46 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel


external module compat hard codes tsc_khz as 2000000 if KERNEL_VERSION <
(2,6,23).

This breaks kvmclock on hosts with different frequency.

While tsc_khz was only exported on 2.6.23, the majority of relevant
older v2.6 based distros seem to have it exported.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/kernel/external-module-compat-comm.h b/kernel/external-module-compat-comm.h
index a14cea2..e0dc577 100644
--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -387,15 +387,11 @@ static inline struct page *__kvm_vm_fault(struct vm_area_struct *vma,
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
-
-static unsigned  __attribute__((__used__)) kvm_tsc_khz = 2000000;
-
-#else
+extern unsigned int tsc_khz;
+#endif
 
 #define kvm_tsc_khz tsc_khz
 
-#endif
-
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21)
 
 #include <linux/ktime.h>

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

* Re: kvm: external module: do not hardcode tsc_khz
  2009-03-23 17:46 kvm: external module: do not hardcode tsc_khz Marcelo Tosatti
@ 2009-03-24  9:36 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-03-24  9:36 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm-devel

Marcelo Tosatti wrote:
> external module compat hard codes tsc_khz as 2000000 if KERNEL_VERSION <
> (2,6,23).
>
> This breaks kvmclock on hosts with different frequency.
>
> While tsc_khz was only exported on 2.6.23, the majority of relevant
> older v2.6 based distros seem to have it exported.
>   

Applied, thanks.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

end of thread, other threads:[~2009-03-24  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-23 17:46 kvm: external module: do not hardcode tsc_khz Marcelo Tosatti
2009-03-24  9:36 ` Avi Kivity

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