Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1705121imm; Thu, 27 Sep 2018 00:53:26 -0700 (PDT) X-Google-Smtp-Source: ACcGV605Cl3YgtNzN/tgw3xWLoSfs/jzLrOV7/OEcDrMB58Q0/cTNnP3Wx/2uJy15EAtNx22/2k1 X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr9413539plb.99.1538034806247; Thu, 27 Sep 2018 00:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538034806; cv=none; d=google.com; s=arc-20160816; b=mtrce0mqsRtaGr2pckukp3YpadSFqZzYXUMb9dcdNFSQ7C7xBebb9GxW59D3aimyxK 474FtZAQlWOeAK9PDbM/h8NyGkrNDJsqpz2sVhipTt5yktv3xAaM3DHgC3v34HH48fgp fdrIXTIcfSQENw+KsH4SMJOAaH8noBgaLHxLkIoKAITBEXG/R7pwr+mAo8QZYeCa71Z1 U7mn5LpPGrH4xMTZqtfUPvzWaSPo/xYU9m3I1ymG+MbKsYnBGnz//ecIMgJBvgHuhKGp kj7gtn97iw/mWshkIw+ySTl+E5RzwwI/7xxkVpYEVV8fZebPVqamZ/DD9dSoIWtDNbfp 1oaQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=l7BpBimOf09KHyyk0Zg5kXWpd+CCDeeZsQm9eTxvK1I=; b=Z1AbRr4EpVFYsRu7ckl0HHQGyLqiuJWLAF05FMnWUpoGsEXJAI7z6PMvYYP+ZQNkqX lxh4Hj0os9m4Uw24sPVdasJgiu+UVojeeKsya8M0ahWfc0a/g0Nmuh8FKW9kxMi5Cquo SQn5KsRWQb04CusqCNGHyG9GZOWjVJxzCqay81Gq28+/DuKAenbN5DCLf4NudRLu3O5X UkVUSSdzlF9cZ/AEovnpx9s1tuEylqUl1V/ndz8lmhrZt5zYSNRO9lt+qeo9iZUPMUJO DoR6pcDIqENaDQcD71whSdlLxmUSU81Kzmrb9PTRAyuhIjQ8FxQBFTofBqRg3zIqcIyx u7DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=YooBauo4; 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 1-v6si1335137pgb.107.2018.09.27.00.53.11; Thu, 27 Sep 2018 00:53:26 -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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=YooBauo4; 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 S1727245AbeI0OJu (ORCPT + 99 others); Thu, 27 Sep 2018 10:09:50 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:43388 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbeI0OJu (ORCPT ); Thu, 27 Sep 2018 10:09:50 -0400 Received: by mail-lf1-f67.google.com with SMTP id x24-v6so1330459lfe.10 for ; Thu, 27 Sep 2018 00:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=l7BpBimOf09KHyyk0Zg5kXWpd+CCDeeZsQm9eTxvK1I=; b=YooBauo4RWdkRf1Qo9YKjHJzhuQMEynSeEmsU5FKIs+37TxHvWvuGim9Um3BDJt6kz vpubinQZCMlE4XLb5sbK0ceWzAxY8M2QfObk3K2i+bnEVttHfP/wNxOq78eg+2vXqeur elT6e4SrMpV24LuaRX+lTdyDfoCIZtsaIzqCY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=l7BpBimOf09KHyyk0Zg5kXWpd+CCDeeZsQm9eTxvK1I=; b=PUyuloCGAQ5o0objmHP/E6xEgoeMY2AVpN7ddeF14nLZ78QrutYNvJi5jmyW2KTL0e DHRSbZt6fIi7YxWzo947LXMPbr7TnbuQBG9JM5e5JmOjL2POmj8um2e9pXNy83Z6gdnG qucb9CxxkMQOaBGX7MEbSRJg5obafJEhqdcdcPVxW6bEhsuz/3cL6sW3EIn3ixdl15XK bQFWEgFb7TjqsnlxM7otRXK0rNYczky7FDqDbZtERayv8K7eDUm/XUB0k3Adl3vwE+36 0lxoL+o2MlKFwXxylelptcW7Tw4WymGJaza4uC6UnLgRDp6zToX6PMxRuvaKL9z8UohX 36cQ== X-Gm-Message-State: ABuFfohDT3B5GZ+VNMXvxP6FcWmXbED8bmICWgETd5xXSBa0F23OWsSu 7rhs2adEXyJjVIOCmssf1cGHDw== X-Received: by 2002:a19:6544:: with SMTP id c4-v6mr6810679lfj.31.1538034772692; Thu, 27 Sep 2018 00:52:52 -0700 (PDT) Received: from [172.16.11.40] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id 33-v6sm281507lfu.64.2018.09.27.00.52.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Sep 2018 00:52:51 -0700 (PDT) Subject: Re: [PATCH v8 02/10] Makefile: Prepare for using macros for inline asm To: Nadav Amit , Ingo Molnar Cc: LKML , X86 ML , Sam Ravnborg , Michal Marek , Thomas Gleixner , "H. Peter Anvin" , "linux-kbuild@vger.kernel.org" References: <20180918212847.199085-1-namit@vmware.com> <20180918212847.199085-3-namit@vmware.com> <1aa5a1f3-ef3d-5cd3-831c-2202d73d3c9e@rasmusvillemoes.dk> <307823F9-DCCF-4384-9FBE-28642FAD6B4E@vmware.com> From: Rasmus Villemoes Message-ID: <4d3684d6-f415-09b3-0a4f-6eca173bfd37@rasmusvillemoes.dk> Date: Thu, 27 Sep 2018 09:52:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <307823F9-DCCF-4384-9FBE-28642FAD6B4E@vmware.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-09-26 19:56, Nadav Amit wrote: > at 1:58 AM, Rasmus Villemoes wrote: > >>> +ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s >>> +export ASM_MACRO_FLAGS >>> +KBUILD_CFLAGS += $(ASM_MACRO_FLAGS) >> How does this affect what gets rebuilt when one of the asm/foo.h files >> going into macros.s changes? Does that cause a global rebuild because >> everything depends on macros.s, or do we still only rebuild the files >> that actually include asm/foo.h? > > There will not be a global rebuild. Any source file that uses the header > files that are included in macros.S will be rebuilt. > > But your question actually raises two issues: > > 1. If macros.S changes, there *should* be a global rebuild, and currently > there wouldn’t be one. Do you happen to know what would be the appropriate > way to trigger one? Hm, that's a question for Kbuild folks, I think. Maybe one could just ensure macros.s gets written into the dependency file for each translation unit (maybe fixdep already has support for that). But if we do that, we probably want macros.s to be generated with some if_changed makefile magic, so that changes in one of the asm/ headers that do not actually change macros.s does not cause a global rebuild (it would still rebuild the files that actually inclue that asm/ header, of course). > 2. Someone might mistakenly use the macros through inline assembly without > including the header file. That's rather unlikely, I think. An open-coded asm("SOME_MACRO ...") would hopefully be caught in review. But yeah... > It would be better to detect such cases and fail > the build. I may be able to create another asm macro in the C part of the > header that would cause the build to fail. But let me know if you any > better idea. The best I can think of (and I'm not suggesting to do this, or that it would actually work): In asm/foo.h, inside its cpp include guard, and inside a guard that excludes this piece when building macros.s itself, have a 'asm("___asm_foo_included__ = 1\n")'. Then inside each asm macro defined in asm/foo.h, have a ".ifndef ___asm_foo_included___\n.error ...\n.endif". That latter part might be macrofied itself so that it's just one line, "CHECK_INCLUDE ___asm_foo_included___\n", with CHECK_INCLUDE being defined in macros.S. Rasmus