public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Jiri Olsa <jolsa@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] perf/x86/intel: Use is_visible callback for default group
Date: Fri, 14 Jun 2019 12:20:17 +0200	[thread overview]
Message-ID: <20190614102017.GA4325@krava> (raw)
In-Reply-To: <20190524132152.GB26617@krava>

On Fri, May 24, 2019 at 03:21:52PM +0200, Jiri Olsa wrote:

SNIP

ping

jirka

> ---
> It's preffered to use group's is_visible callback, so
> we do not need to use condition attribute assignment.
> 
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  arch/x86/events/intel/core.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index 85afe7e98c7d..cfd61b71136d 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -4386,7 +4386,7 @@ static DEVICE_ATTR(allow_tsx_force_abort, 0644,
>  
>  static struct attribute *intel_pmu_attrs[] = {
>  	&dev_attr_freeze_on_smi.attr,
> -	NULL, /* &dev_attr_allow_tsx_force_abort.attr.attr */
> +	&dev_attr_allow_tsx_force_abort.attr,
>  	NULL,
>  };
>  
> @@ -4414,6 +4414,15 @@ exra_is_visible(struct kobject *kobj, struct attribute *attr, int i)
>  	return x86_pmu.version >= 2 ? attr->mode : 0;
>  }
>  
> +static umode_t
> +default_is_visible(struct kobject *kobj, struct attribute *attr, int i)
> +{
> +	if (attr == &dev_attr_allow_tsx_force_abort.attr)
> +		return x86_pmu.flags & PMU_FL_TFA ? attr->mode : 0;
> +
> +	return attr->mode;
> +}
> +
>  static struct attribute_group group_events_td  = {
>  	.name = "events",
>  };
> @@ -4450,7 +4459,8 @@ static struct attribute_group group_format_extra_skl = {
>  };
>  
>  static struct attribute_group group_default = {
> -	.attrs = intel_pmu_attrs,
> +	.attrs      = intel_pmu_attrs,
> +	.is_visible = default_is_visible,
>  };
>  
>  static const struct attribute_group *attr_update[] = {
> @@ -4973,7 +4983,6 @@ __init int intel_pmu_init(void)
>  			x86_pmu.get_event_constraints = tfa_get_event_constraints;
>  			x86_pmu.enable_all = intel_tfa_pmu_enable_all;
>  			x86_pmu.commit_scheduling = intel_tfa_commit_scheduling;
> -			intel_pmu_attrs[1] = &dev_attr_allow_tsx_force_abort.attr;
>  		}
>  
>  		pr_cont("Skylake events, ");
> -- 
> 2.20.1
> 

  reply	other threads:[~2019-06-14 10:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-12 15:55 [PATCHv2 0/9] perf/x86: Add update attribute groups Jiri Olsa
2019-05-12 15:55 ` [PATCH 1/9] sysfs: Add sysfs_update_groups function Jiri Olsa
2019-06-03 13:25   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-05-12 15:55 ` [PATCH 2/9] perf: Add attr_groups_update into struct pmu Jiri Olsa
2019-06-03 13:26   ` [tip:perf/core] perf/core: " tip-bot for Jiri Olsa
2019-05-12 15:55 ` [PATCH 3/9] perf/x86: Get rid of x86_pmu::event_attrs Jiri Olsa
2019-06-03 13:26   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-05-12 15:55 ` [PATCH 4/9] perf/x86: Use the new pmu::update_attrs attribute group Jiri Olsa
2019-06-03 13:27   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-05-12 15:55 ` [PATCH 5/9] perf/x86: Add is_visible attribute_group callback for base events Jiri Olsa
2019-06-03 13:28   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-05-12 15:55 ` [PATCH 6/9] perf/x86: Use update attribute groups for caps Jiri Olsa
2019-06-03 13:28   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-05-12 15:55 ` [PATCH 7/9] perf/x86: Use update attribute groups for extra format Jiri Olsa
2019-06-03 13:29   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-05-12 15:55 ` [PATCH 8/9] perf/x86/intel: Use update attributes for skylake format Jiri Olsa
2019-06-03 13:30   ` [tip:perf/core] " tip-bot for Jiri Olsa
2019-05-12 15:55 ` [PATCH 9/9] perf/x86: Use update attribute groups for default attributes Jiri Olsa
2019-05-13  9:35   ` Peter Zijlstra
2019-05-13 10:13     ` Jiri Olsa
2019-05-24 13:21     ` [PATCH] perf/x86/intel: Use is_visible callback for default group Jiri Olsa
2019-06-14 10:20       ` Jiri Olsa [this message]
2019-06-14 12:34         ` Peter Zijlstra
2019-06-17 14:40       ` [tip:perf/core] perf/x86/intel: Use ->is_visible " tip-bot for Jiri Olsa
2019-06-03 13:31   ` [tip:perf/core] perf/x86: Use update attribute groups for default attributes tip-bot for Jiri Olsa
2019-05-13  9:38 ` [PATCHv2 0/9] perf/x86: Add update attribute groups Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190614102017.GA4325@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox