diff options
| author | Xixin Liu <liuxixin@kylinos.cn> | 2026-08-18 17:10:00 +0800 |
|---|---|---|
| committer | Paul Walmsley <pjw@kernel.org> | 2026-09-01 19:19:26 -0600 |
| commit | 6809da6e9c08ccc9a09cb0a48c61471679274aaa (patch) | |
| tree | 20dfa9829e40ea01f668d9efdfec17c34a2ce315 /scripts/Makefile.thinlto | |
| parent | 6693171c8c540b3a54e671992f0561613076fc3b (diff) | |
| download | linux-stable-6809da6e9c08ccc9a09cb0a48c61471679274aaa.tar.gz linux-stable-6809da6e9c08ccc9a09cb0a48c61471679274aaa.zip | |
perf: RISC-V: store available counter mask as bitmap
The available-counter mask was a single unsigned long, but iteration
uses RISCV_MAX_COUNTERS, which is 64. On RV32 that reads past the object.
Filling with an unsigned-long bit at index 32 and above is also wrong.
Use DECLARE_BITMAP and set_bit/bitmap helpers. Walk each bitmap word
into CFG_MATCH when checking events, when allocating an index, and when
stopping all counters. Set the counter base to i times BITS_PER_LONG.
Share the CFG_MATCH ecall through a small helper so the 32-bit argument
split is not duplicated. On qemu-system-riscv32 the probe bitmap has bits
above XLEN set, so the first word alone is not enough.
Fixes: e9991434596f ("RISC-V: Add perf platform driver based on SBI PMU extension")
Assisted-by: DeepSeek:deepseek-v3
Signed-off-by: Xixin Liu <liuxixin@kylinos.cn>
Link: https://patch.msgid.link/prpmask02cmap.v2.1786434000.git.liuxixin@kylinos.cn
Cc: stable@kernel.org
[pjw@kernel.org: updated to apply; fixed checkpatch.pl issues]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
