Re: [PATCH] drivers/sgi-gru: Use pxdp_get() for page table access

From: Anshuman Khandual
Date: Wed Oct 08 2025 - 00:25:45 EST




On 08/10/25 9:51 AM, Anshuman Khandual wrote:
> Replace all READ_ONCE() with a standard page table accessors i.e pxdp_get()
> that default into READ_ONCE() in cases where platforms do not override.
>
> Cc: Dimitri Sivanich <dimitri.sivanich@xxxxxxx>
> Cc: Arnd Bergmann <arnd@xxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> ---
> drivers/misc/sgi-gru/grufault.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c
> index 3557d78ee47a..60e55facd8d7 100644
> --- a/drivers/misc/sgi-gru/grufault.c
> +++ b/drivers/misc/sgi-gru/grufault.c
> @@ -212,19 +212,19 @@ static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr,
> pte_t pte;
>
> pgdp = pgd_offset(vma->vm_mm, vaddr);
> - if (unlikely(pgd_none(*pgdp)))
> + if (unlikely(pgd_none(pgdp_get(pgdp))))
> goto err;
>
> p4dp = p4d_offset(pgdp, vaddr);
> - if (unlikely(p4d_none(*p4dp)))
> + if (unlikely(p4d_none(p4dp_get(p4dp))))
> goto err;
>
> pudp = pud_offset(p4dp, vaddr);
> - if (unlikely(pud_none(*pudp)))
> + if (unlikely(pud_none(pudp_get(pudp))))
> goto err;
>
> pmdp = pmd_offset(pudp, vaddr);
> - if (unlikely(pmd_none(*pmdp)))
> + if (unlikely(pmd_none(pmdp_get(pmdp))))
> goto err;
> #ifdef CONFIG_X86_64
> if (unlikely(pmd_leaf(*pmdp)))

Please ignore this patch as it does not replace any READ_ONCE()
based page table accesses in this file. My bad.