Re: [PATCH v1] perf trace: Speed up startup time by bypassing the creation of kernel maps

From: Krzysztof Łopatowski
Date: Sun Apr 06 2025 - 18:54:23 EST


Thank you Howard,
I much appreciate your work.

> I also want to express my gratitude to Krzysztof Łopatowski—his
> profiling of the perf trace [1] inspired this patch.

:-)

> I'm not sure why the discussion stalled, and I apologize for
> not being able to answer his questions.

I believe the conversation stalled because it touched a piece of code that
has been forgotten/abandoned.
Perhaps because the mechanism of setting trampolines in the kernel changed.
I'm not sure about that.

> Since his findings significantly improve the startup time of
> perf trace, I don't want to take credit for that.
> So Krzysztof, please let me know if you'd like a Suggested-by:
> or anything else.

I'd appreciate a Suggested-by: credit.

A while ago I also tried to refactor perf's code to improve the startup
time even more by merging all invocations of kallsyms__parse.
I gave up on that for now.

But I also investigated the possibility of removing dependency on
/proc/kallsyms. You can find my findings in [2].

Basic idea is to use a built-in feature of printk [3].
We can use this either in a custom kernel module or
(in a limited way) in an eBPF program to get name of a kernel symbol
on demand from raw kpointer.

It's a question to the more knowledgeable programmers here if such an
approach could work in perf? I didn't share it here before because
I hoped to get some feedback from the BCC guys first.

Best regards,
Krzysztof

[1]: https://lore.kernel.org/linux-perf-users/CAOQCU67EsHyw_FsqGbRuityahZTSAtWzffU=hLUJ7K=aZ=1hhA@xxxxxxxxxxxxxx/
[2]: https://github.com/iovisor/bcc/pull/5217
[3]: https://docs.kernel.org/core-api/printk-formats.html#symbols-function-pointers