From: Ian Rogers Date: Tue, 2 Dec 2025 17:49:57 +0000 (-0800) Subject: perf ilist: Be tolerant of reading a metric on the wrong CPU X-Git-Tag: v6.19-rc1~61^2~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b11c983f453689ac9d51d6528891ab4beb7393e;p=thirdparty%2Flinux.git perf ilist: Be tolerant of reading a metric on the wrong CPU This happens on hybrid machine metrics. Be tolerant and don't cause the ilist application to crash with an exception. Signed-off-by: Ian Rogers Tested-by: Thomas Falcon Signed-off-by: Namhyung Kim --- diff --git a/tools/perf/python/ilist.py b/tools/perf/python/ilist.py index eb687ce9d5a6a..0d757ddb47959 100755 --- a/tools/perf/python/ilist.py +++ b/tools/perf/python/ilist.py @@ -77,8 +77,12 @@ class Metric(TreeValue): return perf.parse_metrics(self.metric_name, self.metric_pmu) def value(self, evlist: perf.evlist, evsel: perf.evsel, cpu: int, thread: int) -> float: - val = evlist.compute_metric(self.metric_name, cpu, thread) - return 0 if math.isnan(val) else val + try: + val = evlist.compute_metric(self.metric_name, cpu, thread) + return 0 if math.isnan(val) else val + except: + # Be tolerant of failures to compute metrics on particular CPUs/threads. + return 0 @dataclass