2024-05-27 12:10:44

by Oscar Salvador

[permalink] [raw]
Subject: Re: [RFC PATCH v3 08/16] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

On Sun, May 26, 2024 at 11:22:28AM +0200, Christophe Leroy wrote:
> In order to fit better with standard Linux page tables layout, add
> support for 8M pages using contiguous PTE entries in a standard
> page table. Page tables will then be populated with 1024 similar
> entries and two PMD entries will point to that page table.
>
> The PMD entries also get a flag to tell it is addressing an 8M page,
> this is required for the HW tablewalk assistance.
>
> Signed-off-by: Christophe Leroy <[email protected]>

I did not look close into KSAN bits, and I trust you with the assembly part,
but other than that looks good to me, so FWIW:

Reviewed-by: Oscar Salvador <[email protected]>

Just a nit below:

> +#define __HAVE_ARCH_HUGE_PTEP_GET
> +static inline pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
> +{
> + if (ptep_is_8m_pmdp(mm, addr, ptep))
> + ptep = pte_offset_kernel((pmd_t *)ptep, 0);

Would it not be more clear to use pmd_page_vaddr directly there?


--
Oscar Salvador
SUSE Labs


2024-05-28 10:54:20

by Christophe Leroy

[permalink] [raw]
Subject: Re: [RFC PATCH v3 08/16] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries



Le 27/05/2024 à 14:10, Oscar Salvador a écrit :
> On Sun, May 26, 2024 at 11:22:28AM +0200, Christophe Leroy wrote:
>> In order to fit better with standard Linux page tables layout, add
>> support for 8M pages using contiguous PTE entries in a standard
>> page table. Page tables will then be populated with 1024 similar
>> entries and two PMD entries will point to that page table.
>>
>> The PMD entries also get a flag to tell it is addressing an 8M page,
>> this is required for the HW tablewalk assistance.
>>
>> Signed-off-by: Christophe Leroy <[email protected]>
>
> I did not look close into KSAN bits, and I trust you with the assembly part,
> but other than that looks good to me, so FWIW:
>
> Reviewed-by: Oscar Salvador <[email protected]>
>
> Just a nit below:
>
>> +#define __HAVE_ARCH_HUGE_PTEP_GET
>> +static inline pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
>> +{
>> + if (ptep_is_8m_pmdp(mm, addr, ptep))
>> + ptep = pte_offset_kernel((pmd_t *)ptep, 0);
>
> Would it not be more clear to use pmd_page_vaddr directly there?
>
>

Well, the correct way should have been:

ptep = pte_offset_kernel((pmd_t *)ptep, ALIGN_DOWN(addr, SZ_8M));

Now, is it more clear with:

ptep = (pte_t *)pmd_page_vaddr(*(pmd_t *)ptep);

I don't know.