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 DC23DC43334 for ; Fri, 24 Jun 2022 05:36:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 626F48E01BF; Fri, 24 Jun 2022 01:36:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D7116B02B4; Fri, 24 Jun 2022 01:36:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49F9E8E01BF; Fri, 24 Jun 2022 01:36:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3780B6B02B3 for ; Fri, 24 Jun 2022 01:36:55 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0437C34AFB for ; Fri, 24 Jun 2022 05:36:54 +0000 (UTC) X-FDA: 79612020390.04.155E001 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id 7507E40011 for ; Fri, 24 Jun 2022 05:36:54 +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 17FB9176C; Thu, 23 Jun 2022 22:36:54 -0700 (PDT) Received: from [10.162.41.7] (unknown [10.162.41.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D519B3F66F; Thu, 23 Jun 2022 22:36:46 -0700 (PDT) Message-ID: Date: Fri, 24 Jun 2022 11:06:44 +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 V4 07/26] mm/mmap: Build protect protection_map[] with ARCH_HAS_VM_GET_PAGE_PROT Content-Language: en-US To: Christophe Leroy , "linux-mm@kvack.org" Cc: "hch@infradead.org" , Andrew Morton , "linuxppc-dev@lists.ozlabs.org" , "sparclinux@vger.kernel.org" , "x86@kernel.org" , "openrisc@lists.librecores.org" , "linux-xtensa@linux-xtensa.org" , "linux-csky@vger.kernel.org" , "linux-hexagon@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linux-alpha@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "linux-ia64@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-m68k@lists.linux-m68k.org" , "linux-snps-arc@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , "linux-um@lists.infradead.org" , "linux-sh@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20220624044339.1533882-1-anshuman.khandual@arm.com> <20220624044339.1533882-8-anshuman.khandual@arm.com> <10aca763-2313-84bf-9200-6a6037fd748c@csgroup.eu> From: Anshuman Khandual In-Reply-To: <10aca763-2313-84bf-9200-6a6037fd748c@csgroup.eu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656049014; 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=FGi1i09TXkJqQySGxRDWtJzkp8nNXMr5xfynL3n1LS0=; b=AiBIvKSFYjEav90ywCfYesvyVN+uL4QUuL7EzecnBq3dvysQJaBmu8VPu5MEmD0kZAwgYr kSoxiAaQ3Y1n/wuIOGPBNoT8PCIvq19AV0oKN8Kti/ySI14gTZKuTeISW7UK78tXS4RYFN rqbUVWTtvbGEln99fudxSRfo265hGWA= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656049014; a=rsa-sha256; cv=none; b=Kr48+nfoRGGeh7gNIV13wDQkj1aL5I0tAQynDFKDHnpCnz1GYiFtv9/wHc4pKf7SH6+dxw UfIlcC6svCjimOZ4jStddEvkc27MwxcCCgKkyCmLq0xe1hPterl/H/Dfd4f4uysFEoX54L 2WIjzi+waS/lJd2H2XlrZf0LegmYFnA= X-Rspamd-Queue-Id: 7507E40011 Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: pjtar8wfrwo46aybrtmy8inbjf4jjaws X-HE-Tag: 1656049014-84596 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/24/22 10:52, Christophe Leroy wrote: > > > Le 24/06/2022 à 06:43, Anshuman Khandual a écrit : >> protection_map[] has already been moved inside those platforms which enable > > Usually "already" means before your series. > > Your series is the one that moves protection_map[] so I would have just > said "Now that protection_map[] has been moved inside those platforms > which enable ...." Got it, will update the commit message. > >> ARCH_HAS_VM_GET_PAGE_PROT. Hence generic protection_map[] array now can be >> protected with CONFIG_ARCH_HAS_VM_GET_PAGE_PROT intead of __P000. >> >> Cc: Andrew Morton >> Cc: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> include/linux/mm.h | 2 +- >> mm/mmap.c | 5 +---- >> 2 files changed, 2 insertions(+), 5 deletions(-) >> >> diff --git a/include/linux/mm.h b/include/linux/mm.h >> index 237828c2bae2..70d900f6df43 100644 >> --- a/include/linux/mm.h >> +++ b/include/linux/mm.h >> @@ -424,7 +424,7 @@ extern unsigned int kobjsize(const void *objp); >> * mapping from the currently active vm_flags protection bits (the >> * low four bits) to a page protection mask.. >> */ >> -#ifdef __P000 >> +#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT >> extern pgprot_t protection_map[16]; > > Is this declaration still needed ? I have the feeling that > protection_map[] is only used in mm/mmap.c now. At this point generic protection_map[] array is still being used via this declaration on many (!ARCH_HAS_VM_GET_PAGE_PROT) platforms such as mips, m68k, arm etc. > >> #endif >> >> diff --git a/mm/mmap.c b/mm/mmap.c >> index 55c30aee3999..43db3bd49071 100644 >> --- a/mm/mmap.c >> +++ b/mm/mmap.c >> @@ -101,7 +101,7 @@ static void unmap_region(struct mm_struct *mm, >> * w: (no) no >> * x: (yes) yes >> */ >> -#ifdef __P000 >> +#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT >> pgprot_t protection_map[16] __ro_after_init = { > > Should this be static, as it seems to now be used only in this file ? This is being used in some platforms as mentioned before. > And it could also be 'const' instead of __ro_after_init. Then should be able to be a 'const' wrt mips, m68k, arm platforms. But should this even be changed, if this is going to be dropped off eventually ? > >> [VM_NONE] = __P000, >> [VM_READ] = __P001, >> @@ -120,9 +120,6 @@ pgprot_t protection_map[16] __ro_after_init = { >> [VM_SHARED | VM_EXEC | VM_WRITE] = __S110, >> [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = __S111 >> }; >> -#endif >> - >> -#ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT >> DECLARE_VM_GET_PAGE_PROT >> #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */ >>