Don't mark TSC unstable due to S4 suspend
PATCH 7/9 Don't mark TSC unstable due to S4 suspend
-------- Original Message --------
Subject: [KVM TSC emulation 7/9] Don't mark TSC unstable due to S4 suspend
Date: Mon, 20 Jun 2011 16:59:35 -0700
From: Zachary Amsden <[email protected]>
To: Avi Kivity <[email protected]>, Marcelo Tosatti <[email protected]>, Glauber Costa <[email protected]>, Frank Arnold <[email protected]>, Joerg Roedel <[email protected]>, Jan Kiszka <[email protected]>, [email protected], [email protected], Zachary Amsden <[email protected]>, Avi Kivity <[email protected]>, Marcelo Tosatti <[email protected]>, Glauber Costa <[email protected]>, Frank Arnold <[email protected]>, Joerg Roedel <[email protected]>, Jan Kiszka <[email protected]>, [email protected]
CC: Zachary Amsden <[email protected]>, Zachary Amsden <[email protected]>
During a host suspend, TSC may go backwards, which KVM interprets as an unstable TSC. Technically, KVM should not be marking the TSC unstable, which causes the TSC clocksource to go bad, but we need to be adjusting the TSC offsets in such a case.
Dealing with this issue is a little tricky as the only place we can reliably do it is before much of the timekeeping infrastructure is up and running. On top of this, we are not in a KVM thread context, so we may not be able to safely access VCPU fields. Instead, we compute our best known hardware offset at power-up and stash it to be applied to all VCPUs when they actually start running.
--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/x86.c | 93 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 5 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -0
@@ -394,6 +394,7 @@ struct kvm_vcpu_arch {u64 last_tsc_nsec;u64 last_tsc_write;u64 last_host_tsc; +u64 tsc_offset_adjustment;bool tsc_catchup;bool tsc_always_catchup;s8 virtual_tsc_shift;
arch/x86/kvm/x86.c +88 -5
107 lines not on this page · raw message
Signature · 1 line
1.7.1