[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1A42CE6F5F474C41B63392A5F80372B22A8253C5@shsmsx501.ccr.corp.intel.com>
Date: Tue, 7 Sep 2010 11:44:01 +0800
From: "Dong, Eddie" <eddie.dong@...el.com>
To: Zachary Amsden <zamsden@...hat.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
CC: Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>,
Glauber Costa <glommer@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
John Stultz <johnstul@...ibm.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Dong, Eddie" <eddie.dong@...el.com>
Subject: RE: [KVM timekeeping 26/35] Catchup slower TSC to guest rate
Zachary:
Will you extend the logic to cover the situation when the guest runs at higher than the guest rate but the PCPU is over committed. In that case, likely we can use the time spent when the VCPU is scheduled out to catch up as well. Of course if the VCPU scheduled out time is not enough to compensate the cycles caused by fast host TSC (exceeding a threahold), we will eventually have to fall back to trap and emulation mode.
Thx, Eddie
-----Original Message-----
From: kvm-owner@...r.kernel.org [mailto:kvm-owner@...r.kernel.org] On Behalf Of Zachary Amsden
Sent: 2010年8月20日 16:08
To: kvm@...r.kernel.org
Cc: Zachary Amsden; Avi Kivity; Marcelo Tosatti; Glauber Costa; Thomas Gleixner; John Stultz; linux-kernel@...r.kernel.org
Subject: [KVM timekeeping 26/35] Catchup slower TSC to guest rate
Use the catchup code to continue adjusting the TSC when
running at lower than the guest rate
Signed-off-by: Zachary Amsden <zamsden@...hat.com>
---
arch/x86/kvm/x86.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a4215d7..086d56a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1013,8 +1013,11 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
kvm_x86_ops->adjust_tsc_offset(v, tsc-tsc_timestamp);
}
local_irq_restore(flags);
- if (catchup)
+ if (catchup) {
+ if (this_tsc_khz < v->kvm->arch.virtual_tsc_khz)
+ vcpu->tsc_rebase = 1;
return 0;
+ }
/*
* Time as measured by the TSC may go backwards when resetting the base
@@ -5022,6 +5025,10 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
kvm_guest_exit();
+ /* Running on slower TSC without kvmclock, we must bump TSC */
+ if (vcpu->arch.tsc_rebase)
+ kvm_request_clock_update(vcpu);
+
preempt_enable();
vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists