RFC KVM: SEV: Limit cache flush operations in sev guest memory reclaim events
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest4 patches 12 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | KVM: SEV: Drop wbinvd_on_all_cpus() as kvm mmu notifier would flush the cachearch/ | +0 | 1 reply | |
| 2/4 | KVM: SEV: Plumb mmu_notifier_event into sev functionarch/ arch/ arch/ +3 more | +20 | 0 replies | |
| 3/4 | KVM: SEV: Limit the call of WBINVDs based on the event type of mmu notifierarch/ | +5 | 1 reply | |
| 4/4 | KVM: SEV: Use a bitmap module param to decide whether a cache flush is needed during the guest memory reclaimarch/ include/ | +47 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/4] KVM: SEV: Limit cache flush operations in sev guest memory reclaim events
The cache flush operation in sev guest memory reclaim events was originally introduced to prevent security issues due to cache incoherence and untrusted VMM. However when this operation gets triggered, it causes performance degradation to the whole machine.
This cache flush operation is performed in mmu_notifiers, in particular, in the mmu_notifier_invalidate_range_start() function, unconditionally on all guest memory regions. Although the intention was to flush cache lines only when guest memory was deallocated, the excessive invocations include many other cases where this flush is unnecessary.
This RFC proposes using the mmu notifier event to determine whether a cache flush is needed. Specifically, only do the cache flush when the address range is unmapped, cleared, released or migrated. A bitmap module param is also introduced to provide flexibility when flush is needed in more events or no flush is needed depending on the hardware platform.
Note that the cache flush operation in memory reclamation only targets SEV/SEV-ES platforms and no cache flush is needed in SEV-SNP VMs. Therefore the patch series does not apply to the SEV-SNP context.
Jacky Li (4):
KVM: SEV: Drop wbinvd_on_all_cpus() as kvm mmu notifier would flush
the cache
KVM: SEV: Plumb mmu_notifier_event into sev function
KVM: SEV: Limit the call of WBINVDs based on the event type of mmu
notifier
KVM: SEV: Use a bitmap module param to decide whether a cache flush is
needed during the guest memory reclaim
arch/x86/include/asm/kvm_host.h | 3 +- arch/x86/kvm/svm/sev.c | 62 ++++++++++++++++++++++++--------- arch/x86/kvm/svm/svm.h | 3 +- arch/x86/kvm/x86.c | 5 +-- include/linux/kvm_host.h | 3 +- include/linux/mmu_notifier.h | 4 +++ virt/kvm/kvm_main.c | 14 +++++--- 7 files changed, 68 insertions(+), 26 deletions(-)
Signature · 1 line
2.43.0.rc0.421.g78406f8d94-goog