<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div><br></div><div><br></div><div>-----Original Message-----</div><div><b>From</b>: Athira Rajeev <<a href="mailto:Athira%20Rajeev%20%3catrajeev@linux.vnet.ibm.com%3e">atrajeev@linux.vnet.ibm.com</a>></div><div><b>To</b>: <a href="mailto:acme@kernel.org">acme@kernel.org</a>, <a href="mailto:jolsa@kernel.org">jolsa@kernel.org</a></div><div><b>Cc</b>: <a href="mailto:mpe@ellerman.id.au">mpe@ellerman.id.au</a>, <a href="mailto:linux-perf-users@vger.kernel.org">linux-perf-users@vger.kernel.org</a>, <a href="mailto:linuxppc-dev@lists.ozlabs.org">linuxppc-dev@lists.ozlabs.org</a>, <a href="mailto:maddy@linux.vnet.ibm.com">maddy@linux.vnet.ibm.com</a>, <a href="mailto:rnsastry@linux.ibm.com">rnsastry@linux.ibm.com</a>, <a href="mailto:kjain@linux.ibm.com">kjain@linux.ibm.com</a>, <a href="mailto:disgoel@linux.vnet.ibm.com">disgoel@linux.vnet.ibm.com</a>, <a href="mailto:irogers@google.com">irogers@google.com</a></div><div><b>Subject</b>: [PATCH V2] tools/perf/tests: Fix session topology test to skip the test in guest environment</div><div><b>Date</b>: Wed, 11 May 2022 17:19:59 +0530</div><div><br></div><pre>The session topology test fails in powerpc pSeries platform.</pre><pre>Test logs:</pre><pre><<>></pre><pre>Session topology : FAILED!</pre><pre><<>></pre><pre><br></pre><pre>This testcases tests cpu topology by checking the core_id and</pre><pre>socket_id stored in perf_env from perf session. The data from</pre><pre>perf session is compared with the cpu topology information</pre><pre>from "/sys/devices/system/cpu/cpuX/topology" like core_id,</pre><pre>physical_package_id. In case of virtual environment, detail</pre><pre>like physical_package_id is restricted to be exposed. Hence</pre><pre>physical_package_id is set to -1. The testcase fails on such</pre><pre>platforms since socket_id can't be fetched from topology info.</pre><pre><br></pre><pre>Skip the testcase in powerpc if physical_package_id returns -1</pre><pre><br></pre><pre>Signed-off-by: Athira Rajeev <</pre><a href="mailto:atrajeev@linux.vnet.ibm.com"><pre>atrajeev@linux.vnet.ibm.com</pre></a><pre>></pre><pre>---</pre><pre>Changelog:</pre><pre>v1 -> v2:</pre><pre> Addressed review comments from Arnaldo and Michael Ellerman.</pre><pre> skip the test in powerpc when physical_package_id is set to</pre><pre> -1.</pre><pre> Dropped patch 1 from V1 since current change doesn't use info</pre><pre> from /proc/cpuinfo and rather uses physical_package_id value.</pre><pre><br></pre><pre> tools/perf/tests/topology.c | 11 +++++++++++</pre><pre> 1 file changed, 11 insertions(+)</pre><pre><br></pre><pre><pre style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Tested the patch on powerpc and powernv, session topology test works fine with the patch.</pre><pre style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Tested-by: Disha Goel <<a href="mailto:disgoel@linux.vnet.ibm.com"></a><a href="mailto:disgoel@linux.vnet.ibm.com">disgoel@linux.vnet.ibm.com</a>></pre><div><br></div></pre><pre>diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c</pre><pre>index ee1e3dcbc0bd..d23a9e322ff5 100644</pre><pre>--- a/tools/perf/tests/topology.c</pre><pre>+++ b/tools/perf/tests/topology.c</pre><pre>@@ -109,6 +109,17 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)</pre><pre>                  && strncmp(session->header.env.arch, "aarch64", 7))</pre><pre>                 return TEST_SKIP;</pre><pre><br></pre><pre>+      /*</pre><pre>+       * In powerpc pSeries platform, not all the topology information</pre><pre>+         * are exposed via sysfs. Due to restriction, detail like</pre><pre>+        * physical_package_id will be set to -1. Hence skip this</pre><pre>+        * test if physical_package_id returns -1 for cpu from perf_cpu_map.</pre><pre>+     */</pre><pre>+     if (strncmp(session->header.env.arch, "powerpc", 7)) {</pre><pre>+             if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1)</pre><pre>+                        return TEST_SKIP;</pre><pre>+       }</pre><pre>+</pre><pre>        TEST_ASSERT_VAL("Session header CPU map not set", session->header.env.cpu);</pre><pre><br></pre><pre>        for (i = 0; i < session->header.env.nr_cpus_avail; i++) {</pre></body></html>