Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should kernel addr-- ? #135

Closed
zdyj3170101136 opened this issue Jan 18, 2023 · 1 comment
Closed

should kernel addr-- ? #135

zdyj3170101136 opened this issue Jan 18, 2023 · 1 comment

Comments

@zdyj3170101136
Copy link

i find that you get addr from perf record.
and add addr with -1 to get right addr.

i find this could change the addr's kernel symbol.

give /proc/kallsyms:

[root@plat-sh-infra-testing-common-parca001 perfcheck]# cat /proc/kallsyms | head -n 34175 | tail
ffffffff92d83fe0 T tty_unlock_slave
ffffffff92d83fff T __lock_text_end
ffffffff92d84000 t perf_event_nmi_handler
ffffffff92d84000 T __kprobes_text_start
ffffffff92d84050 t perf_ibs_nmi_handler
ffffffff92d840c0 T save_paranoid
ffffffff92d84200 t common_interrupt
ffffffff92d8436a t ret_from_intr
ffffffff92d8437f t exit_intr
ffffffff92d8439d t retint_with_reschedule

the perf script would get ret_from_intr for addr ffffffff92d8436a:

[root@plat-sh-infra-testing-common-parca001 .parca-agent]# perf script | head -n 4240 | tail
        ffffffffc04961f5 virtnet_poll+0x265 ([kernel.kallsyms])
        ffffffff92c5057f net_rx_action+0x26f ([kernel.kallsyms])
        ffffffff926a5435 __do_softirq+0xf5 ([kernel.kallsyms])
        ffffffff92d9142c call_softirq+0x1c ([kernel.kallsyms])
        ffffffff9262f715 do_softirq+0x65 ([kernel.kallsyms])
        ffffffff926a57b5 irq_exit+0x105 ([kernel.kallsyms])
        ffffffff92d92886 __irqentry_text_start+0x56 ([kernel.kallsyms])
        ffffffff92d8436a ret_from_intr+0x0 ([kernel.kallsyms])
                  50c5d3 ZSTD_compressBlock_greedy_extDict_row+0x2d3 (/root/zstd/zstd)
        9f5573aeed0b19a2 [unknown] ([unknown])

but with addr--, we would get common_interrupt for addr ffffffff92d8436a.

so with addr--, our result would diff from perf script output.
which is correct?

@gmarin13
Copy link
Collaborator

When using frame pointers to unwind the stack, perf captures the return address at each frame.
The return address is the address of the instruction after the call instruction. For stack unwinding we want to get the symbols associated with the call instructions. That's the motivation for subtracting 1 from each frame address.

You can try to disassemble the code. Is there a call to __irqentry_text_start at the end of common_interrupt or is there a call at the start of ret_from_intr?
What method was used for stack unwinding (fp, dwarf, lbr)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants