linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	carsten.haitzler@arm.com, Leo Yan <leo.yan@linaro.org>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Kajol Jain <kjain@linux.ibm.com>,
	Thomas Richter <tmricht@linux.ibm.com>,
	linux-perf-users@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	sandipan.das@amd.com, ananth.narayan@amd.com,
	santosh.shukla@amd.com, Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH v3 2/2] perf test: Add event group test
Date: Wed, 7 Dec 2022 09:56:12 +0530	[thread overview]
Message-ID: <2e45a93d-56fd-b18e-de61-51ceccfee8a3@amd.com> (raw)
In-Reply-To: <C7F7A9B0-421E-40AB-987C-6D250B9633D3@linux.vnet.ibm.com>

Hi Athira,

>> +static int setup_uncore_event(void)
>> +{
>> +	struct perf_pmu *pmu;
>> +	int i;
>> +
>> +	if (list_empty(&pmus))
>> +		perf_pmu__scan(NULL);
>> +
>> +	perf_pmus__for_each_pmu(pmu) {
>> +		for (i = 0; i < NR_UNCORE_PMUS; i++) {
>> +			if (!strcmp(uncore_pmus[i].name, pmu->name)) {
>> +				pr_debug("Using %s for uncore pmu event\n", pmu->name);
>> +				types[2] = pmu->type;
>> +				configs[2] = uncore_pmus[i].config;
> 
> Hi Ravi,
> 
> Observed failure while running the test on powerpc. It is because the uncore PMU ie hv_24x7 needs
> performance monitoring to be enabled in powerpc. So to handle such cases, can we add an “event_open" check before
> proceeding with the test. Below is the change on top of “tmp.perf/core” .
> 
> 
> From 8b33fb900c26beafc28f75b6f64631f8fdd045c2 Mon Sep 17 00:00:00 2001
> From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> Date: Tue, 6 Dec 2022 20:17:25 +0530
> Subject: [PATCH] perf test: Update event group check for support of uncore
>  event
> 
> Event group test checks group creation for combinations of
> hw, sw and uncore PMU events. Some of the uncore pmu event
> requires performance enablement explicitly.

You need to open an event to activate hv_24x7 pmu?

> Example, hv_24x7
> event in powerpc. Hence add a check to see if event_open
> succeeds before proceeding.
> 
> Fixes: 5c88101b797d ("perf test: Add event group test for events in multiple PMUs")
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
>  tools/perf/tests/event_groups.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/tests/event_groups.c b/tools/perf/tests/event_groups.c
> index 612c0444aaa8..ad52e1da259a 100644
> --- a/tools/perf/tests/event_groups.c
> +++ b/tools/perf/tests/event_groups.c
> @@ -51,7 +51,7 @@ static int event_open(int type, unsigned long config, int group_fd)
>  static int setup_uncore_event(void)
>  {
>  	struct perf_pmu *pmu;
> -	int i;
> +	int i, fd;
>  
>  	if (list_empty(&pmus))
>  		perf_pmu__scan(NULL);
> @@ -62,6 +62,10 @@ static int setup_uncore_event(void)
>  				pr_debug("Using %s for uncore pmu event\n", pmu->name);
>  				types[2] = pmu->type;
>  				configs[2] = uncore_pmus[i].config;

Sure. Just add a comment here to explain why are we opening a
standalone event here.

> +				fd = event_open(types[2], configs[2], -1);
> +				if (fd < 0)
> +					return -1;
> +				close(fd);
>  				return 0;
>  			}
>  		}

Thanks,
Ravi

  reply	other threads:[~2022-12-07  4:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06  4:32 [PATCH v3 0/2] perf test: Add event group test Ravi Bangoria
2022-12-06  4:32 ` [PATCH v3 1/2] perf tool: Move pmus list variable to new a file Ravi Bangoria
2022-12-06  4:32 ` [PATCH v3 2/2] perf test: Add event group test Ravi Bangoria
2022-12-06  6:17   ` Madhavan Srinivasan
2022-12-06 17:27   ` Athira Rajeev
2022-12-07  4:26     ` Ravi Bangoria [this message]
2022-12-07  5:31       ` Madhavan Srinivasan
2022-12-07  5:54         ` Ravi Bangoria
2022-12-06  5:02 ` [PATCH v3 0/2] " Ian Rogers
2022-12-06 14:47 ` Liang, Kan
2022-12-06 16:03   ` 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=2e45a93d-56fd-b18e-de61-51ceccfee8a3@amd.com \
    --to=ravi.bangoria@amd.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ananth.narayan@amd.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=carsten.haitzler@arm.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=kjain@linux.ibm.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=maddy@linux.ibm.com \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sandipan.das@amd.com \
    --cc=santosh.shukla@amd.com \
    --cc=tmricht@linux.ibm.com \
    /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).