Re: [PATCH V2 08/23] perf/x86: Expose CPUID enumeration bits for arch LBR

From: Peter Zijlstra
Date: Tue Jun 30 2020 - 12:40:39 EST


On Tue, Jun 30, 2020 at 11:36:29AM -0400, Liang, Kan wrote:
> > Why keep the full CPUID leaf here? What's wrong with something like:
> >
> > unsigned int lbr_depth_mask:8;
> > unsigned int lbr_deep_c_reset:1;
> > unsigned int lbr_lip:1;
> > unsigned int lbr_cpl:1;
> > unsigned int lbr_filter:1;
> > unsigned int lbr_call_stack:1;
> > unsigned int lbr_mispred:1;
> > unsigned int lbr_timed_lbr:1;
> > unsigned int lbr_br_type:1;
> >
> > That's only 2 bytes, instead of 24.
>
> Yes, it can save the space.
> I will add some codes in patch 14 to initialize these items in
> intel_pmu_arch_lbr_init().

It also makes stuff like:

> + if (!x86_pmu.lbr_ebx.split.lbr_cpl ||
> + !x86_pmu.lbr_ebx.split.lbr_filter ||
> + !x86_pmu.lbr_ebx.split.lbr_call_stack)

eminently more readable.