Re: [PATCH] do not enter vcpu again if it was stopped during IO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > > 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.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux