Re: [PATCH v2 1/3] KVM: VMX: Support the secondary VM-exit controls
From: Chao Gao
Date: Thu Dec 03 2026 - 08:14:56 EST
On Wed, Dec 02, 2026 at 10:51:47PM -0800, Sohil Mehta wrote:
>From: "Xin Li (Intel)" <xin@xxxxxxxxx>
>
>Add the VMCS field for the secondary VM-exit controls, its controls
>shadow and the vmcs_config plumbing. Activate the controls in vmcs01
>whenever hardware supports them, and copy them into vmcs02.
>
>The secondary VM-exit controls are a 64-bit VMCS field for controls that
>no longer fit in the 32-bit primary field. Bit 31 of the primary VM-exit
>controls activates them. No feature KVM supports uses any of these
>controls yet, but the upcoming FRED KVM support is planning to use them.
>With every control bit clear, KVM behaves exactly as before.
>
>Check the secondary controls through their own entry/exit pair table.
>Avoid using a shared table because a failed check would clear the
>activation bit and turn off every secondary control, not just the
>inconsistent one. The new table stays empty until the first feature adds
>a pair.
This only matters with error_on_inconsistent_vmcs_config=0, because
kvm_intel refuses to load on a failed check by default. Sean's reason
in [1] is the stronger one:
"two tables provides better separation, which makes it easier
to follow what's going on, and avoids "polluting" every entry
with empty fields."
I would use it here instead and add a link to that discussion.
[1]: https://lore.kernel.org/all/Z739wdGmk4ZuWJ8v@xxxxxxxxxx/