On 08/01/2013 03:42 PM, Gleb Natapov wrote:
> On Thu, Aug 01, 2013 at 03:31:01PM +0800, Xiao Guangrong wrote:
>> On 08/01/2013 03:18 PM, Xiao Guangrong wrote:
>>  +#endif
>>>>>
>>>>> Hmm, why not use shadow_x_mask, shadow_user_mask instead? PT_WRITABLE_MASK
>>>>> is also suitable for ept, i guess we can remove the "#if/#else/#endif" 
>>>>> after
>>>>> that.
>>>>>
>>>> shadow_x_mask and shadow_user_mask do not depend on guest paging mode,
>>>> so cannot be used here. Since we have to use ifdefs anyway relying on
>>>> VMX_EPT_WRITABLE_MASK == PT_WRITABLE_MASK is not necessary. Makes code
>>>> easier to read.
>>>
>>> Oh, yes, you are right.
>>>
>>> Reviewed-by: Xiao Guangrong <[email protected]>
>>
>> BTW, i notice the code in mmu.c uses PT64_NX_MASK to check the permission,
>> i.e:
>>
>> static bool need_remote_flush(u64 old, u64 new)
>> {
>>      if (!is_shadow_present_pte(old))
>>              return false;
>>      if (!is_shadow_present_pte(new))
>>              return true;
>>      if ((old ^ new) & PT64_BASE_ADDR_MASK)
>>              return true;
>>      old ^= PT64_NX_MASK;
>>      new ^= PT64_NX_MASK;
>>      return (old & ~new & PT64_PERM_MASK) != 0;
>> }
>>
>> It checks shadow page table and the mask is wrong one nest ept spte.
> So shadow_x_mask need to be used here, correct?

Yes. The code checks shadow page table which does not depend on guest mode. :)


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to