Re: [PATCH 00/30] mm/mmap: Drop protection_map[] and platform's __SXXX/__PXXX requirements

From: Anshuman Khandual
Date: Thu Feb 17 2022 - 04:46:17 EST




On 2/14/22 8:00 AM, Anshuman Khandual wrote:
> protection_map[] is an array based construct that translates given vm_flags
> combination. This array contains page protection map, which is populated by
> the platform via [__S000 .. __S111] and [__P000 .. __P111] exported macros.
> Primary usage for protection_map[] is for vm_get_page_prot(), which is used
> to determine page protection value for a given vm_flags. vm_get_page_prot()
> implementation, could again call platform overrides arch_vm_get_page_prot()
> and arch_filter_pgprot(). Some platforms override protection_map[] that was
> originally built with __SXXX/__PXXX with different runtime values.
>
> Currently there are multiple layers of abstraction i.e __SXXX/__PXXX macros
> , protection_map[], arch_vm_get_page_prot() and arch_filter_pgprot() built
> between the platform and generic MM, finally defining vm_get_page_prot().
>
> Hence this series proposes to drop all these abstraction levels and instead
> just move the responsibility of defining vm_get_page_prot() to the platform
> itself making it clean and simple.
>
> This first introduces ARCH_HAS_VM_GET_PAGE_PROT which enables the platforms
> to define custom vm_get_page_prot(). This starts converting platforms that
> either change protection_map[] or define the overrides arch_filter_pgprot()
> or arch_vm_get_page_prot() which enables for those constructs to be dropped
> off completely. This series then converts remaining platforms which enables
> for __SXXX/__PXXX constructs to be dropped off completely. Finally it drops
> the generic vm_get_page_prot() and then ARCH_HAS_VM_GET_PAGE_PROT as every
> platform now defines their own vm_get_page_prot().
>
> The series has been inspired from an earlier discuss with Christoph Hellwig
>
> https://lore.kernel.org/all/1632712920-8171-1-git-send-email-anshuman.khandual@xxxxxxx/
>
> This series applies on 5.17-rc3 after the following patch.
>
> https://lore.kernel.org/all/1643004823-16441-1-git-send-email-anshuman.khandual@xxxxxxx/
>
> This series has been cross built for multiple platforms.
>
> - Anshuman
>
> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: linux-mm@xxxxxxxxx
> Cc: linux-arch@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
>
> Changes in V1:
>
> - Add white spaces around the | operators
> - Moved powerpc_vm_get_page_prot() near vm_get_page_prot() on powerpc
> - Moved arm64_vm_get_page_prot() near vm_get_page_prot() on arm64
> - Moved sparc_vm_get_page_prot() near vm_get_page_prot() on sparc
> - Compacted vm_get_page_prot() switch cases on all platforms
> - _PAGE_CACHE040 inclusion is dependent on CPU_IS_040_OR_060
> - VM_SHARED case should return PAGE_NONE (not PAGE_COPY) on SH platform
> - Reorganized VM_SHARED, VM_EXEC, VM_WRITE, VM_READ
> - Dropped the last patch [RFC V1 31/31] which added macros for vm_flags combinations
> https://lore.kernel.org/all/1643029028-12710-32-git-send-email-anshuman.khandual@xxxxxxx/


Hello,

Just a gentle ping. I am planning to respin the series earlier next week
on v5.17-rc5 with the build failure fixes and also accommodating a review
comment from Geert. But will really appreciate some more reviews/comments/
suggestions as the series changes code in every platform.

Although all individual patches copy required reviewers and mailing lists,
I am wondering should they all be included in the cover letter and copied
for individual patches as well via cc-cover. But previously, patches with
many emails copied, faced problems while being delivered to mailing lists.

- Anshuman