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

Re: [Xen-devel] [PATCH v2 1/3] x86/VPMU: Support only versions 2 through 4 of architectural performance monitoring



>>> On 01.12.15 at 17:50, <boris.ostrovsky@xxxxxxxxxx> wrote:
> @@ -746,6 +746,13 @@ static void core2_vpmu_do_cpuid(unsigned int input,
>              if ( cpu_has(&current_cpu_data, X86_FEATURE_DSCPL) )
>                  *ecx |= cpufeat_mask(X86_FEATURE_DSCPL);
>          }
> +        break;
> +
> +    case 0xa:
> +        /* Since we don't fully emulate version 4 report version 3 */
> +        if ( MASK_EXTR(*eax, PMU_VERSION_MASK) == 4 )

Considering that this may not be what physical CPUID returned, I
think you'd better use >= here.

> @@ -955,59 +962,25 @@ int vmx_vpmu_initialise(struct vcpu *v)
>  int __init core2_vpmu_init(void)
>  {
>      u64 caps;
> +    unsigned int version = 0;
>  
> -    if ( current_cpu_data.x86 != 6 )
> +    if ( current_cpu_data.cpuid_level >= 0xa )
> +        version = MASK_EXTR(cpuid_eax(0xa), PMU_VERSION_MASK);
> +
> +    if ( version == 4 )
> +        printk(XENLOG_INFO "VPMU: PMU version 4 is not fully supported. "
> +               "Emulating version 3\n");
> +    else if ( (version != 2) && (version != 3) )
>      {
> -        printk(XENLOG_WARNING "VPMU: only family 6 is supported\n");
> +        printk(XENLOG_WARNING "VPMU: PMU version %u is not supported\n",
> +               version);
>          return -EINVAL;
>      }

I'd appreciate if you would use switch() here.

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