All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] COLO: Move some trace code behind qemu_mutex_unlock_iothread()
@ 2021-12-10 22:14 Rao, Lei
  2021-12-13 11:45 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Rao, Lei @ 2021-12-10 22:14 UTC (permalink / raw)
  To: chen.zhang, zhang.zhanghailiang, quintela, dgilbert; +Cc: Rao, Lei, qemu-devel

Signed-off-by: Lei Rao <lei.rao@intel.com>
---
 migration/colo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/migration/colo.c b/migration/colo.c
index 2415325262..3ccacb29c8 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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);
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] COLO: Move some trace code behind qemu_mutex_unlock_iothread()
  2021-12-10 22:14 [PATCH] COLO: Move some trace code behind qemu_mutex_unlock_iothread() Rao, Lei
@ 2021-12-13 11:45 ` Dr. David Alan Gilbert
  2021-12-13 12:12   ` Rao, Lei
  0 siblings, 1 reply; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2021-12-13 11:45 UTC (permalink / raw)
  To: Rao, Lei; +Cc: qemu-devel, chen.zhang, zhang.zhanghailiang, quintela

* Rao, Lei (lei.rao@intel.com) wrote:
> Signed-off-by: Lei Rao <lei.rao@intel.com>

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

Dave

> ---
>  migration/colo.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/migration/colo.c b/migration/colo.c
> index 2415325262..3ccacb29c8 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -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);
> -- 
> 2.32.0
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] COLO: Move some trace code behind qemu_mutex_unlock_iothread()
  2021-12-13 11:45 ` Dr. David Alan Gilbert
@ 2021-12-13 12:12   ` Rao, Lei
  0 siblings, 0 replies; 3+ messages in thread
From: Rao, Lei @ 2021-12-13 12:12 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: qemu-devel, chen.zhang, zhang.zhanghailiang, quintela



On 12/13/2021 7:45 PM, Dr. David Alan Gilbert wrote:
> * Rao, Lei (lei.rao@intel.com) wrote:
>> Signed-off-by: Lei Rao <lei.rao@intel.com>
> 
> 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

> 
> Dave
> 
>> ---
>>   migration/colo.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/migration/colo.c b/migration/colo.c
>> index 2415325262..3ccacb29c8 100644
>> --- a/migration/colo.c
>> +++ b/migration/colo.c
>> @@ -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);
>> -- 
>> 2.32.0
>>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-13 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-10 22:14 [PATCH] COLO: Move some trace code behind qemu_mutex_unlock_iothread() Rao, Lei
2021-12-13 11:45 ` Dr. David Alan Gilbert
2021-12-13 12:12   ` Rao, Lei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.