Message ID | 20190623094446.28722-2-npiggin@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fix vmalloc_to_page for huge vmap mappings | expand |
Hi Nick, On Sun, Jun 23, 2019 at 07:44:44PM +1000, Nicholas Piggin wrote: > walk_page_range() is going to be allowed to walk page tables other than > those of user space. For this it needs to know when it has reached a > 'leaf' entry in the page tables. This information will be provided by the > p?d_large() functions/macros. I can't remember whether or not I asked this before, but why not call this macro p?d_leaf() if that's what it's identifying? "Large" and "huge" are usually synonymous, so I find this naming needlessly confusing based on this patch in isolation. Will
On 01/07/2019 10:27, Will Deacon wrote: > Hi Nick, > > On Sun, Jun 23, 2019 at 07:44:44PM +1000, Nicholas Piggin wrote: >> walk_page_range() is going to be allowed to walk page tables other than >> those of user space. For this it needs to know when it has reached a >> 'leaf' entry in the page tables. This information will be provided by the >> p?d_large() functions/macros. > > I can't remember whether or not I asked this before, but why not call > this macro p?d_leaf() if that's what it's identifying? "Large" and "huge" > are usually synonymous, so I find this naming needlessly confusing based > on this patch in isolation. Hi Will, You replied to my posting of this patch before[1], to which you said: > I've have thought p?d_leaf() might match better with your description > above, but I'm not going to quibble on naming. Have you changed your mind about quibbling? ;) Steve [1] https://lore.kernel.org/lkml/20190611153650.GB4324@fuggles.cambridge.arm.com/
On Mon, Jul 01, 2019 at 11:03:51AM +0100, Steven Price wrote: > On 01/07/2019 10:27, Will Deacon wrote: > > On Sun, Jun 23, 2019 at 07:44:44PM +1000, Nicholas Piggin wrote: > >> walk_page_range() is going to be allowed to walk page tables other than > >> those of user space. For this it needs to know when it has reached a > >> 'leaf' entry in the page tables. This information will be provided by the > >> p?d_large() functions/macros. > > > > I can't remember whether or not I asked this before, but why not call > > this macro p?d_leaf() if that's what it's identifying? "Large" and "huge" > > are usually synonymous, so I find this naming needlessly confusing based > > on this patch in isolation. > > You replied to my posting of this patch before[1], to which you said: > > > I've have thought p?d_leaf() might match better with your description > > above, but I'm not going to quibble on naming. That explains the sense of deja vu. > Have you changed your mind about quibbling? ;) Ha, I suppose I have! If it's not loads of effort to use p?d_leaf() instead of p?d_large, then I'd certainly prefer that. Will
Will Deacon's on July 1, 2019 8:15 pm: > On Mon, Jul 01, 2019 at 11:03:51AM +0100, Steven Price wrote: >> On 01/07/2019 10:27, Will Deacon wrote: >> > On Sun, Jun 23, 2019 at 07:44:44PM +1000, Nicholas Piggin wrote: >> >> walk_page_range() is going to be allowed to walk page tables other than >> >> those of user space. For this it needs to know when it has reached a >> >> 'leaf' entry in the page tables. This information will be provided by the >> >> p?d_large() functions/macros. >> > >> > I can't remember whether or not I asked this before, but why not call >> > this macro p?d_leaf() if that's what it's identifying? "Large" and "huge" >> > are usually synonymous, so I find this naming needlessly confusing based >> > on this patch in isolation. Those page table macro names are horrible. Large, huge, leaf, wtf? They could do with a sensible renaming. But this series just follows naming that's alreay there on x86. Thanks, Nick
On Tue, Jul 02, 2019 at 01:07:11PM +1000, Nicholas Piggin wrote: > Will Deacon's on July 1, 2019 8:15 pm: > > On Mon, Jul 01, 2019 at 11:03:51AM +0100, Steven Price wrote: > >> On 01/07/2019 10:27, Will Deacon wrote: > >> > On Sun, Jun 23, 2019 at 07:44:44PM +1000, Nicholas Piggin wrote: > >> >> walk_page_range() is going to be allowed to walk page tables other than > >> >> those of user space. For this it needs to know when it has reached a > >> >> 'leaf' entry in the page tables. This information will be provided by the > >> >> p?d_large() functions/macros. > >> > > >> > I can't remember whether or not I asked this before, but why not call > >> > this macro p?d_leaf() if that's what it's identifying? "Large" and "huge" > >> > are usually synonymous, so I find this naming needlessly confusing based > >> > on this patch in isolation. > > Those page table macro names are horrible. Large, huge, leaf, wtf? > They could do with a sensible renaming. But this series just follows > naming that's alreay there on x86. I realise that, and I wasn't meaning to have a go at you. Just wanted to make my opinion clear by having a moan :) Will
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index fca26759081a..0e973201bc16 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -417,6 +417,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, PMD_TYPE_TABLE) #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ PMD_TYPE_SECT) +#define pmd_large(pmd) pmd_sect(pmd) #if defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS < 3 #define pud_sect(pud) (0) @@ -499,6 +500,7 @@ static inline void pte_unmap(pte_t *pte) { } #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) #define pud_present(pud) pte_present(pud_pte(pud)) +#define pud_large(pud) pud_sect(pud) #define pud_valid(pud) pte_valid(pud_pte(pud)) static inline void set_pud(pud_t *pudp, pud_t pud)
walk_page_range() is going to be allowed to walk page tables other than those of user space. For this it needs to know when it has reached a 'leaf' entry in the page tables. This information will be provided by the p?d_large() functions/macros. For arm64, we already have p?d_sect() macros which we can reuse for p?d_large(). pud_sect() is defined as a dummy function when CONFIG_PGTABLE_LEVELS < 3 or CONFIG_ARM64_64K_PAGES is defined. However when the kernel is configured this way then architecturally it isn't allowed to have a large page that this level, and any code using these page walking macros is implicitly relying on the page size/number of levels being the same as the kernel. So it is safe to reuse this for p?d_large() as it is an architectural restriction. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Steven Price <steven.price@arm.com> --- This patch is taken from arm64 but is required if this series is not build together with arm64 tree. arch/arm64/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+)