Skip to content

mm: new function to forbid zeropage mappings for a process

Dominik Dingel kvm linux-mm linux-s390 lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 8 repliesIn review
  2. v24 patches 3 repliesSuperseded
  3. v14 patches 7 repliesSuperseded

Changes in v3 from the cover letter

- Clearing up patch description Patch 3/4
- removing unnecessary flag in mmu_context (Paolo)

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4s390/mm: recfactor global pgste updatesarch/s390/include/asm/pgalloc.h arch/s390/include/asm/pgtable.h arch/s390/kvm/kvm-s390.c +1 more+56 -1020 replies
2/4mm: introduce mm_forbids_zeropage functioninclude/linux/mm.h mm/huge_memory.c mm/memory.c+6 -24 replies
3/4s390/mm: prevent and break zero page mappings in case of storage keysarch/s390/include/asm/pgtable.h arch/s390/mm/pgtable.c+17 -11 reply
4/4s390/mm: disable KSM for storage key enabled pagesarch/s390/include/asm/pgtable.h arch/s390/kvm/priv.c arch/s390/mm/pgtable.c+28 -71 reply

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchChristian BorntraegerPaolo Bonzini
1/4
2/4R-b
3/4R-b
4/4A-b R-b

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

Read the v3 thread

Cover letter [PATCH v3 0/4] mm: new function to forbid zeropage mappings for a process

s390 has the special notion of storage keys which are some sort of page flags associated with physical pages and live outside of direct addressable memory. These storage keys can be queried and changed with a special set of instructions. The mentioned instructions behave quite nicely under virtualization, if there is:
- an invalid pte, then the instructions will work on memory in the host page table
- a valid pte, then the instructions will work with the real storage key

Thanks to Martin with his software reference and dirty bit tracking, the kernel does not issue any storage key instructions as now a software based approach will be taken, on the other hand distributions in the wild are currently using them.

However, for virtualized guests we still have a problem with guest pages mapped to zero pages and the kernel same page merging.
With each one multiple guest pages will point to the same physical page and share the same storage key.

Let's fix this by introducing a new function which s390 will define to forbid new zero page mappings. If the guest issues a storage key related instruction we flag the mm_struct, drop existing zero page mappings and unmerge the guest memory.

v2 -> v3:
- Clearing up patch description Patch 3/4
- removing unnecessary flag in mmu_context (Paolo)

v1 -> v2:
- Following Dave and Paolo suggestion removing the vma flag

Dominik Dingel (4):
s390/mm: recfactor global pgste updates
mm: introduce mm_forbids_zeropage function
s390/mm: prevent and break zero page mappings in case of storage keys s390/mm: disable KSM for storage key enabled pages

 arch/s390/include/asm/pgalloc.h |   2 -
 arch/s390/include/asm/pgtable.h |   8 +-
 arch/s390/kvm/kvm-s390.c        |   2 +-
 arch/s390/kvm/priv.c            |  17 ++--
 arch/s390/mm/pgtable.c          | 180 ++++++++++++++++++----------------------
 include/linux/mm.h              |   4 +
 mm/huge_memory.c                |   2 +-
 mm/memory.c                     |   2 +-
 8 files changed, 106 insertions(+), 111 deletions(-)
Signature · 7 lines
1.8.5.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>