From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] KVM: fix LAPIC timer period overflow Date: Mon, 28 Sep 2009 13:33:52 -0300 Message-ID: <20090928163352.GC3806@amt.cnet> References: <20090925090937.GA30138@hall.aurel32.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Aurelien Jarno Return-path: Received: from mx1.redhat.com ([209.132.183.28]:17580 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751992AbZI1QfJ (ORCPT ); Mon, 28 Sep 2009 12:35:09 -0400 Content-Disposition: inline In-Reply-To: <20090925090937.GA30138@hall.aurel32.net> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Sep 25, 2009 at 11:09:37AM +0200, Aurelien Jarno wrote: > 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); Applied, thanks.