Skip to content

Reduce alignment constraint on STRICT_KERNEL_RWX and speed-up TLB misses on 8xx and 603

Christophe Leroy linuxppc-dev lkml 1 version Applied

Status from this message: Applied to powerpc/next.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/14powerpc/8xx: Fix initial memory mappingarch/powerpc/mm/nohash/8xx.c+2 -20 replies
2/14powerpc/8xx: Fix kernel vs user address comparisonarch/powerpc/kernel/head_8xx.S+3 -30 replies
3/14powerpc/8xx: Copy kernel PGD entries into all PGDIRsarch/powerpc/include/asm/nohash/pgalloc.h+7 -10 replies
4/14Revert "powerpc/8xx: Always pin kernel text TLB"arch/powerpc/kernel/head_8xx.S arch/powerpc/mm/nohash/8xx.c arch/powerpc/platforms/8xx/Kconfig+17 -10 replies
5/14powerpc/8xx: Allow setting DATA alignment even with STRICT_KERNEL_RWXarch/powerpc/Kconfig+5 -50 replies
6/14powerpc/8xx: Reduce default size of module/execmem areaarch/powerpc/Kconfig arch/powerpc/include/asm/nohash/32/mmu-8xx.h arch/powerpc/mm/nohash/8xx.c+22 -10 replies
7/14powerpc/8xx: Preallocate execmem page tablesarch/powerpc/mm/mem.c+14 -00 replies
8/14powerpc/8xx: Inconditionally use task PGDIR in ITLB missesarch/powerpc/kernel/head_8xx.S+0 -110 replies
9/14powerpc/8xx: Inconditionally use task PGDIR in DTLB missesarch/powerpc/kernel/head_8xx.S+34 -230 replies
10/14powerpc/32s: Reduce default size of module/execmem areaarch/powerpc/Kconfig arch/powerpc/include/asm/book3s/32/pgtable.h arch/powerpc/mm/book3s32/mmu.c+8 -40 replies
11/14powerpc/603: Copy kernel PGD entries into all PGDIRs and preallocate execmem page tablesarch/powerpc/include/asm/nohash/pgalloc.h arch/powerpc/mm/mem.c+2 -20 replies
12/14powerpc/603: Switch r0 and r3 in TLB miss handlersarch/powerpc/kernel/head_book3s_32.S+38 -560 replies
13/14powerpc/603: Inconditionally use task PGDIR in ITLB missesarch/powerpc/kernel/head_book3s_32.S+5 -120 replies
14/14powerpc/603: Inconditionally use task PGDIR in DTLB missesarch/powerpc/kernel/head_book3s_32.S+38 -270 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 00/14] Reduce alignment constraint on STRICT_KERNEL_RWX and speed-up TLB misses on 8xx and 603

This series does mainly two things:
- Remove the 8M alignment constraint on STRICT_KERNEL_RWX on 8xx to avoid wasting memory.
- Speed-up TLB misses by duplicating kernel PGD entries into each task's PGDIRs to avoid the address comparison in TLB miss handler.

On 8xx, the address comparison takes a significant part of CPU cycles as it requires saving/restoring CR, and because a taken branch requires 2 cycles.
On 603 it is less significant because CR is saved automatically and has to be restored anyway but it is still worth it.

For ITLB misses:
- Kernel PGD entries are setup for once during init, before creation of new PGDIRs.
- Module PGD entries are setup also at init by preallocating page tables for a very few number of pages

For DTLB misses:
- Some handling is added in 8xx DATA TLB error interrupt and in 603 DATA read and store TLB miss interrupts to copy missing PGD entries into child.

The cost of that additional handling on error paths is worth the gain on hot TLB miss pathes.

Because 8xx and 603 don't use leaf kernel pages at PGD level, there is no need to care about PGD entries cleanup, page tables are never freed.

Christophe Leroy (14):
powerpc/8xx: Fix initial memory mapping
powerpc/8xx: Fix kernel vs user address comparison powerpc/8xx: Copy kernel PGD entries into all PGDIRs Revert "powerpc/8xx: Always pin kernel text TLB" powerpc/8xx: Allow setting DATA alignment even with STRICT_KERNEL_RWX powerpc/8xx: Reduce default size of module/execmem area powerpc/8xx: Preallocate execmem page tables
powerpc/8xx: Inconditionally use task PGDIR in ITLB misses powerpc/8xx: Inconditionally use task PGDIR in DTLB misses powerpc/32s: Reduce default size of module/execmem area powerpc/603: Copy kernel PGD entries into all PGDIRs and preallocate
execmem page tables
powerpc/603: Switch r0 and r3 in TLB miss handlers powerpc/603: Inconditionally use task PGDIR in ITLB misses powerpc/603: Inconditionally use task PGDIR in DTLB misses

 arch/powerpc/Kconfig                         |  31 +++-
 arch/powerpc/include/asm/book3s/32/pgtable.h |   3 +-
 arch/powerpc/include/asm/nohash/32/mmu-8xx.h |   3 +-
 arch/powerpc/include/asm/nohash/pgalloc.h    |   8 +-
 arch/powerpc/kernel/head_8xx.S               |  78 +++++-----
 arch/powerpc/kernel/head_book3s_32.S         | 144 +++++++++----------
 arch/powerpc/mm/book3s32/mmu.c               |   2 +
 arch/powerpc/mm/mem.c                        |  14 ++
 arch/powerpc/mm/nohash/8xx.c                 |   9 +-
 arch/powerpc/platforms/8xx/Kconfig           |   7 +
 10 files changed, 173 insertions(+), 126 deletions(-)
Signature · 1 line
2.44.0