From: "Jason J. Herne" <jjherne@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
afaerber@suse.de, amit.shah@redhat.com, dgilbert@redhat.com,
borntraeger@de.ibm.com, quintela@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface
Date: Thu, 16 Jul 2015 10:21:40 -0400 [thread overview]
Message-ID: <55A7BDF4.4020509@linux.vnet.ibm.com> (raw)
In-Reply-To: <55A657ED.3070407@redhat.com>
On 07/15/2015 08:54 AM, Paolo Bonzini wrote:
>
>
> On 15/07/2015 14:40, Jason J. Herne wrote:
>>>> I'm not sure how callbacks can pile up here. If the vcpus are
>>>> running then their thread's will execute the callbacks. If they
>>>> are not running then the use of QEMU_CLOCK_VIRTUAL_RT will
>>>> prevent the callbacks from stacking because the timer is not
>>>> running, right?
>>>
>>> Couldn't the iothread starve the VCPUs? They need to take the
>>> iothread lock in order to process the callbacks.
>>
>> Yes, I can see the possibility here. I'm not sure what to do about
>> it though.
>>
>> Maybe this is wishful thinking :) But if the iothread lock cannot be
>> acquired then the cpu cannot run thereby preventing the guest from
>> changing a ton of pages. This will have the effect of indirectly
>> throttling the guest which will allow us to advance to the non-live
>> phase of migration rather quickly.
>
> Makes sense. On the other hand this wouldn't prevent callbacks from
> piling up for a short time because...
>
>> And again, if we are starving on
>> the iothread lock then the guest vcpus are not executing and
>> QEMU_CLOCK_VIRTUAL_RT is not ticking, right?
>
> ... you are talking about stolen time, and QEMU_CLOCK_VIRTUAL_RT does
> count stolen time (stolen time is different for each VCPU, so you would
> have a different clock for each VCPU).
>
> QEMU_CLOCK_VIRTUAL and QEMU_CLOCK_VIRTUAL_RT(*) only pause across
> stop/cont. (By the way, the two are the same with KVM).
>
> However, something like
>
> if (!atomic_xchg(&cpu->throttle_thread_scheduled, 1)) {
> async_run_on_cpu(cpu, cpu_throttle_thread, NULL);
> }
>
> ...
> atomic_set(&cpu->throttle_thread_scheduled, 0);
> g_usleep(...);
>
> should be enough. You'd still have many timers that could starve the
> VCPUs but, as you pointed out, in that case migration would hopefully
> finish pretty fast.
>
> Paolo
>
>
Paolo, Andreas & David, thanks for the review comments.
Has this advanced enough for a reviewed-by? The only remaining
objections I can find are:
1. Using atomic operations to manage throttle_percentage. I'm not sure
where atomics are applicable here. If this is still a concern hopefully
someone can explain.
2. Callback stacking. And it seems like we are convinced that it is not
a big issue. Anyone disagree?
--
-- Jason J. Herne (jjherne@linux.vnet.ibm.com)
next prev parent reply other threads:[~2015-07-16 14:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 16:36 [Qemu-devel] [PATCH v4 0/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-07-02 16:36 ` [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface Jason J. Herne
2015-07-02 16:43 ` Paolo Bonzini
2015-07-02 16:58 ` Dr. David Alan Gilbert
2015-07-13 14:43 ` Jason J. Herne
2015-07-13 15:14 ` Paolo Bonzini
2015-07-15 12:40 ` Jason J. Herne
2015-07-15 12:54 ` Paolo Bonzini
2015-07-16 14:21 ` Jason J. Herne [this message]
2015-07-23 9:59 ` Paolo Bonzini
2015-07-31 17:12 ` Jason J. Herne
2015-07-31 17:16 ` Paolo Bonzini
2015-07-31 17:42 ` Jason J. Herne
2015-07-31 18:11 ` Jason J. Herne
2015-08-01 9:40 ` Paolo Bonzini
2015-09-01 14:43 ` Jason J. Herne
2015-07-02 16:47 ` Andreas Färber
2015-07-02 16:36 ` [Qemu-devel] [PATCH v4 2/5] migration: Parameters for auto-converge cpu throttling Jason J. Herne
2015-07-02 16:36 ` [Qemu-devel] [PATCH v4 3/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-07-02 16:36 ` [Qemu-devel] [PATCH v4 4/5] qmp/hmp: Add throttle ratio to query-migrate and info migrate Jason J. Herne
2015-07-02 16:36 ` [Qemu-devel] [PATCH v4 5/5] migration: Disambiguate MAX_THROTTLE 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=55A7BDF4.4020509@linux.vnet.ibm.com \
--to=jjherne@linux.vnet.ibm.com \
--cc=afaerber@suse.de \
--cc=amit.shah@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=dgilbert@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.