[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 14:11:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 09/09/2015 13:01, Juan Quintela wrote:
> Paolo Bonzini <address@hidden> wrote:
>> 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.
>
>
> But nothing else is protected by the iothread?
Not at this point. Notice how qemu_kvm_wait_io_event calls
qemu_cond_wait just before qemu_wait_io_event_common (which in turn is
what calls flush_queued_work).
So you can be quite sure that qemu_wait_io_event_common runs at a point
where there's nothing hidden that relies on the iothread mutex.
Paolo
- Re: [Qemu-devel] [PATCH v7 2/5] migration: Parameters for auto-converge cpu throttling, (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