On Tue, Sep 22, 2009 at 09:37:51AM +0300, Avi Kivity wrote: > On 09/22/2009 02:37 AM, Marcelo Tosatti wrote: >> get_dirty_log vs mark_page_dirty need to be mutually exclusive. Switch >> to mmu_lock protection. >> >> > > I'm not sure all archs use mmu_lock. Also, I'm unhappy about > introducing more use (especially as it's often unnecessary, if dirty > logging is turned off for the slot for example). True. > I think you can use rcu for this as well. When you read the log, > allocate a new empty bitmap, switch the memslots pointer to include it, > and synchronize_srcu(). Now we are certain everyone is using the new > bitmap we can copy the old one to usespace and delete it. This will slow down get_dirty_log, which can lead to regressions in migration and poorer vga refresh updates. Moreover, since updates are running concurrently, at the time synchronize_srcu returns you can have plenty of dirty data in the new bitmap which is not the case with mutual exclusion. This are the reasons for the choice. Would you prefer a new rw lock? -- 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