Skip to content

RFC Avoid synchronous TLB invalidation for intermediate page-table entries on arm64

Will Deacon linux-arm-kernel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest11 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11arm64: tlb: Use last-level invalidation in flush_tlb_kernel_range()arch/arm64/include/asm/tlbflush.h+1 -10 replies
2/11arm64: tlb: Add DSB ISHST prior to TLBI in __flush_tlb_[kernel_]pgtable()arch/arm64/include/asm/tlbflush.h+2 -02 replies
3/11arm64: pgtable: Implement p[mu]d_valid() and check in set_p[mu]d()arch/arm64/include/asm/pgtable.h+8 -22 replies
4/11arm64: tlb: Justify non-leaf invalidation in flush_tlb_range()arch/arm64/include/asm/tlbflush.h+4 -00 replies
5/11arm64: tlbflush: Allow stride to be specified for __flush_tlb_range()arch/arm64/include/asm/tlb.h arch/arm64/include/asm/tlbflush.h+8 -50 replies
6/11arm64: tlb: Remove redundant !CONFIG_HAVE_RCU_TABLE_FREE codearch/arm64/include/asm/tlb.h+3 -90 replies
7/11asm-generic/tlb: Guard with #ifdef CONFIG_MMUinclude/asm-generic/tlb.h+3 -00 replies
8/11asm-generic/tlb: Track freeing of page-table directories in struct mmu_gatherinclude/asm-generic/tlb.h+23 -84 replies
9/11asm-generic/tlb: Track which levels of the page tables have been clearedinclude/asm-generic/tlb.h mm/memory.c+48 -92 replies
10/11arm64: tlb: Adjust stride and type of TLBI according to mmu_gatherarch/arm64/include/asm/tlb.h+10 -90 replies
11/11arm64: tlb: Avoid synchronous TLBIs when freeing page tablesarch/arm64/Kconfig arch/arm64/include/asm/tlb.h arch/arm64/include/asm/tlbflush.h+1 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 00/11] Avoid synchronous TLB invalidation for intermediate page-table entries on arm64

Hi all,

I hacked up this RFC on the back of the recent changes to the mmu_gather stuff in mainline. It's had a bit of testing and it looks pretty good so far.

The main changes in the series are:

- Avoid emitting a DSB barrier after clearing each page-table entry. Instead, we can have a single DSB prior to the actual TLB invalidation.

- Batch last-level TLB invalidation until the end of the VMA, and use last-level-only invalidation instructions

- Batch intermediate TLB invalidation until the end of the gather, and use all-level invalidation instructions

- Adjust the stride of TLB invalidation based upon the smallest unflushed granule in the gather

As a really stupid benchmark, unmapping a populated mapping of 0x4_3333_3000 bytes using munmap() takes around 20% of the time it took before.

The core changes now track the levels of page-table that have been visited by the mmu_gather since the last flush. It may be possible to use the page_size field instead if we decide to resurrect that from its current "debug" status, but I think I'd prefer to track the levels explicitly.

Anyway, I wanted to post this before disappearing for the long weekend (Monday is a holiday in the UK) in the hope that it helps some of the ongoing discussions.

Cheers,

Will

--->8

Peter Zijlstra (1):
asm-generic/tlb: Track freeing of page-table directories in struct
mmu_gather

Will Deacon (10):
arm64: tlb: Use last-level invalidation in flush_tlb_kernel_range()
arm64: tlb: Add DSB ISHST prior to TLBI in

    __flush_tlb_[kernel_]pgtable()

arm64: pgtable: Implement p[mu]d_valid() and check in set_p[mu]d()
arm64: tlb: Justify non-leaf invalidation in flush_tlb_range()
arm64: tlbflush: Allow stride to be specified for __flush_tlb_range()
arm64: tlb: Remove redundant !CONFIG_HAVE_RCU_TABLE_FREE code asm-generic/tlb: Guard with #ifdef CONFIG_MMU asm-generic/tlb: Track which levels of the page tables have been
cleared
arm64: tlb: Adjust stride and type of TLBI according to mmu_gather
arm64: tlb: Avoid synchronous TLBIs when freeing page tables

 arch/arm64/Kconfig                |  1 +
 arch/arm64/include/asm/pgtable.h  | 10 ++++-
 arch/arm64/include/asm/tlb.h      | 34 +++++++----------
 arch/arm64/include/asm/tlbflush.h | 28 +++++++-------
 include/asm-generic/tlb.h         | 79 +++++++++++++++++++++++++++++++++------
 mm/memory.c                       |  4 +-
 6 files changed, 105 insertions(+), 51 deletions(-)
Signature · 1 line
2.1.4