[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
- Re: [Qemu-devel] [PATCH 15/16] tcg: Make tb_flush() thread safe, (continued)
[Qemu-devel] [PATCH 14/16] cpus-common: Introduce async_safe_run_on_cpu(), Paolo Bonzini, 2016/09/23
[Qemu-devel] [PATCH 16/16] cpus-common: lock-free fast path for cpu_exec_start/end, Paolo Bonzini, 2016/09/23
[Qemu-devel] [PATCH 12/16] cpus-common: remove redundant call to exclusive_idle(), Paolo Bonzini, 2016/09/23
Re: [Qemu-devel] [PATCH v8 00/16] cpu-exec: Safe work in quiescent state, Alex Bennée, 2016/09/25