|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] [RFC PATCH v1 3/9] cpus: only take BQL for sleeping threads |
Date: | Fri, 5 May 2017 17:15:19 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
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). Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |