public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: PING: [PATCH v2] tree-profile: Don't instrument an IFUNC resolver nor its callees
Date: Tue, 2 Apr 2024 16:50:17 +0200	[thread overview]
Message-ID: <ZgwbKb58WVu5lwtl@kam.mff.cuni.cz> (raw)
In-Reply-To: <CAMe9rOpx-_cMm0-Dg6neDKiyYOU5mEJ07sV4b2+p6epVDofB6w@mail.gmail.com>

> On Tue, Mar 5, 2024 at 1:45 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > We can't instrument an IFUNC resolver nor its callees as it may require
> > TLS which hasn't been set up yet when the dynamic linker is resolving
> > IFUNC symbols.
> >
> > Add an IFUNC resolver caller marker to cgraph_node and set it if the
> > function is called by an IFUNC resolver.  Update tree_profiling to skip
> > functions called by IFUNC resolver.
> >
> > Tested with profiledbootstrap on Fedora 39/x86-64.
> >
> > gcc/ChangeLog:
> >
> >         PR tree-optimization/114115
> >         * cgraph.h (symtab_node): Add check_ifunc_callee_symtab_nodes.
> >         (cgraph_node): Add called_by_ifunc_resolver.
> >         * cgraphunit.cc (symbol_table::compile): Call
> >         symtab_node::check_ifunc_callee_symtab_nodes.
> >         * symtab.cc (check_ifunc_resolver): New.
> >         (ifunc_ref_map): Likewise.
> >         (is_caller_ifunc_resolver): Likewise.
> >         (symtab_node::check_ifunc_callee_symtab_nodes): Likewise.
> >         * tree-profile.cc (tree_profiling): Do not instrument an IFUNC
> >         resolver nor its callees.
> >
> > gcc/testsuite/ChangeLog:
> >
> >         PR tree-optimization/114115
> >         * gcc.dg/pr114115.c: New test.
> 
> PING.

I am bit worried about commonly used functions getting "infected" by
being called once from ifunc resolver.  I think we only use thread local
storage for indirect call profiling, so we may just disable indirect
call profiling for these functions.

Also the patch will be noop with -flto -flto-partition=max, so probably
we need to compute this flag at WPA time and stream to partitions.

Honza

  reply	other threads:[~2024-04-02 14:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 21:45 H.J. Lu
2024-04-02 14:41 ` PING: " H.J. Lu
2024-04-02 14:50   ` Jan Hubicka [this message]
2024-04-02 15:57     ` H.J. Lu
2024-04-02 17:03       ` Jan Hubicka
2024-04-03 12:41         ` H.J. Lu

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=ZgwbKb58WVu5lwtl@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).