Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754694AbbFSQuv (ORCPT ); Fri, 19 Jun 2015 12:50:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36216 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752198AbbFSQun (ORCPT ); Fri, 19 Jun 2015 12:50:43 -0400 Message-ID: <5584485F.8050903@redhat.com> Date: Fri, 19 Jun 2015 18:50:39 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: "Michael S. Tsirkin" CC: Igor Mammedov , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, andrey@xdel.ru Subject: Re: [PATCH 3/5] vhost: support upto 509 memory regions References: <20150618134040-mutt-send-email-mst@redhat.com> <5582B088.1090207@redhat.com> <20150618142455-mutt-send-email-mst@redhat.com> <5582CBA6.5070105@redhat.com> <20150618164559-mutt-send-email-mst@redhat.com> <5582EBA6.1080607@redhat.com> <20150619095515-mutt-send-email-mst@redhat.com> <5583CB62.6030405@redhat.com> <20150619100409-mutt-send-email-mst@redhat.com> <5583D85F.7090200@redhat.com> <20150619184220-mutt-send-email-mst@redhat.com> In-Reply-To: <20150619184220-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1980 Lines: 43 On 19/06/2015 18:45, Michael S. Tsirkin wrote: > > user guest QEMU > > ---------------------------------------------------------------------------------------- > > start I/O > > '---------------> address_space_map > > device_del > > '-------------------> receives SCI > > executes _EJ0 > > '---------------> memory_region_del_subregion > > object_unparent > > device_add > > '-----------------------------------------> device_set_realized > > hotplug_handler_plug > > pc_machine_device_plug_cb > > pc_dimm_plug > > memory_region_add_subregion > > > > I/O finishes > > address_space_unmap > > > > OK so what's the problem with checking for this condition, > after address_space_unmap detects that ref count is 0 > and before calling mmap(MAP_NORESERVE)? Should be okay. However, someone still needs to figure out the part where device_add is delayed until the address_space_unmap. Otherwise, the device_add's mmap() overlays the older one and the delayed mmap(MAP_NORESERVE) overlays the device_add's mmap(). It seems like a colossal waste of time to perfect a little-used path that no doubt will have bugs in it, some of which could perhaps have security consequences. Also, QEMU is not the only vhost client, so we're just scratching the surface here. Paolo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/