2

我使用linux perf工具收集程序的分支信息,命令和结果如下:

$ sudo perf record -b /bin/ls
Error:
No hardware sampling interrupt available.
No APIC? If so then you can boot the kernel with the "lapic" boot parameter to force-enable it.

/pro/cpuinfo 中的内容如下:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz
stepping        : 10
microcode       : 0xa07
cpu MHz         : 1994.921
cache size      : 6144 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 4
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 **apic** sep mtrr pge mca cmov pat pse36 clflush dts acpi strong text mmx fxsr sse sse2 ss ht tm
 pbe syscall nx lm constant_tsc arch_perfmon pebs **bts** rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm
 dca sse4_1 xsave lahf_lm dtherm tpr_shadow vnmi flexpriority
bugs            :
bogomips        : 3989.84
clflush size    : 64
cache_alignment : 64
address sizes   : 38 bits physical, 48 bits virtual
power management:

apic并且bts输入flags得到加强(我想要但只是被“**”封装)而且我不知道这种情况下还有什么重要的。其他 7 个处理器与处理器 0 相同。

通过修改 /boot/grub/grub.cfg 添加引导参数“lapic”:

menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0ed8a872-4eb7-4339-a0bb-6c0033da582e' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  ced80bc6-08a9-4909-9717-97658cf0c4fd
        else
          search --no-floppy --fs-uuid --set=root ced80bc6-08a9-4909-9717-97658cf0c4fd
        fi
        linux   /vmlinuz-4.2.0-42-generic root=/dev/mapper/fedora_hustyong-root ro **lapic**  quiet splash $vt_handoff
        initrd  /initrd.img-4.2.0-42-generic
}

只需添加条目lapiclinux

但是重启后没有任何意义。

我的问题:

1)错误信息是什么意思?

2) perf 工具分支采样是否使用 Intel Branch Trace Store(BTS)?还是最后一个分支记录(LBR)?

3) 如何查找 LBR 支持?

4) x86 32bit 和 64bit 之间的 LBR 和 BTS 支持有什么不同?

我的操作系统是Ubuntu 14.04 64bit

$ uname -a
Linux user-S5000VSA 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

perf 安装说明:

$ sudo apt-get install linux-tools-common
$ sudo apt-get install linux-tools-4.2.0-27-generic linux-cloud-tools-4.2.0-27-generic

更新:

/proc/interrupts 的内容:

           CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7       
  0:     127780      52084     127784     126729     127706     128431     127785     126822   IO-APIC   2-edge      timer
  1:         52         42          3          2         62         49          5          2   IO-APIC   1-edge      i8042
  8:          0          0          0          0          0          0          0          1   IO-APIC   8-edge      rtc0
  9:          0          0          0          0          0          0          0          0   IO-APIC   9-fasteoi   acpi
 12:       1428       1307         52         47       1424       1324         53         58   IO-APIC  12-edge      i8042
 14:          0          0          0          0          0          0          0          0   IO-APIC  14-edge      ata_piix
 15:          0          0          0          0          0          0          0          0   IO-APIC  15-edge      ata_piix
 17:         47        276       1004         49         52        295        993         50   IO-APIC  17-fasteoi   radeon
 20:      31062       4201       7533      29935      31080       4297       7540      29824   IO-APIC  20-fasteoi   ata_piix
 22:          0          0          0          0          0          0          0          0   IO-APIC  22-fasteoi   uhci_hcd:usb3, uhci_hcd:usb5
 23:          0          0          0          0          0          0          0          0   IO-APIC  23-fasteoi   ehci_hcd:usb1, uhci_hcd:usb2, uhci_hcd:usb4
 25:          2     755654          3          3          1          1          3          6   PCI-MSI 2621440-edge      eth0
 27:          0          0          0          0          0          0          0          1   PCI-MSI 131072-edge      ioat-msi
NMI:       6756        678       6894       5867        861       2168       4994       3700   Non-maskable interrupts
LOC:     343554     578094    1736638     773135     219952     777567    1459249     689292   Local timer interrupts
SPU:          0          0          0          0          0          0          0          0   Spurious interrupts
PMI:       6756        678       6894       5867        861       2168       4994       3700   Performance monitoring interrupts
IWI:       6756        678       6894       5867        861       2168       4994       3700   IRQ work interrupts
RTR:          0          0          0          0          0          0          0          0   APIC ICR read retries
RES:      82594     294601     142535     259797      77845     316210      84927     261455   Rescheduling interrupts
CAL:       4749       9296       7358      31330       7560       8564       5751      20364   Function call interrupts
TLB:       5933       2044      12867      11215       6563       4682       8669       8272   TLB shootdowns
TRM:          0          0          0          0          0          0          0          0   Thermal event interrupts
THR:          0          0          0          0          0          0          0          0   Threshold APIC interrupts
DFR:          0          0          0          0          0          0          0          0   Deferred Error APIC interrupts
MCE:          0          0          0          0          0          0          0          0   Machine check exceptions
MCP:        292        292        292        292        292        292        292        292   Machine check polls
HYP:          0          0          0          0          0          0          0          0   Hypervisor callback interrupts
ERR:          0
MIS:          0
PIN:          0          0          0          0          0          0          0          0   Posted-interrupt notification event
PIW:          0          0          0          0          0          0          0          0   Posted-interrupt wakeup event

我安装ubuntu 16.10 64bit在我的电脑上并perf record -b成功运行。我认为内核linux-tools-4.2.0-27-genericlinux-cloud-tools-4.2.0-27-generic包中可能有问题。

4

0 回答 0