Re: [Xen-devel] [PATCH] x86/hvm: fix saved pmtimer value

2015-09-09 Thread Wei Liu
On Wed, Sep 09, 2015 at 01:46:35AM -0600, Jan Beulich wrote:
> >>> On 09.09.15 at 09:31,  wrote:
> > The ACPI PM timer is sometimes broken on live migration.
> > Since vcpu->arch.hvm_vcpu.guest_time is 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.
> 

Yes. I think so. I will leave the technical side to you and Andy.

Release-acked-by: Wei Liu 

> Jan

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH] x86/hvm: fix saved pmtimer value

2015-09-09 Thread Jan Beulich
>>> On 09.09.15 at 10:31,  wrote:
> Jan Beulich  writes:
> 
> On 09.09.15 at 09:31,  wrote:
>>> The ACPI PM timer is sometimes broken on live migration.
>>> Since vcpu->arch.hvm_vcpu.guest_time is 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.

>> 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.

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


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH] x86/hvm: fix saved pmtimer value

2015-09-09 Thread Kouya Shimura
Jan Beulich  writes:

 On 09.09.15 at 09:31,  wrote:
>> The ACPI PM timer is sometimes broken on live migration.
>> Since vcpu->arch.hvm_vcpu.guest_time is 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.

> 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

>
> 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

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH] x86/hvm: fix saved pmtimer value

2015-09-09 Thread Jan Beulich
>>> On 09.09.15 at 09:31,  wrote:
> The ACPI PM timer is sometimes broken on live migration.
> Since vcpu->arch.hvm_vcpu.guest_time is 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


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH] x86/hvm: fix saved pmtimer value

2015-09-09 Thread Kouya Shimura
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.

Signed-off-by: Kouya Shimura 
---
 xen/arch/x86/hvm/pmtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/pmtimer.c b/xen/arch/x86/hvm/pmtimer.c
index 07594e1..282efd0 100644
--- a/xen/arch/x86/hvm/pmtimer.c
+++ b/xen/arch/x86/hvm/pmtimer.c
@@ -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 )
-- 
1.9.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel