From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 03/10] KVM: switch dirty_log to mmu_lock protection Date: Tue, 22 Sep 2009 15:52:35 +0300 Message-ID: <4AB8C893.8090900@redhat.com> References: <20090921233711.213665413@amt.cnet> <20090921234124.205345161@amt.cnet> <4AB870BF.4090905@redhat.com> <20090922124415.GB3138@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:60042 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753327AbZIVMwe (ORCPT ); Tue, 22 Sep 2009 08:52:34 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8MCqcZP024274 for ; Tue, 22 Sep 2009 08:52:38 -0400 In-Reply-To: <20090922124415.GB3138@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 09/22/2009 03:44 PM, Marcelo Tosatti wrote: > >> 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. > That's true. By how much? srcu is not so slow that a 30Hz refresh rate would notice. > 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. > By the time ioctl() returns you can have dirty data in the new bitmap. Nothing wrong with that. > This are the reasons for the choice. Would you prefer a new rw lock? > Prefer the srcu thing unless convinced it is too slow. Alternatively, we can copy-and-clear the bitmap using cmpxchg (which won't lose data) to a temporary buffer, then to userspace. Locks are unfashionable. -- error compiling committee.c: too many arguments to function