Skip to content

Defer page pinning for SEV guests until guest pages touched

eric van tassell kvm lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 0 repliesNew
  2. v14 patches 12 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM:MMU: Introduce the pin_page() callbackarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/paging_tmpl.h+45 -150 replies
2/4KVM:SVM: Implement pin_page supportarch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+73 -00 replies
3/4KVM:SVM: Pin sev_launch_update_data() pages via sev_get_page()arch/x86/kvm/svm/sev.c+57 -00 replies
4/4KVM:SVM: Remove struct enc_region and associated pinned page tracking.arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.h+1 -1170 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [Patch v2 0/4] Defer page pinning for SEV guests until guest pages touched

Overview
========
Defer pinning of the guest's pages until nested page faults occur to improve startup time and reduce memory pressure for SEV guests.

Cease paying the computational cost of pinning all pages when an encrypted region is registered, before it is known if they will be accessed.

Cease creating the memory pressure due to pinning all pages when an encrypted region is registered before, it is known if they will be accessed.

Timing Results
==========
All timings are done by hand with and Android stopwatch app

SEV guest size(GiB)  	     |  4 |  8 | 16 | 32 | 60 |
without patch series(sec)    |  2 |  3 |  4 |  8 | 14 |
with patch series (sec)      |  1 |  1 |  1 |  1 |  1 |

Patch Series Changelog
==============
1 -> 2:
* mmio checks move from sev_pin_page() to caller and the set_spte_notify* symbols are renamed to pin_page().

* sev_get_page() warns on failures which should not happen.

* kvm->srcu is used to avoid any possibility of a race in sev_launch_update_data()
Applies To:
===========
This patch applies top of this commit from the <next> branch of the kvm tree:
c34b26b98cac Tianjia Zhang : KVM: MIPS: clean up redundant 'kvm_run' parameters

eric van tassell (4):
KVM:MMU: Introduce the pin_page() callback
KVM:SVM: Implement pin_page support
KVM:SVM: Pin sev_launch_update_data() pages via sev_get_page() KVM:SVM: Remove struct enc_region and associated pinned page tracking.

 arch/x86/include/asm/kvm_host.h |   3 +
 arch/x86/kvm/mmu/mmu.c          |  30 +++-
 arch/x86/kvm/mmu/paging_tmpl.h  |  27 ++--
 arch/x86/kvm/svm/sev.c          | 238 +++++++++++++++++---------------
 arch/x86/kvm/svm/svm.c          |   2 +
 arch/x86/kvm/svm/svm.h          |   4 +-
 6 files changed, 174 insertions(+), 130 deletions(-)
Signature · 1 line
2.17.1