All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Du, Changbin" <changbin.du@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: "Du, Changbin" <changbin.du@intel.com>,
	peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org
Subject: Re: Does perf-annotate work correctly?
Date: Wed, 13 Sep 2017 17:14:09 +0800	[thread overview]
Message-ID: <20170913091408.GA9625@intel.com> (raw)
In-Reply-To: <20170912143350.GA3452@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 6209 bytes --]


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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2017-09-13  9:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 10:10 Does perf-annotate work correctly? Du, Changbin
2017-09-12 14:33 ` Arnaldo Carvalho de Melo
2017-09-13  1:54   ` Du, Changbin
2017-09-26  6:06     ` Du, Changbin
2017-09-13  9:14   ` Du, Changbin [this message]
2017-10-13 10:15     ` Du, Changbin
2017-10-16  9:28       ` Jiri Olsa
2017-10-16  9:34         ` Du, Changbin
2017-10-16  9:30       ` Jiri Olsa
2017-10-16  9:35         ` Du, Changbin
2017-10-16 10:45           ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170913091408.GA9625@intel.com \
    --to=changbin.du@intel.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.