From: Marcelo Tosatti <mtosatti@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] do not enter vcpu again if it was stopped during IO
Date: Tue, 22 Jun 2010 10:59:45 -0300 [thread overview]
Message-ID: <20100622135945.GA6551@amt.cnet> (raw)
In-Reply-To: <20100622051814.GO4689@redhat.com>
On Tue, Jun 22, 2010 at 08:18:14AM +0300, Gleb Natapov wrote:
> On Mon, Jun 21, 2010 at 05:43:04PM -0300, Marcelo Tosatti wrote:
> > On Mon, Jun 21, 2010 at 12:01:52PM +0300, Gleb Natapov wrote:
> > > To prevent reentering vcpu after IO completion it is not enough
> > > to set env->stopped since it is checked only in main loop but control
> > > will not get there until next non-IO exit since kvm_run() will reenter
> > > vcpu to complete IO instruction. Solve this by sending self-signal to
> > > request exit after IO instruction completion.
> > >
> > > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > > diff --git a/qemu-kvm.c b/qemu-kvm.c
> > > index be1dac2..4f7cf6d 100644
> > > --- a/qemu-kvm.c
> > > +++ b/qemu-kvm.c
> > > @@ -603,6 +603,10 @@ int kvm_run(CPUState *env)
> > > r = pre_kvm_run(kvm, env);
> > > if (r)
> > > return r;
> > > + if (env->exit_request) {
> > > + env->exit_request = 0;
> > > + pthread_kill(env->kvm_cpu_state.thread, SIG_IPI);
> > > + }
> > > r = ioctl(fd, KVM_RUN, 0);
> >
> > Can't you check for env->stopped instead?
> >
> Why it would be better? exit_request is used exactly for purpose to
> notify cpu loop that is should exit. Sometimes it may be useful to
> request cpu exit without stopping the cpu. I see gdbstub uses it, haven't
> check if it applicable to kvm though.
Makes sense.
next prev parent reply other threads:[~2010-06-22 16:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-21 9:01 [PATCH] do not enter vcpu again if it was stopped during IO Gleb Natapov
2010-06-21 20:43 ` Marcelo Tosatti
2010-06-22 5:18 ` Gleb Natapov
2010-06-22 13:59 ` Marcelo Tosatti [this message]
2010-06-23 8:22 ` Avi Kivity
2010-06-23 8:24 ` Gleb Natapov
2010-06-23 10:16 ` Jan Kiszka
2010-06-23 10:21 ` Gleb Natapov
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=20100622135945.GA6551@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.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