On Mon, 2026-08-17 at 22:55 +0100, David Woodhouse wrote:
> I've reworked the first half of this on top of the GPC SRCU
> conversion, with the guest-mode pinning done as Sean prescribed:
> 
>   
> https://git.infradead.org/?p=users/dwmw2/linux.git;a=shortlog;h=refs/heads/nvmx-gpc

I did the nested SVM equivalent too, now on top of the same tree:

  
https://git.infradead.org/?p=users/dwmw2/linux.git;a=shortlog;h=refs/heads/nsvm-gpc

(Those kvm_nested_gpc_lock() helpers have nothing to do with nesting
and can be renamed and hoisted to somewhere more generic when I go back
and clean it all up, but I'm keeping it incremental for now.)

SVM doesn't use L1 pages directly from the guest VMCB02 (the merged
MSRPM and the IOPM are kernel pages). It's only ever direct access from
the kernel to gpc->khva.

But that covers the VMCB12 page which is mapped and unmapped twice per
L1←→L2 round trip today, and L1's MSR/IO permission bitmaps
(kvm_vcpu_read_guest() on each trapped access).

So unlike nVMX, we can even see the win on boring non-PFNMAP memory.

From a cpuid ping-pong between L1 and L2 on EPYC Milan
(10k iterations, cycles, measured from L1):

                    baseline                nsvm-gpc
  reflected exit:   p50 47.6k  p99 90.2k    p50 38.6k  p99 81.4k
  MSR intercept:    p50 49.1k  p99 90.9k    p50 39.9k  p99 81.8k

About 9k cycles (~20%) off every emulated vmexit/vmentry. This is a
kernel with KASAN+lockdep for correctness torture testing, so the
measurement might not be indicative of production performance. I'll do
another run on something more representative now it's actually passed
the soak tests without catching fire.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to