* [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
@ 2013-06-04 15:32 Roger Pau Monne
2013-06-04 16:29 ` George Dunlap
2013-06-05 12:02 ` Diana Crisan
0 siblings, 2 replies; 9+ messages in thread
From: Roger Pau Monne @ 2013-06-04 15:32 UTC (permalink / raw)
To: xen-devel; +Cc: George Dunlap, Keir Fraser, Jan Beulich, Roger Pau Monne
When using a vtsc, hvm_set_guest_time changes hvm_vcpu.stime_offset,
which is used in the vcpu time structure to calculate the
tsc_timestamp, so after updating stime_offset we need to propagate the
change to vcpu_time in order for the guest to get the right time if
using the PV clock.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
---
Changes since v2:
* Check for v == current instead of v->is_running to know if the vcpu
is running.
Changes since v1:
* Perform the call to update_vcpu_system_time in hvm_set_guest_time
if the offset has changed and the vCPU is running.
---
xen/arch/x86/hvm/vpt.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 8dee662..4b1e1a3 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -57,7 +57,18 @@ u64 hvm_get_guest_time(struct vcpu *v)
void hvm_set_guest_time(struct vcpu *v, u64 guest_time)
{
- v->arch.hvm_vcpu.stime_offset += guest_time - hvm_get_guest_time(v);
+ u64 offset = guest_time - hvm_get_guest_time(v);
+
+ if ( offset ) {
+ v->arch.hvm_vcpu.stime_offset += offset;
+ /*
+ * If hvm_vcpu.stime_offset is updated make sure to
+ * also update vcpu time, since this value is used to
+ * calculate the TSC.
+ */
+ if ( v == current )
+ update_vcpu_system_time(v);
+ }
}
static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src)
--
1.7.7.5 (Apple Git-26)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
2013-06-04 15:32 [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time Roger Pau Monne
@ 2013-06-04 16:29 ` George Dunlap
2013-06-05 12:02 ` Diana Crisan
1 sibling, 0 replies; 9+ messages in thread
From: George Dunlap @ 2013-06-04 16:29 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: Keir Fraser, Jan Beulich, xen-devel@lists.xen.org
On Tue, Jun 4, 2013 at 4:32 PM, Roger Pau Monne <roger.pau@citrix.com> wrote:
> When using a vtsc, hvm_set_guest_time changes hvm_vcpu.stime_offset,
> which is used in the vcpu time structure to calculate the
> tsc_timestamp, so after updating stime_offset we need to propagate the
> change to vcpu_time in order for the guest to get the right time if
> using the PV clock.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Keir Fraser <keir@xen.org>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> ---
> Changes since v2:
> * Check for v == current instead of v->is_running to know if the vcpu
> is running.
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
It might not be bad at some point to add an ASSERT() in
__update_vcpu_system_time() that v == current.
-George
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
2013-06-04 15:32 [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time Roger Pau Monne
2013-06-04 16:29 ` George Dunlap
@ 2013-06-05 12:02 ` Diana Crisan
2013-06-05 13:06 ` George Dunlap
1 sibling, 1 reply; 9+ messages in thread
From: Diana Crisan @ 2013-06-05 12:02 UTC (permalink / raw)
To: Roger Pau Monne
Cc: George Dunlap, Keir Fraser, Alex Bligh, Jan Beulich, xen-devel
On 04/06/13 16:32, Roger Pau Monne wrote:
> When using a vtsc, hvm_set_guest_time changes hvm_vcpu.stime_offset,
> which is used in the vcpu time structure to calculate the
> tsc_timestamp, so after updating stime_offset we need to propagate the
> change to vcpu_time in order for the guest to get the right time if
> using the PV clock.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Keir Fraser <keir@xen.org>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
Tested-By: Diana Crisan <dcrisan@flexiant.com>
> ---
> Changes since v2:
> * Check for v == current instead of v->is_running to know if the vcpu
> is running.
> Changes since v1:
> * Perform the call to update_vcpu_system_time in hvm_set_guest_time
> if the offset has changed and the vCPU is running.
> ---
> xen/arch/x86/hvm/vpt.c | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
> index 8dee662..4b1e1a3 100644
> --- a/xen/arch/x86/hvm/vpt.c
> +++ b/xen/arch/x86/hvm/vpt.c
> @@ -57,7 +57,18 @@ u64 hvm_get_guest_time(struct vcpu *v)
>
> void hvm_set_guest_time(struct vcpu *v, u64 guest_time)
> {
> - v->arch.hvm_vcpu.stime_offset += guest_time - hvm_get_guest_time(v);
> + u64 offset = guest_time - hvm_get_guest_time(v);
> +
> + if ( offset ) {
> + v->arch.hvm_vcpu.stime_offset += offset;
> + /*
> + * If hvm_vcpu.stime_offset is updated make sure to
> + * also update vcpu time, since this value is used to
> + * calculate the TSC.
> + */
> + if ( v == current )
> + update_vcpu_system_time(v);
> + }
> }
>
> static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src)
I have tested this patch and I have not been able to reproduce the guest
stuck-clock problem we were seeing before (see *HVM Migration of domU on
Qemu-upstream DM causes stuck system clock with ACPI* for details of the
problem).
Note: this was tested without the temporary fix to our problem ( which
is specifying tsc_mode='native_paravirt').
Thanks,
Diana
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
2013-06-05 12:02 ` Diana Crisan
@ 2013-06-05 13:06 ` George Dunlap
2013-06-05 13:35 ` Diana Crisan
2013-06-06 6:59 ` Alex Bligh
0 siblings, 2 replies; 9+ messages in thread
From: George Dunlap @ 2013-06-05 13:06 UTC (permalink / raw)
To: Diana Crisan
Cc: xen-devel, Keir Fraser, Alex Bligh, Jan Beulich, Roger Pau Monne
On 05/06/13 13:02, Diana Crisan wrote:
> On 04/06/13 16:32, Roger Pau Monne wrote:
>> When using a vtsc, hvm_set_guest_time changes hvm_vcpu.stime_offset,
>> which is used in the vcpu time structure to calculate the
>> tsc_timestamp, so after updating stime_offset we need to propagate the
>> change to vcpu_time in order for the guest to get the right time if
>> using the PV clock.
>>
>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>> Cc: Keir Fraser <keir@xen.org>
>> Cc: Jan Beulich <jbeulich@suse.com>
>> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> Tested-By: Diana Crisan <dcrisan@flexiant.com>
>> ---
>> Changes since v2:
>> * Check for v == current instead of v->is_running to know if the vcpu
>> is running.
>> Changes since v1:
>> * Perform the call to update_vcpu_system_time in hvm_set_guest_time
>> if the offset has changed and the vCPU is running.
>> ---
>> xen/arch/x86/hvm/vpt.c | 13 ++++++++++++-
>> 1 files changed, 12 insertions(+), 1 deletions(-)
>>
>> diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
>> index 8dee662..4b1e1a3 100644
>> --- a/xen/arch/x86/hvm/vpt.c
>> +++ b/xen/arch/x86/hvm/vpt.c
>> @@ -57,7 +57,18 @@ u64 hvm_get_guest_time(struct vcpu *v)
>> void hvm_set_guest_time(struct vcpu *v, u64 guest_time)
>> {
>> - v->arch.hvm_vcpu.stime_offset += guest_time -
>> hvm_get_guest_time(v);
>> + u64 offset = guest_time - hvm_get_guest_time(v);
>> +
>> + if ( offset ) {
>> + v->arch.hvm_vcpu.stime_offset += offset;
>> + /*
>> + * If hvm_vcpu.stime_offset is updated make sure to
>> + * also update vcpu time, since this value is used to
>> + * calculate the TSC.
>> + */
>> + if ( v == current )
>> + update_vcpu_system_time(v);
>> + }
>> }
>> static int pt_irq_vector(struct periodic_time *pt, enum
>> hvm_intsrc src)
>
> I have tested this patch and I have not been able to reproduce the
> guest stuck-clock problem we were seeing before (see *HVM Migration of
> domU on Qemu-upstream DM causes stuck system clock with ACPI* for
> details of the problem).
> Note: this was tested without the temporary fix to our problem ( which
> is specifying tsc_mode='native_paravirt').
Great, thanks Diana.
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
2013-06-05 13:06 ` George Dunlap
@ 2013-06-05 13:35 ` Diana Crisan
2013-06-06 6:59 ` Alex Bligh
1 sibling, 0 replies; 9+ messages in thread
From: Diana Crisan @ 2013-06-05 13:35 UTC (permalink / raw)
To: George Dunlap
Cc: xen-devel, Keir Fraser, Alex Bligh, Jan Beulich, Roger Pau Monne
On 05/06/13 14:06, George Dunlap wrote:
> On 05/06/13 13:02, Diana Crisan wrote:
>> On 04/06/13 16:32, Roger Pau Monne wrote:
>>> When using a vtsc, hvm_set_guest_time changes hvm_vcpu.stime_offset,
>>> which is used in the vcpu time structure to calculate the
>>> tsc_timestamp, so after updating stime_offset we need to propagate the
>>> change to vcpu_time in order for the guest to get the right time if
>>> using the PV clock.
>>>
>>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>>> Cc: Keir Fraser <keir@xen.org>
>>> Cc: Jan Beulich <jbeulich@suse.com>
>>> Cc: George Dunlap <george.dunlap@eu.citrix.com>
>> Tested-By: Diana Crisan <dcrisan@flexiant.com>
>>> ---
>>> Changes since v2:
>>> * Check for v == current instead of v->is_running to know if the vcpu
>>> is running.
>>> Changes since v1:
>>> * Perform the call to update_vcpu_system_time in hvm_set_guest_time
>>> if the offset has changed and the vCPU is running.
>>> ---
>>> xen/arch/x86/hvm/vpt.c | 13 ++++++++++++-
>>> 1 files changed, 12 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
>>> index 8dee662..4b1e1a3 100644
>>> --- a/xen/arch/x86/hvm/vpt.c
>>> +++ b/xen/arch/x86/hvm/vpt.c
>>> @@ -57,7 +57,18 @@ u64 hvm_get_guest_time(struct vcpu *v)
>>> void hvm_set_guest_time(struct vcpu *v, u64 guest_time)
>>> {
>>> - v->arch.hvm_vcpu.stime_offset += guest_time -
>>> hvm_get_guest_time(v);
>>> + u64 offset = guest_time - hvm_get_guest_time(v);
>>> +
>>> + if ( offset ) {
>>> + v->arch.hvm_vcpu.stime_offset += offset;
>>> + /*
>>> + * If hvm_vcpu.stime_offset is updated make sure to
>>> + * also update vcpu time, since this value is used to
>>> + * calculate the TSC.
>>> + */
>>> + if ( v == current )
>>> + update_vcpu_system_time(v);
>>> + }
>>> }
>>> static int pt_irq_vector(struct periodic_time *pt, enum
>>> hvm_intsrc src)
>>
>> I have tested this patch and I have not been able to reproduce the
>> guest stuck-clock problem we were seeing before (see *HVM Migration
>> of domU on Qemu-upstream DM causes stuck system clock with ACPI* for
>> details of the problem).
>> Note: this was tested without the temporary fix to our problem (
>> which is specifying tsc_mode='native_paravirt').
>
> Great, thanks Diana.
>
No problem.
On a side note, the patch applied cleanly to 4.2.2 and it works as
expected too.
> -George
>
--
Diana
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
2013-06-05 13:06 ` George Dunlap
2013-06-05 13:35 ` Diana Crisan
@ 2013-06-06 6:59 ` Alex Bligh
2013-06-06 7:20 ` Jan Beulich
1 sibling, 1 reply; 9+ messages in thread
From: Alex Bligh @ 2013-06-06 6:59 UTC (permalink / raw)
To: George Dunlap, Diana Crisan, Roger Pau Monne
Cc: Keir Fraser, Alex Bligh, Jan Beulich, xen-devel
George, Roger,
--On 5 June 2013 14:06:09 +0100 George Dunlap <george.dunlap@eu.citrix.com>
wrote:
>> I have tested this patch and I have not been able to reproduce the
>> guest stuck-clock problem we were seeing before (see *HVM Migration of
>> domU on Qemu-upstream DM causes stuck system clock with ACPI* for
>> details of the problem).
>> Note: this was tested without the temporary fix to our problem ( which
>> is specifying tsc_mode='native_paravirt').
>
> Great, thanks Diana.
I see this has made master: commit 32c864a35ece2c24a336d183869a546798a4b241.
Do you plan to backport this to 4.2? Diana has verified it applies and
fixes the same issue there.
--
Alex Bligh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
2013-06-06 6:59 ` Alex Bligh
@ 2013-06-06 7:20 ` Jan Beulich
2013-06-06 8:45 ` George Dunlap
2013-06-06 9:36 ` Alex Bligh
0 siblings, 2 replies; 9+ messages in thread
From: Jan Beulich @ 2013-06-06 7:20 UTC (permalink / raw)
To: Alex Bligh, Roger Pau Monne, George Dunlap, Diana Crisan
Cc: Keir Fraser, xen-devel
>>> On 06.06.13 at 08:59, Alex Bligh <alex@alex.org.uk> wrote:
> --On 5 June 2013 14:06:09 +0100 George Dunlap <george.dunlap@eu.citrix.com> wrote:
>
>>> I have tested this patch and I have not been able to reproduce the
>>> guest stuck-clock problem we were seeing before (see *HVM Migration of
>>> domU on Qemu-upstream DM causes stuck system clock with ACPI* for
>>> details of the problem).
>>> Note: this was tested without the temporary fix to our problem ( which
>>> is specifying tsc_mode='native_paravirt').
>>
>> Great, thanks Diana.
>
> I see this has made master: commit 32c864a35ece2c24a336d183869a546798a4b241.
>
> Do you plan to backport this to 4.2? Diana has verified it applies and
> fixes the same issue there.
Yes, I have this on my list of pending backports, but currently there's
no rush.
Jan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
2013-06-06 7:20 ` Jan Beulich
@ 2013-06-06 8:45 ` George Dunlap
2013-06-06 9:36 ` Alex Bligh
1 sibling, 0 replies; 9+ messages in thread
From: George Dunlap @ 2013-06-06 8:45 UTC (permalink / raw)
To: Jan Beulich
Cc: Diana Crisan, xen-devel, Keir Fraser, Alex Bligh, Roger Pau Monne
On 06/06/13 08:20, Jan Beulich wrote:
>>>> On 06.06.13 at 08:59, Alex Bligh <alex@alex.org.uk> wrote:
>> --On 5 June 2013 14:06:09 +0100 George Dunlap <george.dunlap@eu.citrix.com> wrote:
>>
>>>> I have tested this patch and I have not been able to reproduce the
>>>> guest stuck-clock problem we were seeing before (see *HVM Migration of
>>>> domU on Qemu-upstream DM causes stuck system clock with ACPI* for
>>>> details of the problem).
>>>> Note: this was tested without the temporary fix to our problem ( which
>>>> is specifying tsc_mode='native_paravirt').
>>> Great, thanks Diana.
>> I see this has made master: commit 32c864a35ece2c24a336d183869a546798a4b241.
>>
>> Do you plan to backport this to 4.2? Diana has verified it applies and
>> fixes the same issue there.
> Yes, I have this on my list of pending backports, but currently there's
> no rush.
...but thank you for chasing it to make sure that it was on somebody's
list and didn't get forgotten. :-)
-George
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
2013-06-06 7:20 ` Jan Beulich
2013-06-06 8:45 ` George Dunlap
@ 2013-06-06 9:36 ` Alex Bligh
1 sibling, 0 replies; 9+ messages in thread
From: Alex Bligh @ 2013-06-06 9:36 UTC (permalink / raw)
To: Jan Beulich, Roger Pau Monne, George Dunlap, Diana Crisan
Cc: Keir Fraser, Alex Bligh, xen-devel
Jan,
--On 6 June 2013 08:20:17 +0100 Jan Beulich <JBeulich@suse.com> wrote:
> Yes, I have this on my list of pending backports, but currently there's
> no rush.
Thanks, and indeed.
--
Alex Bligh
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-06-06 9:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-04 15:32 [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time Roger Pau Monne
2013-06-04 16:29 ` George Dunlap
2013-06-05 12:02 ` Diana Crisan
2013-06-05 13:06 ` George Dunlap
2013-06-05 13:35 ` Diana Crisan
2013-06-06 6:59 ` Alex Bligh
2013-06-06 7:20 ` Jan Beulich
2013-06-06 8:45 ` George Dunlap
2013-06-06 9:36 ` Alex Bligh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).