From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6623BC43334 for ; Mon, 20 Jun 2022 04:45:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B891D6B0071; Mon, 20 Jun 2022 00:45:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B39296B0073; Mon, 20 Jun 2022 00:45:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A286E8D0001; Mon, 20 Jun 2022 00:45:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 932DB6B0071 for ; Mon, 20 Jun 2022 00:45:33 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 6C1EE120415 for ; Mon, 20 Jun 2022 04:45:33 +0000 (UTC) X-FDA: 79597375746.21.18B8C52 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf30.hostedemail.com (Postfix) with ESMTP id EB12D80013 for ; Mon, 20 Jun 2022 04:45:32 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 268D21042; Sun, 19 Jun 2022 21:45:32 -0700 (PDT) Received: from [10.163.42.162] (unknown [10.163.42.162]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 04BA53F7D7; Sun, 19 Jun 2022 21:45:28 -0700 (PDT) Message-ID: Date: Mon, 20 Jun 2022 10:15:31 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH V3 1/2] mm/mmap: Restrict generic protection_map[] array visibility Content-Language: en-US To: kernel test robot , linux-mm@kvack.org Cc: kbuild-all@lists.01.org, hch@infradead.org, Andrew Morton , linux-kernel@vger.kernel.org, Christoph Hellwig References: <20220616040924.1022607-2-anshuman.khandual@arm.com> <202206162004.ak9KTfMD-lkp@intel.com> From: Anshuman Khandual In-Reply-To: <202206162004.ak9KTfMD-lkp@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655700333; a=rsa-sha256; cv=none; b=Q0HyydBgordIOdvyVdHUljTaUrTWsqhFJaNbzu9W1cNCFdvvg5FTHSrgS2NuBKLik1JL0+ wPPI0L78hWJDeAwlkEDHTSe0/aRZ9G1Rds0/Xp0YdTRlH+3OKoSmqeaO9CxTx1Ocjefovu +ST1jlrgWWLeKsoJw7v5NX3mrLlpISo= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655700333; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=slZLz/vIXM7q2uuSXYUzcfQWL5becya4s3ytrLdQS5Y=; b=s7lSBmMPLTCCxQBUdIdA71G27SdujOSlMzE5WphlF+tETuRj0uaEclEXG/rrBIhVYEbrhk LgZNjCEWlm1ICJhDhIkfbypQQvoHA3Pge70eaE4z9reG5H8m3dUOX85L07yOusL1Rvfhv4 gCiQi4x7I5+I3lDof1OF4ASO1a4vZxw= X-Stat-Signature: srkmw96we39c8bq549ya951t4i33rcka X-Rspamd-Queue-Id: EB12D80013 Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1655700332-19183 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > > 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 '' 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]; + 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 #include -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,