linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Clevenger <scclevenger@os.amperecomputing.com>
To: Leo Yan <leo.yan@arm.com>, james.clark@linaro.org, mike.leach@linaro.org
Cc: 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 V2 3/5] Force MAPPING_TYPE__IDENTIY for PIE
Date: Tue, 27 Aug 2024 18:41:25 -0700	[thread overview]
Message-ID: <9c7fcc8f-1475-42ba-8fb4-e4e76c56d869@os.amperecomputing.com> (raw)
In-Reply-To: <9ab26232-90af-4e6a-9960-a8486f0d7bf5@arm.com>



On 8/27/2024 12:55 PM, Leo Yan wrote:
> On 8/26/2024 10:35 PM, Steve Clevenger wrote:
>>
>> Changes in V2:
>>   - Updated mailing list distribution
>>
>> Use dso__is_pie() to check whether the DSO file is a Position
>> Independent Executable (PIE). If PIE, change the MAPPING_TYPE to
>> MAPPING_TYPE__IDENTITY so a zero map pgoff (text offset) is passed
>> into the script.
>>
>>
>> Signed-off-by: Steve Clevenger <scclevenger@os.amperecomputing.com>
>> ---
>>  tools/perf/util/map.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
>> index e1d14936a60d..df7c06fc373e 100644
>> --- a/tools/perf/util/map.c
>> +++ b/tools/perf/util/map.c
>> @@ -171,8 +171,11 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
>>                 assert(!dso__kernel(dso));
>>                 map__init(result, start, start + len, pgoff, dso);
>>
>> +               if (map->pgoff && !no_dso)
>> +                       no_dso = dso__is_pie(dso);      // PIE check
> 
> Here the logic is whatever the `pgoff` is (zero or non-zero), we need to
> always set the mapping type as MAPPING_TYPE__IDENTITY. It is no need to check
> pgoff and is no matter with 'no_dso'. So we can simply check dso__is_pie() and
> set IDENTITY flag for the true case.
> 
>     if (dso__is_pie(dso)) {
>             map__set_mapping_type(map, MAPPING_TYPE__IDENTITY);
>     } else if (anon || no_dso) {
>             ...
>     }
> 
> BTW, please rebase the series on the top of the perf-tools-next branch [1], I
> saw this patch has merging conflict on it.
> 
> Thanks,
> Leo

Hi Leo,

I combined the dso__is_pie() call onto the end of the existing 'if'
statement you now show as an 'else if'. Please see V3 of the patch series.

Steve

> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
>     branch: perf-tools-next
>> +
>>                 if (anon || no_dso) {
>> -                       map->mapping_type = MAPPING_TYPE__IDENTITY;
>> +                       map__set_mapping_type(map, MAPPING_TYPE__IDENTITY);
>>
>>                         /*
>>                          * Set memory without DSO as loaded. All map__find_*
>> --
>> 2.25.1
>>


  reply	other threads:[~2024-08-28  1:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1724707494.git.scclevenger@os.amperecomputing.com>
2024-08-26 21:35 ` [PATCH V2 1/5] Add dso__is_pie call to identify ELF PIE Steve Clevenger
2024-08-26 21:35 ` [PATCH V2 0/5] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset Steve Clevenger
2024-08-26 21:35   ` [PATCH V2 5/5] Adjust objdump start/end range per map pgoff parameter Steve Clevenger
2024-08-27 20:23     ` Leo Yan
2024-08-28  1:49       ` Steve Clevenger
2024-08-26 21:35   ` [PATCH V2 4/5] Add map pgoff to python dictionary based on MAPPING_TYPE Steve Clevenger
2024-08-26 21:35   ` [PATCH V2 3/5] Force MAPPING_TYPE__IDENTIY for PIE Steve Clevenger
2024-08-27 19:55     ` Leo Yan
2024-08-28  1:41       ` Steve Clevenger [this message]
2024-08-26 21:35   ` [PATCH V2 2/5] Add dso__is_pie prototype Steve Clevenger
2024-08-27 19:29     ` Leo Yan

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=9c7fcc8f-1475-42ba-8fb4-e4e76c56d869@os.amperecomputing.com \
    --to=scclevenger@os.amperecomputing.com \
    --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=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 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).