diff options
| author | Leo Yan <leo.yan@arm.com> | 2026-04-02 17:04:47 +0100 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2026-04-02 18:10:59 -0700 |
| commit | 3a61fd866ef9aaa1d3158b460f852b74a2df07f4 (patch) | |
| tree | 26fe7e2963dcefe9b46d76320c7fd30bce63dc8d /tools/perf/scripts/python | |
| parent | eb27e1c885ea75c1661188a548d100c8bce5970a (diff) | |
perf expr: Return -EINVAL for syntax error in expr__find_ids()
expr__find_ids() propagates the parser return value directly. For syntax
errors, the parser can return a positive value, but callers treat it as
success, e.g., for below case on Arm64 platform:
metric expr 100 * (STALL_SLOT_BACKEND / (CPU_CYCLES * #slots) - BR_MIS_PRED * 3 / CPU_CYCLES) for backend_bound
parsing metric: 100 * (STALL_SLOT_BACKEND / (CPU_CYCLES * #slots) - BR_MIS_PRED * 3 / CPU_CYCLES)
Failure to read '#slots' literal: #slots = nan
syntax error
Convert positive parser returns in expr__find_ids() to -EINVAL, as a
result, the error value will be respected by callers.
Before:
perf stat -C 5
Failure to read '#slots'Failure to read '#slots'Failure to read '#slots'Failure to read '#slots'Segmentation fault
After:
perf stat -C 5
Failure to read '#slots'Cannot find metric or group `Default'
Fixes: ded80bda8bc9 ("perf expr: Migrate expr ids table to a hashmap")
Signed-off-by: Leo Yan <leo.yan@arm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
