[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa719c37-109b-4ab6-8ac0-2700430cd912@linux.intel.com>
Date: Thu, 19 Oct 2023 09:58:30 -0400
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mingo@...hat.com, acme@...nel.org, linux-kernel@...r.kernel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, namhyung@...nel.org, irogers@...gle.com,
adrian.hunter@...el.com, ak@...ux.intel.com, eranian@...gle.com,
alexey.v.bayduraev@...ux.intel.com, tinghao.zhang@...el.com
Subject: Re: [PATCH V4 4/7] perf/x86/intel: Support LBR event logging
On 2023-10-19 5:26 a.m., Peter Zijlstra wrote:
> On Wed, Oct 04, 2023 at 11:40:41AM -0700, kan.liang@...ux.intel.com wrote:
>
>> +
>> static struct attribute *lbr_attrs[] = {
>> &dev_attr_branches.attr,
>> + &dev_attr_branch_counter_nr.attr,
>> + &dev_attr_branch_counter_width.attr,
>> NULL
>> };
>>
>> @@ -5590,7 +5665,11 @@ mem_is_visible(struct kobject *kobj, struct attribute *attr, int i)
>> static umode_t
>> lbr_is_visible(struct kobject *kobj, struct attribute *attr, int i)
>> {
>> - return x86_pmu.lbr_nr ? attr->mode : 0;
>> + /* branches */
>> + if (i == 0)
>> + return x86_pmu.lbr_nr ? attr->mode : 0;
>> +
>> + return (x86_pmu.flags & PMU_FL_LBR_EVENT) ? attr->mode : 0;
>> }
>
> As in the patch this is fairly readable, but I just checked and in the
> code lbr_attrs and lbr_is_visible() are rather far away from one another
> which makes the whole i thing hard to interpret.
>
> Should we re-organize that a little?
Sure, I will implement a separate patch to re-organize it.
It seems there are only two attribute groups which have both .attrs and
.is_visible, group_default and group_caps_lbr. I will re-organize for
both of them.
Thanks,
Kan
Powered by blists - more mailing lists