1Future ABI changes 2================== 3 4This file collects items that require a libperf ABI bump. Each entry 5should describe the current limitation, the desired end state, and the 6scope of the change so that a future ABI revision can batch them 7together. 8 91. Widen struct perf_cpu.cpu from int16_t to int 10 - Current limit: 32767 CPUs. No architecture exceeds this today 11 (x86_64 max is 8192, arm64 is 4096), but NR_CPUS limits keep 12 growing. perf clamps to INT16_MAX in set_max_cpu_num() as a 13 safety net. 14 - Code simplification: the int16_t forces defensive truncation 15 checks at every boundary where a wider CPU index (int from 16 sample->cpu, al->cpu, etc.) is narrowed into struct perf_cpu. 17 Without these checks, values > 32767 silently wrap to negative 18 numbers (two's complement), bypassing bounds validation. 19 Widening to int eliminates this entire class of silent 20 truncation bugs and removes the need for the INT16_MAX clamp 21 in set_max_cpu_num(). 22 - Scope: struct perf_cpu is embedded everywhere — perf_cpu_map__cpu(), 23 perf_cpu_map__min(), perf_cpu_map__max(), perf_cpu_map__has(), the 24 for_each_cpu macros, and all internal callers. The perf_cpu_map 25 internal array (RC_CHK_ACCESS(map)->map[]) stores struct perf_cpu 26 directly. Widening changes the struct layout and every function 27 that returns or accepts struct perf_cpu by value. 28 - Migration: bump LIBPERF version in libperf.map, audit all 29 sizeof(struct perf_cpu) assumptions, update perf.data 30 serialization if needed. 31