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

Re: [Xen-devel] [PATCH V7 3/3] x86/xsaves: ebx may return wrong value using CPUID eax=0xdh, ecx =1



>>> On 31.03.16 at 10:57, <shuai.ruan@xxxxxxxxxxxxxxx> wrote:
> Refer to SDM 13.4.3 Extended Region of an XSAVE Area. The value return

No section numbers please - they tend to change.

> by ecx[1] with cpuid function 0xdh and sub-fucntion i (i>1) indicates

Either "0xd" or "0dh". And "function".

> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -1020,6 +1020,18 @@ void pv_cpuid(struct cpu_user_regs *regs)
>              a &= 
> (boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_XSAVEOPT)] &
>                    ~cpufeat_mask(X86_FEATURE_XSAVES));
>              b = c = d = 0;
> +            if ( cpu_has_xsavec )
> +            {
> +                b = XSTATE_AREA_MIN_SIZE;

Is this really correct namely when curr->arch.xcr0 == 0? If not, the
if() below should perhaps be combined with the if() above (and then
the same would apply to hvm_cpuid()).

> +                if ( curr->arch.xcr0 )
> +                    for( subleaf = 2; subleaf < 63; subleaf++ )
> +                        if ( (1ULL << subleaf) & curr->arch.xcr0 )

The first if() is redundant with this second one. If you really
mean to avoid the loop, then please also only check bits
2..62 in the first if().

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®.