From: Joe Lawrence <joe.lawrence@redhat•com>
To: linuxppc-dev@lists•ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail•com>,
Steven Rostedt <rostedt@goodmis•org>
Subject: ppc64le: ftrace self-tests and $(CC_FLAGS_FTRACE) broken?
Date: Sat, 23 Mar 2019 09:19:50 -0400 [thread overview]
Message-ID: <20190323131950.GA30948@redhat.com> (raw)
Hi Steve, Nicholas,
I stumbled across this while working on livepatch self-tests, which like
the ftrace self-tests, specify $(CC_FLAGS_FTRACE) to ensure that target
functions are indeed trace-able.
On ppc64le, v5.0 fails the self-tests on my machine:
% gcc --version
gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3)
% git checkout v5.0
% grep FTRACE_SELFTEST .config
CONFIG_FTRACE_SELFTEST=y
After building the kernel, I noticed no mcount sections and of course
the self-tests fail as it can't hook functions:
% readelf --sections kernel/trace/trace_selftest_dynamic.o | grep mcount
(nothing)
[ ... snip ... ]
[ 126.147892] Testing all events: OK
[ 126.390487] WARNING: CPU: 0 PID: 1 at kernel/trace/trace_events.c:3421 event_trace_self_tests_init+0x94/0xf4
[ 126.390498] Modules linked in:
[ 126.390510] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 5.0.0 #10
[ 126.390520] NIP: c000000000f044d4 LR: c000000000f044cc CTR: c000000000b63d70
[ 126.390530] REGS: c0000001fb183910 TRAP: 0700 Tainted: G W (5.0.0)
[ 126.390540] MSR: 8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE> CR: 28000222 XER: 20040007
[ 126.390564] CFAR: c00000000025b1f4 IRQMASK: 0
[ 126.390564] GPR00: c000000000f044cc c0000001fb183ba0 c000000001453c00 ffffffffffffffed
[ 126.390564] GPR04: 0000000000000000 c0000000017a0aac 000000000000037d c0000001fb142d00
[ 126.390564] GPR08: 0000000000000000 0000000000000001 0000000000000000 0000000000000000
[ 126.390564] GPR12: 0000000000000000 c000000001880000 c000000000010530 0000000000000000
[ 126.390564] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 126.390564] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 126.390564] GPR24: 0000000000000000 0000000000000000 c000000000eb8908 c000000000f4ea68
[ 126.390564] GPR28: c000000000f4eaa8 0000000000000000 c000000000f04440 c000000000f581a8
[ 126.390662] NIP [c000000000f044d4] event_trace_self_tests_init+0x94/0xf4
[ 126.390672] LR [c000000000f044cc] event_trace_self_tests_init+0x8c/0xf4
[ 126.390682] Call Trace:
[ 126.390690] [c0000001fb183ba0] [c000000000f044cc] event_trace_self_tests_init+0x8c/0xf4 (unreliable)
[ 126.390705] [c0000001fb183c10] [c000000000010134] do_one_initcall+0x64/0x264
[ 126.390719] [c0000001fb183ce0] [c000000000ed443c] kernel_init_freeable+0x36c/0x470
[ 126.390731] [c0000001fb183db0] [c000000000010554] kernel_init+0x2c/0x148
[ 126.390744] [c0000001fb183e20] [c00000000000b65c] ret_from_kernel_thread+0x5c/0x80
[ 126.390755] Instruction dump:
[ 126.390765] 3fe2ffb0 f9284578 3bff3d50 794ad182 0b0a0000 2fa90000 419e0058 3bff0858
[ 126.390789] 7fe3fb78 4b356cc1 60000000 54690ffe <0b090000> 2f830000 409c0018 3c62ff96
[ 126.390814] ---[ end trace b5898e7f7f73e163 ]---
[ 126.390822] Failed to enable function tracer for event tests
I git bisected to 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on GCC
4.9 and newer"). Reverting this change and rebuilding, I could see the
mcount sections once again:
% readelf --sections kernel/trace/trace_selftest_dynamic.o | grep mcount
[ 3] __mcount_loc PROGBITS 0000000000000000 00000060
[ 4] .rela__mcount_loc RELA 0000000000000000 000258c8
Reboot and the self-test now passes.
Perhaps this is gcc version specific? I didn't see any other reports,
so maybe its specific to my config. If I run make V=1, I can see that
gcc is called with '-pg -mprofile-kernel', but then the record_mcount
script is skipped. Any ideas?
Regards,
-- Joe
next reply other threads:[~2019-03-23 13:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-23 13:19 Joe Lawrence [this message]
2019-03-23 16:17 ` ppc64le: ftrace self-tests and $(CC_FLAGS_FTRACE) broken? Steven Rostedt
2019-03-23 17:01 ` Joe Lawrence
2019-03-23 17:27 ` Joe Lawrence
2019-03-25 16:07 ` Joe Lawrence
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=20190323131950.GA30948@redhat.com \
--to=joe.lawrence@redhat$(echo .)com \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=npiggin@gmail$(echo .)com \
--cc=rostedt@goodmis$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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