Message ID | 4712D8F4B26E034E80552F30A67BE0B1A13045@ORSMSX112.amr.corp.intel.com |
---|---|
State | New |
Headers | show |
On 14/03/2017 06:14, Xu, Anthony wrote: > Below functions are registered in RCU thread > address_space_dispatch_free, > do_address_space_destroy > flatview_unref > reclaim_ramblock, > qht_map_destroy, > migration_bitmap_free > > first three are address space related, should work without global lock per above analysis. > The rest are very simple, seems doesn't need global lock. flatview_unref can call object_unref and thus reach: - all QOM instance_finalize callbacks - all QOM property release callbacks In turn, of QOM property release callbacks the more important ones are release_drive (which calls blockdev_auto_del and blk_detach_dev) and release_chr (which calls qemu_chr_fe_deinit). Your patch is incorrect, sorry. If it were that simple, it would have been done already... Paolo
diff --git a/memory.c b/memory.c index 6c58373..43e06e9 100644 --- a/memory.c +++ b/memory.c @@ -1503,15 +1503,9 @@ static void memory_region_finalize(Object *obj) * and cause an infinite loop. */ mr->enabled = false; - memory_region_transaction_begin(); - while (!QTAILQ_EMPTY(&mr->subregions)) { - MemoryRegion *subregion = QTAILQ_FIRST(&mr->subregions); - memory_region_del_subregion(mr, subregion); - } - memory_region_transaction_commit(); - + assert(QTAILQ_EMPTY(&mr->subregions)); mr->destructor(mr); - memory_region_clear_coalescing(mr); + assert(QTAILQ_EMPTY(&mr->coalesced)); g_free((char *)mr->name); g_free(mr->ioeventfds); } diff --git a/util/rcu.c b/util/rcu.c index 9adc5e4..51e0248 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -254,24 +254,20 @@ static void *call_rcu_thread(void *opaque) atomic_sub(&rcu_call_count, n); synchronize_rcu(); - qemu_mutex_lock_iothread(); while (n > 0) { node = try_dequeue(); while (!node) { - qemu_mutex_unlock_iothread(); qemu_event_reset(&rcu_call_ready_event); node = try_dequeue(); if (!node) { qemu_event_wait(&rcu_call_ready_event); node = try_dequeue(); } - qemu_mutex_lock_iothread(); } n--; node->func(node); } - qemu_mutex_unlock_iothread(); } abort(); }