From: Shuai Xue <xueshuai@linux.alibaba.com>
To: Karl Mehltretter <kmehltretter@gmail.com>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>,
Changbin Du <changbin.du@intel.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Mark Rutland <mark.rutland@arm.com>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com
Subject: Re: [PATCH 2/2] riscv: Add KUnit test for stack trace start frames
Date: Mon, 12 Oct 2026 17:38:41 +0800 [thread overview]
Message-ID: <dd5c9bd0-df80-4524-aedf-49c5b94fdd12@linux.alibaba.com> (raw)
In-Reply-To: <20261010132712.46931-2-kmehltretter@gmail.com>
On 10/10/26 9:27 PM, Karl Mehltretter wrote:
> stack_trace_save() and return_address() depend on the first frame reported
> by arch_stack_walk(), but no test checks their frame numbering.
>
> Add a test that calls both through a chain of three noinline functions
> and compares the symbol of the result with the function expected for
> each skip count or level.
>
> Require FRAME_POINTER because the stack-scanning walker cannot provide an
> exact start frame.
>
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
> arch/riscv/kernel/tests/Kconfig.debug | 12 ++
> arch/riscv/kernel/tests/Makefile | 1 +
> arch/riscv/kernel/tests/stacktrace_test.c | 142 ++++++++++++++++++++++
> 3 files changed, 155 insertions(+)
>
> diff --git a/arch/riscv/kernel/tests/Kconfig.debug b/arch/riscv/kernel/tests/Kconfig.debug
> index 40f8dafffa0a..eb79df5b2c5a 100644
> --- a/arch/riscv/kernel/tests/Kconfig.debug
> +++ b/arch/riscv/kernel/tests/Kconfig.debug
> @@ -42,6 +42,18 @@ config RISCV_KPROBES_KUNIT
>
> If unsure, say N.
>
> +config RISCV_STACKTRACE_KUNIT_TEST
> + bool "KUnit tests for RISC-V stack trace start frames"
> + depends on KUNIT && STACKTRACE && FRAME_POINTER && KALLSYMS
Hi, Karl
One small nit: the new RISCV_STACKTRACE_KUNIT_TEST entry does
not follow the KUNIT_ALL_TESTS pattern of the two existing entries
right next to it (RISCV_KPROBES_KUNIT, RISCV_MODULE_LINKING_KUNIT):
config RISCV_STACKTRACE_KUNIT_TEST
bool "KUnit tests for RISC-V stack trace start frames" if !KUNIT_ALL_TESTS
default KUNIT_ALL_TESTS
Without "default KUNIT_ALL_TESTS" the suite is never enabled by
kunit.all_tests, and without the "if !KUNIT_ALL_TESTS" prompt guard
it shows up as a redundant prompt when KUNIT_ALL_TESTS is already
set. This is not a blocker in any way, just a nice tweak for a
potential v2.
Please feel free to add
Tested-by: Shuai Xue <xueshuai@linux.alibaba.com>
to both patches, and additionally on 1/2
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Thanks!
Shuai
next prev parent reply other threads:[~2026-10-12 9:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 13:27 [PATCH 1/2] riscv: stacktrace: do not report the walker's own frame from arch_stack_walk() Karl Mehltretter
2026-10-10 13:27 ` [PATCH 2/2] riscv: Add KUnit test for stack trace start frames Karl Mehltretter
2026-10-12 9:38 ` Shuai Xue [this message]
2026-10-12 8:08 ` [PATCH 1/2] riscv: stacktrace: do not report the walker's own frame from arch_stack_walk() Shuai Xue
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=dd5c9bd0-df80-4524-aedf-49c5b94fdd12@linux.alibaba.com \
--to=xueshuai@linux.alibaba.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=brendan.higgins@linux.dev \
--cc=changbin.du@intel.com \
--cc=david@davidgow.net \
--cc=jpoimboe@kernel.org \
--cc=kmehltretter@gmail.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=raemoar63@gmail.com \
--cc=rostedt@goodmis.org \
/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