Re: Does perf-annotate work correctly?

From: Du, Changbin
Date: Wed Sep 13 2017 - 05:20:26 EST



Here is another example which may be easy to analyse. I beleve that something wrong
in parsing objdump output.

The 'test %esi,%esi' is not of 'if (unlikely(error))', but 'if (!idtv_info_valid)'.


perf annotate of function vmx_complete_interrupts():
vmx_complete_interrupts /lib/modules/4.13.0+/kernel/arch/x86/kvm/kvm-intel.ko
Percentâ mov 0x4590(%rdi),%esi â
â vmx_cancel_injection(): â
â vmcs_read32(VM_ENTRY_INTR_INFO_FIELD), â
â VM_ENTRY_INSTRUCTION_LEN, â
â VM_ENTRY_EXCEPTION_ERROR_CODE); â
â â
â vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0); â
â } â
â movb $0x0,0x32c8(%rdi) â
â __vmx_complete_interrupts(): â
â movb $0x0,0x1a7c(%rdi) â
â movb $0x0,0x1a88(%rdi) â
â __vmcs_writel(): â
â u8 error; â
â â
â asm volatile (__ex(ASM_VMX_VMWRITE_RAX_RDX) "; setna %0" â
â : "=q"(error) : "a"(value), "d"(field) : "cc"); â
â if (unlikely(error)) â
â vmwrite_error(field, value); â
0.02 â test %esi,%esi â
â â js 25 â
99.98 â â retq â
â25: push %rbp â
â mov $0x440a,%ecx â
â mov $0x440c,%edx â
â vmx_complete_interrupts(): â
â break; â
â } â
â } â
â â
â static void vmx_complete_interrupts(struct vcpu_vmx *vmx) â
â { â
â mov %rsp,%rbp â
â â callq __vmx_complete_interrupts.part.64 â
â __vmx_complete_interrupts(&vmx->vcpu, vmx->idt_vectoring_info, â
â pop %rbp â
â â retq â




GDB disassable:
(gdb) disassemble /s vmx_complete_interrupts
Dump of assembler code for function vmx_complete_interrupts:
arch/x86/kvm/vmx.c:
8917 {
0x0000000000007110 <+0>: callq 0x7115 <vmx_complete_interrupts+5>

8918 __vmx_complete_interrupts(&vmx->vcpu, vmx->idt_vectoring_info,
0x0000000000007115 <+5>: mov 0x4590(%rdi),%esi

8873 vcpu->arch.nmi_injected = false;
0x000000000000711b <+11>: movb $0x0,0x32c8(%rdi)

arch/x86/kvm/x86.h:
14 vcpu->arch.exception.pending = false;
0x0000000000007122 <+18>: movb $0x0,0x1a7c(%rdi)

15 }
16
17 static inline void kvm_queue_interrupt(struct kvm_vcpu *vcpu, u8 vector,
18 bool soft)
19 {
20 vcpu->arch.interrupt.pending = true;
21 vcpu->arch.interrupt.soft = soft;
22 vcpu->arch.interrupt.nr = vector;
23 }
24
25 static inline void kvm_clear_interrupt_queue(struct kvm_vcpu *vcpu)
26 {
27 vcpu->arch.interrupt.pending = false;
0x0000000000007129 <+25>: movb $0x0,0x1a88(%rdi)

arch/x86/kvm/vmx.c:
8877 if (!idtv_info_valid)
0x0000000000007130 <+32>: test %esi,%esi
0x0000000000007132 <+34>: js 0x7135 <vmx_complete_interrupts+37>

8919 VM_EXIT_INSTRUCTION_LEN,
8920 IDT_VECTORING_ERROR_CODE);
8921 }
0x0000000000007134 <+36>: retq

8917 {
0x0000000000007135 <+37>: push %rbp
0x0000000000007136 <+38>: mov $0x440a,%ecx
0x000000000000713b <+43>: mov $0x440c,%edx
---Type <return> to continue, or q <return> to quit---
0x0000000000007140 <+48>: mov %rsp,%rbp
0x0000000000007143 <+51>: callq 0x7000 <__vmx_complete_interrupts>

8919 VM_EXIT_INSTRUCTION_LEN,
8920 IDT_VECTORING_ERROR_CODE);
8921 }

Attachment: signature.asc
Description: PGP signature