From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755384AbdDRVod (ORCPT ); Tue, 18 Apr 2017 17:44:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37008 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751977AbdDRVoc (ORCPT ); Tue, 18 Apr 2017 17:44:32 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5131880487 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jpoimboe@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5131880487 Date: Tue, 18 Apr 2017 16:44:29 -0500 From: Josh Poimboeuf To: Andi Kleen Cc: kbuild test robot , kbuild-all@01.org, linux-kernel@vger.kernel.org, Ingo Molnar , Steven Rostedt Subject: [PATCH] x86/build: convert function graph '-Os' error to warning Message-ID: <20170418214429.o7fbwbmf4nqosezy@treble> References: <201704160947.iSmcgQi7%fengguang.wu@intel.com> <20170417133313.ibbt5nmp76xzabf4@treble> <87lgqxtuo6.fsf@firstfloor.org> <20170418201942.ohybixihlk36it4t@treble> <20170418202519.GI22592@two.firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170418202519.GI22592@two.firstfloor.org> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 18 Apr 2017 21:44:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 18, 2017 at 01:25:19PM -0700, Andi Kleen wrote: > On Tue, Apr 18, 2017 at 03:19:42PM -0500, Josh Poimboeuf wrote: > > On Tue, Apr 18, 2017 at 11:52:41AM -0700, Andi Kleen wrote: > > > Josh Poimboeuf writes: > > > > > > > > The error is working as designed. gcc < 4.6.0 doesn't have -mfentry, so > > > > it fails the above check on x86. Can you add a skip rule? It should > > > > skip building the following case: > > > > > > > > x86 && ((gcc < 4.6.0) || (CONFIG_X86_32 and !CONFIG_DYNAMIC_FTRACE)) > > > > && CONFIG_FUNCTION_GRAPH_TRACER && CONFIG_CC_OPTIMIZE_FOR_SIZE > > > > > > This will also break everyone's randconfig builds. The better way > > > would be to check this in the Makefile and disable one of the options > > > > I don't know how to disable a config option from the Makefile like that. > > You just don't do something in the Makefile, e.g. don't set the -Os > > For an example see the LTO Makefile here > > https://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git/tree/scripts/Makefile.lto?h=lto-411-1 This seems to work: ---- From: Josh Poimboeuf Subject: [PATCH] x86/build: convert function graph '-Os' error to warning For pre-4.6.0 versions of GCC, which don't have '-mfentry', the '-maccumulate-outgoing-args' option is required for function graph tracing in order to avoid GCC bug 42109. However, GCC ignores '-maccumulate-outgoing-args' when '-Os' is also set. Currently we force a build error to prevent that scenario, but that breaks randconfigs. So change the error to a warning which also disables CONFIG_CC_OPTIMIZE_FOR_SIZE. Reported-by: Andi Kleen Signed-off-by: Josh Poimboeuf --- arch/x86/Makefile | 8 ++++++++ arch/x86/kernel/ftrace.c | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 73604e1..4430dd4 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -154,6 +154,14 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER else ifeq ($(call cc-option-yn, -mfentry), n) ACCUMULATE_OUTGOING_ARGS := 1 + + # GCC ignores '-maccumulate-outgoing-args' when used with '-Os'. + # If '-Os' is enabled, disable it and print a warning. + ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE + undefine CONFIG_CC_OPTIMIZE_FOR_SIZE + $(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE. Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.) + endif + endif endif endif diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 0e5ceac..5b71535 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -29,12 +29,6 @@ #include #include -#if defined(CONFIG_FUNCTION_GRAPH_TRACER) && \ - !defined(CC_USING_FENTRY) && \ - !defined(CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE) -# error The following combination is not supported: ((compiler missing -mfentry) || (CONFIG_X86_32 and !CONFIG_DYNAMIC_FTRACE)) && CONFIG_FUNCTION_GRAPH_TRACER && CONFIG_CC_OPTIMIZE_FOR_SIZE -#endif - #ifdef CONFIG_DYNAMIC_FTRACE int ftrace_arch_code_modify_prepare(void) -- 2.7.4