Skip to content

Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

Christophe Leroy linux-mm linuxppc-dev lkml 7 versions – Applied

Status from this message: [merged mm-stable] mm-remove-config_arch_has_hugepd.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest23 patches 8 repliesApplied 23/23
  2. v623 patches 4 repliesSuperseded
  3. v518 patches 14 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v4 RFC16 patches20 repliesSuperseded
v3 RFC16 patches12 repliesSuperseded
v2 RFC20 patches39 repliesSuperseded
v1 RFC8 patches19 repliesSuperseded

Patches in v7 All 23 applied

#Subject and filesSizeRepliesApplied
1/23powerpc/64e: Remove unused IBM HTW codearch/powerpc/include/asm/nohash/mmu-e500.h arch/powerpc/mm/nohash/tlb.c arch/powerpc/mm/nohash/tlb_low_64e.S+2 -2530 repliesApplied
2/23powerpc/64e: Split out nohash Book3E 64-bit codearch/powerpc/mm/nohash/Makefile arch/powerpc/mm/nohash/tlb.c arch/powerpc/mm/nohash/tlb_64e.c+2 -6710 repliesApplied
3/23powerpc/64e: Drop E500 ifdefs in 64-bit codearch/powerpc/mm/nohash/tlb_64e.c+0 -120 repliesApplied
4/23powerpc/64e: Drop MMU_FTR_TYPE_FSL_E checks in 64-bit codearch/powerpc/kernel/setup_64.c arch/powerpc/mm/nohash/tlb_64e.c+38 -650 repliesApplied
5/23powerpc/64e: Consolidate TLB miss handler patchingarch/powerpc/mm/nohash/tlb_64e.c+15 -230 repliesApplied
6/23powerpc/64e: Drop unused TLB miss handlersarch/powerpc/kernel/exceptions-64e.S arch/powerpc/mm/nohash/tlb_64e.c arch/powerpc/mm/nohash/tlb_low_64e.S+2 -2320 repliesApplied
7/23mm: Define __pte_leaf_size() to also take a PMD entryinclude/linux/pgtable.h kernel/events/core.c+4 -10 repliesApplied
8/23mm: Provide mm_struct and address to huge_ptep_get()arch/arm/include/asm/hugetlb-3level.h arch/arm64/include/asm/hugetlb.h arch/arm64/mm/hugetlbpage.c +18 more+53 -530 repliesApplied
9/23powerpc/mm: Remove _PAGE_PSIZEarch/powerpc/include/asm/nohash/32/pte-44x.h arch/powerpc/include/asm/nohash/32/pte-85xx.h arch/powerpc/include/asm/nohash/32/pte-8xx.h +1 more+3 -120 repliesApplied
10/23powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entriesarch/powerpc/mm/pgtable.c+10 -10 repliesApplied
11/23powerpc/mm: Allow hugepages without hugepdarch/powerpc/Kconfig arch/powerpc/include/asm/book3s/32/pgalloc.h arch/powerpc/include/asm/hugetlb.h +4 more+41 -120 repliesApplied
12/23powerpc/8xx: Fix size given to set_huge_pte_at()arch/powerpc/mm/nohash/8xx.c+2 -10 repliesApplied
13/23powerpc/8xx: Rework support for 8M pages using contiguous PTE entriesarch/powerpc/include/asm/nohash/32/hugetlb-8xx.h arch/powerpc/include/asm/nohash/32/pte-8xx.h arch/powerpc/include/asm/nohash/pgtable.h +9 more+111 -1140 repliesApplied
14/23powerpc/8xx: Simplify struct mmu_psize_defarch/powerpc/include/asm/nohash/32/mmu-8xx.h+2 -70 repliesApplied
15/23powerpc/e500: Remove enc and ind fields from struct mmu_psize_defarch/powerpc/include/asm/nohash/mmu-e500.h arch/powerpc/mm/nohash/book3e_pgtable.c arch/powerpc/mm/nohash/tlb.c +1 more+4 -140 repliesApplied
16/23powerpc/e500: Switch to 64 bits PGD on 85xx (32 bits)arch/powerpc/include/asm/pgtable-types.h arch/powerpc/kernel/head_85xx.S+10 -48 repliesApplied
17/23powerpc/e500: Encode hugepage size in PTE bitsarch/powerpc/include/asm/nohash/hugetlb-e500.h arch/powerpc/include/asm/nohash/pte-e500.h+22 -150 repliesApplied
18/23powerpc/e500: Don't pre-check write access on data TLB errorarch/powerpc/kernel/head_85xx.S+0 -150 repliesApplied
19/23powerpc/e500: Free r10 for FIND_PTEarch/powerpc/kernel/head_85xx.S+16 -140 repliesApplied
20/23powerpc/e500: Use contiguous PMD instead of hugepdarch/powerpc/include/asm/nohash/hugetlb-e500.h arch/powerpc/include/asm/nohash/pgalloc.h arch/powerpc/include/asm/nohash/pgtable.h +7 more+107 -790 repliesApplied
21/23powerpc/64s: Use contiguous PMD/PUD instead of HUGEPDarch/powerpc/include/asm/book3s/64/hash-4k.h arch/powerpc/include/asm/book3s/64/hash.h arch/powerpc/include/asm/book3s/64/hugetlb.h +12 more+74 -1860 repliesApplied
22/23powerpc/mm: Remove hugepd leftoversarch/powerpc/include/asm/hugetlb.h arch/powerpc/include/asm/page.h arch/powerpc/include/asm/pgtable-be-types.h +4 more+3 -4770 repliesApplied
23/23mm: Remove CONFIG_ARCH_HAS_HUGEPDinclude/linux/hugetlb.h mm/Kconfig mm/gup.c +1 more+9 -2580 repliesApplied

Reviews trailers per patch

12 of 23 patches have a Reviewed-by or Acked-by.

PatchOscar SalvadorMichael Ellerman
1/23
2/23
3/23
4/23
5/23
6/23
7/23R-b
8/23R-b
9/23R-b
10/23R-b
11/23R-b
12/23R-b
13/23R-b
14/23R-b
15/23R-b
16/23
17/23
18/23
19/23
20/23
21/23A-b
22/23A-b
23/23A-b

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

Read the v7 thread

Cover letter [PATCH v7 00/23] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

This series should have reached maturity for linux-next.

Version v7 is rebased on top of mm-unstable (9bb8753acdd8)

Also see https://github.com/linuxppc/issues/issues/483

Unlike most architectures, powerpc 8xx HW requires a two-level pagetable topology for all page sizes. So a leaf PMD-contig approach is not feasible as such.

Possible sizes on 8xx are 4k, 16k, 512k and 8M.

First level (PGD/PMD) covers 4M per entry. For 8M pages, two PMD entries must point to a single entry level-2 page table. Until now that was done using hugepd. This series changes it to use standard page tables where the entry is replicated 1024 times on each of the two pagetables refered by the two associated PMD entries for that 8M page.

For e500 and book3s/64 there are less constraints because it is not tied to the HW assisted tablewalk like on 8xx, so it is easier to use leaf PMDs (and PUDs).

On e500 the supported page sizes are 4M, 16M, 64M, 256M and 1G. All at PMD level on e500/32 (mpc85xx) and mix of PMD and PUD for e500/64. We encode page size with 4 available bits in PTE entries. On e300/32 PGD entries size is increases to 64 bits in order to allow leaf-PMD entries because PTE are 64 bits on e500.

On book3s/64 only the hash-4k mode is concerned. It supports 16M pages as cont-PMD and 16G pages as cont-PUD. In other modes (radix-4k, radix-6k and hash-64k) the sizes match with PMD and PUD sizes so that's just leaf entries. The hash processing make things a bit more complex. To ease things, __hash_page_huge() is modified to bail out when DIRTY or ACCESSED bits are missing, leaving it to mm core to fix it.

Global changes in v7:
- Rebased on top of mm-unstable (9bb8753acdd8)
- Added Ack from Michael on patch 21

Global changes in v6:
- Unsquashed preliminary series from Michael so that everything gets merged together through mm
- In patch 3, removed the modification of pte-40x.h, because 40x is going away completely in another series. This has no impact.
- Added a WARN_ON_ONCE() in patch 21 as commented by Oscar.

Global changes in v5:
- Now use PAGE SIZE field in e500's PTE to store TSIZE instead of using U0-U3
- On e500/64, use highest bit to discriminate leaf entries because PUD entries are not garantied to be 4k aligned so PAGE SIZE field is not garantied to be 0 on a non-leaf entry.

Global changes in v4:
- Fixed a few issues reported privately by robots
- Rebased on top of v6.10-rc1

Global changes in v3:
- Removed patches 1 and 2
- Squashed patch 11 into patch 5
- Replaced patches 12 and 13 with a series from Michael
- Reordered patches a bit to have more general patches up front

For more details on changes, see in each patch.

Christophe Leroy (17):
mm: Define __pte_leaf_size() to also take a PMD entry
mm: Provide mm_struct and address to huge_ptep_get() powerpc/mm: Remove _PAGE_PSIZE
powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries powerpc/mm: Allow hugepages without hugepd
powerpc/8xx: Fix size given to set_huge_pte_at() powerpc/8xx: Rework support for 8M pages using contiguous PTE entries powerpc/8xx: Simplify struct mmu_psize_def
powerpc/e500: Remove enc and ind fields from struct mmu_psize_def powerpc/e500: Switch to 64 bits PGD on 85xx (32 bits) powerpc/e500: Encode hugepage size in PTE bits powerpc/e500: Don't pre-check write access on data TLB error powerpc/e500: Free r10 for FIND_PTE
powerpc/e500: Use contiguous PMD instead of hugepd powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD powerpc/mm: Remove hugepd leftovers
mm: Remove CONFIG_ARCH_HAS_HUGEPD

Michael Ellerman (6):
powerpc/64e: Remove unused IBM HTW code powerpc/64e: Split out nohash Book3E 64-bit code powerpc/64e: Drop E500 ifdefs in 64-bit code powerpc/64e: Drop MMU_FTR_TYPE_FSL_E checks in 64-bit code powerpc/64e: Consolidate TLB miss handler patching powerpc/64e: Drop unused TLB miss handlers

 arch/arm/include/asm/hugetlb-3level.h         |   4 +-
 arch/arm64/include/asm/hugetlb.h              |   2 +-
 arch/arm64/mm/hugetlbpage.c                   |   2 +-
 arch/powerpc/Kconfig                          |   1 -
 arch/powerpc/include/asm/book3s/32/pgalloc.h  |   2 -
 arch/powerpc/include/asm/book3s/64/hash-4k.h  |  15 -
 arch/powerpc/include/asm/book3s/64/hash.h     |  40 +-
 arch/powerpc/include/asm/book3s/64/hugetlb.h  |  38 --
 .../include/asm/book3s/64/pgtable-4k.h        |  47 --
 .../include/asm/book3s/64/pgtable-64k.h       |  20 -
 arch/powerpc/include/asm/book3s/64/pgtable.h  |  22 +-
 arch/powerpc/include/asm/hugetlb.h            |  15 +-
 .../include/asm/nohash/32/hugetlb-8xx.h       |  38 +-
 arch/powerpc/include/asm/nohash/32/mmu-8xx.h  |   9 +-
 arch/powerpc/include/asm/nohash/32/pte-44x.h  |   3 -
 arch/powerpc/include/asm/nohash/32/pte-85xx.h |   3 -
 arch/powerpc/include/asm/nohash/32/pte-8xx.h  |  58 ++-
 .../powerpc/include/asm/nohash/hugetlb-e500.h |  39 +-
 arch/powerpc/include/asm/nohash/mmu-e500.h    |   6 +-
 arch/powerpc/include/asm/nohash/pgalloc.h     |   2 -
 arch/powerpc/include/asm/nohash/pgtable.h     |  46 +-
 arch/powerpc/include/asm/nohash/pte-e500.h    |  63 ++-
 arch/powerpc/include/asm/page.h               |  32 --
 arch/powerpc/include/asm/pgtable-be-types.h   |  10 -
 arch/powerpc/include/asm/pgtable-types.h      |  13 +-
 arch/powerpc/include/asm/pgtable.h            |   3 +
 arch/powerpc/kernel/exceptions-64e.S          |   4 +-
 arch/powerpc/kernel/head_85xx.S               |  70 +--
 arch/powerpc/kernel/head_8xx.S                |  10 +-
 arch/powerpc/kernel/setup_64.c                |   6 +-
 arch/powerpc/mm/book3s64/hash_utils.c         |  11 +-
 arch/powerpc/mm/book3s64/hugetlbpage.c        |  10 +
 arch/powerpc/mm/book3s64/pgtable.c            |  12 -
 arch/powerpc/mm/hugetlbpage.c                 | 455 +-----------------
 arch/powerpc/mm/init-common.c                 |   8 +-
 arch/powerpc/mm/kasan/8xx.c                   |  21 +-
 arch/powerpc/mm/nohash/8xx.c                  |  43 +-
 arch/powerpc/mm/nohash/Makefile               |   2 +-
 arch/powerpc/mm/nohash/book3e_pgtable.c       |   4 +-
 arch/powerpc/mm/nohash/tlb.c                  | 407 +---------------
 arch/powerpc/mm/nohash/tlb_64e.c              | 314 ++++++++++++
 arch/powerpc/mm/nohash/tlb_low_64e.S          | 428 +---------------
 arch/powerpc/mm/pgtable.c                     |  94 ++--
 arch/powerpc/mm/pgtable_32.c                  |   2 +-
 arch/riscv/include/asm/hugetlb.h              |   2 +-
 arch/riscv/mm/hugetlbpage.c                   |   2 +-
 arch/s390/include/asm/hugetlb.h               |   4 +-
 arch/s390/mm/hugetlbpage.c                    |   4 +-
 fs/hugetlbfs/inode.c                          |   2 +-
 fs/proc/task_mmu.c                            |  10 +-
 fs/userfaultfd.c                              |   2 +-
 include/asm-generic/hugetlb.h                 |   2 +-
 include/linux/hugetlb.h                       |   6 -
 include/linux/pgtable.h                       |   3 +
 include/linux/swapops.h                       |   4 +-
 kernel/events/core.c                          |   2 +-
 mm/Kconfig                                    |  10 -
 mm/damon/vaddr.c                              |   6 +-
 mm/gup.c                                      | 194 +-------
 mm/hmm.c                                      |   2 +-
 mm/hugetlb.c                                  |  44 +-
 mm/memory-failure.c                           |   2 +-
 mm/mempolicy.c                                |   2 +-
 mm/migrate.c                                  |   4 +-
 mm/mincore.c                                  |   2 +-
 mm/pagewalk.c                                 |  57 +--
 mm/userfaultfd.c                              |   2 +-
 67 files changed, 751 insertions(+), 2051 deletions(-)
 delete mode 100644 arch/powerpc/include/asm/book3s/64/pgtable-4k.h
 create mode 100644 arch/powerpc/mm/nohash/tlb_64e.c
Signature · 1 line
2.44.0