Re: [PATCH 3/5] vhost: support upto 509 memory regions

From: Paolo Bonzini
Date: Fri Jun 19 2015 - 12:50:53 EST




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/