From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Anshuman Khandual <anshuman.khandual@arm.com>,
kernel test robot <lkp@intel.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: "kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
"hch@infradead.org" <hch@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH V3 1/2] mm/mmap: Restrict generic protection_map[] array visibility
Date: Mon, 20 Jun 2022 06:43:01 +0000 [thread overview]
Message-ID: <9dd7e0b5-c5ce-cdea-c519-b15313337c3b@csgroup.eu> (raw)
In-Reply-To: <da75a2d1-afc5-b6ff-dce0-ef0b20dbfde0@arm.com>
Le 20/06/2022 à 06:45, Anshuman Khandual a écrit :
>
> On 6/16/22 18:14, kernel test robot wrote:
>> Hi Anshuman,
>>
>> Thank you for the patch! Yet something to improve:
>>
>> [auto build test ERROR on akpm-mm/mm-everything]
>>
>> url: https://github.com/intel-lab-lkp/linux/commits/Anshuman-Khandual/mm-mmap-Drop-__SXXX-__PXXX-macros-from-across-platforms/20220616-121132
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
>> config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220616/202206162004.ak9KTfMD-lkp@intel.com/config)
>> compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
>> reproduce (this is a W=1 build):
>> # https://github.com/intel-lab-lkp/linux/commit/4eb89368b130fe235d5e587bcc2eec18bb688e2d
>> git remote add linux-review https://github.com/intel-lab-lkp/linux
>> git fetch --no-tags linux-review Anshuman-Khandual/mm-mmap-Drop-__SXXX-__PXXX-macros-from-across-platforms/20220616-121132
>> git checkout 4eb89368b130fe235d5e587bcc2eec18bb688e2d
>> # save the config file
>> mkdir build_dir && cp config build_dir/.config
>> make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/
>>
>> If you fix the issue, kindly add following tag where applicable
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All errors (new ones prefixed by >>):
>>
>> In file included from arch/x86/include/asm/percpu.h:27,
>> from arch/x86/include/asm/preempt.h:6,
>> from include/linux/preempt.h:78,
>> from include/linux/spinlock.h:55,
>> from include/linux/mmzone.h:8,
>> from include/linux/gfp.h:6,
>> from include/linux/mm.h:7,
>> from arch/x86/mm/mem_encrypt_amd.c:14:
>> arch/x86/mm/mem_encrypt_amd.c: In function 'sme_early_init':
>>>> arch/x86/mm/mem_encrypt_amd.c:499:36: error: 'protection_map' undeclared (first use in this function)
>> 499 | for (i = 0; i < ARRAY_SIZE(protection_map); i++)
>> | ^~~~~~~~~~~~~~
>> include/linux/kernel.h:55:33: note: in definition of macro 'ARRAY_SIZE'
>> 55 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>> | ^~~
>> arch/x86/mm/mem_encrypt_amd.c:499:36: note: each undeclared identifier is reported only once for each function it appears in
>> 499 | for (i = 0; i < ARRAY_SIZE(protection_map); i++)
>> | ^~~~~~~~~~~~~~
>> include/linux/kernel.h:55:33: note: in definition of macro 'ARRAY_SIZE'
>> 55 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>> | ^~~
>> In file included from include/linux/bits.h:22,
>> from include/linux/ratelimit_types.h:5,
>> from include/linux/printk.h:9,
>> from include/asm-generic/bug.h:22,
>> from arch/x86/include/asm/bug.h:87,
>> from include/linux/bug.h:5,
>> from include/linux/mmdebug.h:5,
>> from include/linux/mm.h:6,
>> from arch/x86/mm/mem_encrypt_amd.c:14:
>> include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
>> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
>> | ^
>> include/linux/compiler.h:240:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
>> 240 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
>> | ^~~~~~~~~~~~~~~~~
>> include/linux/kernel.h:55:59: note: in expansion of macro '__must_be_array'
>> 55 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>> | ^~~~~~~~~~~~~~~
>> arch/x86/mm/mem_encrypt_amd.c:499:25: note: in expansion of macro 'ARRAY_SIZE'
>> 499 | for (i = 0; i < ARRAY_SIZE(protection_map); i++)
>> | ^~~~~~~~~~
>
> This patch fixes the build failure here.
>
> diff --git a/arch/x86/mm/mem_encrypt_amd.c b/arch/x86/mm/mem_encrypt_amd.c
> index f6d038e2cd8e..d0c2ec1bb659 100644
> --- a/arch/x86/mm/mem_encrypt_amd.c
> +++ b/arch/x86/mm/mem_encrypt_amd.c
> @@ -484,6 +484,8 @@ void __init early_set_mem_enc_dec_hypercall(unsigned long vaddr, int npages, boo
> enc_dec_hypercall(vaddr, npages, enc);
> }
>
> +extern pgprot_t protection_map[16];
Adding extern declaration in C files is not the best solution. Isn't
there a H header with that declaration ?
> +
> void __init sme_early_init(void)
> {
> unsigned int i;
> diff --git a/arch/x86/mm/pgprot.c b/arch/x86/mm/pgprot.c
> index 7eca1b009af6..96eca0b2ec90 100644
> --- a/arch/x86/mm/pgprot.c
> +++ b/arch/x86/mm/pgprot.c
> @@ -4,7 +4,7 @@
> #include <linux/mm.h>
> #include <asm/pgtable.h>
>
> -static pgprot_t protection_map[16] __ro_after_init = {
> +pgprot_t protection_map[16] __ro_after_init = {
> [VM_NONE] = PAGE_NONE,
> [VM_READ] = PAGE_READONLY,
> [VM_WRITE] = PAGE_COPY,
>
next prev parent reply other threads:[~2022-06-20 6:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 4:09 [PATCH V3 0/2] mm/mmap: Drop __SXXX/__PXXX macros from across platforms Anshuman Khandual
2022-06-16 4:09 ` [PATCH V3 1/2] mm/mmap: Restrict generic protection_map[] array visibility Anshuman Khandual
2022-06-16 5:35 ` Christophe Leroy
2022-06-20 5:16 ` Anshuman Khandual
2022-06-20 6:41 ` Christophe Leroy
2022-06-21 9:44 ` Anshuman Khandual
2022-06-16 12:44 ` kernel test robot
2022-06-20 4:45 ` Anshuman Khandual
2022-06-20 5:55 ` Christoph Hellwig
2022-06-20 6:43 ` Christophe Leroy [this message]
2022-06-16 4:09 ` [PATCH V3 2/2] mm/mmap: Drop generic protection_map[] array Anshuman Khandual
2022-06-16 5:27 ` Christophe Leroy
2022-06-16 6:10 ` hch
2022-06-17 3:46 ` Anshuman Khandual
2022-06-16 5:45 ` Christophe Leroy
2022-06-16 6:12 ` hch
2022-06-17 3:29 ` Anshuman Khandual
2022-06-17 5:48 ` Christophe Leroy
2022-06-17 8:00 ` hch
2022-06-20 4:14 ` Anshuman Khandual
2022-06-17 3:43 ` Anshuman Khandual
2022-06-17 5:40 ` Christophe Leroy
2022-06-16 5:22 ` [PATCH V3 0/2] mm/mmap: Drop __SXXX/__PXXX macros from across platforms Christophe Leroy
2022-06-16 6:13 ` hch
2022-06-17 3:07 ` Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9dd7e0b5-c5ce-cdea-c519-b15313337c3b@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox