Re: [PATCH 04/11] KVM: MMU: do not mark access bit on pte write path

Xiao Guangrong
2011-07-27T10:02:09Z

On 07/27/2011 05:08 PM, Avi Kivity wrote:
> On 07/26/2011 02:28 PM, Xiao Guangrong wrote:
>> In current code, the accessed bit is always set when page fault occurred,
>> do not need to set it on pte write path
>>
>
> Is this true? a write with pte.w=pte.a=0 sets pte.a?
>

Generally, we will call set_spte() with speculative = false, then Accessed bit
is set on page fault path, but there has two case:
- if pte.d = 1, everything is ok
- if pte.d = 0, so this write can change pte.d = 1, the access permission of
shadow page can be changed from read-only to writable. So, we will find a
new sp to establish the mapping. In this case, the original spte is not
set Accessed bit.

However, we used Accessed bit to detect write flooding, so the first write can
set the dirty bit, and the later write can not cause sp changed. I think it is
not too bad.