From: Dionna Glaze <dionnaglaze@google.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev,
Dionna Glaze <dionnaglaze@google.com>,
Thomas Lendacky <Thomas.Lendacky@amd.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Joerg Roedel <jroedel@suse.de>, Peter Gonda <pgonda@google.com>,
Borislav Petkov <bp@alien8.de>,
Sean Christopherson <seanjc@google.com>
Subject: [PATCH v4 2/2] kvm: sev: If ccp is busy, report busy to guest
Date: Wed, 14 May 2025 18:41:35 +0000 [thread overview]
Message-ID: <20250514184136.238446-3-dionnaglaze@google.com> (raw)
In-Reply-To: <20250514184136.238446-1-dionnaglaze@google.com>
The ccp driver can be overloaded even with guest request rate limits.
The return value of -EBUSY means that there is no firmware error to
report back to user space, so the guest VM would see this as
exitinfo2 = 0. The false success can trick the guest to update its
message sequence number when it shouldn't have.
Instead, when ccp returns -EBUSY, that is reported to userspace as the
throttling return value.
Cc: Thomas Lendacky <Thomas.Lendacky@amd.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Peter Gonda <pgonda@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Sean Christopherson <seanjc@google.com>
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
---
arch/x86/kvm/svm/sev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index febf4b45fddf..c1bd82c26a11 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -4061,6 +4061,11 @@ static int snp_handle_guest_req(struct vcpu_svm *svm, gpa_t req_gpa, gpa_t resp_
* the PSP is dead and commands are timing out.
*/
ret = sev_issue_cmd(kvm, SEV_CMD_SNP_GUEST_REQUEST, &data, &fw_err);
+ if (ret == -EBUSY) {
+ svm_vmgexit_no_action(svm, SNP_GUEST_ERR(SNP_GUEST_VMM_ERR_BUSY, fw_err));
+ ret = 1;
+ goto out_unlock;
+ }
if (ret && !fw_err)
goto out_unlock;
--
2.49.0.1045.g170613ef41-goog
next prev parent reply other threads:[~2025-05-14 18:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 18:41 [PATCH v4 0/2] kvm: sev: Add SNP guest request throttling Dionna Glaze
2025-05-14 18:41 ` [PATCH v4 1/2] kvm: sev: Add SEV-SNP " Dionna Glaze
2025-05-14 18:50 ` Dionna Amalie Glaze
2025-05-15 18:21 ` kernel test robot
2025-05-14 18:41 ` Dionna Glaze [this message]
2025-05-14 18:41 ` [PATCH v4 2/2] The ccp driver can be overloaded even with guest request rate limits. The return value of -EBUSY means that there is no firmware error to report back to user space, so the guest VM would see this as exitinfo2 = 0. The false success can trick the guest to update its message sequence number when it shouldn't have Dionna Glaze
2025-05-14 18:47 ` Dionna Amalie Glaze
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=20250514184136.238446-3-dionnaglaze@google.com \
--to=dionnaglaze@google.com \
--cc=Thomas.Lendacky@amd.com \
--cc=bp@alien8.de \
--cc=jroedel@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=pgonda@google.com \
--cc=seanjc@google.com \
/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
all inboxes | Powered by JetHome®