[RFC,v2,04/26] replay: fix processing async events

Message ID 20171114081654.27640.84867.stgit@pasha-VirtualBox
State New
Headers show
Series
  • replay additions
Related show

Commit Message

Pavel Dovgalyuk Nov. 14, 2017, 8:16 a.m.
Asynchronous events saved at checkpoints may invoke
callbacks when processed. These callbacks may also generate/read
new events (e.g. clock reads). Therefore event processing flag must be
reset before callback invocation.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>

---
 replay/replay-events.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini Nov. 14, 2017, 1:34 p.m. | #1
On 14/11/2017 09:16, Pavel Dovgalyuk wrote:
> Asynchronous events saved at checkpoints may invoke
> callbacks when processed. These callbacks may also generate/read
> new events (e.g. clock reads). Therefore event processing flag must be
> reset before callback invocation.
> 
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> 
> ---
>  replay/replay-events.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/replay/replay-events.c b/replay/replay-events.c
> index 94a6dcc..768b505 100644
> --- a/replay/replay-events.c
> +++ b/replay/replay-events.c
> @@ -295,13 +295,13 @@ void replay_read_events(int checkpoint)
>          if (!event) {
>              break;
>          }
> +        replay_finish_event();
> +        read_event_kind = -1;
>          replay_mutex_unlock();
>          replay_run_event(event);
>          replay_mutex_lock();
>  
>          g_free(event);
> -        replay_finish_event();
> -        read_event_kind = -1;
>      }
>  }
>  
> 

For 2.11

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Patch

diff --git a/replay/replay-events.c b/replay/replay-events.c
index 94a6dcc..768b505 100644
--- a/replay/replay-events.c
+++ b/replay/replay-events.c
@@ -295,13 +295,13 @@  void replay_read_events(int checkpoint)
         if (!event) {
             break;
         }
+        replay_finish_event();
+        read_event_kind = -1;
         replay_mutex_unlock();
         replay_run_event(event);
         replay_mutex_lock();
 
         g_free(event);
-        replay_finish_event();
-        read_event_kind = -1;
     }
 }