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

Reply via email to