On 08/25/2011 10:04 AM, Marcelo Tosatti wrote: >>> Yes, in this case, the sp is not zapped, but it is hardly to know the gfn >>> is not used as gpte just depends on writing, for example, the guest can >>> change the mapping address or the status bit, and so on...The sp can be >>> zapped if the guest write it again(on the same address), i think it is >>> acceptable, anymore, it is just the speculative way to zap the unused >>> shadow page...your opinion? >> >> It could increase the flood count independently of the accessed bit of >> the spte being updated, zapping after 3 attempts as it is now. >> >> But additionally reset the flood count if the gpte appears to be valid >> (points to an existant gfn if the present bit is set, or if its zeroed). > > Well not zero, as thats a common pattern for non ptes. > Hi Marcelo, Maybe it is not good i think, for some reasons: - checking gfn valid which it is pointed by gpte is high overload, it needs to call gfn_to_hva to walk memslots, especially. kvm_mmu_pte_write is called very frequently on shadow mmu. - MMIO gfn is not an existent gfn, but it is valid pointed by gpte - we can check the reserved bits in the gpte to check whether it is valid a gpte, but for some paging modes, all bits are valid.(for example, non-PAE mode) - it can not work if the gfn has multiple shadow pages, for example: if the gfn was used as PDE, later it is used as PTE, then we have two shadow pages: sp1.level = 2, sp2.level = 1, sp1 can not be zapped even even though it is not used anymore. - sometime, we need to zap the shadow page even though the gpte is written validly: if the gpte is written frequently but infrequently accessed, we do better zap the shadow page to let it is writable(write it directly without #PF) and map it when it is accessed, one example is from Avi, the guest OS may update many gptes at one time after one page fault. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html