qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 16/16] cpus-common: lock-free fast path for cpu_


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 16/16] cpus-common: lock-free fast path for cpu_exec_start/end
Date: Mon, 26 Sep 2016 09:20:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0


On 24/09/2016 22:43, Richard Henderson wrote:
>>> I don't see that the cpu_list_lock protects the
>>> last two lines in any way.
>>
>> It does:
>>
>>         qemu_mutex_lock(&qemu_cpu_list_lock);
> 
> What I meant is that I don't see that the mutex avoids the need for
> atomic_set.

Oh, I see.

cpu->running is only read under the mutex, but can be written _by the
owner thread only_ outside the mutex.  So writes outside the mutex must
be atomic, but writes under the mutex don't because:

- no other thread ever writes to cpu->running

- no other thread can be reading cpu->running

Paolo



reply via email to

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