From: sashiko-bot@kernel.org
To: "Ashish Kalra" <Ashish.Kalra@amd.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v6 4/6] x86/sev: Add interface to re-enable RMP optimizations.
Date: Tue, 02 Jun 2026 20:54:57 +0000 [thread overview]
Message-ID: <20260602205457.982A11F00893@smtp.kernel.org> (raw)
In-Reply-To: <3abe3f20a0bfe7518edadd3d36ca57b4189ca46d.1780427587.git.ashish.kalra@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The leader execution branches in `rmpopt_work_handler` lack `cond_resched()`, potentially causing softlockups on non-preemptible kernels during the expensive RMP scan.
--
commit 083ce9f1c90cf08302bc96625ddfd8a7dbfd5a45
Author: Ashish Kalra <ashish.kalra@amd.com>
x86/sev: Add interface to re-enable RMP optimizations.
This commit adds an interface to explicitly re-enable RMP optimizations.
It allows the processor to recover optimizations that may have been cleared
by events like RMPUPDATE by re-queuing the RMPOPT delayed work.
> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
> index d7e40a5fe5ca6..4442ecae3d18f 100644
> --- a/arch/x86/virt/svm/sev.c
> +++ b/arch/x86/virt/svm/sev.c
> @@ -741,6 +741,21 @@ static void rmpopt_work_handler(struct work_struct *work)
> free_cpumask_var(follower_mask);
> }
[Severity: High]
This is a pre-existing issue, but since the new code provides an interface
to explicitly re-queue this work, is there a risk of CPU stalls in the
work handler?
In rmpopt_work_handler() in arch/x86/virt/svm/sev.c, the leader execution
paths loop over up to 2TB of memory in 1GB chunks (up to 2048 iterations)
without yielding:
for (pa = rmpopt_pa_start; pa < rmpopt_pa_end; pa += SZ_1G)
rmpopt(pa);
It also happens in the IPI loop:
for (pa = rmpopt_pa_start; pa < rmpopt_pa_end; pa += SZ_1G)
smp_call_function_single(leader_cpu, rmpopt_smp,
(void *)pa, true);
Since RMPOPT is an expensive hardware instruction, could executing up to 2048
iterations sequentially without cond_resched() cause workqueue lockups and
softlockup warnings on non-preemptible kernels?
>
> +void snp_rmpopt_all_physmem(void)
> +{
> + if (!cpu_feature_enabled(X86_FEATURE_RMPOPT))
> + return;
> +
> + guard(mutex)(&rmpopt_wq_mutex);
> +
> + if (!rmpopt_wq)
> + return;
> +
> + queue_delayed_work(rmpopt_wq, &rmpopt_delayed_work,
> + msecs_to_jiffies(RMPOPT_WORK_TIMEOUT));
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1780427587.git.ashish.kalra@amd.com?part=4
next prev parent reply other threads:[~2026-06-02 20:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 20:00 [PATCH v6 0/6] Add RMPOPT support Ashish Kalra
2026-06-02 20:00 ` [PATCH v6 1/6] x86/cpufeatures: Add X86_FEATURE_AMD_RMPOPT feature flag Ashish Kalra
2026-06-02 20:10 ` sashiko-bot
2026-06-02 20:01 ` [PATCH v6 2/6] x86/sev: Initialize RMPOPT configuration MSRs Ashish Kalra
2026-06-02 20:36 ` sashiko-bot
2026-06-02 20:01 ` [PATCH v6 3/6] x86/sev: Add support to perform RMP optimizations asynchronously Ashish Kalra
2026-06-02 20:46 ` sashiko-bot
2026-06-02 20:01 ` [PATCH v6 4/6] x86/sev: Add interface to re-enable RMP optimizations Ashish Kalra
2026-06-02 20:54 ` sashiko-bot [this message]
2026-06-02 20:02 ` [PATCH v6 5/6] KVM: SEV: Perform RMP optimizations on SNP guest shutdown Ashish Kalra
2026-06-02 20:02 ` [PATCH v6 6/6] x86/sev: Add debugfs support for RMPOPT Ashish Kalra
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=20260602205457.982A11F00893@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.