Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3526723imm; Mon, 6 Aug 2018 06:24:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe64NlceY00yvuCZgVneYQAfKJ3i0oZz4LMCPemrMXjMa9TaIzkjdzX6XA0M3ATSIC2TKUb X-Received: by 2002:a62:106:: with SMTP id 6-v6mr17311871pfb.168.1533561865937; Mon, 06 Aug 2018 06:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533561865; cv=none; d=google.com; s=arc-20160816; b=Jq/ijSaQepFPa0KIDbVEQry6fxcLjYbU3LkDRVI4XQPNijfMeQIx1G8d44hsDQdAOC EpyAMiXJs5u8WQwxmBiKkHX+Z63XJt+or7BFcZuSbqqjZmoMl6ZCXPJFia2JKLAqV138 /6ASA2DjezTuB/kohprBB4ZvghUW+04W8j18Kpj+83RH8cu0hXQqjUZcPBCmnH3Hifdo 2AXeumCiYPw1kegnU2I6iLlUVHMSJMOV+nYNurs0iKbAby1T9jfvpsqYPyQ5gZT9ZRmY 9vs5KybY8x8LiCl8YSNqd6AJIvqxvkLzXaX2ePbhd4xP6HJ1wIiQayHtAsGNT0Ay9wvh UuzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date :arc-authentication-results; bh=bK6wFguimbCmnHs/y7MnljndPC0z2whfyhSkr3xyHx0=; b=tH+3UTZCRIy3oG6ncuZeERIwF3rh5Bde4Hd3vXUKNwnAQ/Px02UDg3+W5GqyYpuNqs MAywJ4VjpvlqAp37uwA7E9cQoiarToJ4IDzDb3TzuQzB1xQEbFxdTwvNFGCuq8eV6VDU FmC1j1kYOn1yfTQ12thPo1y4fHamU2A9TiVU1yLCfjgsP0yF4jxzC8Q2GZt+VAM+6gCp L2gP3ag9d4NL84o13ncI/bBonOB1Xwn5djms+4aEadWNk1f80r1oDSQjLk55qHk5+YVH fLcyBm085NTDappLTde3BqDuzNT2Vz4F+ErMMtK/H+uA+7+Q9L01MZr2q5UjbEDa6BUn hI2g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si12205885pgg.341.2018.08.06.06.24.11; Mon, 06 Aug 2018 06:24:25 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731058AbeHFP1M (ORCPT + 99 others); Mon, 6 Aug 2018 11:27:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34778 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731997AbeHFP04 (ORCPT ); Mon, 6 Aug 2018 11:26:56 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w76DEHIh119395 for ; Mon, 6 Aug 2018 09:17:53 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kpm97xvf8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 06 Aug 2018 09:17:52 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Aug 2018 14:17:50 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 6 Aug 2018 14:17:47 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w76DHkuF44105944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 6 Aug 2018 13:17:46 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E470A4059; Mon, 6 Aug 2018 16:17:54 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9500A4040; Mon, 6 Aug 2018 16:17:53 +0100 (BST) Received: from localhost (unknown [9.152.212.144]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 6 Aug 2018 16:17:53 +0100 (BST) Date: Mon, 6 Aug 2018 15:17:44 +0200 From: Vasily Gorbik To: Masahiro Yamada , Michal Marek , Martin Schwidefsky , Heiko Carstens , Steven Rostedt , Ingo Molnar Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Andi Kleen Subject: [PATCH 2/4] trace: avoid calling cc-option -mrecord-mcount for every Makefile References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 x-cbid: 18080613-0028-0000-0000-000002E63373 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080613-0029-0000-0000-0000239E55B9 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-06_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808060141 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently if CONFIG_FTRACE_MCOUNT_RECORD is enabled -mrecord-mcount compiler flag support is tested for every Makefile. Top 4 cc-option usages: 511 -mrecord-mcount 11 -fno-stack-protector 9 -Wno-override-init 2 -fsched-pressure To address that move cc-option from scripts/Makefile.build to top Makefile and export CC_USING_RECORD_MCOUNT to be used in original place. While doing that also add -mrecord-mcount to CC_FLAGS_FTRACE (if gcc actually supports it). Signed-off-by: Vasily Gorbik --- Makefile | 7 +++++++ scripts/Makefile.build | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 503f533277c7..621ebdbfbf89 100644 --- a/Makefile +++ b/Makefile @@ -743,6 +743,13 @@ ifdef CONFIG_FUNCTION_TRACER ifndef CC_FLAGS_FTRACE CC_FLAGS_FTRACE := -pg endif +ifdef CONFIG_FTRACE_MCOUNT_RECORD + # gcc 5 supports generating the mcount tables directly + ifeq ($(call cc-option-yn,-mrecord-mcount),y) + CC_FLAGS_FTRACE += -mrecord-mcount + export CC_USING_RECORD_MCOUNT := 1 + endif +endif ifdef CONFIG_HAVE_FENTRY ifeq ($(call cc-option-yn, -mfentry),y) CC_FLAGS_FTRACE += -mfentry diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 514ed63ff571..42ecb8cf7666 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -206,11 +206,8 @@ cmd_modversions_c = \ endif ifdef CONFIG_FTRACE_MCOUNT_RECORD -# gcc 5 supports generating the mcount tables directly -ifneq ($(call cc-option,-mrecord-mcount,y),y) -KBUILD_CFLAGS += -mrecord-mcount -else -# else do it all manually +ifndef CC_USING_RECORD_MCOUNT +# compiler will not generate __mcount_loc use recordmcount or recordmcount.pl ifdef BUILD_C_RECORDMCOUNT ifeq ("$(origin RECORDMCOUNT_WARN)", "command line") RECORDMCOUNT_FLAGS = -w @@ -239,7 +236,7 @@ cmd_record_mcount = \ "$(CC_FLAGS_FTRACE)" ]; then \ $(sub_cmd_record_mcount) \ fi; -endif # -record-mcount +endif # CC_USING_RECORD_MCOUNT endif # CONFIG_FTRACE_MCOUNT_RECORD ifdef CONFIG_STACK_VALIDATION -- 2.18.0.13.gd42ae10