Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ashish Kalra" <Ashish.Kalra@amd.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v15 5/5] x86/sev: Re-enable RMP optimizations on SNP guest shutdown
Date: Wed, 16 Sep 2026 20:06:21 +0000	[thread overview]
Message-ID: <20260916200621.EF7CE1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <9b4608b96d44fa256b55b6ea91603a02a7cd0a35.1789586444.git.ashish.kalra@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] kvm: system-wide synchronous IPI broadcast on every SNP guest teardown defeats batching
--

commit 23bdc9ba80b8a413abe236834cbaf2ae517ee599
Author: Ashish Kalra <ashish.kalra@amd.com>

x86/sev: Re-enable RMP optimizations on SNP guest shutdown

The RMPOPT table indicates whether 1GB regions of physical memory are
entirely hypervisor-owned. When SNP guests are torn down, this patch
re-optimizes all of physical memory by calling snp_enable_rmpopt(). This
process is intended to be batched using a delayed work queue to avoid
overhead during multiple guest terminations.

> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 0a887f8e05d3a..e05adec44d0aa 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -3032,6 +3032,8 @@ void sev_vm_destroy(struct kvm *kvm)
>  		 */
>  		if (snp_decommission_context(kvm))
>  			return;
> +
> +		snp_enable_rmpopt();

[Severity: High]
The commit message mentions that using mod_delayed_work() batches multiple
guest terminations into a single pass.

However, doesn't calling snp_enable_rmpopt() here on every guest teardown
trigger a synchronous system-wide IPI broadcast each time?

arch/x86/virt/svm/sev.c:snp_enable_rmpopt() {
    ...
    on_each_cpu_mask(cpu_primary_thread_mask, rmpopt_program_base, NULL, 1);

    mod_delayed_work(rmpopt_wq, &rmpopt_delayed_work, ...);
    ...
}

Could this unbatched IPI broadcast cause severe performance degradation and
latency spikes across the system when multiple guests are torn down rapidly,
defeating the batching intent?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1789586444.git.ashish.kalra@amd.com?part=5

      reply	other threads:[~2026-09-16 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 19:52 [PATCH v15 0/5] Add RMPOPT support Ashish Kalra
2026-09-16 19:52 ` [PATCH v15 1/5] x86/cpufeatures: Add X86_FEATURE_RMPOPT feature flag Ashish Kalra
2026-09-16 19:52 ` [PATCH v15 2/5] x86/sev: Disable CPU hotplug while SNP is active Ashish Kalra
2026-09-16 20:11   ` sashiko-bot
2026-09-16 19:53 ` [PATCH v15 3/5] x86/sev: Initialize RMPOPT configuration MSRs Ashish Kalra
2026-09-16 20:06   ` sashiko-bot
2026-09-16 19:53 ` [PATCH v15 4/5] x86/sev: Perform RMP optimizations asynchronously Ashish Kalra
2026-09-16 20:09   ` sashiko-bot
2026-09-16 19:53 ` [PATCH v15 5/5] x86/sev: Re-enable RMP optimizations on SNP guest shutdown Ashish Kalra
2026-09-16 20:06   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260916200621.EF7CE1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Ashish.Kalra@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox