From: Juan Quintela <quintela@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com,
borntraeger@de.ibm.com,
"Jason J. Herne" <jjherne@linux.vnet.ibm.com>,
amit.shah@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v7 1/5] cpu: Provide vcpu throttling interface
Date: Wed, 09 Sep 2015 13:01:03 +0200 [thread overview]
Message-ID: <87a8sv6emo.fsf@neno.neno> (raw)
In-Reply-To: <55F00F83.2080708@redhat.com> (Paolo Bonzini's message of "Wed, 9 Sep 2015 12:52:51 +0200")
Paolo Bonzini <pbonzini@redhat.com> 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? That is the part that I
can't see.
> (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. :)
See, that happens when you search in a modified tree O:-)
Thanks for the fast answer.
Later, Juan.
next prev parent reply other threads:[~2015-09-09 11:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-08 17:12 [Qemu-devel] [PATCH v7 0/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 1/5] cpu: Provide vcpu throttling interface Jason J. Herne
2015-09-09 9:42 ` Paolo Bonzini
2015-09-09 10:50 ` Juan Quintela
2015-09-09 10:41 ` Juan Quintela
2015-09-09 10:52 ` Paolo Bonzini
2015-09-09 11:01 ` Juan Quintela [this message]
2015-09-09 12:11 ` Paolo Bonzini
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 2/5] migration: Parameters for auto-converge cpu throttling Jason J. Herne
2015-09-09 10:43 ` Juan Quintela
2015-09-09 11:21 ` Juan Quintela
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 3/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-09-09 10:44 ` Juan Quintela
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 4/5] qmp/hmp: Add throttle ratio to query-migrate and info migrate Jason J. Herne
2015-09-09 10:46 ` Juan Quintela
2015-09-08 17:12 ` [Qemu-devel] [PATCH v7 5/5] migration: Disambiguate MAX_THROTTLE Jason J. Herne
2015-09-09 10:45 ` Juan Quintela
2015-09-09 11:51 ` [Qemu-devel] [PATCH v7 0/5] migration: Dynamic cpu throttling for auto-converge Juan Quintela
2015-09-09 12:51 ` Jason J. Herne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8sv6emo.fsf@neno.neno \
--to=quintela@redhat.com \
--cc=afaerber@suse.de \
--cc=amit.shah@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=dgilbert@redhat.com \
--cc=jjherne@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).