All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test: Update event group check for support of uncore event
@ 2022-12-07 16:58 ` Athira Rajeev
  0 siblings, 0 replies; 8+ messages in thread
From: Athira Rajeev @ 2022-12-07 16:58 UTC (permalink / raw)
  To: acme, jolsa, ravi.bangoria
  Cc: namhyung, irogers, james.clark, mpe, linux-perf-users,
	linuxppc-dev, maddy, rnsastry, kjain, disgoel

Event group test checks group creation for combinations of
hw, sw and uncore PMU events. Some of the uncore pmus may
require additional permission to access the counters.
For example, in case of hv_24x7, partition need to have
permissions to access hv_24x7 pmu counters. If not, event_open
will fail. Hence add a sanity check to see if event_open
succeeds before proceeding with the test.

Fixes: b20d9215a35f ("perf test: Add event group test for events in multiple PMUs")
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
Note: The patch is based on tmp.perf/core branch
    of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git

 tools/perf/tests/event_groups.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/event_groups.c b/tools/perf/tests/event_groups.c
index 612c0444aaa8..029442b4e9c6 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,18 @@ 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;
+				/*
+				 * Check if the chosen uncore pmu event can be
+				 * used in the test. For example, incase of accessing
+				 * hv_24x7 pmu counters, partition should have
+				 * additional permissions. If not, event open will
+				 * fail. So check if the event open succeeds
+				 * before proceeding.
+				 */
+				fd = event_open(types[2], configs[2], -1);
+				if (fd < 0)
+					return -1;
+				close(fd);
 				return 0;
 			}
 		}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] perf test: Update event group check for support of uncore event
@ 2022-12-07 16:58 ` Athira Rajeev
  0 siblings, 0 replies; 8+ messages in thread
From: Athira Rajeev @ 2022-12-07 16:58 UTC (permalink / raw)
  To: acme, jolsa, ravi.bangoria
  Cc: irogers, maddy, rnsastry, linux-perf-users, james.clark, kjain,
	namhyung, disgoel, linuxppc-dev

Event group test checks group creation for combinations of
hw, sw and uncore PMU events. Some of the uncore pmus may
require additional permission to access the counters.
For example, in case of hv_24x7, partition need to have
permissions to access hv_24x7 pmu counters. If not, event_open
will fail. Hence add a sanity check to see if event_open
succeeds before proceeding with the test.

Fixes: b20d9215a35f ("perf test: Add event group test for events in multiple PMUs")
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
Note: The patch is based on tmp.perf/core branch
    of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git

 tools/perf/tests/event_groups.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/event_groups.c b/tools/perf/tests/event_groups.c
index 612c0444aaa8..029442b4e9c6 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,18 @@ 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;
+				/*
+				 * Check if the chosen uncore pmu event can be
+				 * used in the test. For example, incase of accessing
+				 * hv_24x7 pmu counters, partition should have
+				 * additional permissions. If not, event open will
+				 * fail. So check if the event open succeeds
+				 * before proceeding.
+				 */
+				fd = event_open(types[2], configs[2], -1);
+				if (fd < 0)
+					return -1;
+				close(fd);
 				return 0;
 			}
 		}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf test: Update event group check for support of uncore event
  2022-12-07 16:58 ` Athira Rajeev
@ 2022-12-08  4:18   ` Ravi Bangoria
  -1 siblings, 0 replies; 8+ messages in thread
From: Ravi Bangoria @ 2022-12-08  4:18 UTC (permalink / raw)
  To: Athira Rajeev, acme, jolsa
  Cc: namhyung, irogers, james.clark, mpe, linux-perf-users,
	linuxppc-dev, maddy, rnsastry, kjain, disgoel, Ravi Bangoria

On 07-Dec-22 10:28 PM, Athira Rajeev wrote:
> Event group test checks group creation for combinations of
> hw, sw and uncore PMU events. Some of the uncore pmus may
> require additional permission to access the counters.
> For example, in case of hv_24x7, partition need to have
> permissions to access hv_24x7 pmu counters. If not, event_open
> will fail. Hence add a sanity check to see if event_open
> succeeds before proceeding with the test.
> 
> Fixes: b20d9215a35f ("perf test: Add event group test for events in multiple PMUs")
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>

Acked-by: Ravi Bangoria <ravi.bangoria@amd.com>

Thanks,
Ravi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf test: Update event group check for support of uncore event
@ 2022-12-08  4:18   ` Ravi Bangoria
  0 siblings, 0 replies; 8+ messages in thread
From: Ravi Bangoria @ 2022-12-08  4:18 UTC (permalink / raw)
  To: Athira Rajeev, acme, jolsa
  Cc: irogers, maddy, rnsastry, Ravi Bangoria, linux-perf-users,
	james.clark, kjain, namhyung, disgoel, linuxppc-dev

On 07-Dec-22 10:28 PM, Athira Rajeev wrote:
> Event group test checks group creation for combinations of
> hw, sw and uncore PMU events. Some of the uncore pmus may
> require additional permission to access the counters.
> For example, in case of hv_24x7, partition need to have
> permissions to access hv_24x7 pmu counters. If not, event_open
> will fail. Hence add a sanity check to see if event_open
> succeeds before proceeding with the test.
> 
> Fixes: b20d9215a35f ("perf test: Add event group test for events in multiple PMUs")
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>

Acked-by: Ravi Bangoria <ravi.bangoria@amd.com>

Thanks,
Ravi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf test: Update event group check for support of uncore event
  2022-12-08  4:18   ` Ravi Bangoria
@ 2022-12-09  7:27     ` Athira Rajeev
  -1 siblings, 0 replies; 8+ messages in thread
From: Athira Rajeev @ 2022-12-09  7:27 UTC (permalink / raw)
  To: Ravi Bangoria
  Cc: Ian Rogers, maddy, Nageswara Sastry, Kajol Jain,
	Arnaldo Carvalho de Melo, linux-perf-users, James Clark,
	Jiri Olsa, Namhyung Kim, disgoel, linuxppc-dev



> On 08-Dec-2022, at 9:48 AM, Ravi Bangoria <ravi.bangoria@amd.com> wrote:
> 
> On 07-Dec-22 10:28 PM, Athira Rajeev wrote:
>> Event group test checks group creation for combinations of
>> hw, sw and uncore PMU events. Some of the uncore pmus may
>> require additional permission to access the counters.
>> For example, in case of hv_24x7, partition need to have
>> permissions to access hv_24x7 pmu counters. If not, event_open
>> will fail. Hence add a sanity check to see if event_open
>> succeeds before proceeding with the test.
>> 
>> Fixes: b20d9215a35f ("perf test: Add event group test for events in multiple PMUs")
>> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> 
> Acked-by: Ravi Bangoria <ravi.bangoria@amd.com>

Thanks Ravi for checking the patch

Athira
> 
> Thanks,
> Ravi


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf test: Update event group check for support of uncore event
@ 2022-12-09  7:27     ` Athira Rajeev
  0 siblings, 0 replies; 8+ messages in thread
From: Athira Rajeev @ 2022-12-09  7:27 UTC (permalink / raw)
  To: Ravi Bangoria
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ian Rogers, maddy,
	Nageswara Sastry, linux-perf-users, James Clark, Kajol Jain,
	Namhyung Kim, disgoel, linuxppc-dev



> On 08-Dec-2022, at 9:48 AM, Ravi Bangoria <ravi.bangoria@amd.com> wrote:
> 
> On 07-Dec-22 10:28 PM, Athira Rajeev wrote:
>> Event group test checks group creation for combinations of
>> hw, sw and uncore PMU events. Some of the uncore pmus may
>> require additional permission to access the counters.
>> For example, in case of hv_24x7, partition need to have
>> permissions to access hv_24x7 pmu counters. If not, event_open
>> will fail. Hence add a sanity check to see if event_open
>> succeeds before proceeding with the test.
>> 
>> Fixes: b20d9215a35f ("perf test: Add event group test for events in multiple PMUs")
>> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> 
> Acked-by: Ravi Bangoria <ravi.bangoria@amd.com>

Thanks Ravi for checking the patch

Athira
> 
> Thanks,
> Ravi


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf test: Update event group check for support of uncore event
  2022-12-09  7:27     ` Athira Rajeev
@ 2022-12-12 15:39       ` Arnaldo Carvalho de Melo
  -1 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-12-12 15:39 UTC (permalink / raw)
  To: Athira Rajeev
  Cc: Ravi Bangoria, Jiri Olsa, Ian Rogers, maddy, Nageswara Sastry,
	linux-perf-users, James Clark, Kajol Jain, Namhyung Kim, disgoel,
	linuxppc-dev

Em Fri, Dec 09, 2022 at 12:57:34PM +0530, Athira Rajeev escreveu:
> 
> 
> > On 08-Dec-2022, at 9:48 AM, Ravi Bangoria <ravi.bangoria@amd.com> wrote:
> > 
> > On 07-Dec-22 10:28 PM, Athira Rajeev wrote:
> >> Event group test checks group creation for combinations of
> >> hw, sw and uncore PMU events. Some of the uncore pmus may
> >> require additional permission to access the counters.
> >> For example, in case of hv_24x7, partition need to have
> >> permissions to access hv_24x7 pmu counters. If not, event_open
> >> will fail. Hence add a sanity check to see if event_open
> >> succeeds before proceeding with the test.
> >> 
> >> Fixes: b20d9215a35f ("perf test: Add event group test for events in multiple PMUs")
> >> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> > 
> > Acked-by: Ravi Bangoria <ravi.bangoria@amd.com>
> 
> Thanks Ravi for checking the patch

Thanks, applied.

- Arnaldo


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf test: Update event group check for support of uncore event
@ 2022-12-12 15:39       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-12-12 15:39 UTC (permalink / raw)
  To: Athira Rajeev
  Cc: Ian Rogers, maddy, Nageswara Sastry, Kajol Jain, Ravi Bangoria,
	linux-perf-users, James Clark, Jiri Olsa, Namhyung Kim, disgoel,
	linuxppc-dev

Em Fri, Dec 09, 2022 at 12:57:34PM +0530, Athira Rajeev escreveu:
> 
> 
> > On 08-Dec-2022, at 9:48 AM, Ravi Bangoria <ravi.bangoria@amd.com> wrote:
> > 
> > On 07-Dec-22 10:28 PM, Athira Rajeev wrote:
> >> Event group test checks group creation for combinations of
> >> hw, sw and uncore PMU events. Some of the uncore pmus may
> >> require additional permission to access the counters.
> >> For example, in case of hv_24x7, partition need to have
> >> permissions to access hv_24x7 pmu counters. If not, event_open
> >> will fail. Hence add a sanity check to see if event_open
> >> succeeds before proceeding with the test.
> >> 
> >> Fixes: b20d9215a35f ("perf test: Add event group test for events in multiple PMUs")
> >> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> > 
> > Acked-by: Ravi Bangoria <ravi.bangoria@amd.com>
> 
> Thanks Ravi for checking the patch

Thanks, applied.

- Arnaldo


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-12-12 15:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 16:58 [PATCH] perf test: Update event group check for support of uncore event Athira Rajeev
2022-12-07 16:58 ` Athira Rajeev
2022-12-08  4:18 ` Ravi Bangoria
2022-12-08  4:18   ` Ravi Bangoria
2022-12-09  7:27   ` Athira Rajeev
2022-12-09  7:27     ` Athira Rajeev
2022-12-12 15:39     ` Arnaldo Carvalho de Melo
2022-12-12 15:39       ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.