From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by sourceware.org (Postfix) with ESMTPS id AC07D3858D39 for ; Tue, 2 Apr 2024 15:58:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC07D3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AC07D3858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1136 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712073501; cv=none; b=n2L/y4z1zEyYuBgT+lTa/8RQBewEaqQ2hiQx9WxKOMuBdr7/uPbPCXGPpcw3IX5I077ojSEmNR2fUB9aKXAwTbDmAhEDpxwO8No0xV0nbZd9/MycwV5AiVrywpnZW/b2q219UgphFoL+rCtdPz/teXXLBv/nmZTulCPZuQqfrak= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712073501; c=relaxed/simple; bh=PCo7xKC9QIWFZxDbZmRfZf/f8NPoZgmtz0QfDlx7zi4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Gxu3Tx60tuxUVEM5GSKT+7V6Blm8WYCeQF9OeQL2UbwoiaJM8LrMnNhiAfeHJ1wHh6PUSvEIyQpf3JCQlRtQE1o8r7xpfg+sFLzRLkqTkU/zsvto5oeU022+YSlg6jCoQT0YRbOedX0uHSz0DJE5axd6V6hD30rAzEvFaFEvrZ4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-6114c9b4d83so39026937b3.3 for ; Tue, 02 Apr 2024 08:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712073499; x=1712678299; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Agh5Oguiw7L/D0IZ8CwnEFIamK9cAs8/5wW5a/xrZ2s=; b=b3jvoiVjmNPMHEbY7DNaZBULfxv9NXjvZOlB5UnOChTS2cxAOeBJzUc5hsWfEpFTpP zMVq4ZjsOb+lXam2Mbq5f2gFzJ93bb5FTQiKqeDBaiP67WhbJYt/NUq5SvIYg9q3Z9kQ Ym/S0pLmZug1VbBFMJTDKGEWqWWQ+OVvqlHmOnI+yQbK97YMWFOZCG5o2w4FL3UUfJ5R LIb5bJbk0LStWbEPZoKwil/yFICUx4ZVYlxZUWQLZK4rVtTphC79+Qudsojd0YA+45yS OnhFQkYhQz5/wstUtD3ap4O4QdjrSWG1tXSmHW4+myB9NbGIdlu/xnYu/lU9tmvo8kkj bgGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712073499; x=1712678299; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Agh5Oguiw7L/D0IZ8CwnEFIamK9cAs8/5wW5a/xrZ2s=; b=vZwTRRUbq7WUXOwdSJbZXmyb01khSaXIvHBgMXxMSYOzTJmqxn2+t4Nqah0Q2p4cVA xU2hcJqVDMNNg7s0Ak1cLWtILwMxO5Udpj5Cw8/9j9fMiuCX/csiExSCUphwaYCjExMo rAarYymRcTW7z0ddBdxJWN+X1FYHdD9cswpLFlmCzkpAwYefva1MBoRZfkitriL4ZG7r 4AZRiAblltewJUdeyn5qMERW69bA4oHttgskfqJ5okupUiWg+GiDnvFTanbbvkyg5cTR xIOXrOmt1iE31M9YzjEzSY/TxRjr8LaOmkneZ+ZEy1xvUqbXcp4NFTgA/eKUditChMe9 bXDw== X-Gm-Message-State: AOJu0YzpXXYsv0JCvdym4SvMFMwa0oTlkePPBWvNuDy/YmVQGr0zYcd+ querQ0Q49+rUSPcBZv2dRjQI57ioAuR0hRU6mJkMqCTL9+eqI4dUqBX+/UQfHLV1Ye+Czu+X35U mFnKpOeX03OaWwPDXYSlg7MSMScw= X-Google-Smtp-Source: AGHT+IFhkv+2FPxsss/m1lZFlVX22C3rA00qgFFEi7z1HVujCTzUQ6vPm2yOG6/h78YXZuIJ40IKvbbNGgKouqt/k2k= X-Received: by 2002:a0d:f3c7:0:b0:609:ff22:1a88 with SMTP id c190-20020a0df3c7000000b00609ff221a88mr9869829ywf.44.1712073498981; Tue, 02 Apr 2024 08:58:18 -0700 (PDT) MIME-Version: 1.0 References: <20240305214521.326316-1-hjl.tools@gmail.com> In-Reply-To: From: "H.J. Lu" Date: Tue, 2 Apr 2024 08:57:42 -0700 Message-ID: Subject: Re: PING: [PATCH v2] tree-profile: Don't instrument an IFUNC resolver nor its callees To: Jan Hubicka Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3013.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,WEIRD_PORT autolearn=ham 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, Apr 2, 2024 at 7:50=E2=80=AFAM Jan Hubicka wrote: > > > On Tue, Mar 5, 2024 at 1:45=E2=80=AFPM H.J. Lu wr= ote: > > > > > > We can't instrument an IFUNC resolver nor its callees as it may requi= re > > > 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 sk= ip > > > 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 IFUN= C > > > 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. Will change it. > Also the patch will be noop with -flto -flto-partition=3Dmax, so probably > we need to compute this flag at WPA time and stream to partitions. > Why is it a nop with -flto -flto-partition=3Dmax? I got (gdb) bt #0 symtab_node::check_ifunc_callee_symtab_nodes () at /export/gnu/import/git/gitlab/x86-gcc/gcc/symtab.cc:1440 #1 0x0000000000e487d3 in symbol_table::compile (this=3D0x7fffea006000) at /export/gnu/import/git/gitlab/x86-gcc/gcc/cgraphunit.cc:2320 #2 0x0000000000d23ecf in lto_main () at /export/gnu/import/git/gitlab/x86-gcc/gcc/lto/lto.cc:687 #3 0x00000000015254d2 in compile_file () at /export/gnu/import/git/gitlab/x86-gcc/gcc/toplev.cc:449 #4 0x00000000015284a4 in do_compile () at /export/gnu/import/git/gitlab/x86-gcc/gcc/toplev.cc:2154 #5 0x0000000001528864 in toplev::main (this=3D0x7fffffffd84a, argc=3D16, argv=3D0x42261f0) at /export/gnu/import/git/gitlab/x86-gcc/gcc/toplev.c= c:2310 #6 0x00000000030a3fe2 in main (argc=3D16, argv=3D0x7fffffffd958) at /export/gnu/import/git/gitlab/x86-gcc/gcc/main.cc:39 Do you have a testcase to show that it is a nop? --=20 H.J.