linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment
@ 2022-05-11 11:49 Athira Rajeev
  2022-05-12 11:15 ` kajoljain
       [not found] ` <151b1538daf92259702242dbf734230aea3199fe.camel@linux.vnet.ibm.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Athira Rajeev @ 2022-05-11 11:49 UTC (permalink / raw)
  To: acme, jolsa
  Cc: mpe, linux-perf-users, linuxppc-dev, maddy, rnsastry, kjain,
	disgoel, irogers

The session topology test fails in powerpc pSeries platform.
Test logs:
<<>>
Session topology : FAILED!
<<>>

This testcases tests cpu topology by checking the core_id and
socket_id stored in perf_env from perf session. The data from
perf session is compared with the cpu topology information
from "/sys/devices/system/cpu/cpuX/topology" like core_id,
physical_package_id. In case of virtual environment, detail
like physical_package_id is restricted to be exposed. Hence
physical_package_id is set to -1. The testcase fails on such
platforms since socket_id can't be fetched from topology info.

Skip the testcase in powerpc if physical_package_id returns -1

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
Changelog:
v1 -> v2:
 Addressed review comments from Arnaldo and Michael Ellerman.
 skip the test in powerpc when physical_package_id is set to
 -1.
 Dropped patch 1 from V1 since current change doesn't use info
 from /proc/cpuinfo and rather uses physical_package_id value.

 tools/perf/tests/topology.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
index ee1e3dcbc0bd..d23a9e322ff5 100644
--- a/tools/perf/tests/topology.c
+++ b/tools/perf/tests/topology.c
@@ -109,6 +109,17 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
 			&& strncmp(session->header.env.arch, "aarch64", 7))
 		return TEST_SKIP;
 
+	/*
+	 * In powerpc pSeries platform, not all the topology information
+	 * are exposed via sysfs. Due to restriction, detail like
+	 * physical_package_id will be set to -1. Hence skip this
+	 * test if physical_package_id returns -1 for cpu from perf_cpu_map.
+	 */
+	if (strncmp(session->header.env.arch, "powerpc", 7)) {
+		if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1)
+			return TEST_SKIP;
+	}
+
 	TEST_ASSERT_VAL("Session header CPU map not set", session->header.env.cpu);
 
 	for (i = 0; i < session->header.env.nr_cpus_avail; i++) {
-- 
2.31.1


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

* Re: [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment
  2022-05-11 11:49 [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment Athira Rajeev
@ 2022-05-12 11:15 ` kajoljain
       [not found] ` <151b1538daf92259702242dbf734230aea3199fe.camel@linux.vnet.ibm.com>
  1 sibling, 0 replies; 5+ messages in thread
From: kajoljain @ 2022-05-12 11:15 UTC (permalink / raw)
  To: Athira Rajeev, acme, jolsa
  Cc: mpe, linux-perf-users, linuxppc-dev, maddy, rnsastry, disgoel,
	irogers



On 5/11/22 17:19, Athira Rajeev wrote:
> The session topology test fails in powerpc pSeries platform.
> Test logs:
> <<>>
> Session topology : FAILED!
> <<>>
> 
> This testcases tests cpu topology by checking the core_id and
> socket_id stored in perf_env from perf session. The data from
> perf session is compared with the cpu topology information
> from "/sys/devices/system/cpu/cpuX/topology" like core_id,
> physical_package_id. In case of virtual environment, detail
> like physical_package_id is restricted to be exposed. Hence
> physical_package_id is set to -1. The testcase fails on such
> platforms since socket_id can't be fetched from topology info.
> 
> Skip the testcase in powerpc if physical_package_id returns -1
> 

Patch looks fine to me.

Reviewed-by: Kajol Jain<kjain@linux.ibm.com>

Thanks,
Kajol Jain

> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
> Changelog:
> v1 -> v2:
>  Addressed review comments from Arnaldo and Michael Ellerman.
>  skip the test in powerpc when physical_package_id is set to
>  -1.
>  Dropped patch 1 from V1 since current change doesn't use info
>  from /proc/cpuinfo and rather uses physical_package_id value.
> 
>  tools/perf/tests/topology.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
> index ee1e3dcbc0bd..d23a9e322ff5 100644
> --- a/tools/perf/tests/topology.c
> +++ b/tools/perf/tests/topology.c
> @@ -109,6 +109,17 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
>  			&& strncmp(session->header.env.arch, "aarch64", 7))
>  		return TEST_SKIP;
>  
> +	/*
> +	 * In powerpc pSeries platform, not all the topology information
> +	 * are exposed via sysfs. Due to restriction, detail like
> +	 * physical_package_id will be set to -1. Hence skip this
> +	 * test if physical_package_id returns -1 for cpu from perf_cpu_map.
> +	 */
> +	if (strncmp(session->header.env.arch, "powerpc", 7)) {
> +		if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1)
> +			return TEST_SKIP;
> +	}
> +
>  	TEST_ASSERT_VAL("Session header CPU map not set", session->header.env.cpu);
>  
>  	for (i = 0; i < session->header.env.nr_cpus_avail; i++) {

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

* Re: [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment
       [not found] ` <151b1538daf92259702242dbf734230aea3199fe.camel@linux.vnet.ibm.com>
@ 2022-05-13 18:33   ` Ian Rogers
  2022-05-21  4:46     ` Athira Rajeev
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2022-05-13 18:33 UTC (permalink / raw)
  To: Disha Goel
  Cc: Athira Rajeev, acme, jolsa, mpe, linux-perf-users, linuxppc-dev,
	maddy, rnsastry, kjain

On Thu, May 12, 2022 at 11:18 PM Disha Goel <disgoel@linux.vnet.ibm.com> wrote:
>
>
>
> -----Original Message-----
> From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> To: acme@kernel.org, jolsa@kernel.org
> Cc: mpe@ellerman.id.au, linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, maddy@linux.vnet.ibm.com, rnsastry@linux.ibm.com, kjain@linux.ibm.com, disgoel@linux.vnet.ibm.com, irogers@google.com
> Subject: [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment
> Date: Wed, 11 May 2022 17:19:59 +0530
>
> The session topology test fails in powerpc pSeries platform.
>
> Test logs:
>
> <<>>
>
> Session topology : FAILED!
>
> <<>>
>
>
> This testcases tests cpu topology by checking the core_id and
>
> socket_id stored in perf_env from perf session. The data from
>
> perf session is compared with the cpu topology information
>
> from "/sys/devices/system/cpu/cpuX/topology" like core_id,
>
> physical_package_id. In case of virtual environment, detail
>
> like physical_package_id is restricted to be exposed. Hence
>
> physical_package_id is set to -1. The testcase fails on such
>
> platforms since socket_id can't be fetched from topology info.
>
>
> Skip the testcase in powerpc if physical_package_id returns -1
>
>
> Signed-off-by: Athira Rajeev <
>
> atrajeev@linux.vnet.ibm.com
>
> >
>
> ---
>
> Changelog:
>
> v1 -> v2:
>
>  Addressed review comments from Arnaldo and Michael Ellerman.
>
>  skip the test in powerpc when physical_package_id is set to
>
>  -1.
>
>  Dropped patch 1 from V1 since current change doesn't use info
>
>  from /proc/cpuinfo and rather uses physical_package_id value.
>
>
>  tools/perf/tests/topology.c | 11 +++++++++++
>
>  1 file changed, 11 insertions(+)
>
>
> Tested the patch on powerpc and powernv, session topology test works fine with the patch.
>
> Tested-by: Disha Goel <disgoel@linux.vnet.ibm.com>


Acked-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
>
> index ee1e3dcbc0bd..d23a9e322ff5 100644
>
> --- a/tools/perf/tests/topology.c
>
> +++ b/tools/perf/tests/topology.c
>
> @@ -109,6 +109,17 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
>
>   && strncmp(session->header.env.arch, "aarch64", 7))
>
>   return TEST_SKIP;
>
>
> + /*
>
> + * In powerpc pSeries platform, not all the topology information
>
> + * are exposed via sysfs. Due to restriction, detail like
>
> + * physical_package_id will be set to -1. Hence skip this
>
> + * test if physical_package_id returns -1 for cpu from perf_cpu_map.
>
> + */
>
> + if (strncmp(session->header.env.arch, "powerpc", 7)) {
>
> + if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1)
>
> + return TEST_SKIP;
>
> + }
>
> +
>
>   TEST_ASSERT_VAL("Session header CPU map not set", session->header.env.cpu);
>
>
>   for (i = 0; i < session->header.env.nr_cpus_avail; i++) {

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

* Re: [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment
  2022-05-13 18:33   ` Ian Rogers
@ 2022-05-21  4:46     ` Athira Rajeev
  2022-05-21 17:52       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Athira Rajeev @ 2022-05-21  4:46 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Disha Goel, Arnaldo Carvalho de Melo, Jiri Olsa, Michael Ellerman,
	linux-perf-users, linuxppc-dev, maddy, Nageswara Sastry, kjain



> On 14-May-2022, at 12:03 AM, Ian Rogers <irogers@google.com> wrote:
> 
> On Thu, May 12, 2022 at 11:18 PM Disha Goel <disgoel@linux.vnet.ibm.com> wrote:
>> 
>> 
>> 
>> -----Original Message-----
>> From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
>> To: acme@kernel.org, jolsa@kernel.org
>> Cc: mpe@ellerman.id.au, linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, maddy@linux.vnet.ibm.com, rnsastry@linux.ibm.com, kjain@linux.ibm.com, disgoel@linux.vnet.ibm.com, irogers@google.com
>> Subject: [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment
>> Date: Wed, 11 May 2022 17:19:59 +0530
>> 
>> The session topology test fails in powerpc pSeries platform.
>> 
>> Test logs:
>> 
>> <<>>
>> 
>> Session topology : FAILED!
>> 
>> <<>>
>> 
>> 
>> This testcases tests cpu topology by checking the core_id and
>> 
>> socket_id stored in perf_env from perf session. The data from
>> 
>> perf session is compared with the cpu topology information
>> 
>> from "/sys/devices/system/cpu/cpuX/topology" like core_id,
>> 
>> physical_package_id. In case of virtual environment, detail
>> 
>> like physical_package_id is restricted to be exposed. Hence
>> 
>> physical_package_id is set to -1. The testcase fails on such
>> 
>> platforms since socket_id can't be fetched from topology info.
>> 
>> 
>> Skip the testcase in powerpc if physical_package_id returns -1
>> 
>> 
>> Signed-off-by: Athira Rajeev <
>> 
>> atrajeev@linux.vnet.ibm.com
>> 
>>> 
>> 
>> ---
>> 
>> Changelog:
>> 
>> v1 -> v2:
>> 
>> Addressed review comments from Arnaldo and Michael Ellerman.
>> 
>> skip the test in powerpc when physical_package_id is set to
>> 
>> -1.
>> 
>> Dropped patch 1 from V1 since current change doesn't use info
>> 
>> from /proc/cpuinfo and rather uses physical_package_id value.
>> 
>> 
>> tools/perf/tests/topology.c | 11 +++++++++++
>> 
>> 1 file changed, 11 insertions(+)
>> 
>> 
>> Tested the patch on powerpc and powernv, session topology test works fine with the patch.
>> 
>> Tested-by: Disha Goel <disgoel@linux.vnet.ibm.com>
> 
> 
> Acked-by: Ian Rogers <irogers@google.com>
> 
> Thanks,
> Ian

Hi,

Thanks all for the review.

Athira
> 
>> diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
>> 
>> index ee1e3dcbc0bd..d23a9e322ff5 100644
>> 
>> --- a/tools/perf/tests/topology.c
>> 
>> +++ b/tools/perf/tests/topology.c
>> 
>> @@ -109,6 +109,17 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)
>> 
>>  && strncmp(session->header.env.arch, "aarch64", 7))
>> 
>>  return TEST_SKIP;
>> 
>> 
>> + /*
>> 
>> + * In powerpc pSeries platform, not all the topology information
>> 
>> + * are exposed via sysfs. Due to restriction, detail like
>> 
>> + * physical_package_id will be set to -1. Hence skip this
>> 
>> + * test if physical_package_id returns -1 for cpu from perf_cpu_map.
>> 
>> + */
>> 
>> + if (strncmp(session->header.env.arch, "powerpc", 7)) {
>> 
>> + if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1)
>> 
>> + return TEST_SKIP;
>> 
>> + }
>> 
>> +
>> 
>>  TEST_ASSERT_VAL("Session header CPU map not set", session->header.env.cpu);
>> 
>> 
>>  for (i = 0; i < session->header.env.nr_cpus_avail; i++) {


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

* Re: [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment
  2022-05-21  4:46     ` Athira Rajeev
@ 2022-05-21 17:52       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-05-21 17:52 UTC (permalink / raw)
  To: Athira Rajeev
  Cc: Ian Rogers, Disha Goel, Jiri Olsa, Michael Ellerman,
	linux-perf-users, linuxppc-dev, maddy, Nageswara Sastry, kjain

Em Sat, May 21, 2022 at 10:16:59AM +0530, Athira Rajeev escreveu:
> > On 14-May-2022, at 12:03 AM, Ian Rogers <irogers@google.com> wrote:
> > On Thu, May 12, 2022 at 11:18 PM Disha Goel <disgoel@linux.vnet.ibm.com> wrote:
> >> Tested the patch on powerpc and powernv, session topology test works fine with the patch.
> >> Tested-by: Disha Goel <disgoel@linux.vnet.ibm.com>

> > Acked-by: Ian Rogers <irogers@google.com>
 
> Thanks all for the review.

Thanks, applied.

- Arnaldo


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

end of thread, other threads:[~2022-05-21 17:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-11 11:49 [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment Athira Rajeev
2022-05-12 11:15 ` kajoljain
     [not found] ` <151b1538daf92259702242dbf734230aea3199fe.camel@linux.vnet.ibm.com>
2022-05-13 18:33   ` Ian Rogers
2022-05-21  4:46     ` Athira Rajeev
2022-05-21 17:52       ` Arnaldo Carvalho de Melo

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).