From patchwork Tue Jun 7 21:52:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michal Marek X-Patchwork-Id: 9162655 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F79360467 for ; Tue, 7 Jun 2016 21:52:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 101022835C for ; Tue, 7 Jun 2016 21:52:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04AE42836D; Tue, 7 Jun 2016 21:52:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8035C2835C for ; Tue, 7 Jun 2016 21:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933270AbcFGVwl (ORCPT ); Tue, 7 Jun 2016 17:52:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:36505 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932163AbcFGVwl (ORCPT ); Tue, 7 Jun 2016 17:52:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 81B8DACEC; Tue, 7 Jun 2016 21:52:38 +0000 (UTC) Received: by sepie.suse.cz (Postfix, from userid 10020) id 8AD6F40760; Tue, 7 Jun 2016 23:52:37 +0200 (CEST) Date: Tue, 7 Jun 2016 23:52:37 +0200 From: Michal Marek To: "Zanoni, Paulo R" Cc: "yamada.masahiro@socionext.com" , "mmarek@suse.cz" , "linux-kbuild@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "nicolas.pitre@linaro.org" Subject: Re: Regression in "kbuild: fix if_change and friends to consider argument order" Message-ID: <20160607215237.GA13237@sepie.suse.cz> References: <1465263518.3885.9.camel@intel.com> <5756960E.5020706@suse.com> <57569ACC.8050503@suse.cz> <5756A675.3080003@suse.cz> <1465308627.3885.61.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1465308627.3885.61.camel@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jun 07, 2016 at 02:10:28PM +0000, Zanoni, Paulo R wrote: > I tested both patches you provided: >  - kbuild: do not append NOSTDINC_FLAGS to avoid rebuild in package > targets >  - kbuild: Initialize NOSTDINC_CFLAGS > > Both seem to improve the situation to a point where, at least for a > tinyconfig, timings are acceptable. But it's important to notice that > none of the changes are equivalent to just reverting the first bad > commit. We still recompile some additional files that were not compiled > with the full revert. Let me show you: [...] > So after some grepping, I tried to also initialize LDFLAGS_vmlinux, in > the same way you did with NOSTDINC_FLAGS, and it fixed the problem for > me: Good catch! I my tests, I was interrupting the build early and only checking the content of kernel/.bounds.s.cmd; lazy me :). I'm going to apply the patch below to kbuild.git#rc-fixes. > I also wondered that maybe we need to also initialize > KBUILD_LDFLAGS_MODULE, but it seems what fixed the problem was just > LDFLAGS_vmlinux. So I'm not sure if we'll need this. I also have no > idea whether this would cause other unintended regressions. It's up to > you, Makefile maintainers, to judge.  I did check the += assignments now and I only see $ awk '/\+=/ { print $1 }' Makefile | sort -u | while read v; do grep -m1 "$v" Makefile; done | grep '+=' CLEAN_DIRS += $(MODVERDIR) MAKEFLAGS += -rR --include-dir=$(CURDIR) MRPROPER_DIRS += include/config usr/include include/generated \ MRPROPER_FILES += .config .config.old .version .old_version \ The MAKEFLAGS assignment is correct, the CLEAN_DIRS and MRPROPER_* += assignments are unnecessary, but none of these variables is exported. So we are fine _with respect to the main Makefile_. It's possible that e.g. some arch Makefile has a skeleton in the cupboard. We will see. Michal From b36fad65d61fffe4b662d4bfb1ed673c455a36a2 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Tue, 7 Jun 2016 11:57:02 +0200 Subject: [PATCH] kbuild: Initialize exported variables The NOSTDINC_FLAGS variable is exported, so it needs to be cleared to avoid duplicating its content when running make from within make (e.g. in the packaging targets). This became an issue after commit 9c8fa9bc08f6 ("kbuild: fix if_change and friends to consider argument order"), which no longer ignores the duplicate options. As Paulo Zanoni points out, the LDFLAGS_vmlinux variable has the same problem. Reported-by: "Zanoni, Paulo R" Fixes: 9c8fa9bc08f6 ("kbuild: fix if_change and friends to consider argument order") Signed-off-by: Michal Marek --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 0f70de63cfdb..af0c463e908f 100644 --- a/Makefile +++ b/Makefile @@ -363,11 +363,13 @@ CHECK = sparse CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void $(CF) +NOSTDINC_FLAGS = CFLAGS_MODULE = AFLAGS_MODULE = LDFLAGS_MODULE = CFLAGS_KERNEL = AFLAGS_KERNEL = +LDFLAGS_vmlinux = CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im -Wno-maybe-uninitialized CFLAGS_KCOV = -fsanitize-coverage=trace-pc