From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 03/10] KVM: switch dirty_log to mmu_lock protection Date: Tue, 22 Sep 2009 09:44:15 -0300 Message-ID: <20090922124415.GB3138@amt.cnet> References: <20090921233711.213665413@amt.cnet> <20090921234124.205345161@amt.cnet> <4AB870BF.4090905@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61538 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756018AbZIVMoZ (ORCPT ); Tue, 22 Sep 2009 08:44:25 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8MCiTRf006328 for ; Tue, 22 Sep 2009 08:44:29 -0400 Content-Disposition: inline In-Reply-To: <4AB870BF.4090905@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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?