x86/cpuid: Adjust the policies based on the boot time vPMU setting
PATCH 1/1 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 take 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.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Sergey Dyasli <[email protected]>
--- xen/arch/x86/cpuid.c | 8 ++++++++ 1 file changed, 8 insertions(+)
xen/arch/x86/cpuid.c +8 -0
@@ -389,6 +389,10 @@ static void __init calculate_host_policy(void)recalculate_xstate (p);recalculate_misc (p); +/* 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 ;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.07.18 at 19:23, <[email protected]> wrote:
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_PERFMONleaf was previously copied into all policies, unilaterally overridden (to the same value in the general case) by the toolstack usingDOMCTL_set_cpuid, then unilaterally overridden again by Xen's runtime logic (based on the boot time settings).
Quoted 6 lines
The policy retrieved with
DOMCTL_get_cpu_policyneeds to be accurate, so take 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 <[email protected]>
I guess you will want this backported?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 17.07.18 at 19:23, <[email protected]> wrote:
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_PERFMONleaf was previously copied into all policies, unilaterally overridden (to the same value in the general case) by the toolstack usingDOMCTL_set_cpuid, then unilaterally overridden again by Xen's runtime logic (based on the boot time settings).The policy retrieved with
DOMCTL_get_cpu_policyneeds to be accurate, so take 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.
Quoted 4 lines
Quoted 1 line
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>I guess you will want this backported?
It isn't actually a problem until {SYSCTL,DOMCTL}_{get,set}_cpu_policy are in use.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel