From: sashiko-bot@kernel.org
To: "Ashish Kalra" <Ashish.Kalra@amd.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v7 2/6] x86/sev: Initialize RMPOPT configuration MSRs
Date: Mon, 08 Jun 2026 19:17:41 +0000 [thread overview]
Message-ID: <20260608191742.21ABD1F00893@smtp.kernel.org> (raw)
In-Reply-To: <2c2ef36f9dfc5eebb719bf45457b48712ce7e821.1780903370.git.ashish.kalra@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Calling `setup_clear_cpu_cap()` during initcalls triggers an unconditional kernel `WARN_ON` trace because CPU alternatives have already been patched.
--
commit 155a667bf78d513dde1064d7dae284cc80a5dcba
Author: Ashish Kalra <ashish.kalra@amd.com>
x86/sev: Initialize RMPOPT configuration MSRs
The new RMPOPT instruction helps manage per-CPU RMP optimization
structures inside the CPU. It takes a 1GB-aligned physical address
and either returns the status of the optimizations or tries to enable
the optimizations.
> diff --git a/arch/x86/coco/core.c b/arch/x86/coco/core.c
> index 989ca9f72ba30..a8fc2ae502985 100644
> --- a/arch/x86/coco/core.c
> +++ b/arch/x86/coco/core.c
> @@ -172,6 +173,8 @@ static void amd_cc_platform_clear(enum cc_attr attr)
> switch (attr) {
> case CC_ATTR_HOST_SEV_SNP:
> cc_flags.host_sev_snp = 0;
> + snp_clear_rmpopt_configured();
> + setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
[Severity: High]
Does this code trigger a WARN_ON() stack trace?
The function setup_clear_cpu_cap() has an explicit WARN_ON(alternatives_patched).
This path can be executed from initcalls long after arch_cpu_finalize_init()
has set alternatives_patched to 1.
> break;
> default:
> break;
[ ... ]
> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
> index 8bcdce98f6dce..482008bb07e48 100644
> --- a/arch/x86/virt/svm/sev.c
> +++ b/arch/x86/virt/svm/sev.c
[ ... ]
> @@ -488,9 +492,14 @@ static bool __init setup_segmented_rmptable(void)
> static bool __init setup_rmptable(void)
> {
> if (rmp_cfg & MSR_AMD64_SEG_RMP_ENABLED) {
> - if (!setup_segmented_rmptable())
> + if (!setup_segmented_rmptable()) {
> + setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
[Severity: High]
Can this also trigger the same alternatives_patched WARN_ON() trace?
Since setup_rmptable() can run as part of rootfs_initcalls (via pci_iommu_init()
and amd_iommu_init()), alternatives will already be patched by the time this runs.
> return false;
> + }
> + rmpopt_configured = true;
> } else {
> + /* Note that Segmented RMP must be enabled to enable RMPOPT. */
> + setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
[Severity: High]
Would this also result in a WARN_ON() during boot if the system supports RMPOPT
but segmented RMP is disabled?
> if (!setup_contiguous_rmptable())
> return false;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1780903370.git.ashish.kalra@amd.com?part=2
next prev parent reply other threads:[~2026-06-08 19:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 18:56 [PATCH v7 0/6] Add RMPOPT support Ashish Kalra
2026-06-08 18:56 ` [PATCH v7 1/6] x86/cpufeatures: Add X86_FEATURE_RMPOPT feature flag Ashish Kalra
2026-06-08 18:56 ` [PATCH v7 2/6] x86/sev: Initialize RMPOPT configuration MSRs Ashish Kalra
2026-06-08 19:17 ` sashiko-bot [this message]
2026-06-08 18:56 ` [PATCH v7 3/6] x86/sev: Add support to perform RMP optimizations asynchronously Ashish Kalra
2026-06-08 19:12 ` sashiko-bot
2026-06-08 18:57 ` [PATCH v7 4/6] x86/sev: Add interface to re-enable RMP optimizations Ashish Kalra
2026-06-08 18:57 ` [PATCH v7 5/6] KVM: SEV: Perform RMP optimizations on SNP guest shutdown Ashish Kalra
2026-06-08 19:12 ` sashiko-bot
2026-06-08 18:57 ` [PATCH v7 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=20260608191742.21ABD1F00893@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.