All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Jason J. Herne" <jjherne@linux.vnet.ibm.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 v3 1/5] cpu: Provide vcpu throttling interface
Date: Wed, 1 Jul 2015 15:57:33 +0200	[thread overview]
Message-ID: <5593F1CD.7060101@redhat.com> (raw)
In-Reply-To: <1435254377-13322-2-git-send-email-jjherne@linux.vnet.ibm.com>



On 25/06/2015 19:46, Jason J. Herne wrote:
> +static void cpu_throttle_thread(void *opaque)
> +{
> +    long sleeptime_ms = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE);
> +
> +    qemu_mutex_unlock_iothread();
> +    g_usleep(sleeptime_ms * 1000); /* Convert ms to us for usleep call */
> +    qemu_mutex_lock_iothread();
> +
> +    timer_mod(throttle_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) +
> +                                   CPU_THROTTLE_TIMESLICE);

The timer need not run while the VM is stopped.  Please use
QEMU_CLOCK_VIRTUAL_RT.

> +}
> +

Are you sure you want each CPU to set the timer?  I think this should be
done in cpu_throttle_timer_pop, or it could use timer_mod_anticipate.

> +static void cpu_throttle_timer_pop(void *opaque)
> +{
> +    CPUState *cpu;
> +
> +    /* Stop the timer if needed */
> +    if (throttle_timer_stop) {
> +        timer_del(throttle_timer);

timer_del is not needed in the timer callback.

Paolo

> +        timer_free(throttle_timer);
> +        throttle_timer = NULL;
> +        return;
> +    }
> +
> +    CPU_FOREACH(cpu) {
> +        async_run_on_cpu(cpu, cpu_throttle_thread, NULL);
> +    }
> +}
> +

  parent reply	other threads:[~2015-07-01 13:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 17:46 [Qemu-devel] [PATCH v3 0/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 1/5] cpu: Provide vcpu throttling interface Jason J. Herne
2015-06-26 18:07   ` Dr. David Alan Gilbert
2015-06-26 19:02     ` Jason J. Herne
2015-06-29  9:27       ` Dr. David Alan Gilbert
2015-06-29 14:42       ` Jason J. Herne
2015-07-01 14:03     ` Paolo Bonzini
2015-07-02 14:25       ` Jason J. Herne
2015-07-02 14:27         ` Paolo Bonzini
2015-07-02 16:33       ` Jason J. Herne
2015-07-02 16:34         ` Paolo Bonzini
2015-07-01 13:57   ` Paolo Bonzini [this message]
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 2/5] migration: Parameters for auto-converge cpu throttling Jason J. Herne
2015-06-26 17:20   ` Dr. David Alan Gilbert
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 3/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-06-26 17:54   ` Dr. David Alan Gilbert
2015-06-26 18:42     ` Jason J. Herne
2015-06-26 19:07     ` Jason J. Herne
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 4/5] qmp/hmp: Add throttle ratio to query-migrate and info migrate Jason J. Herne
2015-06-26 18:32   ` Dr. David Alan Gilbert
2015-06-25 17:46 ` [Qemu-devel] [PATCH v3 5/5] migration: Disambiguate MAX_THROTTLE Jason J. Herne
2015-06-26 18:36   ` Dr. David Alan Gilbert

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=5593F1CD.7060101@redhat.com \
    --to=pbonzini@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=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.