perf top report中的[Vectors]是什么意思?
What [Vectors] means in perf top report?
我在 arm-linux 上使用 perf top 分析了一个 运行 的进程,结果如下所示:
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 异常向量的地址。
欢迎任何评论。
这个[vectors]
是vectors page的arm memory range,名字在arch/arm64/kernel/vdso.c
的aarch32_setup_vectors_page
函数中定义
#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_name
中的 arch/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 是否会显示正确的地址以分析该区域中的示例,它可能在该部分内发生偏移...
关于arm的矢量页面的另一个问题:
"The Exception Vector Table" 在 arm32 上映射到 0xffff0000,根据 https://doar-e.github.io/blog/2014/04/30/corrupting-arm-evt/
您可以在平台上检查 cat /proc/self/maps
的输出,并使用 gdb x/1024wx 0xffff0000
.
从偏移量 0xffff0000 转储页面
关于 arm64 上更新的 vdso 的介绍https://blog.linuxplumbersconf.org/2016/ocw/system/presentations/3711/original/LPC_vDSO.pdf
我在 arm-linux 上使用 perf top 分析了一个 运行 的进程,结果如下所示:
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 异常向量的地址。
欢迎任何评论。
这个[vectors]
是vectors page的arm memory range,名字在arch/arm64/kernel/vdso.c
aarch32_setup_vectors_page
函数中定义
#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_name
中的 arch/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 是否会显示正确的地址以分析该区域中的示例,它可能在该部分内发生偏移...
关于arm的矢量页面的另一个问题:
"The Exception Vector Table" 在 arm32 上映射到 0xffff0000,根据 https://doar-e.github.io/blog/2014/04/30/corrupting-arm-evt/
您可以在平台上检查 cat /proc/self/maps
的输出,并使用 gdb x/1024wx 0xffff0000
.
关于 arm64 上更新的 vdso 的介绍https://blog.linuxplumbersconf.org/2016/ocw/system/presentations/3711/original/LPC_vDSO.pdf