mbox series

[v10,00/13] Convert powerpc to default topdown mmap layout (v10)

Message ID cover.1649523076.git.christophe.leroy@csgroup.eu (mailing list archive)
Headers show
Series Convert powerpc to default topdown mmap layout (v10) | expand

Message

Christophe Leroy April 9, 2022, 5:17 p.m. UTC
Rebased on top of v5.18-rc1

This series converts powerpc to default topdown mmap layout.

First patch is a mm fix that should go into v5.18 and stable.

Andrew, can you take it ?

It is a complement/fix of f6795053dac8 ("mm: mmap: Allow for
"high" userspace addresses") for hugetlb. It adds support for "high"
userspace addresses that are optionally supported on the system and
have to be requested via a hint mechanism ("high" addr parameter to mmap).

powerpc requires its own arch_get_unmapped_area() only when
slices are needed, which is only for book3s/64. First part of
the series moves slices into book3s/64 specific directories
and cleans up other subarchitectures.

Last part converts to default topdown mmap layout.

A small modification is done to core mm to allow
powerpc to still provide its own arch_randomize_brk()

Another modification is done to core mm to allow powerpc
to use generic versions of get_unmapped_area functions for Radix
while still providing its own implementation for Hash, the
selection between Radix and Hash being doing at runtime.

Last modification to core mm is to give len and flags to
arch_get_mmap_end().

Changes in v10:
- Moved patch 4 as first patch in order to allow merging a stable backporting independently

Changes in v9:
- v9 was just a split of v8 for tentatively getting the mm part merge through mm and the rest through powerpc tree

Changes in v8:
- Moved patch "sizes.h: Add SZ_1T macro" up from which is already in linux-next but not in Linus tree yet.
- Rebased on today's powerpc/next

Changes in v7:
- Taken into account comments from Catalin (patches 3 and 4)

Changes in v6:
- New patch (patch 4) to take arch_get_mmap_base() and arch_get_mmap_end() into account in generic hugetlb_get_unmapped_area()
- Get back arch_randomize_brk() simplification as it relies on default topdown mmap layout.
- Fixed precedence between || and && in powerpc's arch_get_mmap_end() (patch 9)

Changes in v5:
- Added patch 3
- Added arch_get_mmap_base() and arch_get_mmap_end() to patch 7 to better match original powerpc behaviour
- Switched patched 10 and 11 and performed full randomisation in patch 10 just before switching to default implementation, as suggested by Nic.

Changes in v4:
- Move arch_randomize_brk() simplification out of this series
- Add a change to core mm to enable using generic implementation
while providing arch specific one at the same time.
- Reworked radix get_unmapped_area to use generic implementation
- Rebase on top of Nic's series v6

Changes in v3:
- Fixed missing <linux/elf-randomize.h> in last patch
- Added a patch to move SZ_1T out of drivers/pci/controller/pci-xgene.c

Changes in v2:
- Moved patch 4 before patch 2
- Make generic arch_randomize_brk() __weak
- Added patch 9

Christophe Leroy (13):
  mm, hugetlbfs: Allow for "high" userspace addresses
  mm: Allow arch specific arch_randomize_brk() with
    CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
  mm, hugetlbfs: Allow an arch to always use generic versions of
    get_unmapped_area functions
  mm: Add len and flags parameters to arch_get_mmap_end()
  powerpc/mm: Move vma_mmu_pagesize()
  powerpc/mm: Make slice specific to book3s/64
  powerpc/mm: Remove CONFIG_PPC_MM_SLICES
  powerpc/mm: Use generic_get_unmapped_area() and call it from
    arch_get_unmapped_area()
  powerpc/mm: Use generic_hugetlb_get_unmapped_area()
  powerpc/mm: Move get_unmapped_area functions to slice.c
  powerpc/mm: Enable full randomisation of memory mappings
  powerpc/mm: Convert to default topdown mmap layout
  powerpc: Simplify and move arch_randomize_brk()

 arch/arm64/include/asm/processor.h            |   4 +-
 arch/powerpc/Kconfig                          |   2 +-
 arch/powerpc/include/asm/book3s/64/hugetlb.h  |   4 -
 arch/powerpc/include/asm/book3s/64/mmu-hash.h |   1 +
 arch/powerpc/include/asm/book3s/64/mmu.h      |   6 -
 arch/powerpc/include/asm/book3s/64/slice.h    |  24 ++
 arch/powerpc/include/asm/hugetlb.h            |   2 +-
 arch/powerpc/include/asm/paca.h               |   7 -
 arch/powerpc/include/asm/page.h               |   1 -
 arch/powerpc/include/asm/processor.h          |   2 -
 arch/powerpc/include/asm/slice.h              |  46 ----
 arch/powerpc/include/asm/task_size_64.h       |   8 +
 arch/powerpc/kernel/paca.c                    |   5 -
 arch/powerpc/kernel/process.c                 |  41 ---
 arch/powerpc/mm/Makefile                      |   3 +-
 arch/powerpc/mm/book3s64/Makefile             |   2 +-
 arch/powerpc/mm/book3s64/hash_utils.c         |  33 ++-
 arch/powerpc/mm/book3s64/radix_hugetlbpage.c  |  55 ----
 arch/powerpc/mm/{ => book3s64}/slice.c        |  71 ++++-
 arch/powerpc/mm/hugetlbpage.c                 |  34 ---
 arch/powerpc/mm/mmap.c                        | 256 ------------------
 arch/powerpc/mm/nohash/mmu_context.c          |   9 -
 arch/powerpc/mm/nohash/tlb.c                  |   4 -
 arch/powerpc/platforms/Kconfig.cputype        |   4 -
 fs/hugetlbfs/inode.c                          |  26 +-
 include/linux/hugetlb.h                       |   5 +
 include/linux/sched/mm.h                      |  17 ++
 mm/mmap.c                                     |  43 +--
 mm/util.c                                     |   2 +-
 29 files changed, 183 insertions(+), 534 deletions(-)
 delete mode 100644 arch/powerpc/include/asm/slice.h
 rename arch/powerpc/mm/{ => book3s64}/slice.c (91%)
 delete mode 100644 arch/powerpc/mm/mmap.c

Comments

Michael Ellerman May 15, 2022, 10:28 a.m. UTC | #1
On Sat, 9 Apr 2022 19:17:24 +0200, Christophe Leroy wrote:
> Rebased on top of v5.18-rc1
> 
> This series converts powerpc to default topdown mmap layout.
> 
> First patch is a mm fix that should go into v5.18 and stable.
> 
> Andrew, can you take it ?
> 
> [...]

Patches 2-13 applied to powerpc/next.

[02/13] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
        https://git.kernel.org/powerpc/c/723820f3f77dc9f7ffdceb076ebcf6a5b91d0a27
[03/13] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions
        https://git.kernel.org/powerpc/c/4b439e25e29ec336c0e71ef1d1b212c412526518
[04/13] mm: Add len and flags parameters to arch_get_mmap_end()
        https://git.kernel.org/powerpc/c/2cb4de085f383cb9289083d1bedbaad046f640eb
[05/13] powerpc/mm: Move vma_mmu_pagesize()
        https://git.kernel.org/powerpc/c/93ea910295cae7ad69571ed1570e5b5ca54a2f9e
[06/13] powerpc/mm: Make slice specific to book3s/64
        https://git.kernel.org/powerpc/c/1408fca0c198471a5cd089742b9d3f9739073483
[07/13] powerpc/mm: Remove CONFIG_PPC_MM_SLICES
        https://git.kernel.org/powerpc/c/f693d38d9468101587175b1e62d7e4483b51d8f5
[08/13] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area()
        https://git.kernel.org/powerpc/c/76a345ed16c63df9b02d3e374e8d5e39471174ad
[09/13] powerpc/mm: Use generic_hugetlb_get_unmapped_area()
        https://git.kernel.org/powerpc/c/1a0261fd3b218b6999f38dc791a66c9b7ddc7e8b
[10/13] powerpc/mm: Move get_unmapped_area functions to slice.c
        https://git.kernel.org/powerpc/c/ab57bd7570d4393beb5a91bf092ed54e9c3574a2
[11/13] powerpc/mm: Enable full randomisation of memory mappings
        https://git.kernel.org/powerpc/c/5cf7f9a0a54e93a6d3361de5f4ba4358b054c6c2
[12/13] powerpc/mm: Convert to default topdown mmap layout
        https://git.kernel.org/powerpc/c/36e5f9ee776cb6db6ab8cb9b056076c4492b9871
[13/13] powerpc: Simplify and move arch_randomize_brk()
        https://git.kernel.org/powerpc/c/3ba4289a3e7ff4a89a78c4f74d694a344e8d9cc9

cheers