Skip to content

[PW_SID:1155369] [bpf] bpf, riscv: Make arena support depend on ZACAS - #2565

Closed
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__fixesfrom
pw1155369
Closed

[PW_SID:1155369] [bpf] bpf, riscv: Make arena support depend on ZACAS#2565
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__fixesfrom
pw1155369

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1155369 applied to workflow__riscv__fixes

Name: [bpf] bpf, riscv: Make arena support depend on ZACAS
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1155369
Version: 1

Xixin Liu and others added 4 commits August 31, 2026 19:12
Overflow status and restart masks are u64, but bits were built with
BIT(). On RV32 that is an unsigned long shift, so indices >= 32 truncate
or wrap and corrupt the mask.

Use BIT_ULL() for those u64 bitops.

Fixes: a862521 ("drivers/perf: riscv: Implement SBI PMU snapshot function")
Assisted-by: DeepSeek:deepseek-v3
Signed-off-by: Xixin Liu <liuxixin@kylinos.cn>
Link: https://patch.msgid.link/prpmask01bitul.v2.1786434000.git.liuxixin@kylinos.cn
[pjw@kernel.org: updated to apply]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
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: e999143 ("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
[pjw@kernel.org: updated to apply]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
The arena range tree allocates its nodes with kmalloc_nolock() since
commit f8c67d8 ("bpf: Use kmalloc_nolock() in range tree").
kmalloc_nolock() requires slab caches with cmpxchg128 support
(__CMPXCHG_DOUBLE); on riscv cmpxchg128 is provided by the ZACAS
extension. On systems without ZACAS every arena map creation fails
with a misleading -ENOMEM.

Report the missing support instead: make bpf_jit_supports_arena()
return system_has_cmpxchg128(), so arena map creation fails with
-EOPNOTSUPP on systems without ZACAS. This matches how arena
BPF_CMPXCHG instructions are already gated on ZACAS in
bpf_jit_supports_insn().

Fixes: f8c67d8 ("bpf: Use kmalloc_nolock() in range tree")
Cc: stable@vger.kernel.org
Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
linux-riscv-bot force-pushed the workflow__riscv__fixes branch 4 times, most recently from c27f74f to 9ed823f Compare September 2, 2026 05:24
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 142.83 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1476.21 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1070.36 seconds
Result: ERROR
Output:

Redirect to /build/tmp.ezElBLT3Am and /build/tmp.s80S93jZN3
Tree base:
1252e7ddb8d40 ("Adding CI files")
Building the whole tree with the patch
error:
/build/tmppvagu_qb/arch/riscv/net/bpf_jit_comp64.c:2135:16: error: implicit declaration of function 'system_has_cmpxchg128' [-Wimplicit-function-declaration]



real	17m43.362s
user	698m38.809s
sys	109m43.928s

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.58 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.71 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.77 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 89.79 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
kdoc
Desc: Detects for kdoc errors
Duration: 0.80 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[bpf] bpf, riscv: Make arena support depend on ZACAS"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot deleted the pw1155369 branch September 2, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants