diff mbox

kvm: external module: do not hardcode tsc_khz

Message ID 20090323174643.GA28963@amt.cnet (mailing list archive)
State Accepted
Headers show

Commit Message

Marcelo Tosatti March 23, 2009, 5:46 p.m. UTC
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>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Avi Kivity March 24, 2009, 9:36 a.m. UTC | #1
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.
diff mbox

Patch

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>