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

Re: [Xen-devel] [V2 PATCH 1/9] x86/hvm: pkeys, add pkeys support for cpuid handling



>>> On 03.12.15 at 02:53, <huaitong.han@xxxxxxxxx> wrote:
> On Wed, 2015-12-02 at 04:06 -0700, Jan Beulich wrote:
> 
>> > > )
>> > > +            *ecx &= ~cpufeat_mask(X86_FEATURE_PKU);
>> > > +
>> > > +        if ( (count == 0) && cpu_has_pku )
>> > > +            *ecx |= (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PKE)
>> > > ?
>> > > +                     cpufeat_mask(X86_FEATURE_OSPKE) : 0;
>> > 
>> > This is still buggy.  cpu_has_pku has no relevance to whether OSPKE
>> > becomes visible.
>> > 
>> > Visibility of OSPKE is determined solely by v
>> > ->arch.hvm_vcpu.guest_cr[4]
>> > & X86_CR4_PKE and nothing else.
>> 
>> Actually I wouldn't mind guarding against the case where the CR4 flag
>> is wrongly set for whatever reason, but that ought to check the PKU
>> bit in *ecx, not the host flag. Same applies to the cpu_has_xsave
>> check - this too should check the guest flag, not the host one.
> I will add guest_cpuid_has_xxx functions.

If anything, guest_has_ or guest_cpu_has_, but what's wrong with
just (recursively) invoking hvm_cpuid() where needed (as already
done in the 0x80000008 leaf case)?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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