From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 5317B3858D28 for ; Tue, 2 Apr 2024 14:50:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5317B3858D28 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kam.mff.cuni.cz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5317B3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.113.20.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712069421; cv=none; b=UFEkCP3DnVQ857BfKcRCZJxFTuyZDdKHLkpGP/QEQZ6k0YUcyyXnyn75SzoTBjG/By6E0utwjFJJtnhK5y2N5NX1zUvrrVmghF2U9bNuccnDBQ5tSPdFiLLCjD3feS8230aEnFWMeot5MDdsrJguZGAy0gUKtQ1ksfpNrGTjZEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712069421; c=relaxed/simple; bh=dHf8hrNLSRWPhBFQFLV9agX4SqmhB3rxpIMHX1ytFsI=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=x0GHNpqLOCrl/qyWILCXEniOOhNqdRs5wPR+kpWMjTS5dbg/jzBT8lWKOOFqZZ0bvwuscBfpTONJieqLSnP8hS8TySHhwtkXtPgLFMefHZYZyW5zvM25KU/bm66Gmx6FmPLwyiO7aABRCcxDFTjbcjZQK1orsg792mvk84VuZb8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id DADB128601A; Tue, 2 Apr 2024 16:50:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1712069417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qfP4K4IG1plhccF3IyZnHlReep7mDnqJL8R69wy5DX4=; b=kZDXCHkpZb6cV0zaskHib6p+pURMfLOKbop+QfLbT/zZrjE6Y+6XPNj3VZ3nO2c+GPGvXN C67/vObL3JYznGtLztr2ruohJ5FL5XYiEwjNYy2RUyfkhkXIqey/WcnxHnRFFuzl9hPlQN w1Dlh3EO8KeH4qeVBBDHk1Is2d0Ec2A= Date: Tue, 2 Apr 2024 16:50:17 +0200 From: Jan Hubicka To: "H.J. Lu" Cc: GCC Patches Subject: Re: PING: [PATCH v2] tree-profile: Don't instrument an IFUNC resolver nor its callees Message-ID: References: <20240305214521.326316-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > On Tue, Mar 5, 2024 at 1:45 PM H.J. Lu 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