On Thu, Feb 09, 2023 at 10:40:13AM +0800, Robert Hoo wrote: >Intercept CR4.LAM_SUP by KVM, to avoid read VMCS field every time, with >expectation that guest won't toggle this bit frequently. > >Under EPT mode, CR3 is fully under guest control, guest LAM is thus transparent to >KVM. Nothing more need to do. I don't think it is correct. You have to strip LAM_U57/U48 from CR3 when walking guest page table and strip metadata from pointers when emulating instructions. > >For Shadow paging (EPT = off), KVM need to handle guest CR3.LAM_U48 and CR3.LAM_U57 >toggles. > >[1] ISE Chap10 https://cdrdv2.intel.com/v1/dl/getContent/671368 (Section 10.6 VMX interaction) >[2] Thus currently, Kernel enabling patch only enables LAM_U57. https://lore.kernel.org/lkml/20230123220500.21077-1-kirill.shutemov@xxxxxxxxxxxxxxx/ Please add a kvm-unit-test or kselftest for LAM, particularly for operations (e.g., canonical check for supervisor pointers, toggle CR4.LAM_SUP) which aren't covered by the test in Kirill's series.