Skip to content

KVM: SVM: Flush cache only on CPUs running SEV guest

Zheyun Shen kvm lkml 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest3 patches 8 repliesIn review
  2. v63 patches 1 replySuperseded
  3. v53 patches 2 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v42 patches5 repliesSuperseded
v31 patch1 replySuperseded
v21 patch2 repliesSuperseded
v11 patch5 repliesSuperseded

Changes in v7 from the cover letter

- Fixed the writing oversight in sev_vcpu_load().

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: x86: Add a wbinvd helperarch/x86/kvm/x86.c arch/x86/kvm/x86.h+8 -22 replies
2/3KVM: SVM: Remove wbinvd in sev_vm_destroy()arch/x86/kvm/svm/sev.c+0 -61 reply
3/3KVM: SVM: Flush cache only on CPUs running SEV guestarch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+33 -44 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchTom Lendacky
1/3R-b
2/3R-b
3/3R-b

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

Read the v7 thread

Cover letter [PATCH v7 0/3] KVM: SVM: Flush cache only on CPUs running SEV guest

Previous versions pointed out the problem of wbinvd_on_all_cpus() in SEV and tried to maintain a cpumask to solve it. This version includes further code cleanup.

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.

---
v6 -> v7:
- Fixed the writing oversight in sev_vcpu_load().

v5 -> v6:
- Replaced sev_get_wbinvd_dirty_mask() with the helper function to_kvm_sev_info().

v4 -> v5:
- rebase to tip @ 15e2f65f2ecf .
- Added a commit to remove unnecessary calls to wbinvd().
- Changed some comments.

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 | 36 +++++++++++++++++++++++++++---------
 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, 41 insertions(+), 12 deletions(-)
Signature · 1 line
2.34.1