[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240411140445.1038319-1-szy0127@sjtu.edu.cn>
Date: Thu, 11 Apr 2024 22:04:43 +0800
From: Zheyun Shen <szy0127@...u.edu.cn>
To: thomas.lendacky@....com,
seanjc@...gle.com,
pbonzini@...hat.com,
tglx@...utronix.de
Cc: kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Zheyun Shen <szy0127@...u.edu.cn>
Subject: [PATCH v4 0/2] 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. However, recording the CPU
to mask before VMRUN and clearing the mask after reclamation is not
correct. If the next reclamation happens before VMEXIT and VMRUN, lack
of record may lead to miss one wbinvd on this CPU.
---
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 (2):
KVM: x86: Add a wbinvd helper
KVM: SVM: Flush cache only on CPUs running SEV guest
arch/x86/kvm/svm/sev.c | 48 ++++++++++++++++++++++++++++++++++++++----
arch/x86/kvm/svm/svm.c | 2 ++
arch/x86/kvm/svm/svm.h | 4 ++++
arch/x86/kvm/x86.c | 9 ++++++--
arch/x86/kvm/x86.h | 1 +
5 files changed, 58 insertions(+), 6 deletions(-)
--
2.34.1
Powered by blists - more mailing lists