All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration/multifd: sync packet_num after all thread are done
@ 2019-06-04  2:35 Wei Yang
  2019-06-05 10:39 ` Juan Quintela
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2019-06-04  2:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Wei Yang, dgilbert, quintela

Notification from recv thread is not ordered, which means we may be
notified by one MultiFDRecvParams but adjust packet_num for another.

Move the adjustment after we are sure each recv thread are sync-ed.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 migration/ram.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index ac75e3e30e..a4e7587648 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1292,15 +1292,15 @@ static void multifd_recv_sync_main(void)
 
         trace_multifd_recv_sync_main_wait(p->id);
         qemu_sem_wait(&multifd_recv_state->sem_sync);
+    }
+    for (i = 0; i < migrate_multifd_channels(); i++) {
+        MultiFDRecvParams *p = &multifd_recv_state->params[i];
+
         qemu_mutex_lock(&p->mutex);
         if (multifd_recv_state->packet_num < p->packet_num) {
             multifd_recv_state->packet_num = p->packet_num;
         }
         qemu_mutex_unlock(&p->mutex);
-    }
-    for (i = 0; i < migrate_multifd_channels(); i++) {
-        MultiFDRecvParams *p = &multifd_recv_state->params[i];
-
         trace_multifd_recv_sync_main_signal(p->id);
         qemu_sem_post(&p->sem_sync);
     }
-- 
2.19.1



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

* Re: [Qemu-devel] [PATCH] migration/multifd: sync packet_num after all thread are done
  2019-06-04  2:35 [Qemu-devel] [PATCH] migration/multifd: sync packet_num after all thread are done Wei Yang
@ 2019-06-05 10:39 ` Juan Quintela
  2019-06-05 13:34   ` Wei Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Juan Quintela @ 2019-06-05 10:39 UTC (permalink / raw)
  To: Wei Yang; +Cc: qemu-devel, dgilbert

Wei Yang <richardw.yang@linux.intel.com> wrote:
> Notification from recv thread is not ordered, which means we may be
> notified by one MultiFDRecvParams but adjust packet_num for another.
>
> Move the adjustment after we are sure each recv thread are sync-ed.
>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>


Reviewed-by: Juan Quintela <quintela@redhat.com>

It shouldn't matter a lot in real life, but I agree that it is better.


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

* Re: [Qemu-devel] [PATCH] migration/multifd: sync packet_num after all thread are done
  2019-06-05 10:39 ` Juan Quintela
@ 2019-06-05 13:34   ` Wei Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2019-06-05 13:34 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Wei Yang, dgilbert, qemu-devel

On Wed, Jun 05, 2019 at 12:39:06PM +0200, Juan Quintela wrote:
>Wei Yang <richardw.yang@linux.intel.com> wrote:
>> Notification from recv thread is not ordered, which means we may be
>> notified by one MultiFDRecvParams but adjust packet_num for another.
>>
>> Move the adjustment after we are sure each recv thread are sync-ed.
>>
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>
>
>Reviewed-by: Juan Quintela <quintela@redhat.com>
>
>It shouldn't matter a lot in real life, but I agree that it is better.

Yep, thanks.

-- 
Wei Yang
Help you, Help me


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

end of thread, other threads:[~2019-06-05 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04  2:35 [Qemu-devel] [PATCH] migration/multifd: sync packet_num after all thread are done Wei Yang
2019-06-05 10:39 ` Juan Quintela
2019-06-05 13:34   ` Wei Yang

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.