qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 17/26] replay: push replay_mutex_lock up the


From: Pavel Dovgalyuk
Subject: Re: [Qemu-devel] [RFC PATCH 17/26] replay: push replay_mutex_lock up the call tree
Date: Fri, 3 Nov 2017 12:16:39 +0300

> From: Paolo Bonzini [mailto:address@hidden
> 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

[Prev in Thread] Current Thread [Next in Thread]