linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jayaramappa, Srilakshmi" <sjayaram@akamai.com>
To: Ian Rogers <irogers@google.com>
Cc: "linux-perf-users@vger.kernel.org" <linux-perf-users@vger.kernel.org>
Subject: Re: Symbol resolution when text in hugepages
Date: Tue, 19 Sep 2023 20:51:06 +0000	[thread overview]
Message-ID: <0915ceb147174fc4a09a2a0b774c01bb@akamai.com> (raw)
In-Reply-To: <e4473389303b43f1aa063d3dcf72ad57@akamai.com>

From: Ian Rogers <irogers@google.com>
Sent: Thursday, September 14, 2023 4:26 PM
To: Jayaramappa, Srilakshmi
Cc: linux-perf-users@vger.kernel.org
Subject: Re: Symbol resolution when text in hugepages
    
On Wed, Sep 13, 2023 at 5:21 PM Jayaramappa, Srilakshmi
<sjayaram@akamai.com> wrote:
>
> Hi all,
>
> We have an application that has its text section backed by hugepages. In our new build environment the text section of the binary is split up into read and read/execute sections with offsets into the segment. This is breaking the perf symbol resolution. Previously,  everything was in one segment and there was no offset, so perf functioned fine. I know we can dump the symbols from readelf into /tmp/perf-PID.map file. I was wondering if anyone has a cleaner solution? I'd appreciate any pointers you have.

Hi Sri,

Since Linux 5.4 you can use MADV_HUGEPAGE with madvise for file backed
pages. It can still be profitable to use other sources of huge pages
so that you don't wait for the hugepage to be formed, in that case if
there is a file/memfd_create you can embed the information in the
filename. For anonymous pages you can merge them when scanning the
executable in perf_event__synthesize_mmap_events, but it can be
problematic if the program header is on an anonymous page.

Thanks,
Ian

> Thanks
> Sri



[resending since my message bounced from the mailing list. Apologies for the spam, Ian]

Thank you for the response, Ian, appreciate it. The pointer to perf_event__synthesize_mmap_events  is super useful, we will need to do something like that to find if the address range is backed by hugepages and if so grab the offset from the executable. 


For more context - our application first loads and then we remap its text segment to hugepages via the libhugetlbfs. When that happens the memory map doesn't need any offset. But perf is grabbing the maps from the /proc/pid/maps and trying  to lookup the address in the binary, so it looks at the wrong place without the offset into the file. 


Thanks!
Sri      

  parent reply	other threads:[~2023-09-19 20:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 23:50 Symbol resolution when text in hugepages Jayaramappa, Srilakshmi
2023-09-14 23:26 ` Ian Rogers
     [not found]   ` <e4473389303b43f1aa063d3dcf72ad57@akamai.com>
2023-09-19 20:51     ` Jayaramappa, Srilakshmi [this message]
2023-09-20 15:18       ` Ian Rogers

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=0915ceb147174fc4a09a2a0b774c01bb@akamai.com \
    --to=sjayaram@akamai.com \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.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 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).