2024-06-13 13:19:01

by Naresh Kamboju

[permalink] [raw]
Subject: selftests: ftrace: WARNING: at arch/arm64/kernel/stacktrace.c:112 arch_stack_walk

The following kernel warning noticed on arm64 qemu-arm64 and rk3399-rock-pi-4
device while running selftests ftrace tests on Linux next-20240613.

This is always reproducible on qemu-arm64 and rock-pi-4 device with
kselftest merge configs

Reported-by: Linux Kernel Functional Testing <[email protected]>

Test log:
-------
kselftest: Running tests in ftrace
TAP version 13
1..1
# timeout set to 0
# selftests: ftrace: ftracetest-ktap
# unlink: cannot unlink
'/opt/kselftests/default-in-kernel/ftrace/logs/latest': No such file
or directory
# TAP version 13
# 1..141
# ok 1 Basic trace file check
<4>[ 96.183553] ------------[ cut here ]------------
<4>[ 96.187100] WARNING: CPU: 1 PID: 538 at
arch/arm64/kernel/stacktrace.c:112 arch_stack_walk
(arch/arm64/kernel/stacktrace.c:112 (discriminator 1)
arch/arm64/kernel/stacktrace.c:155 (discriminator 1)
arch/arm64/kernel/stacktrace.c:172 (discriminator 1)
arch/arm64/kernel/stacktrace.c:243 (discriminator 1)
arch/arm64/kernel/stacktrace.c:267 (discriminator 1))
<4>[ 96.188005] Modules linked in: crct10dif_ce sm3_ce sm3 sha3_ce
sha512_ce sha512_arm64 fuse drm backlight dm_mod ip_tables x_tables
<4>[ 96.189034] CPU: 1 PID: 538 Comm: ftracetest Not tainted
6.10.0-rc3-next-20240613 #1
<4>[ 96.189183] Hardware name: linux,dummy-virt (DT)
<4>[ 96.189366] pstate: 624000c9 (nZCv daIF +PAN -UAO +TCO -DIT
-SSBS BTYPE=--)
<4>[ 96.189529] pc : arch_stack_walk
(arch/arm64/kernel/stacktrace.c:112 (discriminator 1)
arch/arm64/kernel/stacktrace.c:155 (discriminator 1)
arch/arm64/kernel/stacktrace.c:172 (discriminator 1)
arch/arm64/kernel/stacktrace.c:243 (discriminator 1)
arch/arm64/kernel/stacktrace.c:267 (discriminator 1))
<4>[ 96.189562] lr : arch_stack_walk
(arch/arm64/kernel/stacktrace.c:109 arch/arm64/kernel/stacktrace.c:155
arch/arm64/kernel/stacktrace.c:172 arch/arm64/kernel/stacktrace.c:243
arch/arm64/kernel/stacktrace.c:267)
<4>[ 96.189593] sp : ffff80008000bdf0
<4>[ 96.189610] x29: ffff80008000be80 x28: ffff9969bab84000 x27:
ffff9969b9c53b98
<4>[ 96.189702] x26: ffff9969bb6a60c0 x25: ffff9969b9c53b98 x24:
0000000082000000
<4>[ 96.189775] x23: 65cf9969b8823ddc x22: ffff9969b882e518 x21:
ffff9969b8836200
<4>[ 96.189809] x20: ffff80008000bec8 x19: ffff9969b8823d70 x18:
0000000002000000
<4>[ 96.189842] x17: 0000000000000000 x16: ffff800080008000 x15:
00001e8480000000
<4>[ 96.189876] x14: 000000000003d090 x13: 0000000000000000 x12:
003d090000000000
<4>[ 96.189910] x11: ffff9969bb764150 x10: ffff80008000bf30 x9 :
ffff9969b88b2970
<4>[ 96.189958] x8 : ffff9969b882e518 x7 : 0000000000000000 x6 :
0000000000000023
<4>[ 96.189990] x5 : 0000000000000000 x4 : ffff80008000bf30 x3 :
ffff80008000bfe0
<4>[ 96.190021] x2 : ffff9969b882e518 x1 : ffff9969b882e518 x0 :
ffff9969b882e518
<4>[ 96.190145] Call trace:
<4>[ 96.190196] arch_stack_walk (arch/arm64/kernel/stacktrace.c:112
(discriminator 1) arch/arm64/kernel/stacktrace.c:155 (discriminator 1)
arch/arm64/kernel/stacktrace.c:172 (discriminator 1)
arch/arm64/kernel/stacktrace.c:243 (discriminator 1)
arch/arm64/kernel/stacktrace.c:267 (discriminator 1))
<4>[ 96.190269] return_address (arch/arm64/kernel/return_address.c:45)
<4>[ 96.190335] trace_hardirqs_on (kernel/trace/trace_preemptirq.c:56
(discriminator 1))
<4>[ 96.190372] handle_softirqs (arch/arm64/include/asm/irqflags.h:26
arch/arm64/include/asm/irqflags.h:48 kernel/softirq.c:538)
<4>[ 96.190744] ---[ end trace 0000000000000000 ]---
# ok 2 Basic test for tracers



metadata:
------
git_describe: next-20240613
git_ref: master
git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
git_sha: 6906a84c482f098d31486df8dc98cead21cce2d0
git_short_log: 6906a84c482f ("Add linux-next specific files for 20240613")
arch: arm and arm64
config: kselftest merge configs

Links:
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20240613/testrun/24304248/suite/log-parser-test/test/check-kernel-exception/log
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20240613/testrun/24304248/suite/log-parser-test/tests/
- https://tuxapi.tuxsuite.com/v1/groups/linaro/projects/lkft/tests/2hoMyyk19L9y5Hg3AT2V3yaedPU

Build reproduce:
--
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2hoMxP9HQelutO3feaEW1G9KhDz/tuxmake_reproducer.sh
- https://tuxapi.tuxsuite.com/v1/groups/linaro/projects/lkft/tests/2hoMyyk19L9y5Hg3AT2V3yaedPU/reproducer

--
Linaro LKFT
https://lkft.linaro.org


2024-06-14 12:15:10

by Puranjay Mohan

[permalink] [raw]
Subject: Re: selftests: ftrace: WARNING: at arch/arm64/kernel/stacktrace.c:112 arch_stack_walk

Hi Naresh,

Thanks for finding this.

On Thu, Jun 13, 2024 at 3:16 PM Naresh Kamboju
<[email protected]> wrote:
>
> The following kernel warning noticed on arm64 qemu-arm64 and rk3399-rock-pi-4
> device while running selftests ftrace tests on Linux next-20240613.
>
> This is always reproducible on qemu-arm64 and rock-pi-4 device with
> kselftest merge configs
>
> Reported-by: Linux Kernel Functional Testing <[email protected]>
>
> Test log:
> -------
> kselftest: Running tests in ftrace
> TAP version 13
> 1..1
> # timeout set to 0
> # selftests: ftrace: ftracetest-ktap
> # unlink: cannot unlink
> '/opt/kselftests/default-in-kernel/ftrace/logs/latest': No such file
> or directory
> # TAP version 13
> # 1..141
> # ok 1 Basic trace file check
> <4>[ 96.183553] ------------[ cut here ]------------
> <4>[ 96.187100] WARNING: CPU: 1 PID: 538 at
> arch/arm64/kernel/stacktrace.c:112 arch_stack_walk


29c1c24a2707 ("function_graph: Fix up ftrace_graph_ret_addr()") made
the ftrace_graph_ret_addr() use the
'idx' pointer to optimise the stack unwinding but arm64, riscv, and
some other architectures pass `NULL` for this
parameter. The fix for this is to pass a valid pointer to
ftrace_graph_ret_addr() like x86_64 is doing.

I will send a patch to fix this unless someone else has already sent one.

Thanks,
Puranjay