linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: James Clark <james.clark@linaro.org>, linux-perf-users@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf tests: Fix Tool PMU test segfault
Date: Wed, 12 Feb 2025 14:17:33 -0500	[thread overview]
Message-ID: <b9915fb7-ad8c-40ff-b53a-fb6936c141b1@linux.intel.com> (raw)
In-Reply-To: <20250212163859.1489916-1-james.clark@linaro.org>



On 2025-02-12 11:38 a.m., James Clark wrote:
> tool_pmu__event_to_str() now handles skipped events by returning NULL,
> so it's wrong to re-check for a skip on the resulting string. Calling
> tool_pmu__skip_event() with a NULL string results in a segfault so
> remove the unnecessary skip to fix it:
> 
>   $ perf test -vv "parsing with PMU name"
> 
>   12.2: Parsing with PMU name:
>   ...
>   ---- unexpected signal (11) ----
>   12.2: Parsing with PMU name         : FAILED!
> 

Oops, right. Thanks for the fix.

Acked-by: Kan Liang <kan.liang@linux.intel.com>

Thanks,
Kan

> Fixes: ee8aef2d2321 ("perf tools: Add skip check in tool_pmu__event_to_str()")
> Signed-off-by: James Clark <james.clark@linaro.org>
> --->  tools/perf/tests/tool_pmu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/tests/tool_pmu.c b/tools/perf/tests/tool_pmu.c
> index 187942b749b7..1e900ef92e37 100644
> --- a/tools/perf/tests/tool_pmu.c
> +++ b/tools/perf/tests/tool_pmu.c
> @@ -27,7 +27,7 @@ static int do_test(enum tool_pmu_event ev, bool with_pmu)
>  	parse_events_error__init(&err);
>  	ret = parse_events(evlist, str, &err);
>  	if (ret) {
> -		if (tool_pmu__skip_event(tool_pmu__event_to_str(ev))) {
> +		if (!tool_pmu__event_to_str(ev)) {
>  			ret = TEST_OK;
>  			goto out;
>  		}
> @@ -59,7 +59,7 @@ static int do_test(enum tool_pmu_event ev, bool with_pmu)
>  		}
>  	}
>  
> -	if (!found && !tool_pmu__skip_event(tool_pmu__event_to_str(ev))) {
> +	if (!found && tool_pmu__event_to_str(ev)) {
>  		pr_debug("FAILED %s:%d Didn't find tool event '%s' in parsed evsels\n",
>  			 __FILE__, __LINE__, str);
>  		ret = TEST_FAIL;


  parent reply	other threads:[~2025-02-12 19:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 16:38 [PATCH] perf tests: Fix Tool PMU test segfault James Clark
2025-02-12 17:41 ` Ian Rogers
2025-02-12 19:17 ` Liang, Kan [this message]
2025-02-13 17:21 ` Namhyung Kim

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=b9915fb7-ad8c-40ff-b53a-fb6936c141b1@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --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 \
    /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).