Re: [RFC PATCH V3 2/4] KVM: X86: Introduce role.glevel for level expanded pagetable
From: Lai Jiangshan
Date: Wed Apr 13 2022 - 00:13:44 EST
On Wed, Apr 13, 2022 at 5:31 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > union kvm_mmu_page_role {
> > u32 word;
> > @@ -331,7 +331,8 @@ union kvm_mmu_page_role {
> > unsigned smap_andnot_wp:1;
> > unsigned ad_disabled:1;
> > unsigned guest_mode:1;
> > - unsigned :6;
> > + unsigned glevel:4;
>
> We don't need 4 bits for this. Crossing our fingers that we never had to shadow
> a 2-level guest with a 6-level host, we can do:
>
> unsigned passthrough_delta:2;
We can save the bits in the future when we need more bits so I didn't
hesitate to use 4 bits since glevel gives simple code. ^_^
I think the name passthrough_delta is more informative and glevel
is used only for comparison so passthrough_delta can also be
simple. I will apply your suggestion.
Thanks
Lai