Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Tina Zhang <zhang_wei@open-hieco.net>
Cc: Yosry Ahmed <yosry@kernel.org>, Jim Mattson <jmattson@google.com>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
	 zhouyanjing@hygon.cn, linux-kselftest@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] KVM: nSVM: Expose DecodeAssists to L1
Date: Wed, 8 Jul 2026 07:04:48 -0700	[thread overview]
Message-ID: <ak5ZANYxYeWmDGEL@google.com> (raw)
In-Reply-To: <56649d82-bce1-4fac-b639-345376d219be@open-hieco.net>

On Wed, Jul 08, 2026, Tina Zhang wrote:
> On 7/8/2026 6:34 AM, Yosry Ahmed wrote:
> > On Mon, Jun 29, 2026 at 08:52:03PM +0800, Tina Zhang wrote:
> > > The SVM DecodeAssists feature is reported in CPUID
> > > Fn8000_000A_EDX[7].  When available, hardware provides the length and bytes
> > > of the intercepted instruction in the VMCB, allowing a hypervisor to consume
> > > the decode information directly instead of re-decoding the instruction in
> > > software on relevant VM-Exit paths.
> > > 
> > > KVM currently does not expose DecodeAssists to nested SVM guests, even when
> > > the host supports it, and does not propagate the hardware-provided
> > > instruction length and bytes from VMCB02 to VMCB12 on nested VM-Exit.  This
> > > leaves L1 with an incomplete virtual SVM CPUID model and prevents L1 from
> > > using the same hardware-assisted decode information that KVM receives for
> > > L2 exits.
> > > 
> > > The missing virtualization was observed in practice with Hyper-V as L1,
> > > where the absence of DecodeAssists prevented nested SVM from being made
> > > available to L2 guests.  The fix is not Hyper-V specific.  Complete nested
> > > SVM virtualization of DecodeAssists by advertising the feature to L1 when
> > > supported by hardware, and by copying the decode-assist fields into VMCB12
> > > on nested VM-Exit.
> > > 
> > > Add a selftest that triggers a nested page fault from L2 and verifies that
> > > L1 sees a non-zero instruction length and instruction bytes matching the
> > > faulting instruction.
> > 
> > Taking a large step back from all the discussions in the other replies:
> > Is there a measurable performance improvement? Not trying to say we
> > shouldn't do this, but we should at least see what we're trading this
> > complexity for, it's obviously not straigtforward to fully virtualize
> > decode assists.
> 
> I don't have a meaningful performance number yet. My current understanding
> is that the main value of the series is more about architectural
> completeness and enabling the Hyper-V L1 use case than about a direct
> performance win.

Yeah, and I wouldn't be at all surprised if VMware follows suit in the future.
E.g. see commit 176bfc5b17fe ("KVM: nSVM: Advertise support for flush-by-ASID").

  reply	other threads:[~2026-07-08 14:04 UTC|newest]

Thread overview: 26+ 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
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
2026-07-06 22:10   ` mlevitsk
2026-07-07  0:01     ` Tina Zhang
2026-07-07  1:32       ` Jim Mattson
2026-07-07  2:44         ` Tina Zhang
2026-07-07  3:21           ` Sean Christopherson
2026-07-07  3:25             ` Jim Mattson
2026-07-07  3:32               ` Jim Mattson
2026-07-07 14:42                 ` Sean Christopherson
2026-07-07 15:19                   ` Jim Mattson
2026-07-07 15:47                     ` Sean Christopherson
2026-07-07 18:56                       ` Jim Mattson
2026-07-07 14:41               ` Sean Christopherson
2026-07-07 15:24                 ` Jim Mattson
2026-07-07 15:37                   ` Sean Christopherson
2026-07-07 18:23                     ` Jim Mattson
2026-07-07 19:16                       ` Sean Christopherson
2026-07-07 22:34 ` Yosry Ahmed
2026-07-08  0:53   ` Tina Zhang
2026-07-08 14:04     ` Sean Christopherson [this message]
2026-07-08 17:47     ` Yosry Ahmed

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=ak5ZANYxYeWmDGEL@google.com \
    --to=seanjc@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=shuah@kernel.org \
    --cc=yosry@kernel.org \
    --cc=zhang_wei@open-hieco.net \
    --cc=zhouyanjing@hygon.cn \
    /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