Re: [RFC PATCH V4 1/6] riscv: pgtable: Add custom protection_map init

From: Christoph Hellwig
Date: Wed Sep 15 2021 - 03:46:03 EST


On Sat, Sep 11, 2021 at 05:21:34PM +0800, guoren@xxxxxxxxxx wrote:
> From: Guo Ren <guoren@xxxxxxxxxxxxxxxxx>
>
> Some RISC-V CPU vendors have defined their own PTE attributes to
> solve non-coherent DMA bus problems. That makes _P/SXXX definitions
> contain global variables which could be initialized at the early
> boot stage before setup_vm. The patch prevents compile errors.

That sounds way to nice for someone who deliberatly ignores the
specification and should definitively not go into the kernel
commit log like this.

> This patch is similar to 316d097c4cd4 (x86/pti: Filter at
> vma->vm_page_prot population) which give a choice for arch custom
> implementation.

How? To me it looks like a bad duplication of such functionality in
a way that totally breaks abstractions. architectures really do not
have any business changing protection_map.