x86/hvm: fix saved pmtimer value
PATCH 1/1 x86/hvm: fix saved pmtimer value
The ACPI PM timer is sometimes broken on live migration. Since vcpu->arch.hvm_vcpu.guest_time is zero in most cases.
Without this patch, the clock of windows server 2012R2 without HPET might leap forward several minutes on live migration.
--- xen/arch/x86/hvm/pmtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/hvm/pmtimer.c +1 -1
@@ -252,7 +252,7 @@ static int pmtimer_save(struct domain *d, hvm_domain_context_t *h)/* Update the counter to the guest's current time. We always save * with the domain paused, so the saved time should be after the * last_gtime, but just in case, make sure we only go forwards */ - x = ((s->vcpu->arch.hvm_vcpu.guest_time - s->last_gtime) * s->scale) >>32 ; + x = ((hvm_get_guest_time (s->vcpu) - s->last_gtime) * s->scale) >>32 ;if ( x <1UL <<31 ) s->pm.tmr_val += x;if ( (s->pm.tmr_val &TMR_VAL_MSB ) != msb )
Signature · 1 line
1.9.1
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 09.09.15 at 09:31, <[email protected]> wrote:
The ACPI PM timer is sometimes broken on live migration. Since
vcpu->arch.hvm_vcpu.guest_timeis zero in most cases.
I.e. in other than "delay for missed ticks mode". Would have been nice if you had spelled this out explicitly. With that the question then is - should the field perhaps be used when non-zero, and the function only be called otherwise?
Wei - regardless of the answer to the above (i.e. regardless of whether a v2 is going to be needed) I think we want this in 4.6.
Jan
Quoted 6 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 09.09.15 at 09:31, <[email protected]> wrote:
The ACPI PM timer is sometimes broken on live migration. Since
vcpu->arch.hvm_vcpu.guest_timeis zero in most cases.I.e. in other than "delay for missed ticks mode". Would have been nice if you had spelled this out explicitly.
Actually, I tried "delay for missed ticks mode" (timer_mode=0). Even in this case, the pmtimer was broken. I don't know why.
Quoted 3 lines
With that the question then is -
should the field perhaps be used when non-zero, and the function only be called otherwise?
The adjustment of timer value in pmtimer_save() was introduced before other timer_modes were implemented.
I'm not sure (skeptical) the small adjustment is really necessary in pmtimer_save.
Thanks,
Kouya
Quoted 5 lines
Wei - regardless of the answer to the above (i.e. regardless of whether a v2 is going to be needed) I think we want this in 4.6.
Jan
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 09.09.15 at 10:31, <[email protected]> wrote:
Quoted 1 line · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line · On 09.09.15 at 09:31, <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
The ACPI PM timer is sometimes broken on live migration. Since
vcpu->arch.hvm_vcpu.guest_timeis zero in most cases.I.e. in other than "delay for missed ticks mode". Would have been nice if you had spelled this out explicitly.
Actually, I tried "delay for missed ticks mode" (timer_mode=0). Even in this case, the pmtimer was broken. I don't know why.
It would of course be helpful to understand why.
Quoted 9 lines
Quoted 3 lines
With that the question then is -
should the field perhaps be used when non-zero, and the function only be called otherwise?The adjustment of timer value in
pmtimer_save()was introduced before othertimer_modeswere implemented.I'm not sure (skeptical) the small adjustment is really necessary in
pmtimer_save.
Together with the above, and with or without code adjustment, I'd then like to ask for a v2 with an improved description. And please don't forget to Cc maintainers of the code as well as Wei (the 4.6 release manager).
Jan
Quoted 4 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 09.09.15 at 09:31, <[email protected]> wrote:
The ACPI PM timer is sometimes broken on live migration. Since
vcpu->arch.hvm_vcpu.guest_timeis zero in most cases.
Quoted 8 lines
I.e. in other than "delay for missed ticks mode". Would have been nice if you had spelled this out explicitly. With that the question then is - should the field perhaps be used when non-zero, and the function only be called otherwise?
Wei - regardless of the answer to the above (i.e. regardless of whether a v2 is going to be needed) I think we want this in 4.6.
Yes. I think so. I will leave the technical side to you and Andy.
Quoted 1 line
Jan