Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2963229pxf; Sun, 4 Apr 2021 22:15:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwwIFwHcPLLjaoRwvfu7Mb5T7P48b2hkB1dAAklqPF+RpuV7fur89AH3wbr99gQq6TCscu X-Received: by 2002:a05:6638:102f:: with SMTP id n15mr22267308jan.28.1617599701891; Sun, 04 Apr 2021 22:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617599701; cv=none; d=google.com; s=arc-20160816; b=Oct0D2bxaX/Ghu7FfYslMw6qi/4n5WelMSbF7SSIloBjcee6TtEV4SprvpG000dxxM 7ZewVnfVKgOZTiP5llTVLb8h9xu8TrdID4LkCcXRmy7a5puhHrXpkuViWBinj1VeL8pX Eu2ehcaz0SHQ6o0d5mDCxXJBX4uQ4lvYSa1NUi0tW6E1iEsxoVkT+VsJYsFSkOit/lTB aeN9saDSseb6fcZVGywNWsBg7qXh5x0iJaY0Zsu1j+SPsMb+HZ8JvpHpXlFRIm934ZCY TDjWAccmctFj8hF6EZgEVbrq864eoT4+ZFaCE9C+ytgt+4OX1yTbp6rjXtr0fjGP3iD8 y1Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=P8f56OwRlSED6G6pPMf2wl/BTBj+x3AWzHQn6pYVmDk=; b=aWo0UkT/AIBPzOh9l/psOrMr8lQ5mwBdrP0Bg0kkBT9qxBHwKhqKzLEAmu2bMlfwI+ HPfq6LFTugnTHF4Ph8SXralQe6aKWC4OcUwP2UPTV+CKRhDWcU3QOJ+tdb6VxO8WsUVX qxmg3aGEu0FsQ13dThmt1J/d978M4EE6dR6F/4bzaoTBhj4DrPDnk+HfbWMcscnlQd2M hwNiYhLQUuFWNZPOBBoLxgHDcfwePCO36SVL9UmbywGnWz6hble9ll5Mb4KhLt7uCFht I/G1zqcXdN+ct0+nGOZqq4ZmmiaCDCtlGw7TMfoYZ07H5LUhAm1os1gIjSLTzPT289jS 5ZyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=e1VQ58kL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si16691959iln.23.2021.04.04.22.14.48; Sun, 04 Apr 2021 22:15:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=e1VQ58kL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbhDEEXz (ORCPT + 99 others); Mon, 5 Apr 2021 00:23:55 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:40183 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbhDEEXy (ORCPT ); Mon, 5 Apr 2021 00:23:54 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1617596629; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=P8f56OwRlSED6G6pPMf2wl/BTBj+x3AWzHQn6pYVmDk=; b=e1VQ58kL7LbDGe305KLTY9+Uu1oluBrf+m3KzaBZ8EiXOa7lfJ7qkRpFn5bpJHUI1j1hzyzI cRzvRpQyNsqgK0WAZUMI2FbFInWvH2TtEuBX2NCsJ2AZoNp58sKm29oJDft2gkawl89uQXYB IZcjHafaxiSt9u9O4mEgurWmQIs= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 606a90c6febcffa80f537b9b (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 05 Apr 2021 04:23:34 GMT Sender: eberman=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 572BEC43462; Mon, 5 Apr 2021 04:23:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.1.70] (cpe-76-167-231-33.san.res.rr.com [76.167.231.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: eberman) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1A0D7C433C6; Mon, 5 Apr 2021 04:23:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1A0D7C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=eberman@codeaurora.org Subject: Re: [PATCH] Kbuild: Update config_data.gz only if KCONFIG_CONFIG materially changed To: Masahiro Yamada Cc: Michal Marek , Linux Kbuild mailing list , Linux Kernel Mailing List , Matthias Maennich , Trilok Soni References: <1617317072-26770-1-git-send-email-eberman@codeaurora.org> From: Elliot Berman Message-ID: Date: Sun, 4 Apr 2021 21:23:31 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/2/2021 10:11 PM, Masahiro Yamada wrote: > On Fri, Apr 2, 2021 at 7:45 AM Elliot Berman wrote: >> >> If you update the timestamp of KCONFIG_CONFIG without actually changing >> anything, config_data.gz is re-generated and causes vmlinux to re-link. >> When Link Time Optimization is enabled, unnecessary re-linking of >> vmlinux is highly desirable since it adds several minutes to build time. >> >> Avoid touching config_data.gz by using filechk to compare the existing >> config_data.gz and update only if it changed. >> >> The .config can be touched, for instance, by a build script which >> installs the default defconfig and then applies a defconfig fragment on >> top. >> >> For a simple example on my x86 machine, I modified x86 default defconfig to set >> CONFIG_IKCONFIG=y and run: >> make -j50 defconfig tiny.config vmlinux >> make -j50 defconfig tiny.config vmlinux >> With this patch, vmlinux is not re-built as a result of config_data.gz >> change. >> >> Signed-off-by: Elliot Berman >> --- >> kernel/Makefile | 2 +- >> scripts/Makefile.lib | 2 ++ >> 2 files changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/kernel/Makefile b/kernel/Makefile >> index 320f1f3..bd4e558 100644 >> --- a/kernel/Makefile >> +++ b/kernel/Makefile >> @@ -140,7 +140,7 @@ $(obj)/configs.o: $(obj)/config_data.gz >> >> targets += config_data.gz >> $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE >> - $(call if_changed,gzip) >> + $(call filechk,gzip) > > > I do not think this is the right approach > because gzip is executed every time, even > if the time stamp is not changed. > Since .config is relatively small, gzip was quickly producing the same binary in multiple runs on my host. I thought about following gen_ikheaders.sh approach of comparing the md5sum, but I felt it was more complex than using filechk and re-compressing every time. I'll send a v2 tomorrow which follows gen_ikheaders.sh approach. > >> >> $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz >> >> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib >> index a4fbaf8..81d3ec1 100644 >> --- a/scripts/Makefile.lib >> +++ b/scripts/Makefile.lib >> @@ -282,6 +282,8 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ >> quiet_cmd_gzip = GZIP $@ >> cmd_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 > $@ >> >> +filechk_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 >> + >> # DTC >> # --------------------------------------------------------------------------- >> DTC ?= $(objtree)/scripts/dtc/dtc >> -- >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, >> a Linux Foundation Collaborative Project >>