linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Guo Ren <guoren@kernel.org>
To: Daniel Thompson <daniel.thompson@linaro.org>
Cc: arnd@arndb.de, palmer@rivosinc.com, tglx@linutronix.de,
	peterz@infradead.org, luto@kernel.org,
	conor.dooley@microchip.com, heiko@sntech.de, jszhang@kernel.org,
	lazyparser@gmail.com, falcon@tinylab.org, chenhuacai@kernel.org,
	apatel@ventanamicro.com, atishp@atishpatra.org,
	mark.rutland@arm.com, ben@decadent.org.uk, bjorn@kernel.org,
	palmer@dabbelt.com, linux-arch@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	"Guo Ren" <guoren@linux.alibaba.com>,
	"Björn Töpel" <bjorn@rivosinc.com>,
	"Yipeng Zou" <zouyipeng@huawei.com>,
	"Vincent Chen" <vincent.chen@sifive.com>
Subject: Re: [PATCH -next V17 4/7] riscv: entry: Convert to generic entry
Date: Fri, 30 Jun 2023 07:16:01 -0400	[thread overview]
Message-ID: <CAJF2gTRPYDxDpia=o6oqbt_8_5hqAQk-pwY1uPwUjcxCFg1EPw@mail.gmail.com> (raw)
In-Reply-To: <ZJ2PBosSQtSX28Mf@wychelm>

On Thu, Jun 29, 2023 at 10:02 AM Daniel Thompson
<daniel.thompson@linaro.org> wrote:
>
> On Tue, Feb 21, 2023 at 10:30:18PM -0500, guoren@kernel.org wrote:
> > From: Guo Ren <guoren@linux.alibaba.com>
> >
> > This patch converts riscv to use the generic entry infrastructure from
> > kernel/entry/*. The generic entry makes maintainers' work easier and
> > codes more elegant. Here are the changes:
> >
> >  - More clear entry.S with handle_exception and ret_from_exception
> >  - Get rid of complex custom signal implementation
> >  - Move syscall procedure from assembly to C, which is much more
> >    readable.
> >  - Connect ret_from_fork & ret_from_kernel_thread to generic entry.
> >  - Wrap with irqentry_enter/exit and syscall_enter/exit_from_user_mode
> >  - Use the standard preemption code instead of custom
> >
> > Suggested-by: Huacai Chen <chenhuacai@kernel.org>
> > Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
> > Tested-by: Yipeng Zou <zouyipeng@huawei.com>
> > Tested-by: Jisheng Zhang <jszhang@kernel.org>
> > Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> > Signed-off-by: Guo Ren <guoren@kernel.org>
> > Cc: Ben Hutchings <ben@decadent.org.uk>
>
> Apologies for the late feedback but I've been swamped lately and only
> recently got round to running the full kgdb test suite on the v6.4
> series.
>
> The kgdb test suite includes a couple of tests that verify that the
> system resumes after breakpointing due to a BUG():
> https://github.com/daniel-thompson/kgdbtest/blob/master/tests/test_kdb_fault_injection.py#L24-L45
>
> These tests have regressed on riscv between v6.3 and v6.4 and a bisect
> is pointing at this patch. With these changes in place then, after kdb
> resumes the system, the BUG() message is printed as normal but then
> immediately fails. From the backtrace it looks like the new entry/exit
> code cannot advance past a compiled breakpoint instruction:
> ~~~
> PANIC: Fatal exception in interrupt
It comes from:
void die(struct pt_regs *regs, ...
{
...
if (in_interrupt())
        panic("Fatal exception in interrupt");
...

We could add a dump_backtrace to see what happened:
if (in_interrupt()) {
+      dump_backtrace(regs, NULL, KERN_DEFAULT);
        panic("Fatal exception in interrupt");
}



>
> Entering kdb (current=0xff60000001a2a280, pid 104) on processor 1 due to
> NonMask
> able Interrupt @ 0xffffffff800bb3c4
> [1]kdb> bt
> Stack traceback for pid 104
> 0xff60000001a2a280      104       92  1    1   R  0xff60000001a2ac50
> *echo
> CPU: 1 PID: 104 Comm: echo Tainted: G      D
> 6.3.0-rc1-00003-gf0bddf50586d #119
> Hardware name: riscv-virtio,qemu (DT)
> Call Trace:
> [<ffffffff800050dc>] dump_backtrace+0x1c/0x24
> [<ffffffff808458f8>] show_stack+0x2c/0x38
> [<ffffffff80851b00>] dump_stack_lvl+0x3c/0x54
> [<ffffffff80851b2c>] dump_stack+0x14/0x1c
> [<ffffffff800bc4b8>] kdb_dump_stack_on_cpu+0x64/0x66
> [<ffffffff800c3d2a>] kdb_show_stack+0x82/0x88
> [<ffffffff800c3dc0>] kdb_bt1+0x90/0xf2
> [<ffffffff800c4206>] kdb_bt+0x34c/0x384
> [<ffffffff800c1d28>] kdb_parse+0x27a/0x618
> [<ffffffff800c2566>] kdb_main_loop+0x3b2/0x8fa
> [<ffffffff800c4c5a>] kdb_stub+0x1ba/0x3a8
> [<ffffffff800bbba8>] kgdb_cpu_enter+0x342/0x5ba
> [<ffffffff800bc3da>] kgdb_handle_exception+0xe0/0x11a
> [<ffffffff8000810c>] kgdb_riscv_notify+0x86/0xb4
> [<ffffffff8002f210>] notify_die+0x6a/0xa6
> [<ffffffff80004db0>] handle_break+0x70/0xe0
> [<ffffffff80852462>] do_trap_break+0x48/0x5c
> [<ffffffff80003598>] ret_from_exception+0x0/0x64
> [<ffffffff800bb3c4>] kgdb_compiled_break+0x0/0x14
> ~~~
>
>
> Daniel.



-- 
Best Regards
 Guo Ren

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-06-30 11:16 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22  3:30 [PATCH -next V17 0/7] riscv: Add GENERIC_ENTRY support guoren
2023-02-22  3:30 ` [PATCH -next V17 1/7] compiler_types.h: Add __noinstr_section() for noinstr guoren
2023-03-22 14:46   ` Björn Töpel
2023-03-24  1:51     ` Guo Ren
2023-03-23  0:43   ` Lai Jiangshan
2023-02-22  3:30 ` [PATCH -next V17 2/7] riscv: ptrace: Remove duplicate operation guoren
2023-02-22  3:30 ` [PATCH -next V17 3/7] riscv: entry: Add noinstr to prevent instrumentation inserted guoren
2023-02-22  3:30 ` [PATCH -next V17 4/7] riscv: entry: Convert to generic entry guoren
2023-03-31 18:34   ` Conor Dooley
2023-03-31 18:41     ` Conor Dooley
2023-03-31 18:46       ` Heiko Stübner
2023-03-31 18:55         ` Conor Dooley
2023-03-31 21:22           ` Palmer Dabbelt
2023-04-01  2:15         ` Guo Ren
2023-04-01 12:10           ` Heiko Stübner
2023-04-01 13:19             ` Björn Töpel
2023-04-01 13:33               ` Björn Töpel
2023-04-01 14:58                 ` Björn Töpel
2023-04-01 15:42                   ` Heiko Stübner
2023-04-01 18:41                     ` Björn Töpel
2023-04-07  9:13                       ` Guo Ren
2023-04-07  9:18                         ` Conor.Dooley
2023-04-08  4:59                           ` Guo Ren
2023-04-01  1:39     ` Guo Ren
2023-04-01  9:32       ` Conor Dooley
2023-06-29 14:02   ` Daniel Thompson
2023-06-30 11:16     ` Guo Ren [this message]
2023-06-30 11:22       ` Guo Ren
2023-06-30 14:50         ` Daniel Thompson
2023-07-01  2:55           ` Guo Ren
2023-07-01  3:08             ` Guo Ren
2023-07-01  4:22               ` Guo Ren
2023-07-03  3:09                 ` Guo Ren
2023-02-22  3:30 ` [PATCH -next V17 5/7] riscv: entry: Remove extra level wrappers of trace_hardirqs_{on,off} guoren
2023-02-22  3:30 ` [PATCH -next V17 6/7] riscv: entry: Consolidate ret_from_kernel_thread into ret_from_fork guoren
2023-02-22  3:30 ` [PATCH -next V17 7/7] riscv: entry: Consolidate general regs saving/restoring guoren
2023-03-24 22:01 ` (subset) [PATCH -next V17 0/7] riscv: Add GENERIC_ENTRY support Palmer Dabbelt
2023-03-24 22:10 ` patchwork-bot+linux-riscv
2023-03-27 23:27 ` Palmer Dabbelt

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='CAJF2gTRPYDxDpia=o6oqbt_8_5hqAQk-pwY1uPwUjcxCFg1EPw@mail.gmail.com' \
    --to=guoren@kernel.org \
    --cc=apatel@ventanamicro.com \
    --cc=arnd@arndb.de \
    --cc=atishp@atishpatra.org \
    --cc=ben@decadent.org.uk \
    --cc=bjorn@kernel.org \
    --cc=bjorn@rivosinc.com \
    --cc=chenhuacai@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=daniel.thompson@linaro.org \
    --cc=falcon@tinylab.org \
    --cc=guoren@linux.alibaba.com \
    --cc=heiko@sntech.de \
    --cc=jszhang@kernel.org \
    --cc=lazyparser@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=palmer@dabbelt.com \
    --cc=palmer@rivosinc.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.chen@sifive.com \
    --cc=zouyipeng@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).