From: sashiko-bot@kernel.org
To: "Tina Zhang" <zhang_wei@open-hieco.net>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: nSVM: Virtualize DecodeAssists for nested guests
Date: Mon, 29 Jun 2026 13:12:21 +0000 [thread overview]
Message-ID: <20260629131222.12CEA1F01560@smtp.kernel.org> (raw)
In-Reply-To: <20260629125205.52394-2-zhang_wei@open-hieco.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch completely fails to propagate DecodeAssist information for hardware-generated #NPF exits, breaking its primary stated goal.
--
commit 25d49971bfa61318056a7a414a7878b30f3a2e0d
Author: Tina Zhang <zhang_wei@open-hieco.net>
KVM: nSVM: Virtualize DecodeAssists for nested guests
This commit advertises DecodeAssists to L1 nested guests and copies
instruction length and bytes from VMCB02 to VMCB12 for nested VM-Exits.
It introduces the decode_assists_valid flag to track real hardware exits
and prevent KVM from exposing stale bytes for KVM-synthesized exits.
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index 961804df5f451..86b5cd45a52fe 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
[ ... ]
> @@ -1608,8 +1650,11 @@ int nested_svm_exit_handled(struct vcpu_svm *svm)
>
> vmexit = nested_svm_intercept(svm);
>
> - if (vmexit == NESTED_EXIT_DONE)
> + if (vmexit == NESTED_EXIT_DONE) {
> + /* This path reflects a real VMCB02 exit directly to L1. */
> + svm->nested.decode_assists_valid = true;
> nested_svm_vmexit(svm);
> + }
>
> return vmexit;
> }
[Severity: High]
Does this patch actually propagate DecodeAssist information for #NPF exits?
Looking at nested_svm_exit_special(), SVM_EXIT_NPF unconditionally returns
NESTED_EXIT_HOST. This bypasses nested_svm_exit_handled() entirely, meaning
svm->nested.decode_assists_valid is never set to true for nested page faults.
When KVM later reflects the fault to L1 via nested_svm_inject_npf_exit():
arch/x86/kvm/svm/nested.c:nested_svm_inject_npf_exit() {
...
nested_svm_vmexit(svm);
}
The decode_assists_valid flag will still be false. Won't this cause
nested_svm_vmexit_update_vmcb12() to unconditionally clear the decode
fields, silently discarding the valid hardware DecodeAssist data in VMCB02
that the commit message mentions?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260629125205.52394-1-zhang_wei@open-hieco.net?part=1
next prev parent reply other threads:[~2026-06-29 13:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 12:52 [PATCH 0/2] KVM: nSVM: Expose DecodeAssists to L1 Tina Zhang
2026-06-29 12:52 ` [PATCH 1/2] KVM: nSVM: Virtualize DecodeAssists for nested guests Tina Zhang
2026-06-29 13:12 ` sashiko-bot [this message]
2026-06-30 15:11 ` Jim Mattson
2026-06-29 12:52 ` [PATCH 2/2] KVM: selftests: Add nested SVM DecodeAssists test Tina Zhang
2026-06-30 15:52 ` [PATCH 0/2] KVM: nSVM: Expose DecodeAssists to L1 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=20260629131222.12CEA1F01560@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhang_wei@open-hieco.net \
/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.