Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4395138imu; Tue, 18 Dec 2018 14:09:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/UHMhf538n2xf1kO3iBFc+fClRgyA2KkHSfWel9I69L+VQzELj2O/gA6X7ey+q5a/Ovyv8/ X-Received: by 2002:a62:442:: with SMTP id 63mr17814244pfe.156.1545170988815; Tue, 18 Dec 2018 14:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545170988; cv=none; d=google.com; s=arc-20160816; b=lZe1Si38UUbhuYDTT+I6qZpxIm8I0NEW5a10cQU+WYPUtU5OtL8NjfZc6zUbm0qH6Y SZjJfcit7+mcNn1duz2DTGzAeS5VJxrW6QckyR93jRRJJ31NBtoTRsS7GHAy++rxOAW6 ImtCaYcsxcFBPPgD6cYkzAYmP9rwFai10iI4tfGdPvceqt75XyJh7Efu6FeYBV2byc76 QrArHW//AwKXkL/RH1+Ctf1ftElL7mdkrxBcigeYMn4w48beQtrZ1hdjGnKFkYGH3oGG ZIjBfaSYqqWYJf4NWeNi9iI+mA1mJRGrtmSLm1poB0XR+aPEGw/iRTpeSBlhftbGnQM5 AM0w== 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=1RIAkh059simY2ucmy+OFHBoBG/Rev5CcNEqCQENPhw=; b=hV7/Kp92KkoON1WCVceSNgkdNE7AG2pJroLr99Tm6YbYltlgX/cFZ+zoBHFWpigOYa a6YJ+qjy27laGmHVoYuDOsjpFwaSneRkkOWAZSrywKfYdxZmtruARBQv3SzhgEHNMRtm gpYvuZsnuwGKlcPcl0SF9SSHTQwCLWLLD29+d2sl/Pn+F6lYRxpaTIOtRMIi5daRJ6VP f3jxZS47iI9WIYHPsM4/SCuOHp+gS866bDaMnobg4g+pF4BcIM/ytShxnU+14g5lvH1d IjZNFVEBnZaTrbXvtzsxtCDeyha32mLslmfvPL9h4cMsEN6KozHECmACuHxy1lVv0cJK AgwQ== 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 y10si13827816plt.406.2018.12.18.14.09.33; Tue, 18 Dec 2018 14:09:48 -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 S1727425AbeLRV5R (ORCPT + 99 others); Tue, 18 Dec 2018 16:57:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:57652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726704AbeLRV5R (ORCPT ); Tue, 18 Dec 2018 16:57:17 -0500 Received: from gandalf.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 8FECA21852; Tue, 18 Dec 2018 21:57:15 +0000 (UTC) Date: Tue, 18 Dec 2018 16:57:13 -0500 From: Steven Rostedt To: Andi Kleen Cc: Martin Jambor , Miroslav Benes , Josh Poimboeuf , 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: <20181218165713.4309797a@gandalf.local.home> In-Reply-To: <20181218211501.GD25620@tassilo.jf.intel.com> 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> <20181218211501.GD25620@tassilo.jf.intel.com> X-Mailer: Claws Mail 3.16.0 (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:01 -0800 Andi Kleen 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 " > > The function in question uses noinline too. And that's all I care about. > > > 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. > > For this case we only want one non inlined copy because it is used as a > test case for a function tracer. The function tracer selftest should work just fine if there's more than one copy. Because the test will enable all copies. > > LTO comes into play because it originally relied on being in a separate > file, so it would not be inlined, but with LTO that doesn't work. The reason for it being in a separate file is because the entire directory is marked "notrace". That file, and that file alone in that directory, gets compiled with the -pg flags. As long as the functions in that file don't get inlined (which will make them notrace as well) all is good. Thus, if used and/or noinline prevents the functions from being inlined, and thus have their profiling removed, we should be good. Hmm, how does that work? When does LTO do its linker magic? Because the fentry/mcounts are added when the object is created. Are they removed if the compiler sees that it can be inlined? Or does LTO just compile everything in one go? > > > > > 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 > > AFAIK there is no noclone without noinline in the kernel tree. > > > > 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. > > Neither in the ftrace case, nor in the KVM case (another user which > has fancy inline assembly that cannot be duplicated) that's the case. > It's just about having exactly one out of line instance. Again, that's not the ftrace case. It doesn't care about more than one out of line instance. Thus, for this particular use, "used" should be good enough. -- Steve