From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLz0f-00089j-Ds for qemu-devel@nongnu.org; Tue, 17 Sep 2013 13:24:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLz0Z-00051u-E6 for qemu-devel@nongnu.org; Tue, 17 Sep 2013 13:24:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLz0Z-00051d-4q for qemu-devel@nongnu.org; Tue, 17 Sep 2013 13:24:15 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8HHOE7l005437 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Sep 2013 13:24:14 -0400 Date: Tue, 17 Sep 2013 20:26:27 +0300 From: "Michael S. Tsirkin" Message-ID: <20130917172627.GA21064@redhat.com> References: <20130917124724.GA18965@redhat.com> <52386A29.9090908@redhat.com> <20130917144541.GA19882@redhat.com> <52387840.8090405@redhat.com> <20130917155909.GA20460@redhat.com> <52387FBF.4050504@redhat.com> <20130917162928.GA20672@redhat.com> <52388A3D.4090909@redhat.com> <20130917170752.GA20986@redhat.com> <52388E5F.6020802@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52388E5F.6020802@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 00/38] Delay destruction of memory regions to instance_finalize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Tue, Sep 17, 2013 at 07:16:15PM +0200, Paolo Bonzini wrote: > Il 17/09/2013 19:07, Michael S. Tsirkin ha scritto: > > After memory_region_del_subregion returns, > > it's a promise that there will not be accesses > > to the region. > > It's racy anyway. You can have memory_region_del_subregion happen one > clock cycle after the other (physical) CPU has done checked that there > will not be accesses to the region. Fix it then. Stick synchronize_rcu() in memory_region_del_subregion. Are you trying to convince me there's no way to have synchronous APIs in presence of RCU? > A real bus has a "big PCI lock" (there can be only one transaction at a > time), which is exactly what we want to get rid of. Not really, in a bridged setup transactions on the secondary bus are handled in parallel with transactions on the primary bus. Also, there are split transactions completed asynchronously: guests that care about ordering do flushes e.g. using memory reads. The logic is in the device/memory region really. > > So I'm not even sure we really need to move destroy to finalize anymore ... > > We definitely need to move it. Even if we added a flag that we set in > memory_region_del_subregion, we need to check it later when AIO completes. > > Paolo Flag where? region can become subregion of another region entirely. The solution for RCU is to flush on changes, not add more flags and locks. -- MST