From patchwork Mon Jun 13 05:33:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 12879023 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 3D995C43334 for ; Mon, 13 Jun 2022 05:34:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 936148D014C; Mon, 13 Jun 2022 01:34:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 822268D0142; Mon, 13 Jun 2022 01:34:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FEFA8D014C; Mon, 13 Jun 2022 01:34:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 44C758D0142 for ; Mon, 13 Jun 2022 01:34:06 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E971160DF2 for ; Mon, 13 Jun 2022 05:34:05 +0000 (UTC) X-FDA: 79572096450.08.12E25A4 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf28.hostedemail.com (Postfix) with ESMTP id 34A93C009E for ; Mon, 13 Jun 2022 05:34:05 +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 514A9D6E; Sun, 12 Jun 2022 22:34:04 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.38.134]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4CA4D3F66F; Sun, 12 Jun 2022 22:34:02 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Andrew Morton , linux-kernel@vger.kernel.org Subject: [PATCH V2 0/2] mm/mmap: Drop __SXXX/__PXXX macros from across platforms Date: Mon, 13 Jun 2022 11:03:52 +0530 Message-Id: <20220613053354.553579-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655098445; a=rsa-sha256; cv=none; b=3XlcMEK5le4VPy3W1Slryi7wnPcdLNqKIkF3CyhASdDJN1qkKcG8+nb6vERxzXLHWaX83T 8mv6Lmm6VqEZ+h6Sj4hEJ1ZjvmUwfbwtZAEhZfKpazG7gJoBnA9kdLp6JGjrLWv88HbNp5 sH79wMrvvQer4XxgPfUWfMjaeFPzzog= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.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=1655098445; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=WTxhgria65QNet3O3jpuecR12Oi/iwrHVrjWftTCqmg=; b=KBwe5evhYuvufksNJh9Yrel8W1SXt1Mw2b4iRBkfSLX8L61mB/hsYENsCJ0W+NfgoUQVOk KjkApRZ6BY3EqJvQ///aBV8pAHLstp62yCa/W/BNykE/v5S746J0/bgJcvgnDItXoPpYzE 8x3J6OfLle53m9y6WVUeYZBPmS1EC+0= X-Rspamd-Queue-Id: 34A93C009E Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.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-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: 7o915bmfdoggtkab8e153fteedc5xzpa X-HE-Tag: 1655098445-321304 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: __SXXX/__PXXX macros is an unnecessary abstraction layer in creating the generic protection_map[] array which is used for vm_get_page_prot(). This abstraction layer can be avoided, if the platforms just define the array protection_map[] for all possible vm_flags access permission combinations. This series drops __SXXX/__PXXX macros from across platforms in the tree. First it makes protection_map[] array private (static) on platforms which enable ARCH_HAS_VM_GET_PAGE_PROT, later moves protection_map[] array into arch for all remaining platforms (!ARCH_HAS_VM_GET_PAGE_PROT), dropping the generic one. In the process __SXXX/__PXXX macros become redundant and thus get dropped off completely. I understand that the diff stat is large here, but please do suggest if there is a better way. This series applies on v5.19-rc1 and has been build tested for multiple platforms. The CC list for this series has been reduced to just minimum, until there is some initial agreement. - Anshuman Changes in V2: - Add 'const' identifier to protection_map[] on powerpc - Dropped #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT check from sparc 32 - Dropped protection_map[] init from sparc 64 - Dropped all new platform changes subscribing ARCH_HAS_VM_GET_PAGE_PROT - Added a second patch which moves generic protection_map[] array into all remaining platforms (!ARCH_HAS_VM_GET_PAGE_PROT) Changes in V1: https://lore.kernel.org/linux-mm/20220603101411.488970-1-anshuman.khandual@arm.com/ Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Anshuman Khandual (2): mm/mmap: Restrict generic protection_map[] array visibility mm/mmap: Drop generic protection_map[] array arch/alpha/include/asm/pgtable.h | 17 ------- arch/alpha/mm/init.c | 21 +++++++++ arch/arc/include/asm/pgtable-bits-arcv2.h | 18 -------- arch/arc/mm/mmap.c | 19 ++++++++ arch/arm/include/asm/pgtable.h | 17 ------- arch/arm/lib/uaccess_with_memcpy.c | 2 +- arch/arm/mm/mmu.c | 19 ++++++++ arch/arm64/include/asm/pgtable-prot.h | 18 -------- arch/arm64/mm/mmap.c | 21 +++++++++ arch/csky/include/asm/pgtable.h | 18 -------- arch/csky/mm/init.c | 19 ++++++++ arch/hexagon/include/asm/pgtable.h | 27 ------------ arch/hexagon/mm/init.c | 41 +++++++++++++++++ arch/ia64/include/asm/pgtable.h | 18 -------- arch/ia64/mm/init.c | 27 +++++++++++- arch/loongarch/include/asm/pgtable-bits.h | 19 -------- arch/loongarch/mm/cache.c | 45 +++++++++++++++++++ arch/m68k/include/asm/mcf_pgtable.h | 54 ----------------------- arch/m68k/include/asm/motorola_pgtable.h | 22 --------- arch/m68k/include/asm/sun3_pgtable.h | 17 ------- arch/m68k/mm/mcfmmu.c | 54 +++++++++++++++++++++++ arch/m68k/mm/motorola.c | 19 ++++++++ arch/m68k/mm/sun3mmu.c | 19 ++++++++ arch/microblaze/include/asm/pgtable.h | 17 ------- arch/microblaze/mm/init.c | 19 ++++++++ arch/mips/include/asm/pgtable.h | 22 --------- arch/mips/mm/cache.c | 2 + arch/nios2/include/asm/pgtable.h | 16 ------- arch/nios2/mm/init.c | 19 ++++++++ arch/openrisc/include/asm/pgtable.h | 18 -------- arch/openrisc/mm/init.c | 19 ++++++++ arch/parisc/include/asm/pgtable.h | 18 -------- arch/parisc/mm/init.c | 19 ++++++++ arch/powerpc/include/asm/pgtable.h | 18 -------- arch/powerpc/mm/book3s64/pgtable.c | 1 + arch/powerpc/mm/pgtable.c | 19 ++++++++ arch/riscv/include/asm/pgtable.h | 20 --------- arch/riscv/mm/init.c | 19 ++++++++ arch/s390/include/asm/pgtable.h | 17 ------- arch/s390/mm/mmap.c | 19 ++++++++ arch/sh/include/asm/pgtable.h | 17 ------- arch/sh/mm/mmap.c | 19 ++++++++ arch/sparc/include/asm/pgtable_32.h | 19 -------- arch/sparc/include/asm/pgtable_64.h | 19 -------- arch/sparc/mm/init_32.c | 19 ++++++++ arch/sparc/mm/init_64.c | 3 ++ arch/um/include/asm/pgtable.h | 17 ------- arch/um/kernel/mem.c | 19 ++++++++ arch/x86/include/asm/pgtable_types.h | 19 -------- arch/x86/mm/pgprot.c | 19 ++++++++ arch/x86/um/mem_32.c | 2 +- arch/xtensa/include/asm/pgtable.h | 18 -------- arch/xtensa/mm/init.c | 19 ++++++++ include/linux/mm.h | 2 + mm/mmap.c | 19 -------- 55 files changed, 541 insertions(+), 522 deletions(-) Acked-by: Christoph Hellwig