<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/perf/tests/shell/stat.sh, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-03-04T12:19:23+00:00</updated>
<entry>
<title>perf test stat tests: Fix for virtualized machines</title>
<updated>2026-03-04T12:19:23+00:00</updated>
<author>
<name>Thomas Richter</name>
<email>tmricht@linux.ibm.com</email>
</author>
<published>2026-01-07T13:32:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0736c331d221edefd2d38c3cca34ed28f88703b6'/>
<id>urn:sha1:0736c331d221edefd2d38c3cca34ed28f88703b6</id>
<content type='text'>
[ Upstream commit e272628902c1c96731e2d9f62a7fc77767686eb0 ]

On s390 'perf test's 'perf stat tests', subtest test_hybrid fails for
z/VM systems.  The root cause is this statement:

  $(perf stat -a -- sleep 0.1 2&gt;&amp;1 |\
                  grep -E "/cpu-cycles/[uH]*|  cpu-cycles[:uH]* -c)

The 'perf stat' output on a s390 z/VM system is

  # perf stat -a -- sleep 0.1 2&gt;&amp;1
  Performance counter stats for 'system wide':

        56      context-switches  #     46.3 cs/sec  cs_per_second
  1,210.41 msec cpu-clock         #     11.9 CPUs  CPUs_utilized
        12      cpu-migrations    #      9.9 migrations/sec ...
        81      page-faults       #     66.9 faults/sec ...

        0.100891009 seconds time elapsed

The grep command does not match any single line and exits with error
code 1.

As the bash script is executed with 'set -e', it aborts with the first
error code being non-zero.

Fix this and use 'wc -l' to count matching lines instead of 'grep ... -c'.

Output before:

  # perf test 102
  102: perf stat tests                      : FAILED!
  #

Output after:

  # perf test 102
  102: perf stat tests                      : Ok
  #

Fixes: bb6e7cb11d97ce19 ("perf tools: Add fallback for exclude_guest")
Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Reviewed-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Cc: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Cc: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Cc: Jan Polensky &lt;japo@linux.ibm.com&gt;
Cc: linux-s390@vger.kernel.org
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Sumanth Korikkar &lt;sumanthk@linux.ibm.com&gt;
Cc: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf tests stat: Add test for error for an offline CPU</title>
<updated>2025-12-04T23:42:29+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2025-12-03T21:47:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5123509628e1ebe74bb5ec801de088f36df07d64'/>
<id>urn:sha1:5123509628e1ebe74bb5ec801de088f36df07d64</id>
<content type='text'>
Add a test that if an offline CPU is requested perf stat will fail.

  $ perf test -vv "perf stat tests"
  101: perf stat tests:
  --- start ---
  test child forked, pid 46965
  Basic stat command test
  Basic stat command test [Success]
  Null stat command test
  Null stat command test [Success]
  Offline CPU stat command test (cpu 8)
  Offline CPU stat command test [Success]
  stat record and report test
  stat record and report test [Success]
  stat record and script test
  stat record and script test [Success]
  stat repeat weak groups test
  stat repeat weak groups test [Success]
  Topdown event group test
  Topdown event group test [Success]
  Topdown weak groups test
  Topdown weak groups test [Skipped event parsing failed]
  cputype test
  cputype test [Success]
  hybrid test
  hybrid test [Success]
  ---- end(0) ----
  101: perf stat tests                                                 : Ok

Reported-by: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Closes: https://lore.kernel.org/linux-perf-users/94313b82-888b-4f42-9fb0-4585f9e90080@linux.ibm.com/
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf tests stat: Add "--null" coverage</title>
<updated>2025-12-04T08:36:14+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2025-12-03T21:47:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=279b5a85ebdd17b8e6713583d0ad6cf00f53eb10'/>
<id>urn:sha1:279b5a85ebdd17b8e6713583d0ad6cf00f53eb10</id>
<content type='text'>
Ensure "--null" does a minimal run.

Reported-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Closes: https://lore.kernel.org/linux-perf-users/aSwt7yzFjVJCEmVp@gmail.com/
Tested-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Tested-by: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf test stat: Update test expectations and events</title>
<updated>2025-11-12T00:48:35+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2025-11-11T21:22:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a48cd551d7436be3b1bd65c63a6d00163f7e7706'/>
<id>urn:sha1:a48cd551d7436be3b1bd65c63a6d00163f7e7706</id>
<content type='text'>
test_stat_record_report and test_stat_record_script used default
output which triggers a bug when sending metrics. As this isn't
relevant to the test switch to using named software events.

Update the match in test_hybrid as the cycles event is now cpu-cycles
to workaround potential ARM issues.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf test stat: Additional topdown grouping tests</title>
<updated>2025-03-12T02:05:04+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2025-03-07T02:39:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5b562763d78a99e26054268003e3d0952e3ea89f'/>
<id>urn:sha1:5b562763d78a99e26054268003e3d0952e3ea89f</id>
<content type='text'>
Add a loop and helper function to avoid repetition, the loop uses
arrays so switch the shell to bash. Add additional topdown group tests
where a topdown event needs to be moved beyond others and the slots
event isn't first in the target group. This replicates issues that
occur on hybrid systems where the other events are for the cpu_atom
PMU. Test with both PMU and software events. Place the slots event
later in the event list.

Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Link: https://lore.kernel.org/r/20250307023906.1135613-5-irogers@google.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf test stat: Avoid hybrid assumption when virtualized</title>
<updated>2025-01-14T17:57:19+00:00</updated>
<author>
<name>Ian Rogers</name>
<email>irogers@google.com</email>
</author>
<published>2024-12-12T17:33:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f9c506fb69bdcfb9d7138281378129ff037f2aa1'/>
<id>urn:sha1:f9c506fb69bdcfb9d7138281378129ff037f2aa1</id>
<content type='text'>
The cycles event will fallback to task-clock in the hybrid test when
running virtualized. Change the test to not fail for this.

Fixes: 65d11821910bd910 ("perf test: Add a test for default perf stat command")
Reviewed-by: James Clark &lt;james.clark@linaro.org&gt;
Signed-off-by: Ian Rogers &lt;irogers@google.com&gt;
Acked-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: Alexander Shishkin &lt;alexander.shishkin@linux.intel.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20241212173354.9860-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf tools: Add fallback for exclude_guest</title>
<updated>2024-10-22T16:51:22+00:00</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@kernel.org</email>
</author>
<published>2024-10-16T06:23:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bb6e7cb11d97ce1957894d30d13bfad3e8bfefe9'/>
<id>urn:sha1:bb6e7cb11d97ce1957894d30d13bfad3e8bfefe9</id>
<content type='text'>
Commit 7b100989b4f6bce70 ("perf evlist: Remove __evlist__add_default")
changed to parse "cycles:P" event instead of creating a new cycles
event for perf record.  But it also changed the way how modifiers are
handled so it doesn't set the exclude_guest bit by default.

It seems Apple M1 PMU requires exclude_guest set and returns EOPNOTSUPP
if not.  Let's add a fallback so that it can work with default events.

Also update perf stat hybrid tests to handle possible u or H modifiers.

Reviewed-by: Ian Rogers &lt;irogers@google.com&gt;
Reviewed-by: James Clark &lt;james.clark@linaro.org&gt;
Reviewed-by: Ravi Bangoria &lt;ravi.bangoria@amd.com&gt;
Acked-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Cc: James Clark &lt;james.clark@arm.com&gt;
Cc: Atish Patra &lt;atishp@atishpatra.org&gt;
Cc: Mingwei Zhang &lt;mizhang@google.com&gt;
Cc: Kajol Jain &lt;kjain@linux.ibm.com&gt;
Cc: Thomas Richter &lt;tmricht@linux.ibm.com&gt;
Cc: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Link: https://lore.kernel.org/r/20241016062359.264929-2-namhyung@kernel.org
Fixes: 7b100989b4f6bce70 ("perf evlist: Remove __evlist__add_default")
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf tests: Add more topdown events regroup tests</title>
<updated>2024-09-30T22:23:44+00:00</updated>
<author>
<name>Dapeng Mi</name>
<email>dapeng1.mi@linux.intel.com</email>
</author>
<published>2024-09-13T08:47:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=80f192724e314ba860206e51bc1e3bc1ac7f58dd'/>
<id>urn:sha1:80f192724e314ba860206e51bc1e3bc1ac7f58dd</id>
<content type='text'>
Add more test cases to cover all supported topdown events regroup cases.

Reviewed-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Dapeng Mi &lt;dapeng1.mi@linux.intel.com&gt;
Cc: Yongwei Ma &lt;yongwei.ma@intel.com&gt;
Link: https://lore.kernel.org/r/20240913084712.13861-7-dapeng1.mi@linux.intel.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf tests: Add topdown events counting and sampling tests</title>
<updated>2024-09-30T22:23:44+00:00</updated>
<author>
<name>Dapeng Mi</name>
<email>dapeng1.mi@linux.intel.com</email>
</author>
<published>2024-09-13T08:47:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0836aa60083a478cbc788f19fd2f389574a921bf'/>
<id>urn:sha1:0836aa60083a478cbc788f19fd2f389574a921bf</id>
<content type='text'>
Add counting and leader sampling tests to verify topdown events including
raw format can be reordered correctly.

Reviewed-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Dapeng Mi &lt;dapeng1.mi@linux.intel.com&gt;
Cc: Yongwei Ma &lt;yongwei.ma@intel.com&gt;
Link: https://lore.kernel.org/r/20240913084712.13861-6-dapeng1.mi@linux.intel.com
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf test: Add a test for default perf stat command</title>
<updated>2024-09-26T20:26:12+00:00</updated>
<author>
<name>James Clark</name>
<email>james.clark@linaro.org</email>
</author>
<published>2024-09-26T14:48:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=65d11821910bd910a2b4b5b005360d036c76ecef'/>
<id>urn:sha1:65d11821910bd910a2b4b5b005360d036c76ecef</id>
<content type='text'>
Test that one cycles event is opened for each core PMU when "perf stat"
is run without arguments.

The event line can either be output as "pmu/cycles/" or just "cycles" if
there is only one PMU. Include 2 spaces for padding in the one PMU case
to avoid matching when the word cycles is included in metric
descriptions.

Acked-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
Acked-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: James Clark &lt;james.clark@linaro.org&gt;
Cc: Yang Jihong &lt;yangjihong@bytedance.com&gt;
Cc: Dominique Martinet &lt;asmadeus@codewreck.org&gt;
Cc: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Cc: Howard Chu &lt;howardchu95@gmail.com&gt;
Cc: Ze Gao &lt;zegao2021@gmail.com&gt;
Cc: Yicong Yang &lt;yangyicong@hisilicon.com&gt;
Cc: Weilin Wang &lt;weilin.wang@intel.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Cc: Mike Leach &lt;mike.leach@linaro.org&gt;
Cc: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Cc: Yang Li &lt;yang.lee@linux.alibaba.com&gt;
Cc: Leo Yan &lt;leo.yan@linux.dev&gt;
Cc: ak@linux.intel.com
Cc: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: Yanteng Si &lt;siyanteng@loongson.cn&gt;
Cc: Sun Haiyong &lt;sunhaiyong@loongson.cn&gt;
Cc: John Garry &lt;john.g.garry@oracle.com&gt;
Link: https://lore.kernel.org/r/20240926144851.245903-8-james.clark@linaro.org
Signed-off-by: Namhyung Kim &lt;namhyung@kernel.org&gt;
</content>
</entry>
</feed>
