From: Namhyung Kim <namhyung@kernel.org>
To: Leo Yan <leo.yan@arm.com>
Cc: Steve Clevenger <scclevenger@os.amperecomputing.com>,
james.clark@linaro.org, mike.leach@linaro.org,
suzuki.poulose@arm.com, ilkka@os.amperecomputing.com,
coresight@lists.linaro.org, linux-perf-users@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V8 0/4] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset
Date: Wed, 9 Oct 2024 17:20:55 -0700 [thread overview]
Message-ID: <Zwcd52bq3AqetafI@google.com> (raw)
In-Reply-To: <b484a69a-534f-4274-a000-94edf4d2521d@arm.com>
On Wed, Oct 09, 2024 at 04:24:29PM +0100, Leo Yan wrote:
> Hi Namhyung,
>
> On 10/8/2024 10:00 PM, Namhyung Kim wrote:
>
> [...]
>
> > On Tue, Oct 08, 2024 at 11:24:45AM -0700, Steve Clevenger wrote:
> >>
> >> Hello Namhyung,
> >>
> >> Sorry your question is so late. I don't include the ELF headers here,
> >> but the problem can be seen with a perf.data packet dump of user
> >> instruction trace capture. The problem is with the non-zero pgoff. The
> >> arm-cs-trace-disasm.py script was never passed pgoff information to
> >> adjust the start/end disassemble range passed to objdump. This patch
> >> distributes the fix between perf and the arm-cs-trace-disasm.py script.
> >>
> >> Here's a brief excerpt from an e-mail I sent to James Clark describing
> >> the patch before I submitted it.
> >
> > Oh, is it applied to the coresight tree already?
>
> No.
>
> > I don't think I got> any notification for that. Please make sure to notify
> perf maintainers
> > (and hopefullly to get Ack's) when you touch non-coresight part of the
> > code.
> >
> > Also I think we need to clarify how to route coresight tool patches. I
> > thought they are going through the perf-tools tree. But it doesn't seem
> > to be the case?
>
> AFAIK, in most cases, Arm patches for the perf will be picked up via
> perf-tools tree, including this patch series.
Ok, I was confused and thought it was applied there.
Thanks,
Namhyung
>
> [...]
> >> Fedora 39:
> >>
> >> 4294967295 18446744073709551615 0x8ac8 [0x78]: PERF_RECORD_MMAP2
> >> 18229/18229: [0xffffa5512000(0x1d000) @ 0x10000 103:04 161 4093340249]:
> >> r-xp /usr/lib/ld-linux-aarch64.so.1
> >>
> >> 4294967295 18446744073709551615 0x8b40 [0x60]: PERF_RECORD_MMAP2
> >> 18229/18229: [0xffffa554f000(0x1000) @ 0 00:00 0 0]: r-xp [vdso]
> >> 4294967295 18446744073709551615 0x8ba0 [0x68]: PERF_RECORD_MMAP2
> >> 18229/18229: [0xaaaade7e0000(0xb000) @ 0x10000 103:04 536876423
> >> 421616320]: r-xp /usr/bin/dd
> >> 4294967295 18446744073709551615 0x8c08 [0x70]: PERF_RECORD_MMAP2
> >> 18229/18229: [0xffffa5360000(0x11f000) @ 0x30000 103:04 536873199
> >> 2415801053]: r-xp /usr/lib64/libc.so.6
> >>
> >> The arm-cs-trace-disasm.py script never gets to see the text offset into
> >> the dso binaries, so has no opportunity to adjust the start/end address
> >> range passed to objdump. This wasn’t a problem on Fedora 37 and below
> >> since there’s no start/end adjustment for a zero text offset. On Fedora
> >> 38/39 distros, the instruction trace shows unconditional branch
> >> instructions which do not branch to the target address, the clearest
> >> indication of trouble.
> >
> > Ok, thanks for sharing this. I'm ok with exposing pgoff to the python
> > script itself. But I'd like to make sure if it works correctly with
> > PIEs that have non-zero page offsets in other places (probably ok).
>
> Fair point. The 'pgoff' is exposed from the kernel's VMA info, it is a runtime
> value after the DSO loading. After set the MAPPING_TYPE__IDENTITY type for PIE
> DSO, the 'pgoff' will be ignored in both the perf tool (see map__map_ip()) and
> the script.
>
> Sorry that I missed this part when reviewed the change. I understood Steve
> have verified the script result. Seems to me, the critical question is kernel
> has an offset for PIE DSO but why ignore it in the tool.
>
> @Steve, if you have more info, could you explain a bit what is the reason for
> ignoring pgoff for PIE DSO?
>
> Thanks,
> Leo
prev parent reply other threads:[~2024-10-10 0:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 21:30 [PATCH V8 0/4] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset Steve Clevenger
2024-09-09 21:29 ` [PATCH V8 4/4] Adjust objdump start/end range per map pgoff parameter Steve Clevenger
2024-09-10 8:03 ` Leo Yan
2024-09-09 21:29 ` [PATCH V8 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Steve Clevenger
2024-09-09 21:30 ` [PATCH V8 2/4] Force MAPPING_TYPE__IDENTIY for PIE Steve Clevenger
2024-09-09 21:30 ` [PATCH V8 1/4] Add dso__is_pie call to identify ELF PIE Steve Clevenger
2024-10-09 21:13 ` Leo Yan
2024-10-10 16:30 ` Steve Clevenger
2024-10-08 5:51 ` [PATCH V8 0/4] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset Namhyung Kim
2024-10-08 18:24 ` Steve Clevenger
2024-10-08 21:00 ` Namhyung Kim
2024-10-08 22:12 ` Steve Clevenger
2024-10-09 15:24 ` Leo Yan
2024-10-10 0:20 ` Namhyung Kim [this message]
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=Zwcd52bq3AqetafI@google.com \
--to=namhyung@kernel.org \
--cc=coresight@lists.linaro.org \
--cc=ilkka@os.amperecomputing.com \
--cc=james.clark@linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=scclevenger@os.amperecomputing.com \
--cc=suzuki.poulose@arm.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 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.