x86/msr: add Raw and Host domain policies
PATCH 1/1 x86/msr: add Raw and Host domain policies
Raw policy contains the actual values from H/W MSRs. Add PLATFORM_INFO msr to the policy during probe_cpuid_faulting().
Host policy might have certain features disabled if Xen decides not to use them. For now, make Host policy equal to Raw policy.
---
v1: Decided to upstream this separately from VMX MSRs policy
--- xen/arch/x86/cpu/common.c | 11 ++++++++++- xen/arch/x86/msr.c | 19 ++++++++++++++++++- xen/include/asm-x86/msr.h | 8 ++++++++ 3 files changed, 36 insertions(+), 2 deletions(-)
xen/arch/x86/cpu/common.c +10 -1
@@ -118,9 +118,18 @@ void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next);bool __init probe_cpuid_faulting (void ) { +struct msr_domain_policy *dp = &raw_msr_domain_policy;uint64_t val; +int rc; -if (rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val) || +if ((rc =rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val)) ==0 ) + { + dp->plaform_info.available = true; +if (val &MSR_PLATFORM_INFO_CPUID_FAULTING ) + dp->plaform_info.cpuid_faulting = true; + } + +if (rc || !(val &MSR_PLATFORM_INFO_CPUID_FAULTING ) ||rdmsr_safe (MSR_INTEL_MISC_FEATURES_ENABLES ,this_cpu (msr_misc_features)))
xen/arch/x86/msr.c +18 -1
@@ -24,12 +24,27 @@#include <xen/sched.h> #include <asm/msr.h> -struct msr_domain_policy __read_mostly hvm_max_msr_domain_policy, +struct msr_domain_policy __read_mostly raw_msr_domain_policy, +__read_mostly host_msr_domain_policy, +__read_mostly hvm_max_msr_domain_policy,__read_mostly pv_max_msr_domain_policy;struct msr_vcpu_policy __read_mostly hvm_max_msr_vcpu_policy,__read_mostly pv_max_msr_vcpu_policy; +static void __init calculate_raw_policy (void ) +{ +/* 0x000000ce MSR_INTEL_PLATFORM_INFO */ +/* Was already added by probe_cpuid_faulting() */ +} + +static void __init calculate_host_policy (void ) +{ +struct msr_domain_policy *dp = &host_msr_domain_policy; + + *dp = raw_msr_domain_policy; +} +static void __init calculate_hvm_max_policy (void ) {struct msr_domain_policy *dp = &hvm_max_msr_domain_policy;
@@ -68,6 +83,8 @@ static void __init calculate_pv_max_policy(void)void __init init_guest_msr_policy (void ) { +calculate_raw_policy (); +calculate_host_policy ();calculate_hvm_max_policy ();calculate_pv_max_policy (); }
xen/include/asm-x86/msr.h +8 -0
@@ -220,6 +220,14 @@ struct msr_domain_policy } plaform_info; }; +/* RAW msr domain policy: contains the actual values from H/W MSRs */ +extern msr_domain_policy raw_msr_domain_policy; +/* +* HOST msr domain policy: features that Xen actually decided to use, +* a subset of RAW policy. +*/ +extern msr_domain_policy host_msr_domain_policy; +/* MSR policy object for per-vCPU MSRs */ struct msr_vcpu_policy {
Signature · 7 lines
2.14.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Sergey Dyasli
Raw policy contains the actual values from H/W MSRs. Add
PLATFORM_INFOmsr to the policy duringprobe_cpuid_faulting().Host policy might have certain features disabled if Xen decides not to use them. For now, make Host policy equal to Raw policy.
Signed-off-by Sergey Dyasli <[email protected]>
Ah thanks - I was about to ask you whether you had this patch to hand.
The deferral probe_cpuid_faulting() isn't great but I think is necessary at the moment. I've got some plans to reorder early startup somewhat, but more infrastructure is required before that can work.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
xen/arch/x86/msr.c line 45
Quoted 5 lines · Sergey Dyasli
xen/arch/x86/msr.c +5
-0+static void __init calculate_host_policy (void ) +{ +struct msr_domain_policy *dp = &host_msr_domain_policy; + + *dp = raw_msr_domain_policy;
host_msr_domain_policy = raw_msr_domain_policy;
Should work AFAICT.
Quoted 5 lines
xen/include/asm-x86/msr.h +0
-0
xen/include/asm-x86/msr.h struct msr_domain_policy · line 229
Quoted 10 lines
xen/include/asm-x86/msr.h +7
-0@@ -220,6 +220,14 @@ struct msr_domain_policy } plaform_info; }; +/* RAW msr domain policy: contains the actual values from H/W MSRs */ +extern msr_domain_policy raw_msr_domain_policy; +/* +* HOST msr domain policy: features that Xen actually decided to use, +* a subset of RAW policy. +*/ +extern msr_domain_policy host_msr_domain_policy;
Aren't you missing a 'struct' here? I don't see any typedef for struct msr_domain_policy.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Roger Pau Monné
xen/arch/x86/msr.c line 45
Quoted 5 lines · Sergey Dyasli
xen/arch/x86/msr.c +5
-0+static void __init calculate_host_policy (void ) +{ +struct msr_domain_policy *dp = &host_msr_domain_policy; + + *dp = raw_msr_domain_policy;
host_msr_domain_policy=raw_msr_domain_policy;Should work AFAICT.
This is a template for the future. The code with *dp is much shorter than with host_msr_domain_policy.
Quoted 9 lines
Quoted 9 lines
xen/include/asm-x86/msr.h +0
-0@@ -220,6 +220,14 @@ struct msr_domain_policy } plaform_info; };
Quoted 10 lines
xen/include/asm-x86/msr.h struct msr_domain_policy · line 229
Quoted 7 lines
xen/include/asm-x86/msr.h +7
-0+/* RAW msr domain policy: contains the actual values from H/W MSRs */ +extern msr_domain_policy raw_msr_domain_policy; +/* +* HOST msr domain policy: features that Xen actually decided to use, +* a subset of RAW policy. +*/ +extern msr_domain_policy host_msr_domain_policy;Aren't you missing a 'struct' here? I don't see any typedef for struct
msr_domain_policy.
I don't know how I missed this. You are right, 'struct' is mandatory.
Signature · 6 lines
Thanks, Sergey _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 121
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 08.02.18 at 11:23, <[email protected]> wrote:
xen/arch/x86/cpu/common.c +1
-0@@ -118,9 +118,18 @@ void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next);bool __init probe_cpuid_faulting (void ) { +struct msr_domain_policy *dp = &raw_msr_domain_policy;
Unless you foresee the variable to be needed for further things here, could this be moved into the more narrow scope it's used in please?
Quoted 5 lines
xen/arch/x86/cpu/common.c +2
-1uint64_t val; +int rc; - if (rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) || +if ((rc =rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val)) ==0 )
xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 135
Quoted 10 lines
xen/arch/x86/cpu/common.c +7
-0+ { + dp->plaform_info.available = true; +if (val &MSR_PLATFORM_INFO_CPUID_FAULTING ) + dp->plaform_info.cpuid_faulting = true; + } + +if (rc || !(val &MSR_PLATFORM_INFO_CPUID_FAULTING ) ||rdmsr_safe (MSR_INTEL_MISC_FEATURES_ENABLES ,this_cpu (msr_misc_features)))
Below here we have
setup_clear_cpu_cap(X86_FEATURE_CPUID_FAULTING);
Shouldn't this be reflected in the host policy?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.02.18 at 11:23, <[email protected]> wrote:
xen/arch/x86/cpu/common.c +0
-0@@ -118,9 +118,18 @@ void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next);
Quoted 7 lines
xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 121
Quoted 3 lines
xen/arch/x86/cpu/common.c +1
-0bool __init probe_cpuid_faulting (void ) { +struct msr_domain_policy *dp = &raw_msr_domain_policy;Unless you foresee the variable to be needed for further things here, could this be moved into the more narrow scope it's used in please?
Will do in v2.
Quoted 18 lines
Quoted 5 lines
xen/arch/x86/cpu/common.c +2
-1uint64_t val; +int rc; - if (rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) || +if ((rc =rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val)) ==0 )xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 135
Quoted 10 lines
xen/arch/x86/cpu/common.c +7
-0+ { + dp->plaform_info.available = true; +if (val &MSR_PLATFORM_INFO_CPUID_FAULTING ) + dp->plaform_info.cpuid_faulting = true; + } + +if (rc || !(val &MSR_PLATFORM_INFO_CPUID_FAULTING ) ||rdmsr_safe (MSR_INTEL_MISC_FEATURES_ENABLES ,this_cpu (msr_misc_features)))Below here we have
Quoted 3 lines
setup_clear_cpu_cap(X86_FEATURE_CPUID_FAULTING);Shouldn't this be reflected in the host policy?
I guess the correct thing to do for now for host_msr_domain_policy is:
dp->plaform_info.cpuid_faulting = cpu_has_cpuid_faulting;
Looking at the code, calculate_pv_max_policy() will be simplified with the above change: pv_max_msr_domain_policy will become a copy of host policy.
This actually brings a question: what to do about per-pCPU MSRs in the context of MSR policy?
Signature · 6 lines
Thanks, Sergey _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 16.02.18 at 11:33, <[email protected]> wrote:
Quoted 19 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.02.18 at 11:23, <[email protected]> wrote:
xen/arch/x86/cpu/common.c +2
-1uint64_t val; +int rc; - if (rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) || +if ((rc =rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val)) ==0 )xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 135
Quoted 10 lines
xen/arch/x86/cpu/common.c +7
-0+ { + dp->plaform_info.available = true; +if (val &MSR_PLATFORM_INFO_CPUID_FAULTING ) + dp->plaform_info.cpuid_faulting = true; + } + +if (rc || !(val &MSR_PLATFORM_INFO_CPUID_FAULTING ) ||rdmsr_safe (MSR_INTEL_MISC_FEATURES_ENABLES ,this_cpu (msr_misc_features)))Below here we have
Quoted 3 lines
setup_clear_cpu_cap(X86_FEATURE_CPUID_FAULTING);Shouldn't this be reflected in the host policy?
I guess the correct thing to do for now for
host_msr_domain_policyis:
Quoted 8 lines
dp->plaform_info.cpuid_faulting = cpu_has_cpuid_faulting;Looking at the code,
calculate_pv_max_policy()will be simplified with the above change:pv_max_msr_domain_policywill become a copy of host policy.This actually brings a question: what to do about per-pCPU MSRs in the context of MSR policy?
How does per-pCPU-ness of an MSR affect the policy? Are you thinking of CPUs with different capabilities? We assume all CPUs are identical in many other places.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 35 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 16.02.18 at 11:33, <[email protected]> wrote:
Quoted 20 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 08.02.18 at 11:23, <[email protected]> wrote:
xen/arch/x86/cpu/common.c +2
-1uint64_t val; +int rc; - if (rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) || +if ((rc =rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val)) ==0 )xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 135
Quoted 10 lines
xen/arch/x86/cpu/common.c +7
-0+ { + dp->plaform_info.available = true; +if (val &MSR_PLATFORM_INFO_CPUID_FAULTING ) + dp->plaform_info.cpuid_faulting = true; + } + +if (rc || !(val &MSR_PLATFORM_INFO_CPUID_FAULTING ) ||rdmsr_safe (MSR_INTEL_MISC_FEATURES_ENABLES ,this_cpu (msr_misc_features)))Below here we have
Quoted 3 lines
setup_clear_cpu_cap(X86_FEATURE_CPUID_FAULTING);Shouldn't this be reflected in the host policy?
I guess the correct thing to do for now for
host_msr_domain_policyis:dp->plaform_info.cpuid_faulting = cpu_has_cpuid_faulting;Looking at the code,
calculate_pv_max_policy()will be simplified with the above change:pv_max_msr_domain_policywill become a copy of host policy.
Quoted 6 lines
Quoted 2 lines
This actually brings a question: what to do about per-pCPU MSRs in the context of MSR policy?
How does per-pCPU-ness of an MSR affect the policy? Are you thinking of CPUs with different capabilities? We assume all CPUs are identical in many other places.
Yes, CPUs are assumed to be identical. But currently Xen checks the presence of MISC_FEATURES_ENABLES (which is a per-pCPU msr) on the boot CPU, and it affects X86_FEATURE_CPUID_FAULTING. Which in it's turn affects the presence of MISC_FEATURES_ENABLES for PV vCPUs.
So the actual question is: where to store the availability of MISC_FEATURES_ENABLES (and possibly other per-pCPU msrs in the future) and is it even needed to do so?
Signature · 6 lines
Thanks, Sergey _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 44 lines
Quoted 1 line
Quoted 1 line · On 16.02.18 at 12:31, <[email protected]> wrote:
Quoted 35 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 16.02.18 at 11:33, <[email protected]> wrote:
Quoted 20 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 08.02.18 at 11:23, <[email protected]> wrote:
xen/arch/x86/cpu/common.c +2
-1uint64_t val; +int rc; - if (rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) || +if ((rc =rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val)) ==0 )xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 135
Quoted 10 lines
xen/arch/x86/cpu/common.c +7
-0+ { + dp->plaform_info.available = true; +if (val &MSR_PLATFORM_INFO_CPUID_FAULTING ) + dp->plaform_info.cpuid_faulting = true; + } + +if (rc || !(val &MSR_PLATFORM_INFO_CPUID_FAULTING ) ||rdmsr_safe (MSR_INTEL_MISC_FEATURES_ENABLES ,this_cpu (msr_misc_features)))Below here we have
Quoted 3 lines
setup_clear_cpu_cap(X86_FEATURE_CPUID_FAULTING);Shouldn't this be reflected in the host policy?
I guess the correct thing to do for now for
host_msr_domain_policyis:dp->plaform_info.cpuid_faulting = cpu_has_cpuid_faulting;Looking at the code,
calculate_pv_max_policy()will be simplified with the above change:pv_max_msr_domain_policywill become a copy of host policy.Quoted 6 lines
Quoted 2 lines
This actually brings a question: what to do about per-pCPU MSRs in the context of MSR policy?
How does per-pCPU-ness of an MSR affect the policy? Are you thinking of CPUs with different capabilities? We assume all CPUs are identical in many other places.
Quoted 8 lines
Yes, CPUs are assumed to be identical. But currently Xen checks the presence of
MISC_FEATURES_ENABLES(which is a per-pCPU msr) on the boot CPU, and it affectsX86_FEATURE_CPUID_FAULTING. Which in it's turn affects the presence ofMISC_FEATURES_ENABLESfor PV vCPUs.So the actual question is: where to store the availability of
MISC_FEATURES_ENABLES(and possibly other per-pCPU msrs in the future) and is it even needed to do so?
Well, just like the CPUID policy records which leaves are available, the MSR policy ought to track which MSRs are available (alongside the bits inside each MSRs that are valid to use).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 37 lines · Sergey Dyasli
Quoted 31 lines · Jan Beulich
Quoted 31 lines
Quoted 1 line
Quoted 1 line · On 16.02.18 at 11:33, <[email protected]> wrote:
Quoted 18 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.02.18 at 11:23, <[email protected]> wrote:
xen/arch/x86/cpu/common.c +2
-1uint64_t val; +int rc; - if (rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) || +if ((rc =rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val)) ==0 )xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 135
Quoted 10 lines
xen/arch/x86/cpu/common.c +7
-0+ { + dp->plaform_info.available = true; +if (val &MSR_PLATFORM_INFO_CPUID_FAULTING ) + dp->plaform_info.cpuid_faulting = true; + } + +if (rc || !(val &MSR_PLATFORM_INFO_CPUID_FAULTING ) ||rdmsr_safe (MSR_INTEL_MISC_FEATURES_ENABLES ,this_cpu (msr_misc_features)))Below here we have
Quoted 3 lines
setup_clear_cpu_cap(X86_FEATURE_CPUID_FAULTING);Shouldn't this be reflected in the host policy?
I guess the correct thing to do for now for
host_msr_domain_policyis:dp->plaform_info.cpuid_faulting = cpu_has_cpuid_faulting;Looking at the code,
calculate_pv_max_policy()will be simplified with the above change:pv_max_msr_domain_policywill become a copy of host policy.Quoted 5 lines
Quoted 2 lines
This actually brings a question: what to do about per-pCPU MSRs in the context of MSR policy?
How does per-pCPU-ness of an MSR affect the policy? Are you thinking of CPUs with different capabilities? We assume all CPUs are identical in many other places.
Quoted 8 lines
Yes, CPUs are assumed to be identical. But currently Xen checks the presence of
MISC_FEATURES_ENABLES(which is a per-pCPU msr) on the boot CPU, and it affectsX86_FEATURE_CPUID_FAULTING. Which in it's turn affects the presence ofMISC_FEATURES_ENABLESfor PV vCPUs.So the actual question is: where to store the availability of
MISC_FEATURES_ENABLES(and possibly other per-pCPU msrs in the future) and is it even needed to do so?
Store it in one single host policy.
Part of my CPUID work will be cleaning up some of these warts in the detection logic.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 49 lines · Andrew Cooper
Quoted 48 lines · Sergey Dyasli
Quoted 35 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 16.02.18 at 11:33, <[email protected]> wrote:
Quoted 20 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 08.02.18 at 11:23, <[email protected]> wrote:
xen/arch/x86/cpu/common.c +2
-1uint64_t val; +int rc; - if (rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) || +if ((rc =rdmsr_safe (MSR_INTEL_PLATFORM_INFO , val)) ==0 )xen/arch/x86/cpu/common.c void (* __read_mostly ctxt_switch_masking)(const struct vcpu *next); · line 135
Quoted 10 lines
xen/arch/x86/cpu/common.c +7
-0+ { + dp->plaform_info.available = true; +if (val &MSR_PLATFORM_INFO_CPUID_FAULTING ) + dp->plaform_info.cpuid_faulting = true; + } + +if (rc || !(val &MSR_PLATFORM_INFO_CPUID_FAULTING ) ||rdmsr_safe (MSR_INTEL_MISC_FEATURES_ENABLES ,this_cpu (msr_misc_features)))Below here we have
Quoted 3 lines
setup_clear_cpu_cap(X86_FEATURE_CPUID_FAULTING);Shouldn't this be reflected in the host policy?
I guess the correct thing to do for now for
host_msr_domain_policyis:dp->plaform_info.cpuid_faulting = cpu_has_cpuid_faulting;Looking at the code,
calculate_pv_max_policy()will be simplified with the above change:pv_max_msr_domain_policywill become a copy of host policy.Quoted 6 lines
Quoted 2 lines
This actually brings a question: what to do about per-pCPU MSRs in the context of MSR policy?
How does per-pCPU-ness of an MSR affect the policy? Are you thinking of CPUs with different capabilities? We assume all CPUs are identical in many other places.
Yes, CPUs are assumed to be identical. But currently Xen checks the presence of
MISC_FEATURES_ENABLES(which is a per-pCPU msr) on the boot CPU, and it affectsX86_FEATURE_CPUID_FAULTING. Which in it's turn affects the presence ofMISC_FEATURES_ENABLESfor PV vCPUs.
Quoted 5 lines
Quoted 3 lines
So the actual question is: where to store the availability of
MISC_FEATURES_ENABLES(and possibly other per-pCPU msrs in the future) and is it even needed to do so?Store it in one single host policy.
And where do you propose to actually store it? Currently there are two distinct structures: msr_domain_policy and msr_vcpu_policy.
Quoted 2 lines
Part of my CPUID work will be cleaning up some of these warts in the detection logic.
Signature · 6 lines
Thanks, Sergey _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 44 lines · Sergey Dyasli
Quoted 43 lines · Andrew Cooper
Quoted 42 lines · Sergey Dyasli
Quoted 31 lines · Jan Beulich
Quoted 31 lines
Quoted 1 line
Quoted 1 line · On 16.02.18 at 11:33, <[email protected]> wrote:
Quoted 18 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.02.18 at 11:23, <[email protected]> wrote:
(quoted diff) +2
-1uint64_t val; + int rc; - if (rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) || + if ((rc = rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val)) == 0)Review
Quoted 10 lines
(quoted diff) +7
-0+ { + dp->plaform_info.available = true; + if (val & MSR_PLATFORM_INFO_CPUID_FAULTING) + dp->plaform_info.cpuid_faulting = true; + } + + if (rc || !(val & MSR_PLATFORM_INFO_CPUID_FAULTING) || rdmsr_safe(MSR_INTEL_MISC_FEATURES_ENABLES, this_cpu(msr_misc_features)))Below here we have
Quoted 3 lines
setup_clear_cpu_cap(X86_FEATURE_CPUID_FAULTING);Shouldn't this be reflected in the host policy?
I guess the correct thing to do for now for
host_msr_domain_policyis:dp->plaform_info.cpuid_faulting = cpu_has_cpuid_faulting;Looking at the code,
calculate_pv_max_policy()will be simplified with the above change:pv_max_msr_domain_policywill become a copy of host policy.Quoted 5 lines
Quoted 2 lines
This actually brings a question: what to do about per-pCPU MSRs in the context of MSR policy?
How does per-pCPU-ness of an MSR affect the policy? Are you thinking of CPUs with different capabilities? We assume all CPUs are identical in many other places.
Yes, CPUs are assumed to be identical. But currently Xen checks the presence of
MISC_FEATURES_ENABLES(which is a per-pCPU msr) on the boot CPU, and it affectsX86_FEATURE_CPUID_FAULTING. Which in it's turn affects the presence ofMISC_FEATURES_ENABLESfor PV vCPUs.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
So the actual question is: where to store the availability of
MISC_FEATURES_ENABLES(and possibly other per-pCPU msrs in the future) and is it even needed to do so?Store it in one single host policy.
And where do you propose to actually store it? Currently there are two distinct structures:
msr_domain_policyandmsr_vcpu_policy.
msr_domain_policy, like this patch does.
By and large, I expect the "read only feature style" MSRs to all be in the domain policy, and the "read/write make stuff happen" MSRs to all be in the vcpu policy.
We can revisit this if/when we find a counterexample.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel