Skip to contentSkip to conversation

COLO: Move some trace code behind qemu_mutex_unlock_iothread()

PATCH Superseded Rao, Lei 2 participants 3 messages Dec 10, 2021 – Dec 13, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rao, Lei

author
#0 lore raw

PATCH 1/1 COLO: Move some trace code behind qemu_mutex_unlock_iothread()

---
 migration/colo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
migration/colo.c +3 -3
index 2415325262..3ccacb29c8 100644
@@ -683,8 +683,8 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis,
 
     qemu_mutex_lock_iothread();
     vm_stop_force_state(RUN_STATE_COLO);
-    trace_colo_vm_state_change("run", "stop");
     qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("run", "stop");
 
     /* FIXME: This is unnecessary for periodic checkpoint mode */
     colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_REPLY,
@@ -786,8 +786,8 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis,
 
     vmstate_loading = false;
     vm_start();
-    trace_colo_vm_state_change("stop", "run");
     qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("stop", "run");
 
     if (failover_get_state() == FAILOVER_STATUS_RELAUNCH) {
         return;
@@ -870,8 +870,8 @@ void *colo_process_incoming_thread(void *opaque)
         abort();
 #endif
     vm_start();
-    trace_colo_vm_state_change("stop", "run");
     qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("stop", "run");
 
     colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_READY,
                       &local_err);
Signature · 1 line
2.32.0
#1 lore raw
Quoted 1 line · * Rao, Lei ([email protected]) wrote:

You don't say why you want to move it - it's just a trace, what's the advantage?

Dave

Quoted 41 lines
---
 migration/colo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
migration/colo.c +3 -3
index 2415325262..3ccacb29c8 100644
@@ -683,8 +683,8 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis,
 
     qemu_mutex_lock_iothread();
     vm_stop_force_state(RUN_STATE_COLO);
-    trace_colo_vm_state_change("run", "stop");
     qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("run", "stop");
 
     /* FIXME: This is unnecessary for periodic checkpoint mode */
     colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_REPLY,
@@ -786,8 +786,8 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis,
 
     vmstate_loading = false;
     vm_start();
-    trace_colo_vm_state_change("stop", "run");
     qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("stop", "run");
 
     if (failover_get_state() == FAILOVER_STATUS_RELAUNCH) {
         return;
@@ -870,8 +870,8 @@ void *colo_process_incoming_thread(void *opaque)
         abort();
 #endif
     vm_start();
-    trace_colo_vm_state_change("stop", "run");
     qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("stop", "run");
 
     colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_READY,
                       &local_err);
Signature · 1 line
2.32.0
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
author
#2 lore raw
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 1 line · * Rao, Lei ([email protected]) wrote:

You don't say why you want to move it - it's just a trace, what's the advantage?

I think it's not necessary to put trace code in the critical section. So, moving it behind qemu_mutex_unlock_iothread() may reduce the lock time. I will send the V2 and add some commit messages to say why.

Thanks,
Lei

Quoted 44 lines

Dave

Quoted 41 lines
---
  migration/colo.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
migration/colo.c +3 -3
index 2415325262..3ccacb29c8 100644
@@ -683,8 +683,8 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis,
 
      qemu_mutex_lock_iothread();
      vm_stop_force_state(RUN_STATE_COLO);
-    trace_colo_vm_state_change("run", "stop");
      qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("run", "stop");
 
      /* FIXME: This is unnecessary for periodic checkpoint mode */
      colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_REPLY,
@@ -786,8 +786,8 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis,
 
      vmstate_loading = false;
      vm_start();
-    trace_colo_vm_state_change("stop", "run");
      qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("stop", "run");
 
      if (failover_get_state() == FAILOVER_STATUS_RELAUNCH) {
          return;
@@ -870,8 +870,8 @@ void *colo_process_incoming_thread(void *opaque)
          abort();
  #endif
      vm_start();
-    trace_colo_vm_state_change("stop", "run");
      qemu_mutex_unlock_iothread();
+    trace_colo_vm_state_change("stop", "run");
 
      colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_READY,
                        &local_err);
Signature · 1 line
2.32.0