From: sashiko-bot@kernel.org
To: "Jim Mattson" <jmattson@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] KVM: SVM: Configure ALLOW_LARGER_RAP in svm_vcpu_after_set_cpuid()
Date: Thu, 16 Jul 2026 23:46:29 +0000 [thread overview]
Message-ID: <20260716234629.BF0681F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260716232524.2092085-2-jmattson@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The ERAP_CONTROL_ALLOW_LARGER_RAP bit in the VMCB is permanently lost if the vCPU is reset due to a triple-fault (SHUTDOWN intercept).
--
--- Patch [1]: [PATCH 1/3] KVM: SVM: Configure ALLOW_LARGER_RAP in svm_vcpu_after_set_cpuid() ---
commit 7fe0a6077a4e214f36b5f568e5752ff88dbf1752
Author: Jim Mattson <jmattson@google.com>
KVM: SVM: Configure ALLOW_LARGER_RAP in svm_vcpu_after_set_cpuid()
This commit moves the configuration of the ALLOW_LARGER_RAP bit from
init_vmcb() to svm_vcpu_after_set_cpuid() so that it is properly set
when userspace configures the guest CPUID. It removes the previous
initialization logic from init_vmcb().
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index ef69a51ab27f9..11e023abc7ab9 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -1243,9 +1243,6 @@ static void init_vmcb(struct kvm_vcpu *vcpu, bool init_event)
> svm_clr_intercept(svm, INTERCEPT_PAUSE);
> }
>
> - if (guest_cpu_cap_has(vcpu, X86_FEATURE_ERAPS))
> - svm->vmcb->control.erap_ctl |= ERAP_CONTROL_ALLOW_LARGER_RAP;
> -
[Severity: High]
Does removing this initialization cause the ALLOW_LARGER_RAP bit to be
permanently lost after a triple-fault?
When a guest triggers a triple fault, KVM intercepts the shutdown and wipes
the VMCB:
arch/x86/kvm/svm/svm.c:shutdown_interception() {
...
clear_page(svm->vmcb);
kvm_vcpu_reset(vcpu, true);
...
}
kvm_vcpu_reset() then calls init_vmcb() to reinitialize the VMCB. Since the
ALLOW_LARGER_RAP setup is removed from init_vmcb(), and userspace typically
does not call KVM_SET_CPUID2 during a soft VM reset, will the ERAPS capability
remain disabled indefinitely after the reset?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260716232524.2092085-1-jmattson@google.com?part=1
next prev parent reply other threads:[~2026-07-16 23:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 23:25 [PATCH 0/3] KVM: x86/SVM: Fixes for AMD ERAPS virtualization Jim Mattson
2026-07-16 23:25 ` [PATCH 1/3] KVM: SVM: Configure ALLOW_LARGER_RAP in svm_vcpu_after_set_cpuid() Jim Mattson
2026-07-16 23:46 ` sashiko-bot [this message]
2026-07-16 23:25 ` [PATCH 2/3] KVM: SVM: Dirty ERAPS register on all ASID TLB flushes Jim Mattson
2026-07-16 23:25 ` [PATCH 3/3] KVM: x86: Flush guest TLB on MTRR MSR writes Jim Mattson
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=20260716234629.BF0681F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jmattson@google.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.