Re: [PATCH v5 11/14] nEPT: MMU context for nested EPT

Xiao Guangrong
2013-08-01T09:51:22Z

On 08/01/2013 05:16 PM, Xiao Guangrong wrote:
> On 07/31/2013 10:48 PM, Gleb Natapov wrote:
>> From: Nadav Har'El <nyh@il.ibm.com>
>>
>> KVM's existing shadow MMU code already supports nested TDP. To use it, we
>> need to set up a new "MMU context" for nested EPT, and create a few callbacks
>> for it (nested_ept_*()). This context should also use the EPT versions of
>> the page table access functions (defined in the previous patch).
>> Then, we need to switch back and forth between this nested context and the
>> regular MMU context when switching between L1 and L2 (when L1 runs this L2
>> with EPT).
>
> This patch looks good to me.
>
> Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
>
> But i am confused that update_permission_bitmask() is not adjusted in this
> series. That function depends on kvm_read_cr4_bits(X86_CR4_SMEP) and
> is_write_protection(), these two functions should read the registers from
> L2 guest, using the L2 status to check L1's page table seems strange.
> The same issue is in nested npt. Anything i missed?

After check the code, i found vcpu->arch.mmu is not updated when switch to
nested mmu, that means, "using the L2 status to check L1's page table seems
strange" is wrong. That is fine on nested npt, but nested ept should adjust
the logic anyway.