ppc64le: ftrace self-tests and $(CC_FLAGS_FTRACE) broken?
Joe Lawrence
joe.lawrence at redhat.com
Sun Mar 24 00:19:50 AEDT 2019
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
More information about the Linuxppc-dev
mailing list