* [PATCH] riscv: Establish entry state for kernel software-check exceptions
@ 2026-11-07 7:08 ` Jisheng Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Jisheng Zhang @ 2026-11-07 7:08 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: linux-riscv, linux-kernel
The kernel-mode software-check exception path calls die() without
performing the entry bookkeeping used by other kernel trap handlers.
die() invokes diagnostics and notifiers which need the corresponding
RCU and tracing state established.
Wrap the kernel fault handling with irqentry_nmi_enter() and
irqentry_nmi_exit(), following the existing kernel trap paths.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Assisted-by: LLM
---
arch/riscv/kernel/traps.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index f8292adda099..f28e03f98af0 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -402,8 +402,11 @@ asmlinkage __visible __trap_section void do_trap_software_check(struct pt_regs *
irqentry_exit_to_user_mode(regs);
} else {
+ irqentry_state_t state = irqentry_nmi_enter(regs);
+
/* sw check exception coming from kernel is a bug in kernel */
die(regs, "Kernel BUG");
+ irqentry_nmi_exit(regs, state);
}
}
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH] riscv: Establish entry state for kernel software-check exceptions
@ 2026-11-07 7:08 ` Jisheng Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Jisheng Zhang @ 2026-11-07 7:08 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: linux-riscv, linux-kernel
The kernel-mode software-check exception path calls die() without
performing the entry bookkeeping used by other kernel trap handlers.
die() invokes diagnostics and notifiers which need the corresponding
RCU and tracing state established.
Wrap the kernel fault handling with irqentry_nmi_enter() and
irqentry_nmi_exit(), following the existing kernel trap paths.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Assisted-by: LLM
---
arch/riscv/kernel/traps.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index f8292adda099..f28e03f98af0 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -402,8 +402,11 @@ asmlinkage __visible __trap_section void do_trap_software_check(struct pt_regs *
irqentry_exit_to_user_mode(regs);
} else {
+ irqentry_state_t state = irqentry_nmi_enter(regs);
+
/* sw check exception coming from kernel is a bug in kernel */
die(regs, "Kernel BUG");
+ irqentry_nmi_exit(regs, state);
}
}
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-07 7:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 7:08 [PATCH] riscv: Establish entry state for kernel software-check exceptions Jisheng Zhang
2026-11-07 7:08 ` Jisheng Zhang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.