Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3802975imu; Tue, 18 Dec 2018 04:33:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/UIJ9OiiZ8CHViYjKGDm1V6gms3j2FOdGO2p/32TpEUTqMuqSY4JHAm4ECtpTo/m6IMDo94 X-Received: by 2002:a63:d547:: with SMTP id v7mr15389627pgi.339.1545136411587; Tue, 18 Dec 2018 04:33:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545136411; cv=none; d=google.com; s=arc-20160816; b=wwufgGDHx5b8PiR5bR/TtcT6NjLmNuUpf23rasqMwwAL8FO5D7H5SAn0p9+t9PIyCy kpiRdpG4E1mrAErwGdLJ1RFMTjGl8Qh/EFs268n6gQY7geY0DseMh6CfT6QhXD0IgdWZ qfZXAJ7kwJPn0sVaLAxbmCEdsfIz4c5QEOynSs8WHg+Ipj24H9swb/f3TXrrXbQlaT7k TAjEX7YmXFU7HZ/X35/oeIexhAQAFg3OnRMSK5OgG2Y7el6I8foBodVhBbQOxg3ufMID SrMlz16qmYnyjuJcxVSbCWLjAPMAM9T6c3JGrAsXQDN2egumk5fGma25GfdmqSCgKWIt Qt2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=UNOkkhZTME+wEELRaBaQltw/usA53t1+HRHUHehqxLk=; b=DeMd2qdWpXLeAxBSPYpnhDushRxc8xl9FGUdUQ2nxM3YcYY6QE3IGOHil/AMv+8Tk7 ArsjXgpeTgGs+5y6diCf7HLHJqL7I8L68NQjMfWVd+BVHa57zdEO4CfPEYh2MhsFcP9b 6qQOHSShqtqghdgV1zdac1pU/mVK3JiOegNYJOFfjWvZK3i/EZqg5bGsRYRKE7Vm6DFk n9zJshES31aTs2yJtVtgYIJJQeoCh0IEHss3NWExzxQVUxNoguO7r7Fj81yn8uMvSq4j qpHP/PJzry0RSFiYSo0be3UFfs7eXF8jaeIIv5H6kPP3Uj81k7RptRde1+wBq/bUQGrM 8saQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t186si12152536pfd.68.2018.12.18.04.33.16; Tue, 18 Dec 2018 04:33:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726610AbeLRMbs (ORCPT + 99 others); Tue, 18 Dec 2018 07:31:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:52880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbeLRMbr (ORCPT ); Tue, 18 Dec 2018 07:31:47 -0500 Received: from vmware.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CECC20874; Tue, 18 Dec 2018 12:31:46 +0000 (UTC) Date: Tue, 18 Dec 2018 07:31:43 -0500 From: Steven Rostedt To: Martin Jambor Cc: Miroslav Benes , Josh Poimboeuf , Andi Kleen , Peter Zijlstra , Arnd Bergmann , Linux Kernel Mailing List , "the arch\/x86 maintainers" Subject: Re: objtool warnings for kernel/trace/trace_selftest_dynamic.o Message-ID: <20181218073143.1536e8e9@vmware.local.home> In-Reply-To: References: <20181217173900.ygifx7khwmzn2gv2@treble> <20181217180434.GS25620@tassilo.jf.intel.com> <20181217181638.dfexg6mkmbfyzfli@treble> <20181217192938.GF2218@hirez.programming.kicks-ass.net> <20181217213126.lsqhyszoulel6uq6@treble> <20181217173644.391c2070@gandalf.local.home> <20181218000618.GA25620@tassilo.jf.intel.com> <20181218024916.vmfnyqzouhfxhyvc@treble> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Dec 2018 13:15:40 +0100 Martin Jambor wrote: > I am the developer who introduced attribute noclone to GCC and also the > one who advises against using it :-) ...at least without also using the > noinline attribute, the combination means "I want only one or zero > copies of this function in the compiled assembly" which you might need > if you do fancy stuff in inline assembly, for example. Sounds to me that we should not be using noclone in this instance. > > I believe that when people use noclone on its own, in 99 out 100 cases > they actually want something else. Usually there is something that > references the function from code (such as assembly) or a tool that the > compiler does know about and then they should use the "used" attribute. > That is what I understood to be the use case here and therefore I > recommended it. In other cases people want all inter-procedural (IPA) > analyses to stay away from a function and then they should use attribute > noipa (or in older GCCs, the combination of noinline and noclone). > > The attribute was introduced because it is useful in GCC testsuite, and > although I think occasions when it is useful on its own elsewhere are > very rare and quite obscure, they can happen. But it really only means > you want only one or zero *non-inlined* copies of the function. For > example if you have an asm in it that must appear in the compiled > assembly only once but you are confident it will be optimized out in > inlined instances. Or if you play games with __builtin_return_address() > and somehow have a very clear idea what the return values should be. With this explanation, I really believe the answer is s/noclone/used/. Here's the problem that the "noinline noclone" is trying to solve. When someone compiles with LTO (which links much more and can remove unused functions, or inline them better) the ftrace dynamic self test functions can be inlined. If that happens, they lose the "mcount/fentry" from gcc -pg. Which was the reason they were made, and placed in a separate file to begin with. Then when the self tests try to enable function tracing on these functions, they can't and the boot up tests fail, disabling ftrace. The "noinline noclone" was added to prevent this case. And from your description, it sounds like "noinline used" is what we actually want. -- Steve