[RFC,v2,05/26] replay: fixed replay_enable_events

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

Commit Message

Pavel Dovgalyuk Nov. 14, 2017, 8:17 a.m.
This patch fixes assignment to internal events_enabled variable.
Now it is set only in record/replay mode. This affects the behavior
of the external functions that check this flag.

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

---
 replay/replay-events.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Paolo Bonzini Nov. 14, 2017, 1:34 p.m. | #1
On 14/11/2017 09:17, Pavel Dovgalyuk wrote:
> This patch fixes assignment to internal events_enabled variable.
> Now it is set only in record/replay mode. This affects the behavior
> of the external functions that check this flag.
> 
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> 
> ---
>  replay/replay-events.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/replay/replay-events.c b/replay/replay-events.c
> index 768b505..e858254 100644
> --- a/replay/replay-events.c
> +++ b/replay/replay-events.c
> @@ -67,7 +67,9 @@ static void replay_run_event(Event *event)
>  
>  void replay_enable_events(void)
>  {
> -    events_enabled = true;
> +    if (replay_mode != REPLAY_MODE_NONE) {
> +        events_enabled = true;
> +    }
>  }
>  
>  bool replay_has_events(void)
> @@ -141,7 +143,7 @@ void replay_add_event(ReplayAsyncEventKind event_kind,
>  
>  void replay_bh_schedule_event(QEMUBH *bh)
>  {
> -    if (replay_mode != REPLAY_MODE_NONE && events_enabled) {
> +    if (events_enabled) {
>          uint64_t id = replay_get_current_step();
>          replay_add_event(REPLAY_ASYNC_EVENT_BH, bh, NULL, id);
>      } else {
> @@ -161,7 +163,7 @@ void replay_add_input_sync_event(void)
>  
>  void replay_block_event(QEMUBH *bh, uint64_t id)
>  {
> -    if (replay_mode != REPLAY_MODE_NONE && events_enabled) {
> +    if (events_enabled) {
>          replay_add_event(REPLAY_ASYNC_EVENT_BLOCK, bh, NULL, id);
>      } else {
>          qemu_bh_schedule(bh);
> 

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

Patch

diff --git a/replay/replay-events.c b/replay/replay-events.c
index 768b505..e858254 100644
--- a/replay/replay-events.c
+++ b/replay/replay-events.c
@@ -67,7 +67,9 @@  static void replay_run_event(Event *event)
 
 void replay_enable_events(void)
 {
-    events_enabled = true;
+    if (replay_mode != REPLAY_MODE_NONE) {
+        events_enabled = true;
+    }
 }
 
 bool replay_has_events(void)
@@ -141,7 +143,7 @@  void replay_add_event(ReplayAsyncEventKind event_kind,
 
 void replay_bh_schedule_event(QEMUBH *bh)
 {
-    if (replay_mode != REPLAY_MODE_NONE && events_enabled) {
+    if (events_enabled) {
         uint64_t id = replay_get_current_step();
         replay_add_event(REPLAY_ASYNC_EVENT_BH, bh, NULL, id);
     } else {
@@ -161,7 +163,7 @@  void replay_add_input_sync_event(void)
 
 void replay_block_event(QEMUBH *bh, uint64_t id)
 {
-    if (replay_mode != REPLAY_MODE_NONE && events_enabled) {
+    if (events_enabled) {
         replay_add_event(REPLAY_ASYNC_EVENT_BLOCK, bh, NULL, id);
     } else {
         qemu_bh_schedule(bh);