hvm: reset TSC to 0 after domain resume from S3
PATCH 1/1 hvm: reset TSC to 0 after domain resume from S3
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.
--- xen/arch/x86/hvm/hvm.c | 5 +++++ 1 file changed, 5 insertions(+)
xen/arch/x86/hvm/hvm.c +5 -0
@@ -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(
Signature · 1 line
1.8.4.rc3
xen/arch/x86/hvm/hvm.c static void hvm_s3_suspend(struct domain *d) · line 3739
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Tomasz Wroblewski
xen/arch/x86/hvm/hvm.c +1
-0@@ -3736,8 +3736,13 @@ static void hvm_s3_suspend(struct domain *d)static void hvm_s3_resume (struct domain *d) { +struct vcpu *v;
Blank line needed here.
And it would imo be better to move the declaration inside the body of the if().
xen/arch/x86/hvm/hvm.c static void hvm_s3_suspend(struct domain *d) · line 3743
Quoted 4 lines
xen/arch/x86/hvm/hvm.c +3
-0if (test_and_clear_bool (d->arch.hvm_domain.is_s3_suspended) ) + { +for_each_vcpu ( d, v ) +hvm_set_guest_tsc ( v,0 );
Stray blanks inside the parentheses.
(If I'm ending up committing this, and if no other need to redo the patch shows up, I can take care of these cosmetics on the fly, i.e. no need to send a v2 just for this.)
Jan
Quoted 5 lines
(If I'm ending up committing this, and if no other need to redo the patch shows up, I can take care of these cosmetics on the fly, i.e. no need to send a v2 just for this.)
All right, thanks! Sorry for the blanks, I post patches infrequently enough to forget the precise rules but frequently enough to delude myself I still remember them.
Quoted 2 lines
Jan