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 09:37:51 +0300 Message-ID: <4AB870BF.4090905@redhat.com> References: <20090921233711.213665413@amt.cnet> <20090921234124.205345161@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; 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]:31362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751227AbZIVGhu (ORCPT ); Tue, 22 Sep 2009 02:37:50 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8M6bsT7004969 for ; Tue, 22 Sep 2009 02:37:54 -0400 In-Reply-To: <20090921234124.205345161@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: 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). 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. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.