From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Jason J. Herne" <jjherne@linux.vnet.ibm.com>
Cc: Felipe Franciosi <felipe@nutanix.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Malcolm Crossley <malcolm@nutanix.com>,
Juan Quintela <quintela@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] cpus: reset throttle_thread_scheduled after sleep
Date: Thu, 1 Jun 2017 15:36:17 +0100 [thread overview]
Message-ID: <20170601143616.GA2845@work-vm> (raw)
In-Reply-To: <d643e698-8093-3e46-91de-551db41f3ec3@linux.vnet.ibm.com>
* Jason J. Herne (jjherne@linux.vnet.ibm.com) wrote:
> On 05/19/2017 05:29 PM, Felipe Franciosi wrote:
> > Currently, the throttle_thread_scheduled flag is reset back to 0 before
> > sleeping (as part of the throttling logic). Given that throttle_timer
> > (well, any timer) may tick with a slight delay, it so happens that under
> > heavy throttling (ie. close or on CPU_THROTTLE_PCT_MAX) the tick may
> > schedule a further cpu_throttle_thread() work item after the flag reset,
> > but before the previous sleep completed. This results on the vCPU thread
> > sleeping continuously for potentially several seconds in a row.
> >
> > The chances of that happening can be drastically minimised by resetting
> > the flag after the sleep.
> >
> > Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
> > Signed-off-by: Malcolm Crossley <malcolm@nutanix.com>
> > ---
> > cpus.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/cpus.c b/cpus.c
> > index 516e5cb..f42eebd 100644
> > --- a/cpus.c
> > +++ b/cpus.c
> > @@ -677,9 +677,9 @@ static void cpu_throttle_thread(CPUState *cpu, run_on_cpu_data opaque)
> > sleeptime_ns = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE_NS);
> >
> > 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();
> > + atomic_set(&cpu->throttle_thread_scheduled, 0);
> > }
> >
> > static void cpu_throttle_timer_tick(void *opaque)
> >
>
> This seems to make sense to me.
>
> Acked-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
>
> I'm CC'ing Juan, Amit and David as they are all active in the migration area
> and may have
> opinions on this. Juan and David were also reviewers for the original
> series.
The description is interesting and sounds reasonable; it'll be
interesting to see what difference it makes to the autoconverge
behaviour for those workloads that need this level of throttle.
Dave
> --
> -- Jason J. Herne (jjherne@linux.vnet.ibm.com)
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-06-01 14:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 21:29 [Qemu-devel] [PATCH] cpus: reset throttle_thread_scheduled after sleep Felipe Franciosi
2017-05-22 13:01 ` Jason J. Herne
2017-06-01 14:36 ` Dr. David Alan Gilbert [this message]
2017-06-01 15:02 ` Felipe Franciosi
2017-06-01 15:08 ` Dr. David Alan Gilbert
2017-05-25 15:52 ` Paolo Bonzini
2017-05-25 16:25 ` Felipe Franciosi
2017-05-25 16:34 ` Paolo Bonzini
2017-06-07 16:26 ` Juan Quintela
2017-06-07 16:58 ` Paolo Bonzini
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=20170601143616.GA2845@work-vm \
--to=dgilbert@redhat.com \
--cc=felipe@nutanix.com \
--cc=jjherne@linux.vnet.ibm.com \
--cc=malcolm@nutanix.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).