]> www.infradead.org Git - users/hch/misc.git/commitdiff
perf annotate: Use architecture-agnostic register limit
authorSuchit Karunakaran <suchitkarunakaran@gmail.com>
Tue, 23 Sep 2025 17:42:36 +0000 (23:12 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 1 Oct 2025 14:23:32 +0000 (11:23 -0300)
Remove the arch-specific guard around TYPE_STATE_MAX_REGS and define it
as 32 for all architectures.

The architecture that perf is built on may not match the architecture
that produced the perf.data file, so relying on __powerpc__ or similar
is fragile.

Using 32 as a fixed upper bound is safe since it is greater than the
previous maximum of 16.

Add a comment to clarify that TYPE_STATE_MAX_REGS is an arch-independent
maximum rather than a build-time choice.

Suggested-by: Ian Rogers <irogers@google.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate-data.h

index 541fee1a5f0a7af2eb4a3772efe6c48492a61f41..1f76885facb02382b5c1f9db4f16d018c26ec777 100644 (file)
@@ -189,12 +189,15 @@ struct type_state_stack {
        u8 kind;
 };
 
-/* FIXME: This should be arch-dependent */
-#ifdef __powerpc__
+/*
+ * Maximum number of registers tracked in type_state.
+ *
+ * This limit must cover all supported architectures, since perf
+ * may analyze perf.data files generated on systems with a different
+ * register set. Use 32 as a safe upper bound instead of relying on
+ * build-arch specific values.
+ */
 #define TYPE_STATE_MAX_REGS  32
-#else
-#define TYPE_STATE_MAX_REGS  16
-#endif
 
 /*
  * State table to maintain type info in each register and stack location.