diff mbox

[1/5] public/xen.h: add flags field to vcpu_time_info

Message ID 1458231136-13457-2-git-send-email-joao.m.martins@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Joao Martins March 17, 2016, 4:12 p.m. UTC
This field has two possible flags (as of latest pvclock ABI
shared with KVM).

flags: bits in this field indicate extended capabilities
coordinated between the guest and the hypervisor.  Specifically
on KVM, availability of specific flags has to be checked in
0x40000001 cpuid leaf. On Xen, we don't have that but we can
still check some of the flags after registering the time info
page since a force_update_vcpu_system_time is performed.

Current flags are:

 flag bit   | cpuid bit    | meaning
-------------------------------------------------------------
            |              | time measures taken across
     0      |      24      | multiple cpus are guaranteed to
            |              | be monotonic
-------------------------------------------------------------
            |              | guest vcpu has been paused by
     1      |     N/A      | the host
            |              |
-------------------------------------------------------------

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
---
 xen/include/public/xen.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Andrew Cooper March 18, 2016, 8:12 p.m. UTC | #1
On 17/03/16 16:12, Joao Martins wrote:
> This field has two possible flags (as of latest pvclock ABI
> shared with KVM).
>
> flags: bits in this field indicate extended capabilities
> coordinated between the guest and the hypervisor.  Specifically
> on KVM, availability of specific flags has to be checked in
> 0x40000001 cpuid leaf. On Xen, we don't have that but we can
> still check some of the flags after registering the time info
> page since a force_update_vcpu_system_time is performed.
>
> Current flags are:
>
>  flag bit   | cpuid bit    | meaning
> -------------------------------------------------------------
>             |              | time measures taken across
>      0      |      24      | multiple cpus are guaranteed to
>             |              | be monotonic
> -------------------------------------------------------------
>             |              | guest vcpu has been paused by
>      1      |     N/A      | the host
>             |              |
> -------------------------------------------------------------
>
> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Has the Linux maintainers file been patched to include xen-devel, to
avoid them altering our ABI unnoticed in the future?
Joao Martins March 21, 2016, 11:42 a.m. UTC | #2
On 03/18/2016 08:12 PM, Andrew Cooper wrote:
> On 17/03/16 16:12, Joao Martins wrote:
>> This field has two possible flags (as of latest pvclock ABI
>> shared with KVM).
>>
>> flags: bits in this field indicate extended capabilities
>> coordinated between the guest and the hypervisor.  Specifically
>> on KVM, availability of specific flags has to be checked in
>> 0x40000001 cpuid leaf. On Xen, we don't have that but we can
>> still check some of the flags after registering the time info
>> page since a force_update_vcpu_system_time is performed.
>>
>> Current flags are:
>>
>>  flag bit   | cpuid bit    | meaning
>> -------------------------------------------------------------
>>             |              | time measures taken across
>>      0      |      24      | multiple cpus are guaranteed to
>>             |              | be monotonic
>> -------------------------------------------------------------
>>             |              | guest vcpu has been paused by
>>      1      |     N/A      | the host
>>             |              |
>> -------------------------------------------------------------
>>
>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
Thanks!

> Has the Linux maintainers file been patched to include xen-devel, to
> avoid them altering our ABI unnoticed in the future?
> 
Not yet, but I had planned to do so when sending the v2 of the linux side. But
perhaps you want it beforehand?
Andrew Cooper March 21, 2016, 11:43 a.m. UTC | #3
On 21/03/16 11:42, Joao Martins wrote:
>
> On 03/18/2016 08:12 PM, Andrew Cooper wrote:
>> On 17/03/16 16:12, Joao Martins wrote:
>>> This field has two possible flags (as of latest pvclock ABI
>>> shared with KVM).
>>>
>>> flags: bits in this field indicate extended capabilities
>>> coordinated between the guest and the hypervisor.  Specifically
>>> on KVM, availability of specific flags has to be checked in
>>> 0x40000001 cpuid leaf. On Xen, we don't have that but we can
>>> still check some of the flags after registering the time info
>>> page since a force_update_vcpu_system_time is performed.
>>>
>>> Current flags are:
>>>
>>>  flag bit   | cpuid bit    | meaning
>>> -------------------------------------------------------------
>>>             |              | time measures taken across
>>>      0      |      24      | multiple cpus are guaranteed to
>>>             |              | be monotonic
>>> -------------------------------------------------------------
>>>             |              | guest vcpu has been paused by
>>>      1      |     N/A      | the host
>>>             |              |
>>> -------------------------------------------------------------
>>>
>>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>>> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>
> Thanks!
>
>> Has the Linux maintainers file been patched to include xen-devel, to
>> avoid them altering our ABI unnoticed in the future?
>>
> Not yet, but I had planned to do so when sending the v2 of the linux side. But
> perhaps you want it beforehand?

Just so long as it doesn't get lost.

~Andrew
Joao Martins March 21, 2016, 11:51 a.m. UTC | #4
On 03/21/2016 11:43 AM, Andrew Cooper wrote:
> On 21/03/16 11:42, Joao Martins wrote:
>>
>> On 03/18/2016 08:12 PM, Andrew Cooper wrote:
>>> On 17/03/16 16:12, Joao Martins wrote:
>>>> This field has two possible flags (as of latest pvclock ABI
>>>> shared with KVM).
>>>>
>>>> flags: bits in this field indicate extended capabilities
>>>> coordinated between the guest and the hypervisor.  Specifically
>>>> on KVM, availability of specific flags has to be checked in
>>>> 0x40000001 cpuid leaf. On Xen, we don't have that but we can
>>>> still check some of the flags after registering the time info
>>>> page since a force_update_vcpu_system_time is performed.
>>>>
>>>> Current flags are:
>>>>
>>>>  flag bit   | cpuid bit    | meaning
>>>> -------------------------------------------------------------
>>>>             |              | time measures taken across
>>>>      0      |      24      | multiple cpus are guaranteed to
>>>>             |              | be monotonic
>>>> -------------------------------------------------------------
>>>>             |              | guest vcpu has been paused by
>>>>      1      |     N/A      | the host
>>>>             |              |
>>>> -------------------------------------------------------------
>>>>
>>>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>>>> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>>
>> Thanks!
>>
>>> Has the Linux maintainers file been patched to include xen-devel, to
>>> avoid them altering our ABI unnoticed in the future?
>>>
>> Not yet, but I had planned to do so when sending the v2 of the linux side. But
>> perhaps you want it beforehand?
> 
> Just so long as it doesn't get lost.
It definitely won't get lost.

Joao
Jan Beulich March 21, 2016, 3:10 p.m. UTC | #5
>>> On 17.03.16 at 17:12, <joao.m.martins@oracle.com> wrote:
> --- a/xen/include/public/xen.h
> +++ b/xen/include/public/xen.h
> @@ -614,10 +614,14 @@ struct vcpu_time_info {
>       */
>      uint32_t tsc_to_system_mul;
>      int8_t   tsc_shift;
> -    int8_t   pad1[3];
> +    int8_t   flags;

For use as flags I'm sure this would better be uint8_t.

Jan
Andrew Cooper March 21, 2016, 3:27 p.m. UTC | #6
On 21/03/16 15:10, Jan Beulich wrote:
>>>> On 17.03.16 at 17:12, <joao.m.martins@oracle.com> wrote:
>> --- a/xen/include/public/xen.h
>> +++ b/xen/include/public/xen.h
>> @@ -614,10 +614,14 @@ struct vcpu_time_info {
>>       */
>>      uint32_t tsc_to_system_mul;
>>      int8_t   tsc_shift;
>> -    int8_t   pad1[3];
>> +    int8_t   flags;
> For use as flags I'm sure this would better be uint8_t.

Sadly not possible.  Linux have already made the above adjustment
without (CC'ing xen-devel), so that ABI is set.

~Andrew
Joao Martins March 21, 2016, 3:40 p.m. UTC | #7
On 03/21/2016 03:27 PM, Andrew Cooper wrote:
> On 21/03/16 15:10, Jan Beulich wrote:
>>>>> On 17.03.16 at 17:12, <joao.m.martins@oracle.com> wrote:
>>> --- a/xen/include/public/xen.h
>>> +++ b/xen/include/public/xen.h
>>> @@ -614,10 +614,14 @@ struct vcpu_time_info {
>>>       */
>>>      uint32_t tsc_to_system_mul;
>>>      int8_t   tsc_shift;
>>> -    int8_t   pad1[3];
>>> +    int8_t   flags;
>> For use as flags I'm sure this would better be uint8_t.
> 
> Sadly not possible.  Linux have already made the above adjustment
> without (CC'ing xen-devel), so that ABI is set.
> 
I was double checking again and it's my mistake. Both flags and pad fields are
uint8_t. I will fix both in v2, to make sure it's all kept the same on both
header files. My apologies.

Joao
diff mbox

Patch

diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index 64ba7ab..08373f6 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -614,10 +614,14 @@  struct vcpu_time_info {
      */
     uint32_t tsc_to_system_mul;
     int8_t   tsc_shift;
-    int8_t   pad1[3];
+    int8_t   flags;
+    int8_t   pad1[2];
 }; /* 32 bytes */
 typedef struct vcpu_time_info vcpu_time_info_t;
 
+#define PVCLOCK_TSC_STABLE_BIT	(1 << 0)
+#define PVCLOCK_GUEST_STOPPED	(1 << 1)
+
 struct vcpu_info {
     /*
      * 'evtchn_upcall_pending' is written non-zero by Xen to indicate