From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Andi Kleen <ak@linux.intel.com>
Cc: "Ingo Molnar" <mingo@kernel.org>,
"Clark Williams" <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"David Ahern" <dsahern@gmail.com>,
"Jin Yao" <yao.jin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>, "Martin Liška" <mliska@suse.cz>,
"Namhyung Kim" <namhyung@kernel.org>,
"Ravi Bangoria" <ravi.bangoria@linux.vnet.ibm.com>,
"Thomas Richter" <tmricht@linux.vnet.ibm.com>,
"Wang Nan" <wangnan0@huawei.com>
Subject: Re: [PATCH 17/17] perf annotate: Handle variables in 'sub', 'or' and many other instructions
Date: Fri, 13 Apr 2018 14:20:35 -0300 [thread overview]
Message-ID: <20180413172035.GB26496@kernel.org> (raw)
In-Reply-To: <20180413162043.GD6694@tassilo.jf.intel.com>
Em Fri, Apr 13, 2018 at 09:20:43AM -0700, Andi Kleen escreveu:
> On Fri, Apr 13, 2018 at 11:01:11AM -0300, Arnaldo Carvalho de Melo wrote:
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Just like is done for 'mov' and others that can have as source or
> > targets variables resolved by objdump, to make them more compact:
> >
> > - orb $0x4,0x224d71(%rip) # 226ca4 <_rtld_global+0xca4>
> > + orb $0x4,_rtld_global+0xca4
> That's not equivalent. It could be non rip relative too. You would need
> to keep at least the (%rip).
So, the function is _dl_start in /lib64/ld-2.26.so, the objdump output
is:
0000000000001b10 <_dl_start>:
<SNIP>
1d1f: 0f 84 ab 00 00 00 je 1dd0 <_dl_start+0x2c0>
1d25: 48 8d 3d 64 3c 22 00 lea 0x223c64(%rip),%rdi # 225990 <_rtld_global+0x990>
1d2c: 80 0d 71 3f 22 00 04 orb $0x4,0x223f71(%rip) # 225ca4 <_rtld_global+0xca4>
1d33: e8 78 92 00 00 callq afb0 <_dl_setup_hash>
<SNIP>
Then...
21: 0000000000225000 3960 OBJECT GLOBAL DEFAULT 20 _rtld_global@@GLIBC_PRIVATE
0x225ca4 = 0x225000 + 0x0xca4
And that is equal to 0x1d33 + 0x223f71
What do I miss? Or where is it that I'm misinterpreting the calculations
that objdump did in its output?
This is just to make things compact, on the TUI if one wants to see the
original its just a matter of pressing 'o', i.e. that line appears by
default as:
perf annotate _dl_start
press HOME
press /orb
<SNIP>
│215: lea _rtld_global+0x990,%rdi
│ orb $0x4,_rtld_global+0xca4
│ → callq _dl_setup_hash
<SNIP>
press 'o', to see details, i.e. was this encoded as rip-relative?
<SNIP>
│1f25: lea 0x224a64(%rip),%rdi # 226990 <_rtld_global+0x990>
│1f2c: orb $0x4,0x224d71(%rip) # 226ca4 <_rtld_global+0xca4>
│1f33: → callq b080 <_dl_setup_hash>
<SNIP>
Now, if we have a non-rip relative orb, lemme search one with:
perf annotate --stdio2
/orb
There, we have one in the kernel's sys_pselect6:
perf annotate sys_pselect6
/orb
│ mov %gs:0x15b40,%rax
│ orb $0x4,0x490(%rax)
│ mov %rdx,0x718(%rax)
│ mov (%rax),%rdx
No variables resolved, nothing done, press 'o' to see the original objdump
disassembled line:
│ffffffff8128af29: mov %gs:0x15b40,%rax
│ffffffff8128af32: orb $0x4,0x490(%rax)
│ffffffff8128af39: mov %rdx,0x718(%rax)
│ffffffff8128af40: mov (%rax),%rdx
About something mildly related: what do you think about this:
http://ref.x86asm.net/, there is a xml file there[1] I'm thinking about
using, if available on the developer's HOME or some other standard place,
to provide help about the instructions :-)
- Arnaldo
[1] http://ref.x86asm.net/x86reference.xml
look for <mnem>PUNPCKHQDQ</mnem>
<entry r="yes">
<pref>66</pref>
<proc_start>10</proc_start>
<syntax>
<mnem>PUNPCKHQDQ</mnem>
<dst>
<a>V</a>
<t>dq</t>
</dst>
<src>
<a>W</a>
<t>dq</t>
</src>
</syntax>
<instr_ext>sse2</instr_ext>
<grp1>simdint</grp1>
<grp2>shunpck</grp2>
<note>
<brief>Unpack High Data</brief>
</note>
</entry>
8-)
next prev parent reply other threads:[~2018-04-13 17:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180413140111.25313-1-acme@kernel.org>
2018-04-13 14:00 ` [PATCH 01/17] perf stat: Enable 1ms interval for printing event counters values Arnaldo Carvalho de Melo
2018-04-13 14:00 ` [PATCH 02/17] tools headers: Restore READ_ONCE() C++ compatibility Arnaldo Carvalho de Melo
2018-04-13 14:00 ` [PATCH 03/17] perf tests: Run dwarf unwind test on arm32 Arnaldo Carvalho de Melo
2018-04-13 14:00 ` [PATCH 04/17] perf annotate: Allow showing offsets in more than just jump targets Arnaldo Carvalho de Melo
2018-04-13 14:00 ` [PATCH 05/17] perf annotate browser: " Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 06/17] perf jvmti: Give hints about package names needed to build Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 07/17] perf tests bpf: Remove unused ptrace.h include from LLVM test Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 08/17] Revert "x86/asm: Allow again using asm.h when building for the 'bpf' clang target" Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 10/17] perf tools: Rename HAVE_SYSCALL_TABLE to HAVE_SYSCALL_TABLE_SUPPORT Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 11/17] perf version: Print status for syscall_table Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 12/17] perf sched: Fix documentation for timehist Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 13/17] perf tests: Disable breakpoint accounting test for powerpc Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 14/17] perf record: Change warning for missing sysfs entry to debug Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 15/17] perf report: Fix switching to another perf.data file Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 16/17] perf annotate: Allow setting the offset level in .perfconfig Arnaldo Carvalho de Melo
2018-04-13 14:01 ` [PATCH 17/17] perf annotate: Handle variables in 'sub', 'or' and many other instructions Arnaldo Carvalho de Melo
2018-04-13 16:20 ` Andi Kleen
2018-04-13 17:20 ` Arnaldo Carvalho de Melo [this message]
2018-04-13 17:39 ` Andi Kleen
2018-04-17 2:56 ` Namhyung Kim
2018-04-17 12:51 ` Arnaldo Carvalho de Melo
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=20180413172035.GB26496@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mliska@suse.cz \
--cc=namhyung@kernel.org \
--cc=ravi.bangoria@linux.vnet.ibm.com \
--cc=tmricht@linux.vnet.ibm.com \
--cc=wangnan0@huawei.com \
--cc=williams@redhat.com \
--cc=yao.jin@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).