From: haoran.jiang@linux.dev
To: chenhuacai@kernel.org
Cc: kernel@xen0n.name, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org, yangtiezhu@loongson.cn,
pjw@kernel.org, palmer@dabbelt.com,
Haoran Jiang <jianghaoran@kylinos.cn>
Subject: [PATCH] LoongArch: Fix oops during single-step debugging
Date: Wed, 22 Jul 2026 10:44:09 +0800 [thread overview]
Message-ID: <20260722024409.158142-1-haoran.jiang@linux.dev> (raw)
From: Haoran Jiang <jianghaoran@kylinos.cn>
When entering KDB via a breakpoint and then performing
single-step debugging,an oops is triggered.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
Signed-off-by: Haoran Jiang <jianghaoran@kylinos.cn>
---
arch/loongarch/kernel/kgdb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/loongarch/kernel/kgdb.c b/arch/loongarch/kernel/kgdb.c
index 17664a6043b1..ed39f5cee9da 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))
--
2.43.0
reply other threads:[~2026-07-22 2:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260722024409.158142-1-haoran.jiang@linux.dev \
--to=haoran.jiang@linux.dev \
--cc=chenhuacai@kernel.org \
--cc=jianghaoran@kylinos.cn \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox