[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 1/5] cpu: Provide vcpu throttling interface
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v7 1/5] cpu: Provide vcpu throttling interface |
Date: |
Wed, 9 Sep 2015 12:52:51 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 09/09/2015 12:41, Juan Quintela wrote:
>> > + qemu_mutex_unlock_iothread();
>> > + atomic_set(&cpu->throttle_thread_scheduled, 0);
>> > + g_usleep(sleeptime_ns / 1000); /* Convert ns to us for usleep call */
>> > + qemu_mutex_lock_iothread();
>
> Why is this thread safe?
>
> qemu_mutex_lock_iothread() is protecting (at least) cpu_work_first on
> each cpu. How can we be sure that _nothing_ will change that while we
> are waiting?
You only have to be sure that the queued work list remains consistent;
not that nothing changes.
(BTW, there is a queued patch that moves the queued work list to its own
mutex, and indeed it releases that mutex while calling the work function).
> A fast look through the tree don't show anything that
> runs here that drops the lock.
Actually, the existing implementation of throttling does. :)
Paolo
- Re: [Qemu-devel] [PATCH v7 4/5] qmp/hmp: Add throttle ratio to query-migrate and info migrate, (continued)
[Qemu-devel] [PATCH v7 3/5] migration: Dynamic cpu throttling for auto-converge, Jason J. Herne, 2015/09/08
Re: [Qemu-devel] [PATCH v7 0/5] migration: Dynamic cpu throttling for auto-converge, Juan Quintela, 2015/09/09