Message ID | 256c5d79-d940-3a7c-89e2-19a6140f5ccd@redhat.com |
---|---|
State | New |
Headers | show |
On 25/08/17 19:01, Paolo Bonzini wrote: > On 25/08/2017 10:31, Alexey Kardashevskiy wrote: >> Each address_space_init() updates topology for _every_ address space. > > And finally, does this patch help with the above? > > diff --git a/memory.c b/memory.c > index c0adc35..97c16cc 100644 > --- a/memory.c > +++ b/memory.c > @@ -2607,10 +2607,16 @@ void memory_region_invalidate_mmio_ptr(MemoryRegion *mr, hwaddr offset, > RUN_ON_CPU_HOST_PTR(invalidate_data)); > } > > +static void address_space_rebuild(AddressSpace *as) > +{ > + MEMORY_LISTENER_CALL(as, begin, Forward); > + address_space_update_topology(as); > + MEMORY_LISTENER_CALL(as, commit, Forward); > +} > + > void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name) > { > memory_region_ref(root); > - memory_region_transaction_begin(); > as->ref_count = 1; > as->root = root; > as->malloced = false; > @@ -2622,8 +2628,7 @@ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name) > QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link); > as->name = g_strdup(name ? name : "anonymous"); > address_space_init_dispatch(as); > - memory_region_update_pending |= root->enabled; > - memory_region_transaction_commit(); > + address_space_rebuild(as); > } > > static void do_address_space_destroy(AddressSpace *as) > > > Completely untested because vacation is coming. Friday night arrived here already ;) The patch did not help though (I also had to define section-less MEMORY_LISTENER_CALL()). I'll look into your first suggestion on Monday.
On 25/08/2017 11:16, Alexey Kardashevskiy wrote: > On 25/08/17 19:01, Paolo Bonzini wrote: >> On 25/08/2017 10:31, Alexey Kardashevskiy wrote: >>> Each address_space_init() updates topology for _every_ address space. >> >> And finally, does this patch help with the above? >> >> diff --git a/memory.c b/memory.c >> index c0adc35..97c16cc 100644 >> --- a/memory.c >> +++ b/memory.c >> @@ -2607,10 +2607,16 @@ void memory_region_invalidate_mmio_ptr(MemoryRegion *mr, hwaddr offset, >> RUN_ON_CPU_HOST_PTR(invalidate_data)); >> } >> >> +static void address_space_rebuild(AddressSpace *as) >> +{ >> + MEMORY_LISTENER_CALL(as, begin, Forward); >> + address_space_update_topology(as); >> + MEMORY_LISTENER_CALL(as, commit, Forward); >> +} >> + >> void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name) >> { >> memory_region_ref(root); >> - memory_region_transaction_begin(); >> as->ref_count = 1; >> as->root = root; >> as->malloced = false; >> @@ -2622,8 +2628,7 @@ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name) >> QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link); >> as->name = g_strdup(name ? name : "anonymous"); >> address_space_init_dispatch(as); >> - memory_region_update_pending |= root->enabled; >> - memory_region_transaction_commit(); >> + address_space_rebuild(as); >> } >> >> static void do_address_space_destroy(AddressSpace *as) >> >> >> Completely untested because vacation is coming. > > > Friday night arrived here already ;) > > The patch did not help though (I also had to define section-less > MEMORY_LISTENER_CALL()). I'll look into your first suggestion on Monday. Note that this is not a full solution, only for the O(n^2) transaction commits. Paolo
diff --git a/memory.c b/memory.c index c0adc35..97c16cc 100644 --- a/memory.c +++ b/memory.c @@ -2607,10 +2607,16 @@ void memory_region_invalidate_mmio_ptr(MemoryRegion *mr, hwaddr offset, RUN_ON_CPU_HOST_PTR(invalidate_data)); } +static void address_space_rebuild(AddressSpace *as) +{ + MEMORY_LISTENER_CALL(as, begin, Forward); + address_space_update_topology(as); + MEMORY_LISTENER_CALL(as, commit, Forward); +} + void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name) { memory_region_ref(root); - memory_region_transaction_begin(); as->ref_count = 1; as->root = root; as->malloced = false; @@ -2622,8 +2628,7 @@ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name) QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link); as->name = g_strdup(name ? name : "anonymous"); address_space_init_dispatch(as); - memory_region_update_pending |= root->enabled; - memory_region_transaction_commit(); + address_space_rebuild(as); } static void do_address_space_destroy(AddressSpace *as)
On 25/08/2017 10:31, Alexey Kardashevskiy wrote: > Each address_space_init() updates topology for _every_ address space. And finally, does this patch help with the above? Completely untested because vacation is coming. Thanks, Paolo