lkml.org 
[lkml]   [2023]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V4 4/7] perf/x86/intel: Support LBR event logging
On Wed, Oct 04, 2023 at 11:40:41AM -0700, kan.liang@linux.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?

\
 
 \ /
  Last update: 2023-10-19 11:29    [W:0.096 / U:1.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site