Re: [PATCH 2/4] KVM: nVMX: remove unnecessary code in prepare_vmcs02

From: Paolo Bonzini

Date: Thu May 28 2026 - 03:57:00 EST


On 5/28/26 02:14, Sean Christopherson wrote:
Hah! Fixing your own mistakes, but making it look like it was my fault. :-D

In the original version[1] of what ended up being commit c7554efc8335 ("KVM: nVMX:
Copy PDPTRs to/from vmcs12 only when necessary"), the writes in what is now
prepare_vmcs02_rare() (and I at least am still amused by the meat pun[2]) were
removed. When the mega-collection of optimizations was posted[3], the removal
of that code got dropped.

AFAICT, it was completely unintenional. Maybe a rebase goof?

Yes, probably.

I don't care terribly about the performance, and I 100% agree the extra complexity
to do the "late" loading is ugly, but I still think I'd prefer to keep the "late"
loading so that there's symmetry with the vmcs02 => vmcs12 sync, and so that we
don't try to optimize the prepare_vmcs02_rare() code and consume incorrect state
via is_pae_paging().

Alternatively, expand the comment in prepare_vmcs02_rare()?

Ok, I will keep the late loading.

Paolo