Skip to content

Remove hash page table slot tracking from linux PTE

Aneesh Kumar K.V linuxppc-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest16 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16powerpc/mm/hash: Remove the superfluous bitwise operation when find hpte grouparch/powerpc/mm/dump_hashpagetable.c arch/powerpc/mm/hash64_4k.c arch/powerpc/mm/hash64_64k.c +2 more+21 -240 replies
2/16powerpc/mm: Update native_hpte_find to return hash ptearch/powerpc/mm/hash_native_64.c+44 -290 replies
3/16powerpc/pseries: Update hpte find helper to take hash valuearch/powerpc/platforms/pseries/lpar.c+17 -110 replies
4/16powerpc/mm: Add hash invalidate callbackarch/powerpc/include/asm/book3s/64/mmu-hash.h arch/powerpc/mm/hash_native_64.c arch/powerpc/mm/hash_utils_64.c +2 more+119 -80 replies
5/16powerpc/mm: use hash_invalidate for __kernel_map_pages()arch/powerpc/mm/hash_utils_64.c+5 -270 replies
6/16powerpc/mm: Switch flush_hash_range to not use slotarch/powerpc/mm/hash_native_64.c arch/powerpc/platforms/pseries/lpar.c+16 -290 replies
7/16powerpc/mm: Add hash updatepp callbackarch/powerpc/include/asm/book3s/64/mmu-hash.h arch/powerpc/mm/hash64_4k.c arch/powerpc/mm/hash64_64k.c +4 more+110 -280 replies
8/16powerpc/mm/hash: Don't track hash pte slot number in linux page table.arch/powerpc/include/asm/book3s/64/hash-4k.h arch/powerpc/include/asm/book3s/64/hash-64k.h arch/powerpc/include/asm/book3s/64/hash.h +12 more+49 -2200 replies
9/16powerpc/mm: Add new firmware feature HASH APIarch/powerpc/include/asm/firmware.h arch/powerpc/kvm/powerpc.c arch/powerpc/platforms/pseries/firmware.c +1 more+8 -10 replies
10/16powerpc/kvm/hash: Implement HASH_REMOVE hcallarch/powerpc/include/asm/hvcall.h arch/powerpc/include/asm/plpar_wrappers.h arch/powerpc/kvm/book3s_hv.c +2 more+138 -180 replies
11/16powerpc/kvm/hash: Implement HASH_PROTECT hcallarch/powerpc/include/asm/hvcall.h arch/powerpc/include/asm/plpar_wrappers.h arch/powerpc/kvm/book3s_hv.c +2 more+63 -230 replies
12/16powerpc/kvm/hash: Implement HASH_BULK_REMOVE hcallarch/powerpc/include/asm/book3s/64/mmu-hash.h arch/powerpc/include/asm/hvcall.h arch/powerpc/kvm/book3s_hv.c +2 more+101 -10 replies
13/16powerpc/mm/pseries: Use HASH_PROTECT hcall in guestarch/powerpc/platforms/pseries/lpar.c+6 -10 replies
14/16powerpc/mm/pseries: Use HASH_REMOVE hcall in guestarch/powerpc/platforms/pseries/lpar.c+24 -00 replies
15/16powerpc/mm/pseries: Move slot based bulk remove to helperarch/powerpc/platforms/pseries/lpar.c+31 -200 replies
16/16powerpc/mm/pseries: Use HASH_BULK_REMOVE hcall in guestarch/powerpc/platforms/pseries/lpar.c+32 -80 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/16] Remove hash page table slot tracking from linux PTE

Hi,

With hash translation mode we always tracked the hash pte slot details in linux page table. This occupied space in the linux page table and also limitted our ability to support linux features that require additional PTE bits. This series attempt to lift this limitation by not tracking slot number in linux page table. We still track slot details w.r.t Transparent Hugepage entries because an invalidate there requires us to go through all the 256 hash pte slots. So tracking whether hash page table entry is valid helps us in avoiding a lot of hcalls there. With THP entries we don't keep slot details in the primary linux page table entry but in the second half of page table. Hence tracking slot details for THP doesn't take up space in PTE.

Even though we don't track slot, for removing/updating hash page table entry, PAPR hcalls expect hash page table slot details. On pseries we find slot using H_READ hcall using H_READ_4 flags. This implies an additional 2 hcalls in the updatepp and remove paths. The patch series also attempt to limit the impact of this by adding new hcalls that does remove/update of hash page table entry using hash value instead of hash page table slot.

Below is the performance numbers observed when running a workload that does the below sequence

for(5000) {
mmap(128M)
touch every page of 2048 page
munmap()
}

The test is run with address randomization off, swap disabled in both host and guest.

|------------+----------+---------------+--------------------------+-----------------------|
| iterations | platform | without patch | With series and no hcall | With series and hcall |
|------------+----------+---------------+--------------------------+-----------------------|
|          1 | powernv  |               |                50.818343 |                       |
|          2 | powernv  |               |                50.744123 |                       |
|          3 | powernv  |               |                50.721603 |                       |
|          4 | powernv  |               |                50.739922 |                       |
|          5 | powernv  |               |                50.638555 |                       |
|          1 | powernv  |     51.388249 |                          |                       |
|          2 | powernv  |     51.789701 |                          |                       |
|          3 | powernv  |     52.240394 |                          |                       |
|          4 | powernv  |     51.432255 |                          |                       |
|          5 | powernv  |     51.392947 |                          |                       |
|------------+----------+---------------+--------------------------+-----------------------|
|          1 | pseries  |               |                          |            123.154394 |
|          2 | pseries  |               |                          |            122.253956 |
|          3 | pseries  |               |                          |            117.666344 |
|          4 | pseries  |               |                          |            117.681479 |
|          5 | pseries  |               |                          |            117.735808 |
|          1 | pseries  |               |               119.424940 |                       |
|          2 | pseries  |               |               117.663078 |                       |
|          3 | pseries  |               |               118.345584 |                       |
|          4 | pseries  |               |               119.620934 |                       |
|          5 | pseries  |               |               119.463185 |                       |
|          1 | pseries  |    122.810867 |                          |                       |
|          2 | pseries  |    115.760801 |                          |                       |
|          3 | pseries  |    115.257030 |                          |                       |
|          4 | pseries  |    116.617884 |                          |                       |
|          5 | pseries  |    117.247036 |                          |                       |
|------------+----------+---------------+--------------------------+-----------------------|

-aneesh

Aneesh Kumar K.V (16):
powerpc/mm/hash: Remove the superfluous bitwise operation when find
hpte group
powerpc/mm: Update native_hpte_find to return hash pte powerpc/pseries: Update hpte find helper to take hash value powerpc/mm: Add hash invalidate callback
powerpc/mm: use hash_invalidate for __kernel_map_pages() powerpc/mm: Switch flush_hash_range to not use slot powerpc/mm: Add hash updatepp callback
powerpc/mm/hash: Don't track hash pte slot number in linux page table. powerpc/mm: Add new firmware feature HASH API powerpc/kvm/hash: Implement HASH_REMOVE hcall powerpc/kvm/hash: Implement HASH_PROTECT hcall powerpc/kvm/hash: Implement HASH_BULK_REMOVE hcall powerpc/mm/pseries: Use HASH_PROTECT hcall in guest powerpc/mm/pseries: Use HASH_REMOVE hcall in guest powerpc/mm/pseries: Move slot based bulk remove to helper powerpc/mm/pseries: Use HASH_BULK_REMOVE hcall in guest

 arch/powerpc/include/asm/book3s/64/hash-4k.h       |  16 +-
 arch/powerpc/include/asm/book3s/64/hash-64k.h      |  44 +--
 arch/powerpc/include/asm/book3s/64/hash.h          |   5 +-
 arch/powerpc/include/asm/book3s/64/mmu-hash.h      |  12 +
 arch/powerpc/include/asm/book3s/64/pgtable.h       |  26 --
 arch/powerpc/include/asm/book3s/64/tlbflush-hash.h |   3 +-
 arch/powerpc/include/asm/firmware.h                |   3 +-
 arch/powerpc/include/asm/hvcall.h                  |   5 +-
 arch/powerpc/include/asm/pgtable-be-types.h        |  10 -
 arch/powerpc/include/asm/pgtable-types.h           |   9 -
 arch/powerpc/include/asm/plpar_wrappers.h          |  23 ++
 arch/powerpc/kvm/book3s_hv.c                       |   3 +
 arch/powerpc/kvm/book3s_hv_rm_mmu.c                | 297 ++++++++++++++++++---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S            |   4 +
 arch/powerpc/kvm/powerpc.c                         |   4 +
 arch/powerpc/mm/dump_hashpagetable.c               |   2 +-
 arch/powerpc/mm/dump_linuxpagetables.c             |  10 -
 arch/powerpc/mm/hash64_4k.c                        |  17 +-
 arch/powerpc/mm/hash64_64k.c                       | 124 +++------
 arch/powerpc/mm/hash_native_64.c                   | 175 ++++++++----
 arch/powerpc/mm/hash_utils_64.c                    |  75 ++----
 arch/powerpc/mm/hugepage-hash64.c                  |   9 +-
 arch/powerpc/mm/hugetlbpage-hash64.c               |  13 +-
 arch/powerpc/mm/tlb_hash64.c                       |   9 +-
 arch/powerpc/platforms/ps3/htab.c                  |  88 ++++++
 arch/powerpc/platforms/pseries/firmware.c          |   1 +
 arch/powerpc/platforms/pseries/lpar.c              | 196 +++++++++++---
 include/uapi/linux/kvm.h                           |   1 +
 28 files changed, 760 insertions(+), 424 deletions(-)
Signature · 1 line
2.13.6