mirror-linux/arch/riscv
Martin Kaiser b0d7f5f0c9 riscv: trace: fix snapshot deadlock with sbi ecall
If sbi_ecall.c's functions are traceable,

echo "__sbi_ecall:snapshot" > /sys/kernel/tracing/set_ftrace_filter

may get the kernel into a deadlock.

(Functions in sbi_ecall.c are excluded from tracing if
CONFIG_RISCV_ALTERNATIVE_EARLY is set.)

__sbi_ecall triggers a snapshot of the ringbuffer. The snapshot code
raises an IPI interrupt, which results in another call to __sbi_ecall
and another snapshot...

All it takes to get into this endless loop is one initial __sbi_ecall.
On RISC-V systems without SSTC extension, the clock events in
timer-riscv.c issue periodic sbi ecalls, making the problem easy to
trigger.

Always exclude the sbi_ecall.c functions from tracing to fix the
potential deadlock.

sbi ecalls can easiliy be logged via trace events, excluding ecall
functions from function tracing is not a big limitation.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://patch.msgid.link/20251223135043.1336524-1-martin@kaiser.cx
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2026-01-07 13:25:56 -07:00
..
boot riscv: boot: Always make Image from vmlinux, not vmlinux.unstripped 2025-12-30 19:57:55 -07:00
configs riscv: configs: Clean up references to non-existing configs 2026-01-07 12:49:06 -07:00
crypto lib/crypto: riscv: Depend on RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS 2025-12-09 15:10:21 -08:00
errata riscv: errata: Fix the PAUSE Opcode for MIPS P8700 2025-09-19 10:33:56 -06:00
include riscv: remove irqflags.h inclusion in asm/bitops.h 2026-01-07 13:16:38 -07:00
kernel riscv: trace: fix snapshot deadlock with sbi ecall 2026-01-07 13:25:56 -07:00
kvm KVM/riscv changes for 6.19 2025-12-02 18:35:25 +01:00
lib riscv: checksum: Use riscv_has_extension_likely 2025-11-19 09:19:27 -07:00
mm riscv: pgtable: Use riscv_has_extension_unlikely 2025-11-19 09:19:27 -07:00
net bpf: specify the old and new poke_type for bpf_arch_text_poke 2025-11-24 09:47:03 -08:00
purgatory kcfi: Rename CONFIG_CFI_CLANG to CONFIG_CFI 2025-09-24 14:29:14 -07:00
tools riscv: Stop considering R_RISCV_NONE as bad relocations 2025-07-16 08:13:55 -07:00
Kbuild riscv: migrate to the generic rule for built-in DTB 2025-03-18 13:30:13 +00:00
Kconfig First set of RISC-V updates for v6.19-rc1 2025-12-05 16:26:57 -08:00
Kconfig.debug
Kconfig.errata riscv: errata: Fix the PAUSE Opcode for MIPS P8700 2025-09-19 10:33:56 -06:00
Kconfig.socs Initial Anlogic Platform Support 2025-11-21 21:29:57 +01:00
Kconfig.vendor riscv: Add xmipsexectl as a vendor extension 2025-09-18 20:36:00 -06:00
Makefile riscv: Remove redundant judgment for the default build target 2025-11-07 17:39:07 -07:00
Makefile.postlink kbuild: Create intermediate vmlinux build with relocations preserved 2025-03-17 00:29:50 +09:00