From: Tomasz Wroblewski Subject: [PATCH] hvm: reset TSC to 0 after domain resume from S3 Date: Wed, 20 Nov 2013 15:22:28 +0100 Message-ID: <1384957348-5853-1-git-send-email-tomasz.wroblewski@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Tomasz Wroblewski List-Id: xen-devel@lists.xenproject.org Host S3 implicitly resets the host TSC to 0, but the tsc offset for hvm domains is not recalculated when they resume, causing it to go into negative values. In Linux guest using tsc clocksource, this results in a hang after wrap back to positive values since the tsc clocksource implementation expects it reset. Signed-off-by: Tomasz Wroblewski --- xen/arch/x86/hvm/hvm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 3b353ec..3d48978 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3736,8 +3736,13 @@ static void hvm_s3_suspend(struct domain *d) static void hvm_s3_resume(struct domain *d) { + struct vcpu *v; if ( test_and_clear_bool(d->arch.hvm_domain.is_s3_suspended) ) + { + for_each_vcpu( d, v ) + hvm_set_guest_tsc( v, 0 ); domain_unpause(d); + } } static int hvmop_set_isa_irq_level( -- 1.8.4.rc3