A guest sees RDTSCP, RDPID and INVPCID in CPUID when the host lets it use them. In VMX non-root operation these instructions raise #UD unless the secondary control that enables them is set, and L1 was not offered these controls. A hypervisor that shows its guest what it sees itself then has an L2 that gets #UD for an instruction that CPUID announces. VirtualBox does that: Linux as its guest halted early in its boot.
Offer "enable RDTSCP" and "enable INVPCID" if the CPU has them, and copy them to vmcs02. The VM exits that these instructions can cause depend on "RDTSC exiting" and "INVLPG exiting", which are L1's, so they go to L1 as all exits do that the host has no use for. IA32_TSC_AUX, which L1 and L2 share like the other MSRs that a guest reads without a VM exit, can be in the MSR areas now.
AI assistance: as D61708, this change was developed with an AI assistant (Anthropic's Claude) under my direction. The assistant wrote the code and this description. The tests in the test plan were run on real hardware.
Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Sponsored by: keelos.dev