Re: [Xen-devel] [PATCH 22/27] x86/cpuid: Perform max_leaf calculations in guest_cpuid()

2017-01-05 Thread Jan Beulich
>>> On 05.01.17 at 16:02, wrote: > On 05/01/17 14:52, Jan Beulich wrote: > On 05.01.17 at 15:28, wrote: >>> What else would you suggest? One way or another (better shown in the >>> context of the following patch), we need one block per

Re: [Xen-devel] [PATCH 22/27] x86/cpuid: Perform max_leaf calculations in guest_cpuid()

2017-01-05 Thread Andrew Cooper
On 05/01/17 14:52, Jan Beulich wrote: On 05.01.17 at 15:28, wrote: >> On 05/01/17 13:51, Jan Beulich wrote: @@ -333,21 +340,50 @@ void guest_cpuid(const struct vcpu *v, unsigned int leaf, unsigned int subleaf, struct cpuid_leaf

Re: [Xen-devel] [PATCH 22/27] x86/cpuid: Perform max_leaf calculations in guest_cpuid()

2017-01-05 Thread Jan Beulich
>>> On 05.01.17 at 15:28, wrote: > On 05/01/17 13:51, Jan Beulich wrote: >>> @@ -333,21 +340,50 @@ void guest_cpuid(const struct vcpu *v, unsigned int >>> leaf, >>> unsigned int subleaf, struct cpuid_leaf *res) >>> { >>> const struct domain *d =

Re: [Xen-devel] [PATCH 22/27] x86/cpuid: Perform max_leaf calculations in guest_cpuid()

2017-01-05 Thread Andrew Cooper
On 05/01/17 13:51, Jan Beulich wrote: > >> @@ -333,21 +340,50 @@ void guest_cpuid(const struct vcpu *v, unsigned int >> leaf, >> unsigned int subleaf, struct cpuid_leaf *res) >> { >> const struct domain *d = v->domain; >> +const struct cpuid_policy *p = d->arch.cpuid;

Re: [Xen-devel] [PATCH 22/27] x86/cpuid: Perform max_leaf calculations in guest_cpuid()

2017-01-05 Thread Jan Beulich
>>> On 04.01.17 at 13:39, wrote: > @@ -306,6 +310,9 @@ void recalculate_cpuid_policy(struct domain *d) > if ( !d->disable_migrate && !d->arch.vtsc ) > __clear_bit(X86_FEATURE_ITSC, fs); > > +if ( p->basic.max_leaf < 0xd ) XSTATE_CPUID > @@ -333,21

[Xen-devel] [PATCH 22/27] x86/cpuid: Perform max_leaf calculations in guest_cpuid()

2017-01-04 Thread Andrew Cooper
Clamp the toolstack-providied max_leaf values in recalculate_cpuid_policy(), causing the per-domain policy to have guest-accurate data. Have guest_cpuid() exit early if a requested leaf is out of range, rather than falling into the legacy path. Signed-off-by: Andrew Cooper