Re: [PATCH] arm64: mm: Make flush_tlb_fix_spurious_fault() a no-op
From: Catalin Marinas
Date: Wed Sep 30 2020 - 13:14:12 EST
On Wed, Sep 30, 2020 at 02:18:59PM +0100, Will Deacon wrote:
> diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
> index f07333e86c2f..a696a7921da4 100644
> --- a/arch/arm64/mm/fault.c
> +++ b/arch/arm64/mm/fault.c
> @@ -218,7 +218,9 @@ int ptep_set_access_flags(struct vm_area_struct *vma,
> pteval = cmpxchg_relaxed(&pte_val(*ptep), old_pteval, pteval);
> } while (pteval != old_pteval);
>
> - flush_tlb_fix_spurious_fault(vma, address);
> + /* Invalidate a stale read-only entry */
> + if (dirty)
> + flush_tlb_page(vma, address);
> return 1;
In my proposal I had a pte_accessible(pte) check instead of dirty here
since we may go for an old pte directly to a writable one and a TLBI
wouldn't be needed. Not that it matters from a performance perspective.
Either way,
Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>