[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/cpuid: Adjust the policies based on the boot time vPMU setting

commit 93102b49d501175a8ebbfb1f13f06d4bc754827f
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Jul 16 10:21:54 2018 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jul 18 11:29:49 2018 +0100

    x86/cpuid: Adjust the policies based on the boot time vPMU setting
    The vPMU logic isn't integrated into the CPUID policy logic (and still
    requires a fair amount of work before it can be).
    The ARCH_PERFMON leaf was previously copied into all policies, unilaterally
    overridden (to the same value in the general case) by the toolstack using
    DOMCTL_set_cpuid, then unilaterally overridden again by Xen's runtime
    logic (based on the boot time settings).
    The policy retrieved with DOMCTL_get_cpu_policy needs to be accurate, so 
    the boot time settings into account when creating and clipping the toolstack
    policy.  The runtime logic is still required for now, to clip the maximum
    reported version when necessary.
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
 xen/arch/x86/cpuid.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 3c29191a1b..5f093a9b30 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -389,6 +389,10 @@ static void __init calculate_host_policy(void)
+    /* When vPMU is disabled, drop it from the host policy. */
+    if ( vpmu_mode == XENPMU_MODE_OFF )
+        p->basic.raw[0xa] = EMPTY_LEAF;
     if ( p->extd.svm )
         /* Clamp to implemented features which require hardware support. */
@@ -689,6 +693,10 @@ void recalculate_cpuid_policy(struct domain *d)
+    if ( vpmu_mode == XENPMU_MODE_OFF ||
+         ((vpmu_mode & XENPMU_MODE_ALL) && !is_hardware_domain(d)) )
+        p->basic.raw[0xa] = EMPTY_LEAF;
     if ( !p->extd.svm )
         p->extd.raw[0xa] = EMPTY_LEAF;
generated by git-patchbot for /home/xen/git/xen.git#master

Xen-changelog mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.