qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v7 12/21] replay: recording and replaying cl


From: Pavel Dovgaluk
Subject: Re: [Qemu-devel] [RFC PATCH v7 12/21] replay: recording and replaying clock ticks
Date: Mon, 19 Jan 2015 15:03:23 +0300

> From: Paolo Bonzini [mailto:address@hidden
> On 16/01/2015 09:03, Pavel Dovgaluk wrote:
> > There is one problem with protecting log file inside the replay code.
> > We probably should have the following sequence of calls:
> >
> > lock_replay_mutex
> > replay_save_events
> >     replay_run_event
> > unlock_replay_mutex
> >
> > But replay_run_event can also generate some log events and we will have 
> > deadlock here.
> > That is why we rely on global mutex.
> 
> I think replay_run_event should run with the lock _not_ taken, that is:
> 
>     qemu_mutex_lock(&lock);
>     while (!QTAILQ_EMPTY(&events_list)) {
>         Event *event = QTAILQ_FIRST(&events_list);
>         QTAILQ_REMOVE(&events_list, event, events);
>         qemu_mutex_unlock(&lock);
>         replay_run_event(event);
>         g_free(event);
>         qemu_mutex_lock(&lock);
>     }
>     qemu_mutex_unlock(&lock);

It will work for protecting the events list (I've already did this).
But that will not work for protecting the log file.
replay_run_event can write some data to the log. And also some other function 
like replay_checkpoint
can also write to the log simultaneously (if we will remove the global mutex).
That's why we cannot simply replace the global mutex with some kind of local 
one.

Pavel Dovgalyuk




reply via email to

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