Re: [Qemu-devel] [RFC PATCH v4 2/5] ramlist mutex

2011-08-23 Thread Marcelo Tosatti
On Tue, Aug 23, 2011 at 06:15:33AM -0300, Marcelo Tosatti wrote: On Tue, Aug 16, 2011 at 11:56:37PM -0400, Umesh Deshpande wrote: ramlist mutex is implemented to protect the RAMBlock list traversal in the migration thread from their addition/removal from the iothread. Signed-off-by:

Re: [Qemu-devel] [RFC PATCH v4 2/5] ramlist mutex

2011-08-23 Thread Paolo Bonzini
On 08/23/2011 11:17 AM, Marcelo Tosatti wrote: typedef struct RAMList { +QemuMutex mutex; uint8_t *phys_dirty; QLIST_HEAD(ram, RAMBlock) blocks; QLIST_HEAD(, RAMBlock) blocks_mru; A comment on what the mutex protects would be good. Indeed,

Re: [Qemu-devel] [RFC PATCH v4 2/5] ramlist mutex

2011-08-23 Thread Marcelo Tosatti
On Tue, Aug 23, 2011 at 01:41:48PM +0200, Paolo Bonzini wrote: On 08/23/2011 11:17 AM, Marcelo Tosatti wrote: typedef struct RAMList { +QemuMutex mutex; uint8_t *phys_dirty; QLIST_HEAD(ram, RAMBlock) blocks; QLIST_HEAD(, RAMBlock) blocks_mru;

Re: [Qemu-devel] [RFC PATCH v4 2/5] ramlist mutex

2011-08-22 Thread Paolo Bonzini
On 08/19/2011 08:20 AM, Umesh Deshpande wrote: Or, is it okay to convert all the ramblock list traversals in exec.c (under iothread) to mru traversals, and probably it makes sense as the original list was also maintained in the mru order, whereas the sequence of blocks doesn't matter for the

Re: [Qemu-devel] [RFC PATCH v4 2/5] ramlist mutex

2011-08-19 Thread Umesh Deshpande
On 08/17/2011 02:28 AM, Paolo Bonzini wrote: On 08/16/2011 08:56 PM, Umesh Deshpande wrote: @@ -3001,8 +3016,10 @@ void qemu_ram_free_from_ptr(ram_addr_t addr) QLIST_FOREACH(block,ram_list.blocks, next) { if (addr == block-offset) { +qemu_mutex_lock_ramlist();

Re: [Qemu-devel] [RFC PATCH v4 2/5] ramlist mutex

2011-08-17 Thread Paolo Bonzini
On 08/16/2011 08:56 PM, Umesh Deshpande wrote: @@ -3001,8 +3016,10 @@ void qemu_ram_free_from_ptr(ram_addr_t addr) QLIST_FOREACH(block,ram_list.blocks, next) { if (addr == block-offset) { +qemu_mutex_lock_ramlist(); QLIST_REMOVE(block, next);

[Qemu-devel] [RFC PATCH v4 2/5] ramlist mutex

2011-08-16 Thread Umesh Deshpande
ramlist mutex is implemented to protect the RAMBlock list traversal in the migration thread from their addition/removal from the iothread. Signed-off-by: Umesh Deshpande udesh...@redhat.com --- cpu-all.h |2 ++ exec.c| 19 +++ qemu-common.h |2 ++ 3 files