From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: kvm: external module: do not hardcode tsc_khz Date: Mon, 23 Mar 2009 14:46:43 -0300 Message-ID: <20090323174643.GA28963@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm-devel To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:57566 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753417AbZCWRqx (ORCPT ); Mon, 23 Mar 2009 13:46:53 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n2NHkpOh009047 for ; Mon, 23 Mar 2009 13:46:51 -0400 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: 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 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