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

Re: [Xen-devel] [PATCH v2 1/2] x86/VPMU: return correct fixed PMC count



>>> On 25.11.15 at 00:53, <bgregg@xxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/cpu/vpmu_intel.c
> +++ b/xen/arch/x86/cpu/vpmu_intel.c
> @@ -166,10 +166,10 @@ static int core2_get_arch_pmc_count(void)
>   */
>  static int core2_get_fixed_pmc_count(void)
>  {
> -    u32 eax;
> +    u32 edx;
>  
> -    eax = cpuid_eax(0xa);
> -    return MASK_EXTR(eax, PMU_FIXED_NR_MASK);
> +    edx = cpuid_edx(0xa);
> +    return MASK_EXTR(edx, PMU_FIXED_NR_MASK);
>  }
>  
>  /* edx bits 5-12: Bit width of fixed-function performance counters  */

I'll commit as is since it's an immediate improvement, but I don't think
this is sufficient: The SDM clearly says "if Version ID > 1", which isn't
being tested here or in the immediately following function.

Looking at this I'd also like to note that the triplets
PMU_*_{SHIFT,BITS,MASK} seem to be rather less readable than if
there were just PMU_*_MASK with a simple hex number on the right
side (the SHIFT and BITS ones aren't being used for other than
defining MASK afaics).

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