<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/tools/perf/tests/expr.c, branch v6.18.21</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>perf test expr: Fix system_tsc_freq for only x86</title>
<updated>2024-12-11T17:19:44+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-12-05T02:23:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=a93a620c38f3763ec74cb0def9625756966f12d9'/>
<id>a93a620c38f3763ec74cb0def9625756966f12d9</id>
<content type='text'>
The refactoring of tool PMU events to have a PMU then adding the expr
literals to the tool PMU made it so that the literal system_tsc_freq
was only supported on x86. Update the test expectations to match -
namely the parsing is x86 specific and only yields a non-zero value on
Intel.

Fixes: 609aa2667f67 ("perf tool_pmu: Switch to standard pmu functions and json descriptions")
Reported-by: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Closes: https://lore.kernel.org/linux-perf-users/20241022140156.98854-1-atrajeev@linux.vnet.ibm.com/
Co-developed-by: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Tested-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: James Clark &lt;james.clark@linaro.org&gt;
Cc: akanksha@linux.ibm.com
Cc: hbathini@linux.ibm.com
Cc: kjain@linux.ibm.com
Cc: maddy@linux.ibm.com
Cc: disgoel@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20241205022305.158202-1-irogers@google.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The refactoring of tool PMU events to have a PMU then adding the expr
literals to the tool PMU made it so that the literal system_tsc_freq
was only supported on x86. Update the test expectations to match -
namely the parsing is x86 specific and only yields a non-zero value on
Intel.

Fixes: 609aa2667f67 ("perf tool_pmu: Switch to standard pmu functions and json descriptions")
Reported-by: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Closes: https://lore.kernel.org/linux-perf-users/20241022140156.98854-1-atrajeev@linux.vnet.ibm.com/
Co-developed-by: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Tested-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: James Clark &lt;james.clark@linaro.org&gt;
Cc: akanksha@linux.ibm.com
Cc: hbathini@linux.ibm.com
Cc: kjain@linux.ibm.com
Cc: maddy@linux.ibm.com
Cc: disgoel@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20241205022305.158202-1-irogers@google.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf header: Pass a perf_cpu rather than a PMU to get_cpuid_str</title>
<updated>2024-11-16T19:40:30+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-11-07T16:20:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=494c403ff159fdfdb41c364acbe79f2f53ad585d'/>
<id>494c403ff159fdfdb41c364acbe79f2f53ad585d</id>
<content type='text'>
On ARM the cpuid is dependent on the core type of the CPU in
question. The PMU was passed for the sake of the CPU map but this
means in places a temporary PMU is created just to pass a CPU
value. Just pass the CPU and fix up the callers.

As there are no longer PMU users in header.h, shuffle forward
declarations earlier to work around build failures.

Reviewed-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Albert Ou &lt;aou@eecs.berkeley.edu&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Alexandre Ghiti &lt;alexghiti@rivosinc.com&gt;
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: Ben Zong-You Xie &lt;ben717@andestech.com&gt;
Cc: Benjamin Gray &lt;bgray@linux.ibm.com&gt;
Cc: Bibo Mao &lt;maobibo@loongson.cn&gt;
Cc: Clément Le Goffic &lt;clement.legoffic@foss.st.com&gt;
Cc: Dima Kogan &lt;dima@secretsauce.net&gt;
Cc: Dr. David Alan Gilbert &lt;linux@treblig.org&gt;
Cc: Huacai Chen &lt;chenhuacai@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Leo Yan &lt;leo.yan@linux.dev&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Palmer Dabbelt &lt;palmer@dabbelt.com&gt;
Cc: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Sandipan Das &lt;sandipan.das@amd.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yicong Yang &lt;yangyicong@hisilicon.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-riscv@lists.infradead.org
Link: https://lore.kernel.org/r/20241107162035.52206-7-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On ARM the cpuid is dependent on the core type of the CPU in
question. The PMU was passed for the sake of the CPU map but this
means in places a temporary PMU is created just to pass a CPU
value. Just pass the CPU and fix up the callers.

As there are no longer PMU users in header.h, shuffle forward
declarations earlier to work around build failures.

Reviewed-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Albert Ou &lt;aou@eecs.berkeley.edu&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Alexandre Ghiti &lt;alexghiti@rivosinc.com&gt;
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: Ben Zong-You Xie &lt;ben717@andestech.com&gt;
Cc: Benjamin Gray &lt;bgray@linux.ibm.com&gt;
Cc: Bibo Mao &lt;maobibo@loongson.cn&gt;
Cc: Clément Le Goffic &lt;clement.legoffic@foss.st.com&gt;
Cc: Dima Kogan &lt;dima@secretsauce.net&gt;
Cc: Dr. David Alan Gilbert &lt;linux@treblig.org&gt;
Cc: Huacai Chen &lt;chenhuacai@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Leo Yan &lt;leo.yan@linux.dev&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Palmer Dabbelt &lt;palmer@dabbelt.com&gt;
Cc: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Sandipan Das &lt;sandipan.das@amd.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yicong Yang &lt;yangyicong@hisilicon.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-riscv@lists.infradead.org
Link: https://lore.kernel.org/r/20241107162035.52206-7-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf header: Avoid transitive PMU includes</title>
<updated>2024-11-16T19:39:59+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-11-07T16:20:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=7463ee17a74090081f0f013fa514904a01fcc954'/>
<id>7463ee17a74090081f0f013fa514904a01fcc954</id>
<content type='text'>
Currently satisfied via header.h. Note, pmu.h includes parse-events.h.

Reviewed-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Albert Ou &lt;aou@eecs.berkeley.edu&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Alexandre Ghiti &lt;alexghiti@rivosinc.com&gt;
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: Ben Zong-You Xie &lt;ben717@andestech.com&gt;
Cc: Benjamin Gray &lt;bgray@linux.ibm.com&gt;
Cc: Bibo Mao &lt;maobibo@loongson.cn&gt;
Cc: Clément Le Goffic &lt;clement.legoffic@foss.st.com&gt;
Cc: Dima Kogan &lt;dima@secretsauce.net&gt;
Cc: Dr. David Alan Gilbert &lt;linux@treblig.org&gt;
Cc: Huacai Chen &lt;chenhuacai@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Leo Yan &lt;leo.yan@linux.dev&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Palmer Dabbelt &lt;palmer@dabbelt.com&gt;
Cc: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Sandipan Das &lt;sandipan.das@amd.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yicong Yang &lt;yangyicong@hisilicon.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-riscv@lists.infradead.org
Link: https://lore.kernel.org/r/20241107162035.52206-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently satisfied via header.h. Note, pmu.h includes parse-events.h.

Reviewed-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Albert Ou &lt;aou@eecs.berkeley.edu&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Alexandre Ghiti &lt;alexghiti@rivosinc.com&gt;
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: Ben Zong-You Xie &lt;ben717@andestech.com&gt;
Cc: Benjamin Gray &lt;bgray@linux.ibm.com&gt;
Cc: Bibo Mao &lt;maobibo@loongson.cn&gt;
Cc: Clément Le Goffic &lt;clement.legoffic@foss.st.com&gt;
Cc: Dima Kogan &lt;dima@secretsauce.net&gt;
Cc: Dr. David Alan Gilbert &lt;linux@treblig.org&gt;
Cc: Huacai Chen &lt;chenhuacai@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Leo Yan &lt;leo.yan@linux.dev&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Palmer Dabbelt &lt;palmer@dabbelt.com&gt;
Cc: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Sandipan Das &lt;sandipan.das@amd.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yicong Yang &lt;yangyicong@hisilicon.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-riscv@lists.infradead.org
Link: https://lore.kernel.org/r/20241107162035.52206-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf pmu: Move pmu__find_core_pmu() to pmus.c</title>
<updated>2023-09-15T23:46:40+00:00</updated>
<author>
<name>James Clark</name>
<email>james.clark@arm.com</email>
</author>
<published>2023-09-13T15:33:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=3d0f5f456a5786573ba6a3358178c8db580e4b85'/>
<id>3d0f5f456a5786573ba6a3358178c8db580e4b85</id>
<content type='text'>
pmu__find_core_pmu() more logically belongs in pmus.c because it
iterates over all PMUs, so move it to pmus.c

At the same time rename it to perf_pmus__find_core_pmu() to match the
naming convention in this file.

list_prepare_entry() can't be used in perf_pmus__scan_core() anymore now
that it's called from the same compilation unit. This is with -O2
(specifically -O1 -ftree-vrp -finline-functions
-finline-small-functions) which allow the bounds of the array
access to be determined at compile time. list_prepare_entry() subtracts
the offset of the 'list' member in struct perf_pmu from &amp;core_pmus,
which isn't a struct perf_pmu. The compiler sees that pmu results in
&amp;core_pmus - 8 and refuses to compile. At runtime this works because
list_for_each_entry_continue() always adds the offset back again before
dereferencing -&gt;next, but it's technically undefined behavior. With
-fsanitize=undefined an additional warning is generated.

Using list_first_entry_or_null() to get the first entry here avoids
doing &amp;core_pmus - 8 but has the same result and fixes both the compile
warning and the undefined behavior warning. There are other uses of
list_prepare_entry() in pmus.c, but the compiler doesn't seem to be
able to see that they can also be called with &amp;core_pmus, so I won't
change any at this time.

Signed-off-by: James Clark &lt;james.clark@arm.com&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Reviewed-by: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Leo Yan &lt;leo.yan@linaro.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Haixin Yu &lt;yuhaixin.yhx@linux.alibaba.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230913153355.138331-2-james.clark@arm.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
pmu__find_core_pmu() more logically belongs in pmus.c because it
iterates over all PMUs, so move it to pmus.c

At the same time rename it to perf_pmus__find_core_pmu() to match the
naming convention in this file.

list_prepare_entry() can't be used in perf_pmus__scan_core() anymore now
that it's called from the same compilation unit. This is with -O2
(specifically -O1 -ftree-vrp -finline-functions
-finline-small-functions) which allow the bounds of the array
access to be determined at compile time. list_prepare_entry() subtracts
the offset of the 'list' member in struct perf_pmu from &amp;core_pmus,
which isn't a struct perf_pmu. The compiler sees that pmu results in
&amp;core_pmus - 8 and refuses to compile. At runtime this works because
list_for_each_entry_continue() always adds the offset back again before
dereferencing -&gt;next, but it's technically undefined behavior. With
-fsanitize=undefined an additional warning is generated.

Using list_first_entry_or_null() to get the first entry here avoids
doing &amp;core_pmus - 8 but has the same result and fixes both the compile
warning and the undefined behavior warning. There are other uses of
list_prepare_entry() in pmus.c, but the compiler doesn't seem to be
able to see that they can also be called with &amp;core_pmus, so I won't
change any at this time.

Signed-off-by: James Clark &lt;james.clark@arm.com&gt;
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Reviewed-by: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Leo Yan &lt;leo.yan@linaro.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Haixin Yu &lt;yuhaixin.yhx@linux.alibaba.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230913153355.138331-2-james.clark@arm.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf test: Add a test for strcmp_cpuid_str() expression</title>
<updated>2023-09-12T20:32:00+00:00</updated>
<author>
<name>James Clark</name>
<email>james.clark@arm.com</email>
</author>
<published>2023-09-04T09:50:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=a1ebf7718ee31501d2d2ee3af1716e0084c81926'/>
<id>a1ebf7718ee31501d2d2ee3af1716e0084c81926</id>
<content type='text'>
Test that the new expression builtin returns a match when the current
escaped CPU ID is given, and that it doesn't match when "0x0" is given.

The CPU ID in test__expr() has to be changed to perf_pmu__getcpuid()
which returns the CPU ID string, rather than the raw CPU ID that
get_cpuid() returns because that can't be used with strcmp_cpuid_str().
It doesn't affect the is_intel test because both versions contain
"Intel".

Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: James Clark &lt;james.clark@arm.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Haixin Yu &lt;yuhaixin.yhx@linux.alibaba.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Leo Yan &lt;leo.yan@linaro.org&gt;
Cc: Liam Howlett &lt;liam.howlett@oracle.com&gt;
Cc: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yang Jihong &lt;yangjihong1@huawei.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230904095104.1162928-5-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Test that the new expression builtin returns a match when the current
escaped CPU ID is given, and that it doesn't match when "0x0" is given.

The CPU ID in test__expr() has to be changed to perf_pmu__getcpuid()
which returns the CPU ID string, rather than the raw CPU ID that
get_cpuid() returns because that can't be used with strcmp_cpuid_str().
It doesn't affect the is_intel test because both versions contain
"Intel".

Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: James Clark &lt;james.clark@arm.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Haixin Yu &lt;yuhaixin.yhx@linux.alibaba.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Leo Yan &lt;leo.yan@linaro.org&gt;
Cc: Liam Howlett &lt;liam.howlett@oracle.com&gt;
Cc: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yang Jihong &lt;yangjihong1@huawei.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230904095104.1162928-5-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf test: Check result of has_event(cycles) test</title>
<updated>2023-09-12T20:32:00+00:00</updated>
<author>
<name>James Clark</name>
<email>james.clark@arm.com</email>
</author>
<published>2023-09-04T09:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=d19a353cdd0d3021e31e00df17811ab68472ad77'/>
<id>d19a353cdd0d3021e31e00df17811ab68472ad77</id>
<content type='text'>
Currently the function always returns 0, so even when the has_event()
test fails, the test still passes. Fix it by returning ret instead.

Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: James Clark &lt;james.clark@arm.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Haixin Yu &lt;yuhaixin.yhx@linux.alibaba.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Leo Yan &lt;leo.yan@linaro.org&gt;
Cc: Liam Howlett &lt;liam.howlett@oracle.com&gt;
Cc: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yang Jihong &lt;yangjihong1@huawei.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230904095104.1162928-2-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently the function always returns 0, so even when the has_event()
test fails, the test still passes. Fix it by returning ret instead.

Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: James Clark &lt;james.clark@arm.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Haixin Yu &lt;yuhaixin.yhx@linux.alibaba.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Leo Yan &lt;leo.yan@linaro.org&gt;
Cc: Liam Howlett &lt;liam.howlett@oracle.com&gt;
Cc: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Yang Jihong &lt;yangjihong1@huawei.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230904095104.1162928-2-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf metric: Add #num_cpus_online literal</title>
<updated>2023-08-31T02:03:03+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2023-08-30T07:30:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=f0005f1732245533f0bfa5bad4803c30a0e9f4e0'/>
<id>f0005f1732245533f0bfa5bad4803c30a0e9f4e0</id>
<content type='text'>
Returns the number of CPUs online, unlike #num_cpus that returns the
number present.

Add a test of the property.

This will be used in future Intel metrics.

Reviewed-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: James Clark &lt;james.clark@arm.com&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Perry Taylor &lt;perry.taylor@intel.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lore.kernel.org/lkml/20230830073026.1829912-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Returns the number of CPUs online, unlike #num_cpus that returns the
number present.

Add a test of the property.

This will be used in future Intel metrics.

Reviewed-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: James Clark &lt;james.clark@arm.com&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Perry Taylor &lt;perry.taylor@intel.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lore.kernel.org/lkml/20230830073026.1829912-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf expr: Add has_event function</title>
<updated>2023-06-30T05:13:15+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2023-06-23T15:10:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=4a4a9bf9075fbc753ab20f05347fd1482d4801e4'/>
<id>4a4a9bf9075fbc753ab20f05347fd1482d4801e4</id>
<content type='text'>
Some events are dependent on firmware/kernel enablement. Allow such
events to be detected when the metric is parsed so that the metric's
event parsing doesn't fail.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Sohom Datta &lt;sohomdatta1@gmail.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Caleb Biggers &lt;caleb.biggers@intel.com&gt;
Cc: Edward Baker &lt;edward.baker@intel.com&gt;
Cc: Perry Taylor &lt;perry.taylor@intel.com&gt;
Cc: Samantha Alt &lt;samantha.alt@intel.com&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Zhengjun Xing &lt;zhengjun.xing@linux.intel.com&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Link: https://lore.kernel.org/r/20230623151016.4193660-2-irogers@google.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some events are dependent on firmware/kernel enablement. Allow such
events to be detected when the metric is parsed so that the metric's
event parsing doesn't fail.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Sohom Datta &lt;sohomdatta1@gmail.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Caleb Biggers &lt;caleb.biggers@intel.com&gt;
Cc: Edward Baker &lt;edward.baker@intel.com&gt;
Cc: Perry Taylor &lt;perry.taylor@intel.com&gt;
Cc: Samantha Alt &lt;samantha.alt@intel.com&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Zhengjun Xing &lt;zhengjun.xing@linux.intel.com&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Link: https://lore.kernel.org/r/20230623151016.4193660-2-irogers@google.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf expr: Make the evaluation of &amp; and | logical and lazy</title>
<updated>2023-06-05T18:56:14+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2023-05-19T06:37:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=6f765bbbfb3c8c5993796402a3cba311e9506eed'/>
<id>6f765bbbfb3c8c5993796402a3cba311e9506eed</id>
<content type='text'>
Currently the &amp; and | operators are only used in metric thresholds like
(from the tma_retiring metric):

tma_retiring &gt; 0.7 | tma_heavy_operations &gt; 0.1

Thresholds are always computed when present, but a lack of events may
mean the threshold can't be computed. This happens with the option
--metric-no-threshold for say the metric tma_retiring on Tigerlake model
CPUs.

To fully compute the threshold tma_heavy_operations is needed and it
needs the extra events of IDQ.MS_UOPS, UOPS_DECODED.DEC0,
cpu/UOPS_DECODED.DEC0,cmask=1/ and IDQ.MITE_UOPS. So
--metric-no-threshold is a useful option to reduce the number of events
needed and potentially multiplexing of events.

Rather than just fail threshold computations like this, we may know a
result from just the left or right-hand side. So, for tma_retiring if
its value is "&gt; 0.7" we know it is over the threshold. This allows the
metric to have the threshold coloring, when possible, without all the
counters being programmed.

Reviewed-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Acked-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Ahmad Yasin &lt;ahmad.yasin@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Cc: Caleb Biggers &lt;caleb.biggers@intel.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Edward Baker &lt;edward.baker@intel.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: James Clark &lt;james.clark@arm.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Perry Taylor &lt;perry.taylor@intel.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Samantha Alt &lt;samantha.alt@intel.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Link: https://lore.kernel.org/r/20230519063719.1029596-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently the &amp; and | operators are only used in metric thresholds like
(from the tma_retiring metric):

tma_retiring &gt; 0.7 | tma_heavy_operations &gt; 0.1

Thresholds are always computed when present, but a lack of events may
mean the threshold can't be computed. This happens with the option
--metric-no-threshold for say the metric tma_retiring on Tigerlake model
CPUs.

To fully compute the threshold tma_heavy_operations is needed and it
needs the extra events of IDQ.MS_UOPS, UOPS_DECODED.DEC0,
cpu/UOPS_DECODED.DEC0,cmask=1/ and IDQ.MITE_UOPS. So
--metric-no-threshold is a useful option to reduce the number of events
needed and potentially multiplexing of events.

Rather than just fail threshold computations like this, we may know a
result from just the left or right-hand side. So, for tma_retiring if
its value is "&gt; 0.7" we know it is over the threshold. This allows the
metric to have the threshold coloring, when possible, without all the
counters being programmed.

Reviewed-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Acked-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Ahmad Yasin &lt;ahmad.yasin@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Cc: Caleb Biggers &lt;caleb.biggers@intel.com&gt;
Cc: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Cc: Edward Baker &lt;edward.baker@intel.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: James Clark &lt;james.clark@arm.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Perry Taylor &lt;perry.taylor@intel.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Samantha Alt &lt;samantha.alt@intel.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Link: https://lore.kernel.org/r/20230519063719.1029596-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>perf metric: Change divide by zero and !support events behavior</title>
<updated>2023-05-10T15:35:02+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2023-05-02T22:38:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=2a939c8695035b11e00239610d88551be34c7a61'/>
<id>2a939c8695035b11e00239610d88551be34c7a61</id>
<content type='text'>
Division by zero causes expression parsing to fail and no metric to be
generated. This can mean for short running benchmarks metrics are not
shown. Change the behavior to make the value nan, which gets shown like:

'''
$ perf stat -M TopdownL2 true

 Performance counter stats for 'true':

         1,031,492      INST_RETIRED.ANY                 #      nan %  tma_fetch_bandwidth
                                                  #      nan %  tma_heavy_operations
                                                  #      nan %  tma_light_operations
            29,304      CPU_CLK_UNHALTED.REF_XCLK        #      nan %  tma_fetch_latency
                                                  #      nan %  tma_branch_mispredicts
                                                  #      nan %  tma_machine_clears
                                                  #      nan %  tma_core_bound
                                                  #      nan %  tma_memory_bound
         2,658,319      IDQ_UOPS_NOT_DELIVERED.CORE
            11,167      EXE_ACTIVITY.BOUND_ON_STORES
           262,058      EXE_ACTIVITY.1_PORTS_UTIL
     &lt;not counted&gt;      BR_MISP_RETIRED.ALL_BRANCHES                                            (0.00%)
     &lt;not counted&gt;      INT_MISC.RECOVERY_CYCLES_ANY                                            (0.00%)
     &lt;not counted&gt;      CPU_CLK_UNHALTED.ONE_THREAD_ACTIVE                                        (0.00%)
     &lt;not counted&gt;      CPU_CLK_UNHALTED.THREAD                                                 (0.00%)
     &lt;not counted&gt;      UOPS_RETIRED.RETIRE_SLOTS                                               (0.00%)
     &lt;not counted&gt;      CYCLE_ACTIVITY.STALLS_MEM_ANY                                           (0.00%)
     &lt;not counted&gt;      UOPS_RETIRED.MACRO_FUSED                                                (0.00%)
     &lt;not counted&gt;      IDQ_UOPS_NOT_DELIVERED.CYCLES_0_UOPS_DELIV.CORE                                        (0.00%)
     &lt;not counted&gt;      EXE_ACTIVITY.2_PORTS_UTIL                                               (0.00%)
     &lt;not counted&gt;      CYCLE_ACTIVITY.STALLS_TOTAL                                             (0.00%)
     &lt;not counted&gt;      MACHINE_CLEARS.COUNT                                                    (0.00%)
     &lt;not counted&gt;      UOPS_ISSUED.ANY                                                         (0.00%)

       0.002864879 seconds time elapsed

       0.003012000 seconds user
       0.000000000 seconds sys
'''

When events aren't supported a count of 0 can be confusing and make
metrics look meaningful. Change these to be nan also which, with the
next change, gets shown like:

'''
$ perf stat true
 Performance counter stats for 'true':

              1.25 msec task-clock:u                     #    0.387 CPUs utilized
                 0      context-switches:u               #    0.000 /sec
                 0      cpu-migrations:u                 #    0.000 /sec
                46      page-faults:u                    #   36.702 K/sec
           255,942      cycles:u                         #    0.204 GHz                         (88.66%)
           123,046      instructions:u                   #    0.48  insn per cycle
            28,301      branches:u                       #   22.580 M/sec
             2,489      branch-misses:u                  #    8.79% of all branches
             4,719      CPU_CLK_UNHALTED.REF_XCLK:u      #    3.765 M/sec
                                                  #      nan %  tma_frontend_bound
                                                  #      nan %  tma_retiring
                                                  #      nan %  tma_backend_bound
                                                  #      nan %  tma_bad_speculation
           344,855      IDQ_UOPS_NOT_DELIVERED.CORE:u    #  275.147 M/sec
   &lt;not supported&gt;      INT_MISC.RECOVERY_CYCLES_ANY:u
     &lt;not counted&gt;      CPU_CLK_UNHALTED.ONE_THREAD_ACTIVE:u                                        (0.00%)
     &lt;not counted&gt;      CPU_CLK_UNHALTED.THREAD:u                                               (0.00%)
     &lt;not counted&gt;      UOPS_RETIRED.RETIRE_SLOTS:u                                             (0.00%)
     &lt;not counted&gt;      UOPS_ISSUED.ANY:u                                                       (0.00%)

       0.003238142 seconds time elapsed

       0.000000000 seconds user
       0.003434000 seconds sys
'''

Ensure that nan metric values are quoted as nan isn't a valid number
in JSON.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Ahmad Yasin &lt;ahmad.yasin@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: Caleb Biggers &lt;caleb.biggers@intel.com&gt;
Cc: Edward Baker &lt;edward.baker@intel.com&gt;
Cc: Florian Fischer &lt;florian.fischer@muhq.space&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: James Clark &lt;james.clark@arm.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Kang Minchul &lt;tegongkang@gmail.com&gt;
Cc: Leo Yan &lt;leo.yan@linaro.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Perry Taylor &lt;perry.taylor@intel.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Rob Herring &lt;robh@kernel.org&gt;
Cc: Samantha Alt &lt;samantha.alt@intel.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Cc: Sumanth Korikkar &lt;sumanthk@linux.ibm.com&gt;
Cc: Suzuki Poulouse &lt;suzuki.poulose@arm.com&gt;
Cc: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Cc: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Cc: Xing Zhengjun &lt;zhengjun.xing@linux.intel.com&gt;
Cc: Yang Jihong &lt;yangjihong1@huawei.com&gt;
Link: https://lore.kernel.org/r/20230502223851.2234828-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Division by zero causes expression parsing to fail and no metric to be
generated. This can mean for short running benchmarks metrics are not
shown. Change the behavior to make the value nan, which gets shown like:

'''
$ perf stat -M TopdownL2 true

 Performance counter stats for 'true':

         1,031,492      INST_RETIRED.ANY                 #      nan %  tma_fetch_bandwidth
                                                  #      nan %  tma_heavy_operations
                                                  #      nan %  tma_light_operations
            29,304      CPU_CLK_UNHALTED.REF_XCLK        #      nan %  tma_fetch_latency
                                                  #      nan %  tma_branch_mispredicts
                                                  #      nan %  tma_machine_clears
                                                  #      nan %  tma_core_bound
                                                  #      nan %  tma_memory_bound
         2,658,319      IDQ_UOPS_NOT_DELIVERED.CORE
            11,167      EXE_ACTIVITY.BOUND_ON_STORES
           262,058      EXE_ACTIVITY.1_PORTS_UTIL
     &lt;not counted&gt;      BR_MISP_RETIRED.ALL_BRANCHES                                            (0.00%)
     &lt;not counted&gt;      INT_MISC.RECOVERY_CYCLES_ANY                                            (0.00%)
     &lt;not counted&gt;      CPU_CLK_UNHALTED.ONE_THREAD_ACTIVE                                        (0.00%)
     &lt;not counted&gt;      CPU_CLK_UNHALTED.THREAD                                                 (0.00%)
     &lt;not counted&gt;      UOPS_RETIRED.RETIRE_SLOTS                                               (0.00%)
     &lt;not counted&gt;      CYCLE_ACTIVITY.STALLS_MEM_ANY                                           (0.00%)
     &lt;not counted&gt;      UOPS_RETIRED.MACRO_FUSED                                                (0.00%)
     &lt;not counted&gt;      IDQ_UOPS_NOT_DELIVERED.CYCLES_0_UOPS_DELIV.CORE                                        (0.00%)
     &lt;not counted&gt;      EXE_ACTIVITY.2_PORTS_UTIL                                               (0.00%)
     &lt;not counted&gt;      CYCLE_ACTIVITY.STALLS_TOTAL                                             (0.00%)
     &lt;not counted&gt;      MACHINE_CLEARS.COUNT                                                    (0.00%)
     &lt;not counted&gt;      UOPS_ISSUED.ANY                                                         (0.00%)

       0.002864879 seconds time elapsed

       0.003012000 seconds user
       0.000000000 seconds sys
'''

When events aren't supported a count of 0 can be confusing and make
metrics look meaningful. Change these to be nan also which, with the
next change, gets shown like:

'''
$ perf stat true
 Performance counter stats for 'true':

              1.25 msec task-clock:u                     #    0.387 CPUs utilized
                 0      context-switches:u               #    0.000 /sec
                 0      cpu-migrations:u                 #    0.000 /sec
                46      page-faults:u                    #   36.702 K/sec
           255,942      cycles:u                         #    0.204 GHz                         (88.66%)
           123,046      instructions:u                   #    0.48  insn per cycle
            28,301      branches:u                       #   22.580 M/sec
             2,489      branch-misses:u                  #    8.79% of all branches
             4,719      CPU_CLK_UNHALTED.REF_XCLK:u      #    3.765 M/sec
                                                  #      nan %  tma_frontend_bound
                                                  #      nan %  tma_retiring
                                                  #      nan %  tma_backend_bound
                                                  #      nan %  tma_bad_speculation
           344,855      IDQ_UOPS_NOT_DELIVERED.CORE:u    #  275.147 M/sec
   &lt;not supported&gt;      INT_MISC.RECOVERY_CYCLES_ANY:u
     &lt;not counted&gt;      CPU_CLK_UNHALTED.ONE_THREAD_ACTIVE:u                                        (0.00%)
     &lt;not counted&gt;      CPU_CLK_UNHALTED.THREAD:u                                               (0.00%)
     &lt;not counted&gt;      UOPS_RETIRED.RETIRE_SLOTS:u                                             (0.00%)
     &lt;not counted&gt;      UOPS_ISSUED.ANY:u                                                       (0.00%)

       0.003238142 seconds time elapsed

       0.000000000 seconds user
       0.003434000 seconds sys
'''

Ensure that nan metric values are quoted as nan isn't a valid number
in JSON.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Ahmad Yasin &lt;ahmad.yasin@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: Caleb Biggers &lt;caleb.biggers@intel.com&gt;
Cc: Edward Baker &lt;edward.baker@intel.com&gt;
Cc: Florian Fischer &lt;florian.fischer@muhq.space&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: James Clark &lt;james.clark@arm.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Kang Minchul &lt;tegongkang@gmail.com&gt;
Cc: Leo Yan &lt;leo.yan@linaro.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Perry Taylor &lt;perry.taylor@intel.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Cc: Rob Herring &lt;robh@kernel.org&gt;
Cc: Samantha Alt &lt;samantha.alt@intel.com&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Cc: Sumanth Korikkar &lt;sumanthk@linux.ibm.com&gt;
Cc: Suzuki Poulouse &lt;suzuki.poulose@arm.com&gt;
Cc: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Cc: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Cc: Xing Zhengjun &lt;zhengjun.xing@linux.intel.com&gt;
Cc: Yang Jihong &lt;yangjihong1@huawei.com&gt;
Link: https://lore.kernel.org/r/20230502223851.2234828-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
