Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4589623imm; Mon, 20 Aug 2018 19:52:00 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwlUL9gMEH1Hq34n5y+k2zJdjm+TYm1n0WwnneEc7kxFNh6O7jqdDJzFA5+eUq3D1W5K5EQ X-Received: by 2002:a17:902:28aa:: with SMTP id f39-v6mr48166045plb.150.1534819920838; Mon, 20 Aug 2018 19:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534819920; cv=none; d=google.com; s=arc-20160816; b=myMcF0jHF71iA+TQ3i+xPYF7PTxdp4i21D/pxf/+wYdsTHXh6282FlJA9lui6DpGgb rUpUUl1jG8ISnVoYSsIxCheh+W2fTLX5UgkQ4TYQS/x9k1q05T4o6/wPnUJWNd1EsOOG RafRgsmjTiVCjm/0cr5zB6vP2G9ogoTfxi+pzSaaHt3g3Hn361ogjmImpYz8aIH2fqGk WMhN7lHROUZzytJZvivPsRFIAImGEOS93uzS8Etiv+6JuuUfB62rBcPyyKnVI98wFiKa b5SdTiAclpkrTCr4127hnRZrdAZZO0mhTM8yfPIU4d2cH8UxTNVUw4PyqkVYKYYIpc0x kYiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=2SnKKCgOxkdWjMCE667kGEvM+4IJy+haEWj5gaMpkP4=; b=tiYxOou5MfkjvdDYBoO03mPZxRtBfqlOES9n1b7/OOIo91xCyg1PY+2TBo2dXhOzD9 vBwRmqTItKFfgkhYP4jPah5J3kubd8rUmU3J9GbhlEBkFA5ZJH+/+ybrF/bGgiFQs2bB ndAglifo+erFHnNW+fLOhEjvbg0lKt/NZ40fGaTUD/Dn/rSQDLGS75mqHsHpZxPts+XI mn2RNg7QjkJbE4SyXZoyUdg7g814pdkQwM2bS7yEKjoSL0T5H6RYuQhrVnKN/fw6XItY pvh/9lB0EwBeIOMO9OCYsnS9IMHvBRX5bpPfWIexohtmatn28OHyFK9S7yIpmeTZHEqZ 9NqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=mT88LcgE; 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 f18-v6si10967033pgi.300.2018.08.20.19.51.45; Mon, 20 Aug 2018 19:52:00 -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=@nifty.com header.s=dec2015msa header.b=mT88LcgE; 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 S1726545AbeHUGIw (ORCPT + 99 others); Tue, 21 Aug 2018 02:08:52 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:59589 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbeHUGIw (ORCPT ); Tue, 21 Aug 2018 02:08:52 -0400 Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) (authenticated) by conssluserg-02.nifty.com with ESMTP id w7L2oTSx003053; Tue, 21 Aug 2018 11:50:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com w7L2oTSx003053 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1534819830; bh=2SnKKCgOxkdWjMCE667kGEvM+4IJy+haEWj5gaMpkP4=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=mT88LcgEBvKTBZBElAAzR24aBR2lfKs5C0Y5KTnjr4g/9WrY+SKhFelkV07Msjjhx u1vsplU43Q12Ajb2SJpsKEfrPEP0rMsZdT6VZpqtXkwHZ744vEXmSoCQbLqaz99czO R1FFNPDjWhuHPpOAiQUsF5VBWurNgW3aaXchS4yyDmCBpOk0EDRjSF9g3lZ+bNxSkv 3BQA3KWp3VR1OfGdxVqFL7tGgot4GlfYlG2ugV/2fU0b2nCzdbfeK1JE1rUISsHDN+ YO+niYfPKXCWppwHnGS8C4FZPtFbYiHJAr0b8w7dxXS3QXwVDHhLBzlCMNpE6V+/vV CN5KcsTN9e1dQ== X-Nifty-SrcIP: [209.85.222.52] Received: by mail-ua1-f52.google.com with SMTP id w7-v6so10979143uan.9; Mon, 20 Aug 2018 19:50:29 -0700 (PDT) X-Gm-Message-State: AOUpUlEYtO8e5/px7uhAqKyDfTa+6GOokOIebJqhlYVNe+pyJAb5lD6Q r3GiaPxT/Feu1/TzBAhxQKjrtPPfQN3VPDy5Rs8= X-Received: by 2002:ab0:6a6:: with SMTP id g35-v6mr32207073uag.16.1534819828641; Mon, 20 Aug 2018 19:50:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:2642:0:0:0:0:0 with HTTP; Mon, 20 Aug 2018 19:49:48 -0700 (PDT) In-Reply-To: <20180820223618.22319-2-paul.burton@mips.com> References: <20180820183417.dejfsluih7elbclu@pburton-laptop> <20180820223618.22319-1-paul.burton@mips.com> <20180820223618.22319-2-paul.burton@mips.com> From: Masahiro Yamada Date: Tue, 21 Aug 2018 11:49:48 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 1/2] kbuild: Allow arch-specific asm/compiler.h To: Paul Burton Cc: Linux-MIPS , linux-arch , Arnd Bergmann , James Hogan , Linux Kbuild mailing list , Linux Kernel Mailing List , Ralf Baechle Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, The code diff looks good to me. Reviewed-by: Masahiro Yamada Just comments in the commit description. See below. 2018-08-21 7:36 GMT+09:00 Paul Burton : > We have a need to override the definition of > barrier_before_unreachable() for MIPS, which means we either need to add > architecture-specific code into linux/compiler-gcc.h or we need to allow > the architecture to provide a header that can define the macro before > the generic definition. The latter seems like the better approach. > > A straightforward approach to the per-arch header is to make use of > asm-generic to provide a default empty header & adjust architectures > which don't need anything specific to make use of that by adding the > header to generic-y. Unfortunately this doesn't work so well due to > commit a95b37e20db9 ("kbuild: get out of > ") which moved the inclusion of linux/compiler.h to > cflags using the -include compiler flag. I doubt this statement. Commit a95b37e20db9 is not the cause of the problem. include/linux/kconfig.h is also included by using the -include compiler flag. See the top-level Makefile. USERINCLUDE := \ -I$(srctree)/arch/$(SRCARCH)/include/uapi \ -I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \ -I$(srctree)/include/uapi \ -I$(objtree)/include/generated/uapi \ -include $(srctree)/include/linux/kconfig.h So, (then, ) would be also required for all C files in the archprepare stage regardless of commit a95b37e20db9. The change happened in commit 28128c61e08e. One more thing, you are not touching any makefile in this version. Maybe, you can prefix the subject with "compiler.h:" or something instead of "kbuild:". > Because the -include flag is present for all C files we compile, we need > the architecture-provided header to be present before any C files are > compiled. If any C files can be compiled prior to the asm-generic header > wrappers being generated then we hit a build failure due to missing > header. Such cases do exist - one pointed out by the kbuild test robot > is the compilation of arch/ia64/kernel/nr-irqs.c, which occurs as part > of the archprepare target [1]. > > This leaves us with a few options: > > 1) Use generic-y & fix any build failures we find by enforcing > ordering such that the asm-generic target occurs before any C > compilation, such that linux/compiler_types.h can always include > the generated asm-generic wrapper which in turn includes the empty > asm-generic header. This would rely on us finding all the > problematic cases - I don't know for sure that the ia64 issue is > the only one. > > 2) Add an actual empty header to each architecture, so that we don't > need the generated asm-generic wrapper. This seems messy. > > 3) Give up & add #ifdef CONFIG_MIPS or similar to > linux/compiler_types.h. This seems messy too. > > 4) Include the arch header only when it's actually needed, removing > the need for the asm-generic wrapper for all other architectures. > > This patch allows us to use approach 4, by including an asm/compiler.h > header from linux/compiler_types.h after the inclusion of the > compiler-specific linux/compiler-*.h header(s). We do this > conditionally, only when CONFIG_HAVE_ARCH_COMPILER_H is selected, in > order to avoid the need for asm-generic wrappers & the associated build > ordering issue described above. The asm/compiler.h header is included > after the generic linux/compiler-*.h header(s) for consistency with the > way linux/compiler-intel.h & linux/compiler-clang.h are included after > the linux/compiler-gcc.h header that they override. > > [1] https://lists.01.org/pipermail/kbuild-all/2018-August/051175.html > > Signed-off-by: Paul Burton > Cc: Arnd Bergmann > Cc: James Hogan > Cc: Masahiro Yamada > Cc: Ralf Baechle > Cc: linux-arch@vger.kernel.org > Cc: linux-kbuild@vger.kernel.org > Cc: linux-mips@linux-mips.org