[PATCH v2 8/8] KVM: SVM: Flush cache only on CPUs running SEV guest

Tom Lendacky thomas.lendacky at amd.com
Mon May 19 17:48:55 UTC 2025


On 5/16/25 16:28, Sean Christopherson wrote:
> From: Zheyun Shen <szy0127 at sjtu.edu.cn>
> 
> On AMD CPUs without ensuring cache consistency, each memory page
> reclamation in an SEV guest triggers a call to do WBNOINVD/WBINVD on all
> CPUs, thereby affecting the performance of other programs on the host.
> 
> Typically, an AMD server may have 128 cores or more, while the SEV guest
> might only utilize 8 of these cores. Meanwhile, host can use qemu-affinity
> to bind these 8 vCPUs to specific physical CPUs.
> 
> Therefore, keeping a record of the physical core numbers each time a vCPU
> runs can help avoid flushing the cache for all CPUs every time.
> 
> Signed-off-by: Zheyun Shen <szy0127 at sjtu.edu.cn>
> Co-developed-by: Sean Christopherson <seanjc at google.com>
> Signed-off-by: Sean Christopherson <seanjc at google.com>

Reviewed-by: Tom Lendacky <thomas.lendacky at amd.com>

> ---
>  arch/x86/kvm/svm/sev.c | 46 +++++++++++++++++++++++++++++++++++-------
>  arch/x86/kvm/svm/svm.h |  1 +
>  2 files changed, 40 insertions(+), 7 deletions(-)
> 


More information about the dri-devel mailing list