Re: [PATCH v5 03/11] perf/x86/intel/pt: Introduce a new function to get the capability of Intel PT

From: Paolo Bonzini
Date: Fri Mar 16 2018 - 13:28:13 EST


On 04/03/2018 13:07, Luwei Kang wrote:
> +u32 pt_cap_get_ex(u32 *caps, enum pt_capabilities cap)
> +{
> + struct pt_cap_desc *cd = &pt_caps[cap];
> + u32 c = caps[cd->leaf * PT_CPUID_REGS_NUM + cd->reg];
> + unsigned int shift = __ffs(cd->mask);
> +
> + return (c & cd->mask) >> shift;
> +}
> +EXPORT_SYMBOL_GPL(pt_cap_get_ex);
> +

You should change pt_cap_get to use this function. Also, "_ex" is not a
very common suffix, so perhaps you can call it __pt_cap_get.

I don't have any other comments on patches 1-3, so when you resend we
can ask the x86 maintainers for approval.

Thanks,

Paolo