qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v1 3/9] cpus: only take BQL for sleeping thr


From: Alex Bennée
Subject: Re: [Qemu-devel] [RFC PATCH v1 3/9] cpus: only take BQL for sleeping threads
Date: Fri, 05 May 2017 16:28:59 +0100
User-agent: mu4e 0.9.19; emacs 25.2.17

Paolo Bonzini <address@hidden> writes:

> On 05/05/2017 12:38, Alex Bennée wrote:
>>
>>      while (qemu_tcg_should_sleep(cpu)) {
>> +        qemu_mutex_lock_iothread();
>>          stop_tcg_kick_timer();
>>          qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
>> +        qemu_mutex_unlock_iothread();
>>      }
>
> This is racy.  You need to recheck the condition under the lock, or to
> switch from QemuCond to QemuEvent (then you still need to check the
> condition twice, the second between qemu_event_reset and qemu_event_wait).


Doh of course, being a bit too eager there ;-)

--
Alex Bennée



reply via email to

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