Re: [PATCH V4 4/7] perf/x86/intel: Support LBR event logging

From: Liang, Kan
Date: Thu Oct 19 2023 - 10:29:04 EST




On 2023-10-19 7:00 a.m., Peter Zijlstra wrote:
> On Wed, Oct 04, 2023 at 11:40:41AM -0700, kan.liang@xxxxxxxxxxxxxxx wrote:
>
>> +static ssize_t branch_counter_width_show(struct device *cdev,
>> + struct device_attribute *attr,
>> + char *buf)
>> +{
>> + return snprintf(buf, PAGE_SIZE, "2\n");
>> +}
>
>> +#define ARCH_LBR_EVENT_LOG_WIDTH 2
>
> I'm assuming this is the same '2' ? And having it hard-coded in two
> locations is awesome..
>
>> +#define ARCH_LBR_EVENT_LOG_MASK 0x3
>
> Should probably be ((1<<2)-1)
>
> As per that other email, the naming is confusing, should this not be:
>
> ARCH_LBR_EVENT_COUNTER_BITS
>
> or, since it's all local to lbr.c something shorter still, like:
>
> LBR_COUNTER_BITS
>
> hmm?

Sure, I will use the name LBR_COUNTER_BITS.

Thanks,
Kan