public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/3] KVM: SVM: Flush cache only on CPUs running SEV guest
@ 2025-01-20 12:05 Zheyun Shen
  2025-01-20 12:05 ` [PATCH v5 1/3] KVM: x86: Add a wbinvd helper Zheyun Shen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Zheyun Shen @ 2025-01-20 12:05 UTC (permalink / raw)
  To: thomas.lendacky, seanjc, pbonzini, tglx, kevinloughlin, mingo, bp
  Cc: kvm, linux-kernel, Zheyun Shen

Previous versions pointed out the problem of wbinvd_on_all_cpus() in SEV
and tried to maintain a cpumask to solve it. This version futher removes
unnecessary calls to wbinvd(). 

Although dirty_mask is not maintained perfectly and may lead to wbinvd on 
physical CPUs that are not running a SEV guest, it's still better than 
wbinvd_on_all_cpus(). And vcpu migration is designed to be solved in 
future work.

---
v4 -> v5:
- Added a commit to remove unnecessary calls to wbinvd().

v3 -> v4:
- Added a wbinvd helper and export it to SEV.
- Changed the struct cpumask in kvm_sev_info into cpumask*, which should
be dynamically allocated and freed.
- Changed the time of recording the CPUs from pre_sev_run() to vcpu_load().
- Removed code of clearing the mask.

v2 -> v3:
- Replaced get_cpu() with parameter cpu in pre_sev_run().

v1 -> v2:
- Added sev_do_wbinvd() to wrap two operations.
- Used cpumask_test_and_clear_cpu() to avoid concurrent problems.
---

Zheyun Shen (3):
  KVM: x86: Add a wbinvd helper
  KVM: SVM: Remove wbinvd in sev_vm_destroy()
  KVM: SVM: Flush cache only on CPUs running SEV guest

 arch/x86/kvm/svm/sev.c | 45 +++++++++++++++++++++++++++++++++---------
 arch/x86/kvm/svm/svm.c |  2 ++
 arch/x86/kvm/svm/svm.h |  5 ++++-
 arch/x86/kvm/x86.c     |  9 +++++++--
 arch/x86/kvm/x86.h     |  1 +
 5 files changed, 50 insertions(+), 12 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-26 10:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-20 12:05 [PATCH v5 0/3] KVM: SVM: Flush cache only on CPUs running SEV guest Zheyun Shen
2025-01-20 12:05 ` [PATCH v5 1/3] KVM: x86: Add a wbinvd helper Zheyun Shen
2025-01-20 12:05 ` [PATCH v5 2/3] KVM: SVM: Remove wbinvd in sev_vm_destroy() Zheyun Shen
2025-01-20 12:05 ` [PATCH v5 3/3] KVM: SVM: Flush cache only on CPUs running SEV guest Zheyun Shen
2025-01-21  5:01   ` Nikunj A Dadhania
2025-01-26 10:33     ` Zheyun Shen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox