Il 28/08/2013 18:02, Mike Day ha scritto: > @@ -1102,15 +1110,15 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char > *name, DeviceState *dev) > pstrcat(new_block->idstr, sizeof(new_block->idstr), name); > > /* This assumes the iothread lock is taken here too. */ > - qemu_mutex_lock_ramlist(); > - QTAILQ_FOREACH(block, &ram_list.blocks, next) { > + rcu_read_lock(); > + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { > if (block != new_block && !strcmp(block->idstr, new_block->idstr)) { > fprintf(stderr, "RAMBlock \"%s\" already registered, abort!\n", > new_block->idstr); > abort(); > } > } > - qemu_mutex_unlock_ramlist(); > + rcu_read_unlock();
Forgot about this. Every time you see "This assumes the iothread lock is taken here too", you're in the write side so you do not need lock/unlock and you do not need... > /* This assumes the iothread lock is taken here too. */ > qemu_mutex_lock_ramlist(); > - QTAILQ_FOREACH(block, &ram_list.blocks, next) { > + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { > if (addr == block->offset) { > - QTAILQ_REMOVE(&ram_list.blocks, block, next); > + QLIST_REMOVE_RCU(block, next); > ram_list.mru_block = NULL; > ram_list.version++; > g_free(block); qemu_mutex_lock_ramlist/qemu_mutex_unlock_ramlist either. Otherwise, the patch is pretty solid! Thanks, Paolo