Skip to content

Fixup page directory freeing

Aneesh Kumar K.V linux-arch linux-mm linuxppc-dev lkml oe-kbuild-all stable 3 versions – Applied

Status from this message: [merged] asm-generic-tlb-provide-mmu_gather_table_free.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest9 patches 5 repliesApplied 9/9
  2. v39 patches 4 repliesSuperseded
  3. v23 patches 6 repliesSuperseded

Changes in v4 from the cover letter

* Added Cc:stable for first two patches
* Explained why we have sparc related changes in patch 2

Patches in v4 All 9 applied

#Subject and filesSizeRepliesApplied
1/9powerpc/mmu_gather: Enable RCU_TABLE_FREE even for !SMP casearch/powerpc/Kconfig arch/powerpc/include/asm/book3s/32/pgalloc.h arch/powerpc/include/asm/book3s/64/pgalloc.h +2 more+1 -261 replyApplied
2/9mm/mmu_gather: Invalidate TLB correctly on batch allocation failure and flusharch/Kconfig arch/powerpc/Kconfig arch/powerpc/include/asm/tlb.h +4 more+43 -201 replyApplied
3/9asm-generic/tlb: Avoid potential double flushinclude/asm-generic/tlb.h+6 -12 repliesApplied
4/9asm-gemeric/tlb: Remove stray function declarationsinclude/asm-generic/tlb.h+0 -40 repliesApplied
5/9asm-generic/tlb: Add missing CONFIG symbolarch/Kconfig+3 -00 repliesApplied
6/9asm-generic/tlb: Rename HAVE_RCU_TABLE_FREEarch/Kconfig arch/arm/Kconfig arch/arm/include/asm/tlb.h +10 more+21 -211 replyApplied
7/9asm-generic/tlb: Rename HAVE_MMU_GATHER_PAGE_SIZEarch/Kconfig arch/powerpc/Kconfig include/asm-generic/tlb.h +1 more+10 -70 repliesApplied
8/9asm-generic/tlb: Rename HAVE_MMU_GATHER_NO_GATHERarch/Kconfig arch/s390/Kconfig include/asm-generic/tlb.h +1 more+19 -90 repliesApplied
9/9asm-generic/tlb: Provide MMU_GATHER_TABLE_FREEarch/Kconfig arch/arm/include/asm/tlb.h include/asm-generic/tlb.h +1 more+130 -710 repliesApplied

Reviews trailers per patch

2 of 9 patches have a Reviewed-by or Acked-by.

PatchPeter Zijlstra (Intel)Michael Ellerman
1/9A-b A-b
2/9A-b
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/9] Fixup page directory freeing

This is a repost of patch series from Peter with the arch specific changes except ppc64 dropped. ppc64 changes are added here because we are redoing the patch series on top of ppc64 changes. This makes it easy to backport these changes. Only the first 2 patches need to be backported to stable.

The thing is, on anything SMP, freeing page directories should observe the exact same order as normal page freeing:

1) unhook page/directory
2) TLB invalidate
3) free page/directory

Without this, any concurrent page-table walk could end up with a Use-after-Free. This is esp. trivial for anything that has software page-table walkers (HAVE_FAST_GUP / software TLB fill) or the hardware caches partial page-walks (ie. caches page directories).

Even on UP this might give issues since mmu_gather is preemptible these days. An interrupt or preempted task accessing user pages might stumble into the free page if the hardware caches page directories.

This patch series fixup ppc64 and add generic MMU_GATHER changes to support the conversion of other architectures. I haven't added patches w.r.t other architecture because they are yet to be acked.

Changes from V3:
* Added Cc:stable for first two patches
* Explained why we have sparc related changes in patch 2

Aneesh Kumar K.V (1):
powerpc/mmu_gather: Enable RCU_TABLE_FREE even for !SMP case

Peter Zijlstra (8):
mm/mmu_gather: Invalidate TLB correctly on batch allocation failure
and flush
asm-generic/tlb: Avoid potential double flush asm-gemeric/tlb: Remove stray function declarations asm-generic/tlb: Add missing CONFIG symbol asm-generic/tlb: Rename HAVE_RCU_TABLE_FREE asm-generic/tlb: Rename HAVE_MMU_GATHER_PAGE_SIZE asm-generic/tlb: Rename HAVE_MMU_GATHER_NO_GATHER asm-generic/tlb: Provide MMU_GATHER_TABLE_FREE

 arch/Kconfig                                 |  13 +-
 arch/arm/Kconfig                             |   2 +-
 arch/arm/include/asm/tlb.h                   |   4 -
 arch/arm64/Kconfig                           |   2 +-
 arch/powerpc/Kconfig                         |   5 +-
 arch/powerpc/include/asm/book3s/32/pgalloc.h |   8 --
 arch/powerpc/include/asm/book3s/64/pgalloc.h |   2 -
 arch/powerpc/include/asm/nohash/pgalloc.h    |   8 --
 arch/powerpc/include/asm/tlb.h               |  11 ++
 arch/powerpc/mm/book3s64/pgtable.c           |   7 -
 arch/s390/Kconfig                            |   4 +-
 arch/sparc/Kconfig                           |   3 +-
 arch/sparc/include/asm/tlb_64.h              |   9 ++
 arch/x86/Kconfig                             |   2 +-
 arch/x86/include/asm/tlb.h                   |   4 +-
 include/asm-generic/tlb.h                    | 120 ++++++++++-------
 mm/gup.c                                     |   2 +-
 mm/mmu_gather.c                              | 134 +++++++++++++------
 18 files changed, 207 insertions(+), 133 deletions(-)
Signature · 1 line
2.24.1