Perf:内核模块符号未显示在分析中

问题描述 投票:0回答:1

加载并运行内核模块,然后通过 perf 进行分析。

$ perf record -a -g --call-graph dwarf sleep 30
$ perf report

我的内核模块的符号未出现在性能报告中。 尽管符号出现在

/proc/kallsyms.
该模块也不存在于
perf buildid-list
中 正如 this 答案所说,使模块成为内核模块,我尝试过但没有帮助。 可能导致这种情况的原因有哪些?

linux linux-kernel profiling perf
1个回答
2
投票

消息

Failed to open [thrUserCtrl], continuing without symbols
听起来好像 perf 无法找到您的模块。尝试将其安装到

/lib/modules/`uname -r`/extra

目录如https://wiki.centos.org/HowTos/BuildingKernelModules中所述:

6. In this example, the file cifs.ko has just been created. 
 As root, copy the .ko file to the /lib/modules/<kernel-version>/extra/
 directory.
   [root@host linux-2.6.18.i686]# cp fs/cifs/cifs.ko /lib/modules/`uname -r`/extra

(在

depmod -a
中更改文件后不要忘记
/lib/modules
命令)

此消息在

map__load
中生成: http://elixir.free-electrons.com/linux/v4.11/source/tools/perf/util/map.c#L284

int map__load(struct map *map)
{
    const char *name = map->dso->long_name;
    int nr;
    ...
    nr = dso__load(map->dso, map);
    if (nr < 0) {
        if (map->dso->has_build_id) {
         ...
        } else
            pr_warning("Failed to open %s", name);

        pr_warning(", continuing without symbols\n");
        return -1;

dso__load
函数返回错误时。

© www.soinside.com 2019 - 2024. All rights reserved.