【问题标题】:Perf cannot use symbol from kernel modulePerf 不能使用来自内核模块的符号
【发布时间】:2022-11-11 11:42:32
【问题描述】:

我想跟踪我使用 Intel PT 编写的内核模块,但我无法通过性能识别来自我的内核模块的符号。为了简单起见,我尝试使用perf record -e intel_pt// -a --filter 'filter print_hello' sleep 1 跟踪一个定期将字符串打印到日志的模块。这会导致以下错误:

Kernel symbol lookup: Symbol 'print_hello' not found.
Note that symbols must be functions.
Failed to parse address filter: 'filter print_hello'
Filter format is: filter|start|stop|tracestop <start symbol or address> [/ <end symbol or size>] [@<file name>]
Where multiple filters are separated by space or comma.

使用perf record -a -e intel_pt//k sleep 1 在没有过滤器的情况下录制,然后对print_helloperf script 输出进行grep 处理也不会返回任何内容。

但是,perf kallsyms print_hello 返回

print_hello: [hello_periodic] /lib/modules/5.4.161/extra/hello-periodic.ko 0xffffffffc07af07c-0xffffffffc07af0b6 (0x7c-0xb6)

所以我认为 perf 毕竟可以找到符号。

为什么会发生这种情况?

【问题讨论】:

    标签: linux-kernel profiling kernel-module perf intel-pmu


    【解决方案1】:

    一种解决方法是可能的:

    perf record -e intel_pt// -a "$(printf 'filter print_hello	[hello_periodic]')" sleep 1
    

    或者只使用数字:

    perf record -e intel_pt// -a --filter 'filter 0xffffffffc07af07c/0x3a' sleep 1
    

    但是,至少可能需要内核 v5.18,因为它已提交 c243cecb58e3(“perf/x86/intel/pt:放宽地址过滤器验证”)

    如需 perf 帮助,还可以尝试 linux perf users 邮件列表:

    linux-perf-users@vger.kernel.org

    和邮件存档:

    https://lore.kernel.org/linux-perf-users/

    有关一般信息,内核性能 wiki:

    https://perf.wiki.kernel.org

    对于英特尔 PT,英特尔 PT wiki 页面:

    https://perf.wiki.kernel.org/index.php/Perf_tools_support_for_Intel%C2%AE_Processor_Trace

    【讨论】:

      猜你喜欢
      • 2014-03-01
      • 1970-01-01
      • 2012-08-06
      • 2014-02-12
      • 2022-01-26
      • 1970-01-01
      • 1970-01-01
      • 2012-03-18
      • 1970-01-01
      相关资源
      最近更新 更多