linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@arm.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Rob Herring <robh@kernel.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/6] perf parse-events: Fixes relating to no_value terms
Date: Sat, 2 Sep 2023 08:11:15 -0300	[thread overview]
Message-ID: <ZPMYU2lvkhfmPYyG@kernel.org> (raw)
In-Reply-To: <20230901233949.2930562-1-irogers@google.com>

Em Fri, Sep 01, 2023 at 04:39:44PM -0700, Ian Rogers escreveu:
> A term may have no value in which case it is assumed to have a value
> of 1. It doesn't just apply to alias/event terms so change the
> parse_events_term__to_strbuf assert.
> 
> Commit 99e7138eb789 ("perf tools: Fail on using multiple bits long
> terms without value") made it so that no_value terms could only be for
> a single bit. Prior to commit 64199ae4b8a3 ("perf parse-events: Fix
> propagation of term's no_value when cloning") this missed a test case
> where config1 had no_value.
> 
> Fixes: 64199ae4b8a3 ("perf parse-events: Fix propagation of term's no_value when cloning")
> Signed-off-by: Ian Rogers <irogers@google.com>

I'm trying to minimize the number of patches that aren't strict fixes
this late in the process for v6.6, so I think I'll get just this first
one and defer the other cleanups/improvements for v6.7, ok?

Thanks,

- Arnaldo

> ---
>  tools/perf/tests/parse-events.c | 2 +-
>  tools/perf/util/parse-events.c  | 2 +-
>  tools/perf/util/parse-events.h  | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
> index d86076d575ed..d47f1f871164 100644
> --- a/tools/perf/tests/parse-events.c
> +++ b/tools/perf/tests/parse-events.c
> @@ -2170,7 +2170,7 @@ static const struct evlist_test test__events[] = {
>  
>  static const struct evlist_test test__events_pmu[] = {
>  	{
> -		.name  = "cpu/config=10,config1,config2=3,period=1000/u",
> +		.name  = "cpu/config=10,config1=1,config2=3,period=1000/u",
>  		.valid = test__pmu_cpu_valid,
>  		.check = test__checkevent_pmu,
>  		/* 0 */
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 68fe2c4ff49f..65608a3cba81 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -2607,7 +2607,7 @@ int parse_events_term__to_strbuf(struct list_head *term_list, struct strbuf *sb)
>  
>  		if (term->type_val == PARSE_EVENTS__TERM_TYPE_NUM)
>  			if (term->no_value) {
> -				assert(term->type_term == PARSE_EVENTS__TERM_TYPE_USER);
> +				assert(term->val.num == 1);
>  				ret = strbuf_addf(sb, "%s", term->config);
>  			} else
>  				ret = strbuf_addf(sb, "%s=%#"PRIx64, term->config, term->val.num);
> diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
> index 855b0725c5d4..594e5d2dc67f 100644
> --- a/tools/perf/util/parse-events.h
> +++ b/tools/perf/util/parse-events.h
> @@ -124,8 +124,8 @@ struct parse_events_term {
>  	 */
>  	bool weak;
>  	/**
> -	 * @no_value: Is there no value. TODO: this should really be part of
> -	 * type_val.
> +	 * @no_value: Is there no value. If a numeric term has no value then the
> +	 * value is assumed to be 1. An event name also has no value.
>  	 */
>  	bool no_value;
>  };
> -- 
> 2.42.0.283.g2d96d420d3-goog
> 

-- 

- Arnaldo

  parent reply	other threads:[~2023-09-02 11:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 23:39 [PATCH v1 1/6] perf parse-events: Fixes relating to no_value terms Ian Rogers
2023-09-01 23:39 ` [PATCH v1 2/6] perf parse-events: Remove unnecessary __maybe_unused Ian Rogers
2023-09-01 23:39 ` [PATCH v1 3/6] perf parse-events: Tidy up str parameter Ian Rogers
2023-09-01 23:39 ` [PATCH v1 4/6] perf parse-events: Avoid enum casts Ian Rogers
2023-09-01 23:39 ` [PATCH v1 5/6] perf parse-events: Copy fewer term lists Ian Rogers
2023-09-01 23:39 ` [PATCH v1 6/6] perf parse-events: Add struct parse_events_terms Ian Rogers
2023-09-02 11:11 ` Arnaldo Carvalho de Melo [this message]
2023-09-02 16:28   ` [PATCH v1 1/6] perf parse-events: Fixes relating to no_value terms Ian Rogers
2023-09-05  9:39 ` James Clark
2023-09-06 15:48   ` Arnaldo Carvalho de Melo
2023-09-06 15:51   ` Arnaldo Carvalho de Melo

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=ZPMYU2lvkhfmPYyG@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=robh@kernel.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;
as well as URLs for NNTP newsgroup(s).