qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 10/12] Dump: add qmp command "query-dump"


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v3 10/12] Dump: add qmp command "query-dump"
Date: Tue, 1 Dec 2015 10:54:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0


On 01/12/2015 04:57, Peter Xu wrote:
>> > You need a mutex around the reads of ->status and ->written_size.
> Could I avoid using mutex here? Let me try to explain what I
> thought.
> 
> The concurrency of this should only happen when:
> 
> - detached dump thread is working (dump thread)
> - user queries dump status (main thread)
> 
> What the dump thread is doing should be something like:
> 
> - [start dumping]
> - inc written_size
> - inc written_size
> - ...
> - inc written_size
> - set ->status to COMPLETED|FAILED
> - [end dumping]

Yes, it's possible but you need to use atomic_mb_read/atomic_mb_set to
write ->status.  Otherwise a CPU can see the write to ->status before
some of the final writes to ->written_size.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]