Hypervisor cpuid time leaf
Is there a reason why we don't document hypervisor time leaf (3, or is it 4?) in public/arch-x86/cpuid.h?
We have a regression in Linux where there is a window when vcpu_time_info data is not yet available and one possibility is to use this leaf. But I'd like to be sure it is part of a stable ABI.
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 2 lines · Boris Ostrovsky
Is there a reason why we don't document hypervisor time leaf (3, or is it 4?) in
public/arch-x86/cpuid.h?
(The leaf with the number 3. The way the documentation refers to leaves and numeric values is very counter-intuitive. I half remember a plan to renumber the comments to be zero-based, which then match the constants. Also, XEN_CPUID_MAX_NUM_LEAVES is entirely erroneous to have in the public API.)
I wondered the same when I looked at it. I presume it was due to insufficient review of the virtual timing modes when they were introduced.
Quoted 4 lines
We have a regression in Linux where there is a window when
vcpu_time_infodata is not yet available and one possibility is to use this leaf. But I'd like to be sure it is part of a stable ABI.
One problem it has is that there is no indication of the valid subleafs (a problem shared with the subsequent leaf). I'd like to get agreement on how to sort that (possibly via documentation only) before declaring the ABI stable.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 8 lines · Andrew Cooper
Quoted 2 lines · Boris Ostrovsky
Is there a reason why we don't document hypervisor time leaf (3, or is it 4?) in
public/arch-x86/cpuid.h?(The leaf with the number 3. The way the documentation refers to leaves and numeric values is very counter-intuitive. I half remember a plan to renumber the comments to be zero-based, which then match the constants. Also,
XEN_CPUID_MAX_NUM_LEAVESis entirely erroneous to have in the public API.)
Especially given that we return it in leaf 0 (aka 1).
Quoted 3 lines
I wondered the same when I looked at it. I presume it was due to insufficient review of the virtual timing modes when they were introduced.
Looking at __update_vcpu_system_time(), I am not sure we are reporting correct values on (PV & !vtsc). I think it should be t->tsc_scale.
Quoted 4 lines
Quoted 4 lines
We have a regression in Linux where there is a window when
vcpu_time_infodata is not yet available and one possibility is to use this leaf. But I'd like to be sure it is part of a stable ABI.
I BTW realized that using this leaf to fix the regression is probably not the right approach. But the original question stands.
Quoted 4 lines
One problem it has is that there is no indication of the valid subleafs (a problem shared with the subsequent leaf). I'd like to get agreement on how to sort that (possibly via documentation only) before declaring the ABI stable.
We can't use EAX=0 as it is sometimes a valid response on the first subleaf. But both EAX and ECX being zero could work.
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 03.05.17 at 16:26, <[email protected]> wrote:
Looking at
__update_vcpu_system_time(), I am not sure we are reporting correct values on (PV & !vtsc). I think it should bet->tsc_scale.
Indeed. I wouldn't be surprised at all if it was simply assumed by the author to only be used by HVM guests. And the issue would extend to HVM && !hvm_tsc_scaling_supported afaics.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 03.05.17 at 16:06, <[email protected]> wrote:
Quoted 2 lines · Boris Ostrovsky
Is there a reason why we don't document hypervisor time leaf (3, or is it 4?) in
public/arch-x86/cpuid.h?(The leaf with the number 3. The way the documentation refers to leaves and numeric values is very counter-intuitive. I half remember a plan to renumber the comments to be zero-based, which then match the constants. Also,
XEN_CPUID_MAX_NUM_LEAVESis entirely erroneous to have in the public API.)
I agree.
Quoted 8 lines
Quoted 3 lines
We have a regression in Linux where there is a window when
vcpu_time_infodata is not yet available and one possibility is to use this leaf. But I'd like to be sure it is part of a stable ABI.One problem it has is that there is no indication of the valid subleafs (a problem shared with the subsequent leaf). I'd like to get agreement on how to sort that (possibly via documentation only) before declaring the ABI stable.
I don't think we can call this ABI unstable, considering for how long we've been shipping releases with it. The lack of valid subleaf indication is not very problematic imo as long as all invalid ones properly return all zeros. Of course that doesn't mean I'm opposed to (a) avoiding the issue in future leaves and (b) fixing the issue in the HVM leaf (where we still can without breaking the ABI, just not via the usual way of providing the maximum valid number in EAX).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel