mirror-linux/arch/riscv/kernel
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
..
compat_vdso
pi riscv: pi: use 'targets' instead of extra-y in Makefile 2025-09-18 08:20:56 -06:00
probes riscv: kprobes: Fix probe address validation 2025-10-09 19:36:45 -06:00
tests riscv: fix KUnit test_kprobes crash when building with Clang 2025-12-30 20:10:52 -07:00
vdso riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot 2025-10-17 22:23:11 -06:00
vendor_extensions riscv: hwprobe: Add MIPS vendor extension probing 2025-09-19 10:33:56 -06:00
.gitignore
Makefile riscv: trace: fix snapshot deadlock with sbi ecall 2026-01-07 13:25:56 -07:00
Makefile.syscalls
acpi.c RISC-V: ACPI: enable parsing the BGRT table 2025-09-18 08:21:45 -06:00
acpi_numa.c
alternative.c riscv: errata: Fix the PAUSE Opcode for MIPS P8700 2025-09-19 10:33:56 -06:00
asm-offsets.c arch: Add the macro COMPILE_OFFSETS to all the asm-offsets.c 2025-09-25 09:57:15 +02:00
bugs.c riscv: Add ghostwrite vulnerability 2025-01-18 12:33:39 -08:00
cacheinfo.c riscv: cacheinfo: Use of_property_present() for non-boolean properties 2025-02-14 13:04:20 -08:00
cfi.c cfi: Move BPF CFI types and helpers to generic code 2025-07-31 18:23:53 -07:00
compat_signal.c
compat_syscall_table.c
copy-unaligned.S
copy-unaligned.h RISC-V: Report vector unaligned access speed hwprobe 2024-10-18 12:38:34 -07:00
cpu-hotplug.c RISC-V: clear hot-unplugged cores from all task mm_cpumasks to avoid rfence errors 2025-10-09 19:36:45 -06:00
cpu.c RISC-V: Don't print details of CPUs disabled in DT 2025-10-17 22:02:21 -06:00
cpu_ops.c
cpu_ops_sbi.c riscv: cpu_ops_sbi: smp_processor_id() returns int, not unsigned int 2026-01-07 13:03:16 -07:00
cpu_ops_spinwait.c
cpufeature.c riscv: cpufeature: Fix Zk bundled extension missing Zknh 2026-01-05 17:40:44 -07:00
crash_dump.c
crash_save_regs.S
efi-header.S include: pe.h: Fix PE definitions 2025-05-21 16:46:37 +02:00
efi.c
entry.S riscv: entry: fix typo in comment 'instruciton' -> 'instruction' 2025-10-09 19:36:45 -06:00
fpu.S RISC-V: Replace RISCV_MISALIGNED with RISCV_SCALAR_MISALIGNED 2024-10-18 12:38:32 -07:00
ftrace.c riscv: ftrace: Properly acquire text_mutex to fix a race condition 2025-07-16 08:21:47 -07:00
head.S RISC-V: KVM: Remove scounteren initialization 2025-05-21 09:34:55 +05:30
head.h
hibernate-asm.S
hibernate.c
image-vars.h
irq.c riscv: Helper to parse hart index 2025-06-26 16:06:40 +02:00
jump_label.c riscv: Move nop definition to insn-def.h 2025-03-20 09:14:42 +00:00
kernel_mode_fpu.c
kernel_mode_vector.c riscv: vector: Support xtheadvector save/restore 2025-01-18 12:33:33 -08:00
kexec_elf.c riscv: kexec: Initialize kexec_buf struct 2025-09-05 15:31:28 -06:00
kexec_image.c riscv: kexec_image: Fix dead link to boot-image-header.rst 2026-01-05 17:54:11 -07:00
kexec_relocate.S
kgdb.c riscv: KGDB: Replace deprecated strcpy in kgdb_arch_handle_qxfer_pkt 2025-10-27 23:30:01 -06:00
machine_kexec.c kexec: Consolidate machine_kexec_mask_interrupts() implementation 2024-12-11 20:32:34 +01:00
machine_kexec_file.c riscv: Strengthen duplicate and inconsistent definition of RV_X() 2025-09-16 16:28:30 -06:00
mcount-dyn.S riscv: ftrace: support direct call using call_ops 2025-06-05 11:09:31 -07:00
mcount.S riscv: fgraph: Fix stack layout to match __arch_ftrace_regs argument of ftrace_return_to_handler 2025-03-19 12:03:25 +00:00
module-sections.c riscv: Fix memory leak in module_frob_arch_sections() 2025-10-27 11:40:44 -06:00
module.c riscv: module: Fix out-of-bounds relocation access 2025-04-14 13:07:07 +00:00
paravirt.c
patch.c asm-generic: introduce text-patching.h 2024-11-07 14:25:15 -08:00
perf_callchain.c The biggest change here is eliminating the awful idea that KVM had, of 2024-11-23 16:00:50 -08:00
perf_regs.c
process.c arch: copy_thread: pass clone_flags as u64 2025-09-01 15:31:34 +02:00
ptrace.c riscv: ptrace: Optimize the allocation of vector regset 2025-11-19 09:19:28 -07:00
reset.c
return_address.c
riscv_ksyms.c
sbi-ipi.c
sbi.c riscv: sbi: Prefer SRST shutdown over legacy 2025-11-16 10:37:27 -07:00
sbi_ecall.c
setup.c riscv: acpi: avoid errors caused by probing DT devices when ACPI is used 2025-10-09 19:36:45 -06:00
signal.c riscv: signal: abstract header saving for setup_sigcontext 2025-12-19 00:18:33 -07:00
smp.c riscv: Register IPI IRQs with unique names 2025-10-17 22:00:29 -06:00
smpboot.c RISC-V: Enable HOTPLUG_PARALLEL for secondary CPUs 2025-11-19 09:19:27 -07:00
soc.c
stacktrace.c riscv: stacktrace: Disable KASAN checks for non-current tasks 2025-10-27 11:40:43 -06:00
suspend.c riscv: Add stimecmp save and restore 2025-03-18 12:59:03 +00:00
suspend_entry.S
sys_hwprobe.c riscv: hwprobe: export Zilsd and Zclsd ISA extensions 2025-12-19 00:22:30 -07:00
sys_riscv.c riscv: mmap(): use unsigned offset type in riscv_sys_mmap 2025-09-18 08:19:47 -06:00
syscall_table.c
time.c
traps.c riscv: Sanitize syscall table indexing under speculation 2025-12-30 19:57:55 -07:00
traps_misaligned.c riscv: Move all duplicate insn parsing macros into asm/insn.h 2025-09-16 16:29:07 -06:00
unaligned_access_speed.c riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot 2025-10-17 22:23:11 -06:00
vdso.c riscv: enable mseal sysmap for RV64 2025-06-05 14:03:08 -07:00
vec-copy-unaligned.S riscv: Fix the __riscv_copy_vec_words_unaligned implementation 2025-03-18 13:37:27 +00:00
vector.c riscv: ptrace: Optimize the allocation of vector regset 2025-11-19 09:19:28 -07:00
vendor_extensions.c riscv: Add xmipsexectl as a vendor extension 2025-09-18 20:36:00 -06:00
vmcore_info.c
vmlinux-xip.lds.S
vmlinux.lds.S riscv: Add runtime constant support 2025-03-20 09:15:03 +00:00