From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLYsU-0004vV-Pt for qemu-devel@nongnu.org; Tue, 09 Oct 2012 08:25:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLYsT-0004ui-NT for qemu-devel@nongnu.org; Tue, 09 Oct 2012 08:25:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLYsT-0004ta-6h for qemu-devel@nongnu.org; Tue, 09 Oct 2012 08:25:37 -0400 Message-ID: <5074171A.2030904@redhat.com> Date: Tue, 09 Oct 2012 14:22:50 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1348577763-12920-1-git-send-email-pbonzini@redhat.com> <20121008113932.GB16332@stefanha-thinkpad.redhat.com> <5072CE54.8020208@redhat.com> <20121009090811.GB13775@stefanha-thinkpad.redhat.com> <5073EDB3.3020804@redhat.com> <5073FE3A.1090903@redhat.com> <507401D8.8090203@redhat.com> <507405B5.4060108@redhat.com> <507410BD.6050901@redhat.com> <50741218.90000@redhat.com> In-Reply-To: <50741218.90000@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Block I/O outside the QEMU global mutex was "Re: [RFC PATCH 00/17] Support for multiple "AIO contexts"" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Anthony Liguori , Ping Fan Liu , Stefan Hajnoczi , qemu-devel@nongnu.org, Jan Kiszka On 10/09/2012 02:01 PM, Paolo Bonzini wrote: > >> [could we also avoid refcounting by doing the equivalent of >> stop_machine() during hotunplug?] > > That's quite an interesting alternative. It's somewhat unattractive in that we know how much stop_machine is hated in Linux. But maybe it makes sense as a transitional path. Note it's not sufficient to stop vcpu threads, we also have to stop non-vcpu threads that may be issuing address_space_rw() or family. But no, it's actually impossible. Hotplug may be triggered from a vcpu thread, which clearly it can't be stopped. The only two solutions are Ping's garbage collector thread or refcounting. The original deadlock was: read_lock_rcu() / mmap_lock() lookup device dispatch device mmio handler memory_region_del_subregion() synchronize_rcu() / mmap_lock() rcu_read_unlock() / mmap_unlock stop_machine() is just another name for synchronize_rcu() wrt locking. -- error compiling committee.c: too many arguments to function