From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aurelien Jarno Subject: [PATCH] KVM: fix LAPIC timer period overflow Date: Fri, 25 Sep 2009 11:09:37 +0200 Message-ID: <20090925090937.GA30138@hall.aurel32.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 To: kvm@vger.kernel.org Return-path: Received: from hall.aurel32.net ([88.191.82.174]:43674 "EHLO hall.aurel32.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750769AbZIYJbB (ORCPT ); Fri, 25 Sep 2009 05:31:01 -0400 Received: from aurel32 by hall.aurel32.net with local (Exim 4.69) (envelope-from ) id 1Mr6o5-0007s4-Lr for kvm@vger.kernel.org; Fri, 25 Sep 2009 11:09:37 +0200 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: Don't overflow when computing the 64-bit period from 32-bit registers. Fixes sourceforge bug #2826486. Signed-off-by: Aurelien Jarno --- arch/x86/kvm/lapic.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 9c8f901..3ca7767 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -658,7 +658,7 @@ static void start_apic_timer(struct kvm_lapic *apic) { ktime_t now = apic->lapic_timer.timer.base->get_time(); - apic->lapic_timer.period = apic_get_reg(apic, APIC_TMICT) * + apic->lapic_timer.period = (u64)apic_get_reg(apic, APIC_TMICT) * APIC_BUS_CYCLE_NS * apic->divide_count; atomic_set(&apic->lapic_timer.pending, 0); -- 1.6.4.3 -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net