diff mbox

[kvm-Bugs-2826486] Clock speed in FreeBSD

Message ID E1Mr6qA-00072Z-Ks@155xhf1.ch3.sourceforge.com (mailing list archive)
State New, archived
Headers show

Commit Message

SourceForge.net Sept. 25, 2009, 9:11 a.m. UTC
Bugs item #2826486, was opened at 2009-07-24 11:16
Message generated for change (Comment added) made by aurel32
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=2826486&group_id=180599

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: POLYMORF34 (polymorf34)
Assigned to: Nobody/Anonymous (nobody)
Summary: Clock speed in FreeBSD

Initial Comment:
I use KVM 88 and KVM 85 on Gentoo GNU/Linux 2.6.29, running on Intel Core2 CPU 6320 and Intel Xeon CPU E5405, both in 64 bits mode.
All gests running on FreeBSD 7.1-p5 in 64 bits with -smp 1. The first machine host only one gest.

The "sleep" command on FreeBSD does not work has expected. All sleep time are multiplied by 3

Example :

 freebsdmachine ~ # time sleep 1
real	0m3.148s
user	0m0.000s
sys	0m0.002s

freebsdmachine ~ # time sleep 10
real	0m31.429s
user	0m0.009s
sys	0m0.002s

With the "-no-kvm" flag, the "sleep" command works has expected.

----------------------------------------------------------------------

Comment By: Aurelien Jarno (aurel32)
Date: 2009-09-25 11:11

Message:
The following patch fixes the problem for me (already posted on the mailing
list).

From 0dc540e09345ad5a1b99acbc92a7eab60029cec3 Mon Sep 17 00:00:00 2001
From: Aurelien Jarno <aurelien@aurel32.net>
Date: Fri, 25 Sep 2009 11:01:30 +0200
Subject: [PATCH] KVM: fix LAPIC timer period overflow

Don't overflow when computing the 64-bit period from 32-bit registers.

Fixes sourceforge bug #2826486.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 arch/x86/kvm/lapic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

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);