Re: [PATCH 08/12] mm: pgtable: add shortcuts for accessing kernel PMD and PTE

2020-05-12 Thread Mike Rapoport
On Tue, May 12, 2020 at 12:24:41PM -0700, Matthew Wilcox wrote: > On Tue, May 12, 2020 at 09:44:18PM +0300, Mike Rapoport wrote: > > +++ b/include/linux/pgtable.h > > @@ -28,6 +28,24 @@ > > #define USER_PGTABLES_CEILING 0UL > > #endif > > > > +/* FIXME: */ > > Fix you what? Add documenta

Re: [PATCH 03/12] mm: reorder includes after introduction of linux/pgtable.h

2020-05-12 Thread Mike Rapoport
On Tue, May 12, 2020 at 12:20:13PM -0700, Matthew Wilcox wrote: > On Tue, May 12, 2020 at 09:44:13PM +0300, Mike Rapoport wrote: > > diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h > > index a093cd45ec79..701a05090141 100644 > > --- a/arch/alpha/kernel/proto.h > > +++ b/arch/alph

Re: [PATCH 08/12] mm: pgtable: add shortcuts for accessing kernel PMD and PTE

2020-05-12 Thread Matthew Wilcox
On Tue, May 12, 2020 at 09:44:18PM +0300, Mike Rapoport wrote: > +++ b/include/linux/pgtable.h > @@ -28,6 +28,24 @@ > #define USER_PGTABLES_CEILING0UL > #endif > > +/* FIXME: */ Fix you what? Add documentation? > +static inline pmd_t *pmd_off(struct mm_struct *mm, unsigned long va) >

Re: [PATCH 03/12] mm: reorder includes after introduction of linux/pgtable.h

2020-05-12 Thread Matthew Wilcox
On Tue, May 12, 2020 at 09:44:13PM +0300, Mike Rapoport wrote: > diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h > index a093cd45ec79..701a05090141 100644 > --- a/arch/alpha/kernel/proto.h > +++ b/arch/alpha/kernel/proto.h > @@ -2,8 +2,6 @@ > #include > #include > > -#inclu

[PATCH 12/12] mm: consolidate pgd_index() and pgd_offset{_k}() definitions

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport All architectures tables define pgd_offset() as an entry in the array of PGDs indexed by the pgd_index(), where pgd_index() is (address >> PGD_SHIFT) & (PTRS_PER_PGD - 1) For the most cases, the pgd_offset() uses mm->pgd as the pointer to the top-level page directory

[PATCH 10/12] mm: consolidate pmd_index() and pmd_offset() definitions

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport All architectures define pmd_index() as (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1) and all architectures that have at least three-level page tables define pmd_offset() as an entry in the array of PMDs indexed by the pmd_index(). For the most architectures the pmd_o

[PATCH 11/12] mm: consolidate pud_index() and pud_offset() definitions

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport All architectures that have at least four-level page tables define pud_offset() as an entry in the array of PUDs indexed by the pud_index(), where pud_index() is (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1) For the most architectures the pud_offset() implementation re

[PATCH 06/12] m68k/mm: move {cache, nocahe}_page() definitions close to their user

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport The cache_page() and nocache_page() functions are only used by the morotola MMU variant for setting caching attributes for the page table pages. Move the definitions of these functions from arch/m68k/include/asm/motorola_pgtable.h closer to their usage in arch/m68k/mm/motorol

[PATCH 08/12] mm: pgtable: add shortcuts for accessing kernel PMD and PTE

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport The powerpc 32-bit implementation of pgtable has nice shortcuts for accessing kernel PMD and PTE for a given virtual address. Make this helpers available for all architectures. Signed-off-by: Mike Rapoport --- arch/arc/mm/highmem.c | 10 +--- arch/arm/ma

[PATCH 07/12] x86/mm: simplify init_trampoline() and surrounding logic

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport There are three cases for the trampoline initialization: * 32-bit does nothing * 64-bit with kaslr disabled simply copies a PGD entry from the direct map to the trampoline PGD * 64-bit with kaslr enabled maps the real mode trampoline at PUD level These cases are currently d

[PATCH 09/12] mm: consolidate pte_index() and pte_offset_*() definitions

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport All architectures define pte_index() as (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1) and all architectures define pte_offset_kernel() as an entry in the array of PTEs indexed by the pte_index(). For the most architectures the pte_offset_kernel() implementation relie

[PATCH 03/12] mm: reorder includes after introduction of linux/pgtable.h

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport The replacement of with made the include of the latter in the middle of asm includes. Fix this up with the aid of the below script and manual adjustments here and there. import sys import re if len(sys.argv) is not 3: print "USAGE: %s "

[PATCH 05/12] m68k/mm/motorola: move comment about page table allocation funcitons

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport The comment about page table allocation functions resides in include/asm/motorola_pgtable.h while the functions live in include/asm/motorola_pgaloc.h. Move the comment close to the code. Signed-off-by: Mike Rapoport --- arch/m68k/include/asm/motorola_pgalloc.h | 6 ++

[PATCH 04/12] csky: replace definitions of __pXd_offset() with pXd_index()

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport All architectures use pXd_index() to get an entry in the page table page corresponding to a virtual address. Align csky with other architectures. Signed-off-by: Mike Rapoport --- arch/csky/include/asm/pgtable.h | 5 ++--- arch/csky/mm/fault.c| 2 +- arch/csky/m

[PATCH 01/12] mm: don't include asm/pgtable.h if linux/mm.h is already included

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport The linux/mm.h header includes to allow inlining of the functions involving page table manipulations, e.g. pte_alloc() and pmd_alloc(). So, there is no point to explicitly include in the files that include . The include statements in such cases are remove with a simple loop

[PATCH 00/12] mm: consolidate definitions of page table accessors

2020-05-12 Thread Mike Rapoport
From: Mike Rapoport Hi, The low level page table accessors (pXY_index(), pXY_offset()) are duplicated across all architectures and sometimes more than once. For instance, we have 31 definition of pgd_offset() for 25 supported architectures. Most of these definitions are actually identical and t