[PATCH] ARM: perf: Use correct unwind info for tracepoint events
Haibo Li
haibo.li at mediatek.com
Mon Feb 26 22:58:28 PST 2024
>Unwinding tends to work okay in practice
>because perf_trace_* functions and their callers
>usually have similar prologues.A common unwind insn sequence
>is "sp=fp, sp-=X, pop_r4_to_rN", so even if prologues don't match exactly,
>stored LR gets correctly popped off the stack.
It does not work well for all tracepoint events.
perf gets incomplete stacktrace after below commands
if CONFIG_ARM_UNWIND is on:
perf record -e block:block_rq_complete -g sleep 10
perf script
'''
swapper 0 [000] 50333.927556: block:block_rq_complete:
254,0 WSM () 376888 + 18 [0]
804ac458 __traceiter_block_rq_complete+0x3c ([kernel.kallsyms])
806bdd70 virtblk_done+0xc8 ([kernel.kallsyms])
10 [unknown] ([unknown])
'''
In experiment,
ext4:ext4_da_write_begin,
block:block_rq_complete,
csd:csd_function_entry
suffer from above problem(maybe more).
As you said,it is caused by mismatched ARM_pc.
After apply similar patch,now perf gets correct stacktrace:
swapper 0 [000] 122.003800: block:block_rq_complete:
254,0 WSM () 377064 + 16 [0]
804acdd4 perf_trace_block_rq_completion+0x80 ([kernel.kallsyms])
804ac2b0 __traceiter_block_rq_complete+0x3c ([kernel.kallsyms])
804b9388 blk_update_request+0x64 ([kernel.kallsyms])
804b9ab4 blk_mq_end_request+0x14 ([kernel.kallsyms])
804c0bac blk_done_softirq+0x58 ([kernel.kallsyms])
8010135c __softirqentry_text_start+0x138 ([kernel.kallsyms])
801298f8 __irq_exit_rcu+0x58 ([kernel.kallsyms])
801299a0 irq_exit+0x8 ([kernel.kallsyms])
80100ba8 __irq_svc+0x88 ([kernel.kallsyms])
80165628 arch_local_irq_enable+0x4 ([kernel.kallsyms])
801659d8 do_idle+0xdc ([kernel.kallsyms])
80165bf4 cpu_startup_entry+0x28 ([kernel.kallsyms])
809c8764 kernel_init+0x0 ([kernel.kallsyms])
Acked-by: Haibo Li <haibo.li at mediatek.com>
More information about the linux-arm-kernel
mailing list