Skip to content

Commit 6a1bdb1

Browse files
committed
arm64: mm: Make flush_tlb_fix_spurious_fault() a no-op
Our use of broadcast TLB maintenance means that spurious page-faults that have been handled already by another CPU do not require additional TLB maintenance. Make flush_tlb_fix_spurious_fault() a no-op and rely on the existing TLB invalidation instead. Add an explicit flush_tlb_page() when making a page dirty, as the TLB is permitted to cache the old read-only entry. Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20200728092220.GA21800@willie-the-truck Signed-off-by: Will Deacon <will@kernel.org>
1 parent e676594 commit 6a1bdb1

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

arch/arm64/include/asm/pgtable.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
5050
__flush_tlb_range(vma, addr, end, PUD_SIZE, false, 1)
5151
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
5252

53+
/*
54+
* Outside of a few very special situations (e.g. hibernation), we always
55+
* use broadcast TLB invalidation instructions, therefore a spurious page
56+
* fault on one CPU which has been handled concurrently by another CPU
57+
* does not need to perform additional invalidation.
58+
*/
59+
#define flush_tlb_fix_spurious_fault(vma, address) do { } while (0)
60+
5361
/*
5462
* ZERO_PAGE is a global shared page that is always zero: used
5563
* for zero-mapped memory areas etc..

arch/arm64/mm/fault.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ int ptep_set_access_flags(struct vm_area_struct *vma,
218218
pteval = cmpxchg_relaxed(&pte_val(*ptep), old_pteval, pteval);
219219
} while (pteval != old_pteval);
220220

221-
flush_tlb_fix_spurious_fault(vma, address);
221+
/* Invalidate a stale read-only entry */
222+
if (dirty)
223+
flush_tlb_page(vma, address);
222224
return 1;
223225
}
224226

0 commit comments

Comments
 (0)