From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH 0/2] Fix build on i386 due to the latest tsc changes Date: Thu, 16 Feb 2012 15:48:01 +0200 Message-ID: <1329400083-22070-1-git-send-email-avi@redhat.com> Cc: kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53391 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752955Ab2BPNsO (ORCPT ); Thu, 16 Feb 2012 08:48:14 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1GDmE7j010162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Feb 2012 08:48:14 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q1GDmDgo024290 for ; Thu, 16 Feb 2012 08:48:14 -0500 Sender: kvm-owner@vger.kernel.org List-ID: The code fixed by the second patch looks suspect though: nsdiff = data - kvm->arch.last_tsc_write; nsdiff = (nsdiff * 1000) / vcpu->arch.virtual_tsc_khz; before the division, nsdiff is in tsc units. Dividing it by tsc_khz/1000 is equivalent to multiplying it by 1000000 and dividing it by tsc_hz, so the result is in units of mega-seconds. I expect we want nsdiff /= (u64)tsc_khz * 1000; (which is somewhat hard on i386) Avi Kivity (2): KVM: Fix 64-bit division in kvm_set_tsc_khz() KVM: Fix 64-bit division in kvm_write_tsc() arch/x86/kvm/x86.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) -- 1.7.9