summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHaoran Jiang <jianghaoran@kylinos.cn>2026-07-23 22:27:30 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2026-07-23 22:27:30 +0800
commit73555fdab5e1e4f24ca000c41a616b34edf4b55d (patch)
tree676069e2a7b031b909d208cb8bd1557ceb9db86e /arch
parent485ed44db5694d8d2e5027f63ad608e705286f30 (diff)
downloadlinux-next-73555fdab5e1e4f24ca000c41a616b34edf4b55d.tar.gz
linux-next-73555fdab5e1e4f24ca000c41a616b34edf4b55d.zip
LoongArch: Fix oops during single-step debugging
When entering KDB via a breakpoint and then performing single-step debugging, an oops is triggered. Now during single-step debugging, kdb_local() expects the reason to be KDB_REASON_SSTEP, but it is actually KDB_REASON_OOPS. In kdb_stub(), when determining the reason, the ex_vector for single-step should be 0, as already implemented on other architectures such as arm64 and riscv. Before the patch: [112]kdb> ss Entering kdb (current=0x900020009f520000, pid 10661) on processor 112 Oops: (null) due to oops @ 0x90000000005b57a4 Cc: stable@vger.kernel.org Signed-off-by: Haoran Jiang <jianghaoran@kylinos.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch')
-rw-r--r--arch/loongarch/kernel/kgdb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/loongarch/kernel/kgdb.c b/arch/loongarch/kernel/kgdb.c
index 17664a6043b1..e7b59f8a4b05 100644
--- a/arch/loongarch/kernel/kgdb.c
+++ b/arch/loongarch/kernel/kgdb.c
@@ -252,7 +252,8 @@ static int kgdb_loongarch_notify(struct notifier_block *self, unsigned long cmd,
if (atomic_read(&kgdb_active) != -1)
kgdb_nmicallback(smp_processor_id(), regs);
- if (kgdb_handle_exception(args->trapnr, args->signr, cmd, regs))
+ if (kgdb_handle_exception(regs->csr_era == stepped_address ? 0 : args->trapnr,
+ args->signr, cmd, regs))
return NOTIFY_DONE;
if (atomic_read(&kgdb_setting_breakpoint))