From patchwork Fri Sep 25 09:09:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 50120 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8P9V8m9025551 for ; Fri, 25 Sep 2009 09:31:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751158AbZIYJbD (ORCPT ); Fri, 25 Sep 2009 05:31:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750992AbZIYJbB (ORCPT ); Fri, 25 Sep 2009 05:31:01 -0400 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 X-Greylist: delayed 1286 seconds by postgrey-1.27 at vger.kernel.org; Fri, 25 Sep 2009 05:31:01 EDT 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 Date: Fri, 25 Sep 2009 11:09:37 +0200 From: Aurelien Jarno To: kvm@vger.kernel.org Subject: [PATCH] KVM: fix LAPIC timer period overflow Message-ID: <20090925090937.GA30138@hall.aurel32.net> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: Mutt 1.5.18 (2008-05-17) User-Agent: Mutt/1.5.18 (2008-05-17) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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);