[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: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH 16/16] cpus-common: lock-free fast path for cpu_exec_start/end |
Date: |
Mon, 26 Sep 2016 08:28:12 +0100 |
User-agent: |
mu4e 0.9.17; emacs 25.1.50.1 |
Paolo Bonzini <address@hidden> writes:
> 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
Should we add some comments to cpu.h's definitions to make the rules clear?
--
Alex Bennée
- 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