qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/9] Incoming migration coroutine
@ 2012-10-18 10:22 Paolo Bonzini
  2012-10-18 10:22 ` [Qemu-devel] [PATCH 01/12] migration: unify stdio-based QEMUFile operations Paolo Bonzini
                   ` (11 more replies)
  0 siblings, 12 replies; 35+ messages in thread
From: Paolo Bonzini @ 2012-10-18 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: quintela

Juan,

here is the implementation of migration-in-a-coroutine, applying on top
of your pull request.  With these patches, the monitor (and in the future
the NBD server) is responsive during migration.

The first ten patches are just cleanups, generalizing some parts of
QEMUFile and improving the way migration sockets are closed.

The last two actually implement the feature.  They are the opposite
change of the nonblocking->blocking change that you implemented for the
migration thread.  However, the change is much simpler because we have
no timers, and because of the use of coroutines.

Without coroutines (and as in non-threaded migration), you have
to proceed in two steps: first collect data in a buffer, then
write it.  This lets you handle EAGAIN only at precise points in
buffered_flush/buffered_put_buffer, so that you can restart writing
in migrate_fd_put_notify.  This "checkpointing" is the reason why
QEMUFileBuffered exists.  With coroutines, you can just stop whenever
you want with qemu_coroutine_yield.  As soon as select tells you that
you can read, you'll re-enter directly in qemu_get_buffer, read more
data and pass it to the loading routines.

Thanks,

Paolo

Paolo Bonzini (12):
  migration: unify stdio-based QEMUFile operations
  migration: consolidate QEMUFile methods in a single QEMUFileOps struct
  migration: add qemu_get_fd
  migration: replace qemu_stdio_fd with qemu_get_fd
  migration: clean up server sockets and handlers before invoking process_incoming_migration
  migration: use migrate_fd_close in migrate_fd_cleanup
  migration: use closesocket, not close
  migration: xxx_close will only be called once
  migration: close socket QEMUFile from socket_close
  migration: move qemu_fclose to process_incoming_migration
  migration: handle EAGAIN while reading QEMUFile
  migration: move process_incoming_migration to a coroutine

 buffered_file.c  |  21 +++++--
 migration-exec.c |  19 +++---
 migration-fd.c   |  36 +++++------
 migration-tcp.c  |  19 +++---
 migration-unix.c |  17 +++--
 migration.c      |  47 +++++++++-----
 qemu-file.h      |  23 ++++---
 savevm.c         | 188 ++++++++++++++++++++++++++++++++-----------------------
 8 file modificati, 215 inserzioni(+), 155 rimozioni(-)

-- 
1.7.12.1

^ permalink raw reply	[flat|nested] 35+ messages in thread
* [Qemu-devel] [PATCH 0/9] Incoming migration coroutine
@ 2012-09-21 17:04 Paolo Bonzini
  0 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2012-09-21 17:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: quintela

Juan,

here is the implementation of migration-in-a-coroutine, applying on top
of your recently-posted 41-patch series.  With these patches, the monitor
(and in the future the NBD server) is responsive during migration.

The first seven patches are just cleanups, only the last two
actually implement the feature.  They are the opposite change of the
nonblocking->blocking change that you implemented for the migration
thread.  However, the change is much simpler because we have no timers,
and because of the use of coroutines.

Without coroutines (and as in non-threaded migration), you have
to proceed in two steps: first collect data in a buffer, then
write it.  This lets you handle EAGAIN only at precise points in
buffered_flush/buffered_put_buffer, so that you can restart writing
in migrate_fd_put_notify.  This "checkpointing" is the reason why
QEMUFileBuffered exists.  With coroutines, you can just stop whenever
you want with qemu_coroutine_yield.  As soon as select tells you that you
can read, you'll re-enter directly in qemu_get_buffer, read more data
and pass it to the loading routines.

Thanks,

Paolo

Paolo Bonzini (9):
  migration: unify stdio-based QEMUFile operations
  migration: consolidate QEMUFile methods in a single QEMUFileOps struct
  migration: add qemu_get_fd
  migration: replace qemu_stdio_fd with qemu_get_fd
  migration: clean up server sockets and handlers before invoking process_incoming_migration
  migration: close socket QEMUFile from socket_close
  migration: move qemu_fclose to process_incoming_migration
  migration: handle EAGAIN while reading QEMUFile
  migration: move process_incoming_migration to a coroutine

 buffered_file.c  |  21 +++++--
 migration-exec.c |   5 +-
 migration-fd.c   |   3 +-
 migration-tcp.c  |  10 +--
 migration-unix.c |  10 +--
 migration.c      |  27 +++++++-
 qemu-file.h      |  23 ++++---
 savevm.c         | 188 ++++++++++++++++++++++++++++++++-----------------------
 8 file modificati, 181 inserzioni(+), 106 rimozioni(-)

-- 
1.7.12

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

end of thread, other threads:[~2012-10-30 12:40 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18 10:22 [Qemu-devel] [PATCH 0/9] Incoming migration coroutine Paolo Bonzini
2012-10-18 10:22 ` [Qemu-devel] [PATCH 01/12] migration: unify stdio-based QEMUFile operations Paolo Bonzini
2012-10-28 11:20   ` Orit Wasserman
2012-10-30 12:19   ` Juan Quintela
2012-10-18 10:22 ` [Qemu-devel] [PATCH 02/12] migration: consolidate QEMUFile methods in a single QEMUFileOps struct Paolo Bonzini
2012-10-28 11:24   ` Orit Wasserman
2012-10-30 12:26   ` Juan Quintela
2012-10-18 10:22 ` [Qemu-devel] [PATCH 03/12] migration: add qemu_get_fd Paolo Bonzini
2012-10-28 11:27   ` Orit Wasserman
2012-10-30 12:27   ` Juan Quintela
2012-10-18 10:22 ` [Qemu-devel] [PATCH 04/12] migration: replace qemu_stdio_fd with qemu_get_fd Paolo Bonzini
2012-10-28  9:29   ` Orit Wasserman
2012-10-30 12:28   ` Juan Quintela
2012-10-18 10:22 ` [Qemu-devel] [PATCH 05/12] migration: clean up server sockets and handlers before invoking process_incoming_migration Paolo Bonzini
2012-10-28  9:35   ` Orit Wasserman
2012-10-30 12:29   ` Juan Quintela
2012-10-18 10:22 ` [Qemu-devel] [PATCH 06/12] migration: use migrate_fd_close in migrate_fd_cleanup Paolo Bonzini
2012-10-28  9:47   ` Orit Wasserman
2012-10-28 15:05     ` Paolo Bonzini
2012-10-18 10:22 ` [Qemu-devel] [PATCH 07/12] migration: use closesocket, not close Paolo Bonzini
2012-10-28  9:49   ` Orit Wasserman
2012-10-30 12:32   ` Juan Quintela
2012-10-18 10:22 ` [Qemu-devel] [PATCH 08/12] migration: xxx_close will only be called once Paolo Bonzini
2012-10-28  9:53   ` Orit Wasserman
2012-10-30 12:35   ` Juan Quintela
2012-10-18 10:22 ` [Qemu-devel] [PATCH 09/12] migration: close socket QEMUFile from socket_close Paolo Bonzini
2012-10-28  9:55   ` Orit Wasserman
2012-10-30 12:40   ` Juan Quintela
2012-10-18 10:22 ` [Qemu-devel] [PATCH 10/12] migration: move qemu_fclose to process_incoming_migration Paolo Bonzini
2012-10-28  9:56   ` Orit Wasserman
2012-10-18 10:22 ` [Qemu-devel] [PATCH 11/12] migration: handle EAGAIN while reading QEMUFile Paolo Bonzini
2012-10-28 10:01   ` Orit Wasserman
2012-10-18 10:22 ` [Qemu-devel] [PATCH 12/12] migration: move process_incoming_migration to a coroutine Paolo Bonzini
2012-10-28 10:07   ` Orit Wasserman
  -- strict thread matches above, loose matches on Subject: below --
2012-09-21 17:04 [Qemu-devel] [PATCH 0/9] Incoming migration coroutine Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).