On Fri, May 3, 2013 at 5:10 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Fri, May 03, 2013 at 10:45:18AM +0800, Liu Ping Fan wrote: >> +/** >> + * Install new regions list >> + */ >> +static void hostmem_listener_commit(MemoryListener *listener) >> +{ >> + HostMem *tmp; >> + AddrSpaceMem *as_mem = container_of(listener, AddrSpaceMem, listener); >> + >> + /* writer of cur_hostmem &next_hostmem is serialed by biglock > > s/serialed/serialized/ > Will fix, >> + * in hotplug path. So only take care of r/w on cur_hostmem >> + */ > > Indentation. > Will fix, >> @@ -164,18 +203,30 @@ void hostmem_init(void) >> .coalesced_mmio_del = hostmem_listener_coalesced_mmio_dummy, >> .priority = 10, >> }; >> + as_mem->cur_hostmem = g_new0(HostMem, 1); >> + as_mem->cur_hostmem->ref = 1; >> + memory_listener_register(&as_mem->listener, as); >> >> - memory_listener_register(&system_mem->listener, &address_space_memory); >> - if (system_mem->num_new_regions > 0) { >> - hostmem_listener_commit(&system_mem->listener); >> - } > > The point of this if statement was to make the newly added regions > visible. I guess it is not necessary because exec.c is calling us > before any memory gets initialized now?
Yes, before any memory_region added into system. Regards, Pingfan