From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: quintela@redhat.com, dgilbert@redhat.com, qemu-devel@nongnu.org,
borntraeger@de.ibm.com,
"Jason J. Herne" <jjherne@linux.vnet.ibm.com>,
amit.shah@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface
Date: Thu, 2 Jul 2015 17:58:23 +0100 [thread overview]
Message-ID: <20150702165823.GE2226@work-vm> (raw)
In-Reply-To: <55956A2E.4020806@redhat.com>
* Paolo Bonzini (pbonzini@redhat.com) wrote:
>
>
> On 02/07/2015 18:36, Jason J. Herne wrote:
> > +static void cpu_throttle_thread(void *opaque)
> > +{
> > + double pct = (double)throttle_percentage/100;
> > + double throttle_ratio = pct / (1 - pct);
> > + long sleeptime_ms = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE);
> > +
> > + if (!throttle_percentage) {
> > + return;
> > + }
> > +
> > + qemu_mutex_unlock_iothread();
> > + g_usleep(sleeptime_ms * 1000); /* Convert ms to us for usleep call */
> > + qemu_mutex_lock_iothread();
> > +}
> > +
> > +static void cpu_throttle_timer_tick(void *opaque)
> > +{
> > + CPUState *cpu;
> > +
> > + /* Stop the timer if needed */
> > + if (!throttle_percentage) {
> > + return;
> > + }
> > + CPU_FOREACH(cpu) {
> > + async_run_on_cpu(cpu, cpu_throttle_thread, NULL);
> > + }
> > +
> > + timer_mod(throttle_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
> > + CPU_THROTTLE_TIMESLICE);
> > +}
>
> This could cause callbacks to pile up I think. David, do you have any
> idea how to fix it?
I don't know the timer code well enough.
Dave
>
> Paolo
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2015-07-02 16:58 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 [this message]
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
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=20150702165823.GE2226@work-vm \
--to=dgilbert@redhat.com \
--cc=afaerber@suse.de \
--cc=amit.shah@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=jjherne@linux.vnet.ibm.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 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).