什么[向量]在perf top报告中的含义?

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

我使用perf top来分析在arm-linux上运行的进程,结果如下所示:

 4.27%  [vectors]             [.] 0x00000fc4                      
 3.84%  [kernel]              [k] _raw_spin_unlock_irqrestore     
 2.30%  [kernel]              [k] _raw_spin_unlock_irq            
 1.94%  libc-2.20.so          [.] 0x0007c35c                      
 1.91%  [vectors]             [.] 0x00000fd8                      
 1.56%  libGLESv2.so.1.9.6.0  [.] 0x0003a5e0                      
 1.34%  libGLESv2.so.1.9.6.0  [.] 0x0003a5cc                      
 0.91%  [omapdrm_pvr]         [k] _SegmentListInsert              
 0.87%  libpthread-2.20.so    [.] 0x0000aee4                      
 0.82%  libc-2.20.so          [.] 0x00075464                      
 0.76%  libc-2.20.so          [.] 0x0007767c                      
 0.48%  libpthread-2.20.so    [.] 0x000094dc                      
 0.46%  libv8.so.4            [.] 0x0017a058                      
 0.46%  libGLESv2.so.1.9.6.0  [.] 0x0003a420                      
 0.43%  [kernel]              [k] do_nanosleep                    
 0.41%  [kernel]              [k] __copy_from_user                
 0.40%  libc-2.20.so          [.] 0x0007d8a4                      
 0.40%  libpthread-2.20.so    [.] 0x00009480                      
 0.39%  [kernel]              [k] do_vfp                          
 0.39%  librender_engine.so   [.] 0x004d3ff8 

我想知道[vectros]可能代表什么?据我所知,它不是内核模块,但0x00000fc4是一个永远不应该使用的低端地址,除此之外,0x00000fc4似乎是arm异常向量的地址。

任何评论都欢迎。

vector kernel perf
1个回答
2
投票

这个[vectors]用于矢量页面的臂记忆范围,名称在aarch32_setup_vectors_pagearch/arm64/kernel/vdso.c函数中定义

#define AARCH32_VECTORS_BASE    0xffff0000
....

int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp)
{
...
    unsigned long addr = AARCH32_VECTORS_BASE;
    static const struct vm_special_mapping spec = {
        .name   = "[vectors]",
        .pages  = vectors_page,
    };
    ...
    current->mm->context.vdso = (void *)addr;

    /* Map vectors page at the high address. */
    ret = _install_special_mapping(mm, addr, PAGE_SIZE,
                       VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC,
                       &spec);
    ...
}

arch_vma_namearch/arm/kernel/process.c

/*
 * The vectors page is always readable from user space for the
 * atomic helpers. Insert it into the gate_vma so that it is visible
 * through ptrace and /proc/<pid>/mem.
 */
static struct vm_area_struct gate_vma = {
    .vm_start   = 0xffff0000,
    .vm_end     = 0xffff0000 + PAGE_SIZE,
    .vm_flags   = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYEXEC,
};
...

const char *arch_vma_name(struct vm_area_struct *vma)
{
    return is_gate_vma(vma) ? "[vectors]" : NULL;
}

我不确定perf是否会在此区域中显示正确的分析样本地址,它可能会在该区域内偏移...

关于手臂矢量页面的另一个问题:Vectors page mapping in linux for ARM

根据https://doar-e.github.io/blog/2014/04/30/corrupting-arm-evt/,arm32上的“异常向量表”映射到0xffff0000您可以在平台上检查cat /proc/self/maps的输出,并使用gdb x/1024wx 0xffff0000从0xffff0000偏移量转储页面。

关于arm64 https://blog.linuxplumbersconf.org/2016/ocw/system/presentations/3711/original/LPC_vDSO.pdf的更新vdso的介绍

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