> From: Paolo Bonzini [mailto:pbonz...@redhat.com]
> On 31/10/2017 12:26, Pavel Dovgalyuk wrote:
> > +    /* We need to drop the replay_lock so any vCPU threads woken up
> > +     * can finish their replay tasks
> > +     */
> > +    if (replay_mode != REPLAY_MODE_NONE) {
> > +        g_assert(replay_mutex_locked());
> > +        qemu_mutex_unlock_iothread();
> > +        replay_mutex_unlock();
> > +        qemu_mutex_lock_iothread();
> > +    }
> 
> The assert+unlock+lock here is unnecessary; just do
> 
>     if (replay_mode != REPLAY_MODE_NONE) {
>         replay_mutex_unlock();
>     }
> 
> which according to a previous suggestion can become just
> 
>     replay_mutex_unlock();

We can't remove qemu_mutex_unlock_iothread(), because there is an assert
inside replay_mutex_unlock(), which checks that iothread is unlocked.

> 
> >      while (!all_vcpus_paused()) {
> >          qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
> >          CPU_FOREACH(cpu) {
> >              qemu_cpu_kick(cpu);
> >          }
> >      }
> > +
> > +    if (replay_mode != REPLAY_MODE_NONE) {
> > +        qemu_mutex_unlock_iothread();
> > +        replay_mutex_lock();
> > +        qemu_mutex_lock_iothread();
> > +    }
> 

Pavel Dovgalyuk


Reply via email to