rdma: migration support
PATCH v7 10/12 rdma: introduce capability x-rdma-pin-all
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
This capability allows you to disable dynamic chunk registration for better throughput on high-performance links.
For example, using an 8GB RAM virtual machine with all 8GB of memory in active use and the VM itself is completely idle using a 40 gbps infiniband link:
1. x-rdma-pin-all disabled total time: approximately 7.5 seconds @ 9.5 Gbps
2. x-rdma-pin-all enabled total time: approximately 4 seconds @ 26 Gbps
These numbers would of course scale up to whatever size virtual machine you have to migrate using RDMA.
Enabling this feature does *not* have any measurable affect on migration *downtime*. This is because, without this feature, all of the memory will have already been registered already in advance during the bulk round and does not need to be re-registered during the successive iteration rounds.
--- include/migration/migration.h | 2 ++ migration.c | 9 +++++++++ qapi-schema.json | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-)
include/migration/migration.h +2 -0
@@ -125,6 +125,8 @@ void migrate_add_blocker(Error *reason);*/ void migrate_del_blocker (Error *reason); +bool migrate_rdma_pin_all (void ); +int xbzrle_encode_buffer (uint8_t *old_buf,uint8_t *new_buf,int slen,uint8_t *dst,int dlen);int xbzrle_decode_buffer (uint8_t *src,int slen,uint8_t *dst,int dlen);
migration.c +9 -0
@@ -476,6 +476,15 @@ void qmp_migrate_set_downtime(double value, Error **errp) max_downtime = (uint64_t )value; } +bool migrate_rdma_pin_all (void ) +{ +MigrationState *s; + + s =migrate_get_current (); + +return s->enabled_capabilities[MIGRATION_CAPABILITY_X_RDMA_PIN_ALL ]; +} +int migrate_use_xbzrle (void ) {MigrationState *s;
qapi-schema.json +6 -1
@@ -608,10 +608,15 @@ # This feature allows us to minimize migration traffic for certain work # loads, by sending compressed difference of the pages # +# @x-rdma-pin-all: Controls whether or not the entire VM memory footprint is +# mlock()'d on demand or all at once. Refer to docs/rdma.txt for usage. +# Disabled by default. Experimental: may (or may not) be renamed after +# further testing is complete. (since 1.5) +# # Since: 1.2 ## { 'enum': 'MigrationCapability', - 'data': ['xbzrle'] } + 'data': ['xbzrle', 'x-rdma-pin-all'] } ## # @MigrationCapabilityStatus
Signature · 1 line
1.7.10.4
PATCH v7 7/12 rdma: introduce ram_handle_compressed()
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
This gives RDMA shared access to madvise() on the destination side when an entire chunk is found to be zero.
--- arch_init.c | 24 ++++++++++++++++-------- include/migration/migration.h | 2 ++ 2 files changed, 18 insertions(+), 8 deletions(-)
arch_init.c +16 -8
@@ -782,6 +782,21 @@ static inline void *host_from_stream_offset(QEMUFile *f,return NULL ; } +/* +* If a page (or a whole RDMA chunk) has been +* determined to be zero, then zap it. +*/ +void ram_handle_compressed (void *host,uint8_t ch,uint64_t size) +{ +memset (host, ch,TARGET_PAGE_SIZE ); +#ifndef _WIN32 +if (ch ==0 && (!kvm_enabled () ||kvm_has_sync_mmu ()) && +getpagesize () <=TARGET_PAGE_SIZE ) { +qemu_madvise (host, size,QEMU_MADV_DONTNEED ); + } +#endif +} +static int ram_load (QEMUFile *f,void *opaque,int version_id) {ram_addr_t addr;
@@ -849,14 +864,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) } ch =qemu_get_byte (f); -memset (host, ch,TARGET_PAGE_SIZE ); -#ifndef _WIN32 -if (ch ==0 && - (!kvm_enabled () ||kvm_has_sync_mmu ()) && -getpagesize () <=TARGET_PAGE_SIZE ) { -qemu_madvise (host,TARGET_PAGE_SIZE ,QEMU_MADV_DONTNEED ); - } -#endif +ram_handle_compressed (host, ch,TARGET_PAGE_SIZE ); }else if (flags &RAM_SAVE_FLAG_PAGE ) {void *host;
include/migration/migration.h +2 -0
@@ -108,6 +108,8 @@ uint64_t xbzrle_mig_pages_transferred(void);uint64_t xbzrle_mig_pages_overflow (void );uint64_t xbzrle_mig_pages_cache_miss (void ); +void ram_handle_compressed (void *host,uint8_t ch,uint64_t size); +/** * @migrate_add_blocker - prevent migration from proceeding *
Signature · 1 line
1.7.10.4
PATCH v7 5/12 rdma: introduce qemu_file_mode_is_not_valid()
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
QEMUFileRDMA also has read and write modes. This function is now shared to reduce code duplication.
--- include/migration/qemu-file.h | 1 + savevm.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-)
include/migration/qemu-file.h +1 -0
@@ -80,6 +80,7 @@ void qemu_put_byte(QEMUFile *f, int v);* The buffer should be available till it is sent asynchronously. */ void qemu_put_buffer_async (QEMUFile *f,const uint8_t *buf,int size); +bool qemu_file_mode_is_not_valid (const char *mode);static inline void qemu_put_ubyte (QEMUFile *f,unsigned int v) {
savevm.c +13 -7
@@ -449,14 +449,23 @@ static const QEMUFileOps socket_write_ops = { .close = socket_close }; -QEMUFile *qemu_fopen_socket (int fd,const char *mode) +bool qemu_file_mode_is_not_valid (const char *mode) { -QEMUFileSocket *s =g_malloc0 (sizeof (QEMUFileSocket)); -if (mode ==NULL || (mode[0 ] !='r' && mode[0 ] !='w' ) || mode[1 ] !='b' || mode[2 ] !=0 ) {fprintf (stderr,"qemu_fopen: Argument validity check failed\n" ); +return true; + } + +return false; +} + +QEMUFile *qemu_fopen_socket (int fd,const char *mode) +{ +QEMUFileSocket *s =g_malloc0 (sizeof (QEMUFileSocket)); + +if (qemu_file_mode_is_not_valid (mode)) {return NULL ; }
@@ -474,10 +483,7 @@ QEMUFile *qemu_fopen(const char *filename, const char *mode) {QEMUFileStdio *s; -if (mode ==NULL || - (mode[0 ] !='r' && mode[0 ] !='w' ) || - mode[1 ] !='b' || mode[2 ] !=0 ) { -fprintf (stderr,"qemu_fopen: Argument validity check failed\n" ); +if (qemu_file_mode_is_not_valid (mode)) {return NULL ; }
Signature · 1 line
1.7.10.4
PATCH v7 9/12 rdma: new QEMUFileOps hooks
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
These are the prototypes and implementation of new hooks that RDMA takes advantage of to perform dynamic page registration.
An optional hook is also introduced for a custom function to be able to override the default save_page function.
Also included are the prototypes and accessor methods used by arch_init.c which invoke funtions inside savevm.c to call out to the hooks that may or may not have been overridden inside of QEMUFileOps.
--- include/migration/migration.h | 20 ++++++++++++++ include/migration/qemu-file.h | 29 ++++++++++++++++++++ savevm.c | 59 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+)
include/migration/migration.h +20 -0
@@ -21,6 +21,7 @@#include "qapi/error.h" #include "migration/vmstate.h" #include "qapi-types.h" +#include "exec/cpu-common.h" struct MigrationParams {bool blk;
@@ -132,4 +133,23 @@ int migrate_use_xbzrle(void);int64_t migrate_xbzrle_cache_size (void );int64_t xbzrle_cache_resize (int64_t new_size); + +void ram_control_before_iterate (QEMUFile *f,uint64_t flags); +void ram_control_after_iterate (QEMUFile *f,uint64_t flags); +void ram_control_load_hook (QEMUFile *f,uint64_t flags); + +/* Whenever this is found in the data stream, the flags +* will be passed to ram_control_load_hook in the incoming-migration +* side. This lets before_ram_iterate/after_ram_iterate add +* transport-specific sections to the RAM migration data. +*/ +#define RAM_SAVE_FLAG_HOOK 0x80 + +#define RAM_SAVE_CONTROL_NOT_SUPP -1000 +#define RAM_SAVE_CONTROL_DELAYED -2000 + +size_t ram_control_save_page (QEMUFile *f,ram_addr_t block_offset, +ram_addr_t offset,size_t size, +int *bytes_sent); +#endif
include/migration/qemu-file.h +29 -0
@@ -23,6 +23,7 @@*/ #ifndef QEMU_FILE_H #define QEMU_FILE_H 1 +#include "exec/cpu-common.h" /* This function writes a chunk of data to a file at the given position. * The pos argument can be ignored if the file is only being used for
@@ -57,12 +58,40 @@ typedef int (QEMUFileGetFD)(void *opaque);typedef ssize_t (QEMUFileWritevBufferFunc )(void *opaque,struct iovec *iov,int iovcnt,int64_t pos); +/* +* This function provides hooks around different +* stages of RAM migration. +*/ +typedef int (QEMURamHookFunc )(QEMUFile *f,void *opaque,uint64_t flags); + +/* +* Constants used by ram_control_* hooks +*/ +#define RAM_CONTROL_SETUP 0 +#define RAM_CONTROL_ROUND 1 +#define RAM_CONTROL_HOOK 2 +#define RAM_CONTROL_FINISH 3 + +/* +* This function allows override of where the RAM page +* is saved (such as RDMA, for example.) +*/ +typedef size_t (QEMURamSaveFunc )(QEMUFile *f,void *opaque, +ram_addr_t block_offset, +ram_addr_t offset, +size_t size, +int *bytes_sent); +typedef struct QEMUFileOps {QEMUFilePutBufferFunc *put_buffer;QEMUFileGetBufferFunc *get_buffer;QEMUFileCloseFunc *close;QEMUFileGetFD *get_fd;QEMUFileWritevBufferFunc *writev_buffer; +QEMURamHookFunc *before_ram_iterate; +QEMURamHookFunc *after_ram_iterate; +QEMURamHookFunc *hook_ram_load; +QEMURamSaveFunc *save_page; }QEMUFileOps ;QEMUFile *qemu_fopen_ops (void *opaque,const QEMUFileOps *ops);
savevm.c +59 -0
65 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v7 4/12 rdma: export throughput w/ MigrationStats QMP
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
This exposes throughput (in megabits/sec) through QMP.
--- hmp.c | 2 ++ include/migration/migration.h | 1 + migration.c | 6 ++++++ qapi-schema.json | 5 ++++- 4 files changed, 13 insertions(+), 1 deletion(-)
hmp.c +2 -0
@@ -169,6 +169,8 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)if (info->has_ram) {monitor_printf (mon,"transferred ram: %" PRIu64" kbytes\n" , info->ram->transferred >>10 ); +monitor_printf (mon,"throughput: %0.2f mbps\n" , + info->ram->mbps);monitor_printf (mon,"remaining ram: %" PRIu64" kbytes\n" , info->ram->remaining >>10 ); monitor_printf(mon, "total ram: %" PRIu64 " kbytes\n",
include/migration/migration.h +1 -0
@@ -47,6 +47,7 @@ struct MigrationStateint64_t dirty_bytes_rate;bool enabled_capabilities[MIGRATION_CAPABILITY_MAX ];int64_t xbzrle_cache_size; +double mbps; };void process_incoming_migration (QEMUFile *f);
migration.c +6 -0
@@ -66,6 +66,7 @@ MigrationState *migrate_get_current(void) .state = MIG_STATE_SETUP, .bandwidth_limit = MAX_THROTTLE, .xbzrle_cache_size = DEFAULT_MIGRATE_CACHE_SIZE, + .mbps = -1, };return ¤t_migration;
@@ -201,6 +202,7 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->normal =norm_mig_pages_transferred (); info->ram->normal_bytes =norm_mig_bytes_transferred (); info->ram->dirty_pages_rate = s->dirty_pages_rate; + info->ram->mbps = s->mbps;if (blk_mig_active ()) { info->has_disk = true;
@@ -230,6 +232,7 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->skipped =skipped_mig_pages_transferred (); info->ram->normal =norm_mig_pages_transferred (); info->ram->normal_bytes =norm_mig_bytes_transferred (); + info->ram->mbps = s->mbps;break ;case MIG_STATE_ERROR : info->has_status = true;
@@ -543,6 +546,9 @@ static void *migration_thread(void *opaque)double bandwidth = transferred_bytes / time_spent; max_size = bandwidth *migrate_max_downtime () /1000000 ; + s->mbps = time_spent ? (((double ) transferred_bytes *8.0 ) / + ((double ) time_spent /1000.0 )) /1000.0 /1000.0 :-1 ; +DPRINTF ("transferred %" PRIu64" time_spent %" PRIu64" bandwidth %g max_size %" PRId64"\n" , transferred_bytes, time_spent, bandwidth, max_size);
qapi-schema.json +4 -1
@@ -513,12 +513,15 @@ # @dirty-pages-rate: number of pages dirtied by second by the # guest (since 1.3) # +# @mbps: throughput in megabits/sec. (since 1.5) +# # Since: 0.14.0 ## { 'type': 'MigrationStats', 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , 'duplicate': 'int', 'skipped': 'int', 'normal': 'int', - 'normal-bytes': 'int', 'dirty-pages-rate' : 'int' } } + 'normal-bytes': 'int', 'dirty-pages-rate' : 'int', + 'mbps' : 'number' } } ## # @XBZRLECacheStats
Signature · 1 line
1.7.10.4
PATCH v7 1/12 rdma: add documentation
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
docs/rdma.txt contains full documentation,
wiki links, github url and contact information.
--- docs/rdma.txt | 404 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 404 insertions(+) create mode 100644 docs/rdma.txt
docs/rdma.txt new file +404 -0
@@ -0,0 +1,404 @@ +(RDMA: Remote Direct Memory Access) +RDMA Live Migration Specification, Version # 1 +============================================== +Wiki: http://wiki.qemu.org/Features/RDMALiveMigration +Github: [email protected]:hinesmr/qemu.git, 'rdma' branch + +Copyright (C) 2013 Michael R. Hines <[email protected]> + +An *exhaustive* paper (2010) shows additional performance details +linked on the QEMU wiki above. + +Contents: +========= +* Introduction +* Before running +* Running +* Performance +* RDMA Migration Protocol Description +* Versioning and Capabilities +* QEMUFileRDMA Interface +* Migration of pc.ram +* Error handling +* TODO + +Introduction: +============= + +RDMA helps make your migration more deterministic under heavy load because +of the significantly lower latency and higher throughput over TCP/IP. This is +because the RDMA I/O architecture reduces the number of interrupts and +data copies by bypassing the host networking stack. In particular, a TCP-based +migration, under certain types of memory-bound workloads, may take a more +unpredicatable amount of time to complete the migration if the amount of +memory tracked during each live migration iteration round cannot keep pace +with the rate of dirty memory produced by the workload. + +RDMA currently comes in two flavors: both Ethernet based (RoCE, or RDMA +over Convered Ethernet) as well as Infiniband-based. This implementation of +migration using RDMA is capable of using both technologies because of +the use of the OpenFabrics OFED software stack that abstracts out the +programming model irrespective of the underlying hardware. + +Refer to openfabrics.org or your respective RDMA hardware vendor for +an understanding on how to verify that you have the OFED software stack +installed in your environment. You should be able to successfully link +against the "librdmacm" and "libibverbs" libraries and development headers +for a working build of QEMU to run successfully using RDMA Migration. + +BEFORE RUNNING: +=============== + +Use of RDMA during migration requires pinning and registering memory +with the hardware. This means that memory must be physically resident +before the hardware can transmit that memory to another machine. +If this is not acceptable for your application or product, then the use +of RDMA migration may in fact be harmful to co-located VMs or other +software on the machine if there is not sufficient memory available to +relocate the entire footprint of the virtual machine. If so, then the +use of RDMA is discouraged and it is recommended to use standard TCP migration. + +Experimental: Next, decide if you want dynamic page registration. +For example, if you have an 8GB RAM virtual machine, but only 1GB +is in active use, then enabling this feature will cause all 8GB to +be pinned and resident in memory. This feature mostly affects the +bulk-phase round of the migration and can be enabled for extremely +high-performance RDMA hardware using the following command: + +QEMU Monitor Command: +$ migrate_set_capability x-rdma-pin-all on # disabled by default + +Performing this action will cause all 8GB to be pinned, so if that's +not what you want, then please ignore this step altogether. + +On the other hand, this will also significantly speed up the bulk round +of the migration, which can greatly reduce the "total" time of your migration. +Example performance of this using an idle VM in the previous example +can be found in the "Performance" section. + +RUNNING: +======== + +First, set the migration speed to match your hardware's capabilities: + +QEMU Monitor Command: +$ migrate_set_speed 40g # or whatever is the MAX of your RDMA device + +Next, on the destination machine, add the following to the QEMU command line: + +qemu ..... -incoming x-rdma:host:port + +Finally, perform the actual migration on the source machine: + +QEMU Monitor Command: +$ migrate -d x-rdma:host:port + +PERFORMANCE +=========== + +Here is a brief summary of total migration time and downtime using RDMA: +Using a 40gbps infiniband link performing a worst-case stress test, +using an 8GB RAM virtual machine: + +Using the following command: +$ apt-get install stress +$ stress --vm-bytes 7500M --vm 1 --vm-keep + +1. Migration throughput: 26 gigabits/second. +2. Downtime (stop time) varies between 15 and 100 milliseconds. + +EFFECTS of memory registration on bulk phase round: + +For example, in the same 8GB RAM example with all 8GB of memory in +active use and the VM itself is completely idle using the same 40 gbps +infiniband link: + +1. x-rdma-pin-all disabled total time: approximately 7.5 seconds @ 9.5 Gbps +2. x-rdma-pin-all enabled total time: approximately 4 seconds @ 26 Gbps + +These numbers would of course scale up to whatever size virtual machine +you have to migrate using RDMA. + +Enabling this feature does *not* have any measurable affect on +migration *downtime*. This is because, without this feature, all of the +memory will have already been registered already in advance during +the bulk round and does not need to be re-registered during the successive +iteration rounds. + +RDMA Protocol Description: +========================== + +Migration with RDMA is separated into two parts: + +1. The transmission of the pages using RDMA +2. Everything else (a control channel is introduced) + +"Everything else" is transmitted using a formal +protocol now, consisting of infiniband SEND messages. + +An infiniband SEND message is the standard ibverbs +message used by applications of infiniband hardware. +The only difference between a SEND message and an RDMA +message is that SEND messages cause notifications +to be posted to the completion queue (CQ) on the +infiniband receiver side, whereas RDMA messages (used +for pc.ram) do not (to behave like an actual DMA). + +Messages in infiniband require two things: + +1. registration of the memory that will be transmitted +2. (SEND only) work requests to be posted on both + sides of the network before the actual transmission + can occur. + +RDMA messages are much easier to deal with. Once the memory +on the receiver side is registered and pinned, we're +basically done. All that is required is for the sender +side to start dumping bytes onto the link. + +(Memory is not released from pinning until the migration +completes, given that RDMA migrations are very fast.) + +SEND messages require more coordination because the +receiver must have reserved space (using a receive +work request) on the receive queue (RQ) before QEMUFileRDMA +can start using them to carry all the bytes as +a control transport for migration of device state. + +To begin the migration, the initial connection setup is +as follows (migration-rdma.c): + +1. Receiver and Sender are started (command line or libvirt): +2. Both sides post two RQ work requests +3. Receiver does listen() +4. Sender does connect() +5. Receiver accept() +6. Check versioning and capabilities (described later) + +At this point, we define a control channel on top of SEND messages +which is described by a formal protocol. Each SEND message has a +header portion and a data portion (but together are transmitted +as a single SEND message). + +Header: + * Length (of the data portion, uint32, network byte order) + * Type (what command to perform, uint32, network byte order) + * Repeat (Number of commands in data portion, same type only) + +The 'Repeat' field is here to support future multiple page registrations +in a single message without any need to change the protocol itself +so that the protocol is compatible against multiple versions of QEMU. +Version #1 requires that all server implementations of the protocol must +check this field and register all requests found in the array of commands located +in the data portion and return an equal number of results in the response. +The maximum number of repeats is hard-coded to 4096. This is a conservative +limit based on the maximum size of a SEND message along with emperical +observations on the maximum future benefit of simultaneous page registrations. + +The 'type' field has 9 different command values: + 1. Unused + 2. Error (sent to the source during bad things) + 3. Ready (control-channel is available) + 4. QEMU File (for sending non-live device state) + 5. RAM Blocks (used right after connection setup) + 6. Compress page (zap zero page and skip registration) + 7. Register request (dynamic chunk registration) + 8. Register result ('rkey' to be used by sender) + 9. Register finished (registration for current iteration finished) + +A single control message, as hinted above, can contain within the data +portion an array of many commands of the same type. If there is more than +one command, then the 'repeat' field will be greater than 1. + +After connection setup is completed, we have two protocol-level +functions, responsible for communicating control-channel commands +using the above list of values: + +Logically: + +qemu_rdma_exchange_recv(header, expected command type) + +1. We transmit a READY command to let the sender know that + we are *ready* to receive some data bytes on the control channel. +2. Before attempting to receive the expected command, we post another + RQ work request to replace the one we just used up. +3. Block on a CQ event channel and wait for the SEND to arrive. +4. When the send arrives, librdmacm will unblock us. +5. Verify that the command-type and version received matches the one we expected. + +qemu_rdma_exchange_send(header, data, optional response header & data): + +1. Block on the CQ event channel waiting for a READY command + from the receiver to tell us that the receiver + is *ready* for us to transmit some new bytes. +2. Optionally: if we are expecting a response from the command + (that we have no yet transmitted), let's post an RQ + work request to receive that data a few moments later. +3. When the READY arrives, librdmacm will + unblock us and we immediately post a RQ work request + to replace the one we just used up. +4. Now, we can actually post the work request to SEND + the requested command type of the header we were asked for. +5. Optionally, if we are expecting a response (as before), + we block again and wait for that response using the additional + work request we previously posted. (This is used to carry + 'Register result' commands #6 back to the sender which + hold the rkey need to perform RDMA. Note that the virtual address + corresponding to this rkey was already exchanged at the beginning + of the connection (described below). + +All of the remaining command types (not including 'ready') +described above all use the aformentioned two functions to do the hard work: + +1. After connection setup, RAMBlock information is exchanged using + this protocol before the actual migration begins. This information includes + a description of each RAMBlock on the server side as well as the virtual addresses + and lengths of each RAMBlock. This is used by the client to determine the + start and stop locations of chunks and how to register them dynamically + before performing the RDMA operations. +2. During runtime, once a 'chunk' becomes full of pages ready to + be sent with RDMA, the registration commands are used to ask the + other side to register the memory for this chunk and respond + with the result (rkey) of the registration. +3. Also, the QEMUFile interfaces also call these functions (described below) + when transmitting non-live state, such as devices or to send + its own protocol information during the migration process. +4. Finally, zero pages are only checked if a page has not yet been registered + using chunk registration (or not checked at all and unconditionally + written if chunk registration is disabled. This is accomplished using + the "Compress" command listed above. If the page *has* been registered + then we check the entire chunk for zero. Only if the entire chunk is + zero, then we send a compress command to zap the page on the other side. + +Versioning and Capabilities +=========================== +Current version of the protocol is version #1. + +The same version applies to both for protocol traffic and capabilities +negotiation. (i.e. There is only one version number that is referred to +by all communication). + +librdmacm provides the user with a 'private data' area to be exchanged +at connection-setup time before any infiniband traffic is generated. + +Header: + * Version (protocol version validated before send/recv occurs), uint32, network byte order + * Flags (bitwise OR of each capability), uint32, network byte order + +There is no data portion of this header right now, so there is +no length field. The maximum size of the 'private data' section +is only 192 bytes per the Infiniband specification, so it's not +very useful for data anyway. This structure needs to remain small. + +This private data area is a convenient place to check for protocol +versioning because the user does not need to register memory to +transmit a few bytes of version information. + +This is also a convenient place to negotiate capabilities +(like dynamic page registration). + +If the version is invalid, we throw an error. + +If the version is new, we only negotiate the capabilities that the +requested version is able to perform and ignore the rest. + +Currently there is only *one* capability in Version #1: dynamic page registration + +Finally: Negotiation happens with the Flags field: If the primary-VM +sets a flag, but the destination does not support this capability, it +will return a zero-bit for that flag and the primary-VM will understand +that as not being an available capability and will thus disable that +capability on the primary-VM side. + +QEMUFileRDMA Interface: +======================= + +QEMUFileRDMA introduces a couple of new functions: + +1. qemu_rdma_get_buffer() (QEMUFileOps rdma_read_ops) +2. qemu_rdma_put_buffer() (QEMUFileOps rdma_write_ops) + +These two functions are very short and simply use the protocol +describe above to deliver bytes without changing the upper-level +users of QEMUFile that depend on a bytestream abstraction. + +Finally, how do we handoff the actual bytes to get_buffer()? + +Again, because we're trying to "fake" a bytestream abstraction +using an analogy not unlike individual UDP frames, we have +to hold on to the bytes received from control-channel's SEND +messages in memory. + +Each time we receive a complete "QEMU File" control-channel +message, the bytes from SEND are copied into a small local holding area. + +Then, we return the number of bytes requested by get_buffer() +and leave the remaining bytes in the holding area until get_buffer() +comes around for another pass. + +If the buffer is empty, then we follow the same steps +listed above and issue another "QEMU File" protocol command, +asking for a new SEND message to re-fill the buffer. + +Migration of pc.ram: +==================== + +At the beginning of the migration, (migration-rdma.c), +the sender and the receiver populate the list of RAMBlocks +to be registered with each other into a structure. +Then, using the aforementioned protocol, they exchange a +description of these blocks with each other, to be used later +during the iteration of main memory. This description includes +a list of all the RAMBlocks, their offsets and lengths, virtual +addresses and possibly includes pre-registered RDMA keys in case dynamic +page registration was disabled on the server-side, otherwise not. + +Main memory is not migrated with the aforementioned protocol, +but is instead migrated with normal RDMA Write operations. + +Pages are migrated in "chunks" (hard-coded to 1 Megabyte right now). +Chunk size is not dynamic, but it could be in a future implementation. +There's nothing to indicate that this is useful right now. + +When a chunk is full (or a flush() occurs), the memory backed by +the chunk is registered with librdmacm is pinned in memory on +both sides using the aforementioned protocol. +After pinning, an RDMA Write is generated and transmitted +for the entire chunk. + +Chunks are also transmitted in batches: This means that we +do not request that the hardware signal the completion queue +for the completion of *every* chunk. The current batch size +is about 64 chunks (corresponding to 64 MB of memory). +Only the last chunk in a batch must be signaled. +This helps keep everything as asynchronous as possible +and helps keep the hardware busy performing RDMA operations. + +Error-handling: +=============== + +Infiniband has what is called a "Reliable, Connected" +link (one of 4 choices). This is the mode in which +we use for RDMA migration. + +If a *single* message fails, +the decision is to abort the migration entirely and +cleanup all the RDMA descriptors and unregister all +the memory. + +After cleanup, the Virtual Machine is returned to normal +operation the same way that would happen if the TCP +socket is broken during a non-RDMA based migration. + +TODO: +===== +1. 'migrate x-rdma:host:port' and '-incoming x-rdma' options will be + renamed to 'rdma' after the experimental phase of this work has + completed upstream. +2. Currently, 'ulimit -l' mlock() limits as well as cgroups swap limits + are not compatible with infinband memory pinning and will result in + an aborted migration (but with the source VM left unaffected). +3. Use of the recent /proc/<pid>/pagemap would likely speed up + the use of KSM and ballooning while using RDMA. +4. Also, some form of balloon-device usage tracking would also + help alleviate some issues.
Signature · 1 line
1.7.10.4
PATCH v7 3/12 rdma: export yield_until_fd_readable()
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
The RDMA event channel can be made non-blocking just like a TCP socket. Exporting this function allows us to yield so that the QEMU monitor remains available.
--- include/block/coroutine.h | 6 ++++++ qemu-coroutine-io.c | 23 +++++++++++++++++++++++ savevm.c | 28 ---------------------------- 3 files changed, 29 insertions(+), 28 deletions(-)
include/block/coroutine.h +6 -0
@@ -209,4 +209,10 @@ void qemu_co_rwlock_unlock(CoRwlock *lock);*/ void coroutine_fn co_sleep_ns(QEMUClock *clock, int64_t ns); +/** +* Yield until a file descriptor becomes readable +* +* Note that this function clobbers the handlers for the file descriptor. +*/ +void coroutine_fn yield_until_fd_readable(int fd);#endif /* QEMU_COROUTINE_H */
qemu-coroutine-io.c +23 -0
@@ -63,3 +63,26 @@ qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send)struct iovec iov = { .iov_base = buf, .iov_len = bytes };return qemu_co_sendv_recvv (sockfd, &iov,1 ,0 , bytes, do_send); } + +typedef struct { +Coroutine *co; +int fd; +}FDYieldUntilData ; + +static void fd_coroutine_enter (void *opaque) +{ +FDYieldUntilData *data = opaque; +qemu_set_fd_handler (data->fd,NULL ,NULL ,NULL ); +qemu_coroutine_enter (data->co,NULL ); +} + +void coroutine_fn yield_until_fd_readable(int fd) +{ +FDYieldUntilData data; + +assert (qemu_in_coroutine ()); + data.co =qemu_coroutine_self (); + data.fd = fd; +qemu_set_fd_handler (fd, fd_coroutine_enter,NULL , &data); +qemu_coroutine_yield (); +}
savevm.c +0 -28
@@ -149,34 +149,6 @@ typedef struct QEMUFileSocketQEMUFile *file; } QEMUFileSocket; -typedef struct { -Coroutine *co; -int fd; -}FDYieldUntilData ; - -static void fd_coroutine_enter (void *opaque) -{ -FDYieldUntilData *data = opaque; -qemu_set_fd_handler (data->fd,NULL ,NULL ,NULL ); -qemu_coroutine_enter (data->co,NULL ); -} - -/** -* Yield until a file descriptor becomes readable -* -* Note that this function clobbers the handlers for the file descriptor. -*/ -static void coroutine_fn yield_until_fd_readable(int fd) -{ -FDYieldUntilData data; - -assert (qemu_in_coroutine ()); - data.co =qemu_coroutine_self (); - data.fd = fd; -qemu_set_fd_handler (fd, fd_coroutine_enter,NULL , &data); -qemu_coroutine_yield (); -} -static ssize_t socket_writev_buffer (void *opaque,struct iovec *iov,int iovcnt,int64_t pos) {
Signature · 1 line
1.7.10.4
PATCH v7 12/12 rdma: send pc.ram
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
This takes advantages of the previous patches:
1. use the new QEMUFileOps hook 'save_page'
2. call out to the right accessor methods to invoke the iteration hooks defined in QEMUFileOps
--- arch_init.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
arch_init.c +37 -1
@@ -115,6 +115,7 @@ const uint32_t arch_type = QEMU_ARCH;#define RAM_SAVE_FLAG_EOS 0x10#define RAM_SAVE_FLAG_CONTINUE 0x20#define RAM_SAVE_FLAG_XBZRLE 0x40 +/* 0x80 is reserved in migration.h start with 0x100 next */ static struct defconfig_file {
@@ -447,6 +448,7 @@ static int ram_save_block(QEMUFile *f, bool last_stage) ram_bulk_stage = false; } }else { +int ret;uint8_t *p;int cont = (block == last_sent_block) ?RAM_SAVE_FLAG_CONTINUE :0 ;
@@ -455,7 +457,18 @@ static int ram_save_block(QEMUFile *f, bool last_stage)/* In doubt sent page as normal */ bytes_sent =-1 ; -if (is_zero_page (p)) { + ret =ram_control_save_page (f, block->offset, + offset,TARGET_PAGE_SIZE , &bytes_sent); + +if (ret !=RAM_SAVE_CONTROL_NOT_SUPP ) { +if (ret !=RAM_SAVE_CONTROL_DELAYED ) { +if (bytes_sent >0 ) { + acct_info.norm_pages++; + }else if (bytes_sent ==0 ) { + acct_info.dup_pages++; + } + } + }else if (is_zero_page (p)) { acct_info.dup_pages++;if (!ram_bulk_stage) { bytes_sent = save_block_hdr(f, block, offset, cont,
@@ -610,6 +623,15 @@ static int ram_save_setup(QEMUFile *f, void *opaque) }qemu_mutex_unlock_ramlist (); + +/* +* Please leave in place. These calls generate reserved messages in +* the RDMA protocol in order to pre-register RDMA memory in the +* future before the bulk round begins. +*/ +ram_control_before_iterate (f,RAM_CONTROL_SETUP ); +ram_control_after_iterate (f,RAM_CONTROL_SETUP ); +qemu_put_be64 (f,RAM_SAVE_FLAG_EOS );return 0 ;
@@ -628,6 +650,8 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)reset_ram_globals (); } +ram_control_before_iterate (f,RAM_CONTROL_ROUND ); + t0 =qemu_get_clock_ns (rt_clock); i =0 ;while ((ret =qemu_file_rate_limit (f)) ==0 ) {
@@ -658,6 +682,12 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)qemu_mutex_unlock_ramlist (); +/* +* Must occur before EOS (or any QEMUFile operation) +* because of RDMA protocol. +*/ +ram_control_after_iterate (f,RAM_CONTROL_ROUND ); +if (ret <0 ) { bytes_transferred += total_sent;return ret;
@@ -675,6 +705,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)qemu_mutex_lock_ramlist ();migration_bitmap_sync (); +ram_control_before_iterate (f,RAM_CONTROL_FINISH ); +/* try transferring iterative blocks of memory */ /* flush all remaining blocks regardless of rate limiting */
@@ -688,6 +720,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque) } bytes_transferred += bytes_sent; } + +ram_control_after_iterate (f,RAM_CONTROL_FINISH );migration_end ();qemu_mutex_unlock_ramlist ();
@@ -884,6 +918,8 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) ret = -EINVAL ; goto done; } + }else if (flags &RAM_SAVE_FLAG_HOOK ) { +ram_control_load_hook (f, flags); } error =qemu_file_get_error (f);if (error) {
Signature · 1 line
1.7.10.4
v7 cover rdma: migration support
From: "Michael R. Hines" <[email protected]>
Please pull.
Changes since v6:
- added signed-off bys
- *Major* bug testing:
- In-depth regression testing, several bug fixes.
- Over 1000+ back-to-back migrations performed without error.
- rdma: introduce qemu_update_position(), since RDMA writes are asynchronous, the accounting needs to be also.
- fixed configure when RDMA libraries not available
Wiki: http://wiki.qemu.org/Features/RDMALiveMigration
Github: [email protected]:hinesmr/qemu.git
Here is a brief summary of total migration time and downtime using RDMA:
Using a 40gbps infiniband link performing a worst-case stress test, using an 8GB RAM virtual machine:
Using the following command:
$ apt-get install stress $ stress --vm-bytes 7500M --vm 1 --vm-keep
RESULTS:
1. Migration throughput: 26 gigabits/second.
2. Downtime (stop time) varies between 15 and 100 milliseconds.
EFFECTS of memory registration on bulk phase round:
For example, in the same 8GB RAM example with all 8GB of memory in active use and the VM itself is completely idle using the same 40 gbps infiniband link:
1. x-rdma-pin-all disabled total time: approximately 7.5 seconds @ 9.5 Gbps
2. x-rdma-pin-all enabled total time: approximately 4 seconds @ 26 Gbps
These numbers would of course scale up to whatever size virtual machine you have to migrate using RDMA.
Enabling this feature does *not* have any measurable affect on migration *downtime*. This is because, without this feature, all of the memory will have already been registered already in advance during the bulk round and does not need to be re-registered during the successive iteration rounds.
The following changes since commit 4f293bd6e53739e089f33b458f70a9c4ac136b92:
xilinx_axidma: Do not set DMA .notify to NULL after notify (2013-06-10 13:04:40 +0200)
are available in the git repository at:
[email protected]:hinesmr/qemu.git rdma_patch_v7
for you to fetch changes up to 3f500e47dd4e112ed3e65cb33b6efa5c0f03f0ff:
rdma: send pc.ram (2013-06-10 11:52:20 -0400)
----------------------------------------------------------------
Michael R. Hines (12):
rdma: add documentation
rdma: introduce qemu_update_position()
rdma: export yield_until_fd_readable()
rdma: export throughput w/ MigrationStats QMP
rdma: introduce qemu_file_mode_is_not_valid()
rdma: export qemu_fflush()
rdma: introduce ram_handle_compressed()
rdma: introduce qemu_ram_foreach_block()
rdma: new QEMUFileOps hooks
rdma: introduce capability x-rdma-pin-all
rdma: core logic
rdma: send pc.ram
Makefile.objs | 1 + arch_init.c | 74 +- configure | 29 + docs/rdma.txt | 404 ++++++ exec.c | 9 + hmp.c | 2 + include/block/coroutine.h | 6 + include/exec/cpu-common.h | 5 + include/migration/migration.h | 31 + include/migration/qemu-file.h | 32 + migration-rdma.c | 2809 +++++++++++++++++++++++++++++++++++++++++ migration.c | 23 + qapi-schema.json | 12 +- qemu-coroutine-io.c | 23 + savevm.c | 114 +- 15 files changed, 3527 insertions(+), 47 deletions(-) create mode 100644 docs/rdma.txt create mode 100644 migration-rdma.c
Signature · 1 line
1.7.10.4
PATCH v7 8/12 rdma: introduce qemu_ram_foreach_block()
From: "Michael R. Hines" <[email protected]>
This is used during RDMA initialization in order to transmit a description of all the RAM blocks to the peer for later dynamic chunk registration purposes.
--- exec.c | 9 +++++++++ include/exec/cpu-common.h | 5 +++++ 2 files changed, 14 insertions(+)
exec.c +9 -0
@@ -2604,3 +2604,12 @@ bool cpu_physical_memory_is_io(hwaddr phys_addr) memory_region_is_romd(section->mr)); }#endif + +void qemu_ram_foreach_block (RAMBlockIterFunc func,void *opaque) +{ +RAMBlock *block; + + QTAILQ_FOREACH(block, &ram_list.blocks, next) { +func (block->host, block->offset, block->length, opaque); + } +}
include/exec/cpu-common.h +5 -0
@@ -113,6 +113,11 @@ void cpu_physical_memory_write_rom(hwaddr addr,extern struct MemoryRegion io_mem_rom;extern struct MemoryRegion io_mem_notdirty; +typedef void (RAMBlockIterFunc )(void *host_addr, +ram_addr_t offset,ram_addr_t length,void *opaque); + +void qemu_ram_foreach_block (RAMBlockIterFunc func,void *opaque); +#endif #endif /* !CPU_COMMON_H */
Signature · 1 line
1.7.10.4
PATCH v7 11/12 rdma: core logic
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
Code that does need to be visible is kept
well contained inside this file and this is the only new additional file to the entire patch - good progress.
This file includes the entire protocol and interfaces required to perform RDMA migration.
Also, the configure and Makefile modifications to link this file are included.
Full documentation is in docs/rdma.txt
--- Makefile.objs | 1 + configure | 29 + include/migration/migration.h | 4 + migration-rdma.c | 2809 +++++++++++++++++++++++++++++++++++++++++ migration.c | 8 + 5 files changed, 2851 insertions(+) create mode 100644 migration-rdma.c
Makefile.objs +1 -0
@@ -51,6 +51,7 @@ common-obj-$(CONFIG_POSIX) += os-posix.o common-obj-$(CONFIG_LINUX) += fsdev/ common-obj-y += migration.o migration-tcp.o +common-obj-$(CONFIG_RDMA) += migration-rdma.o common-obj-y += qemu-char.o #aio.o common-obj-y += block-migration.o common-obj-y += page_cache.o xbzrle.o
configure +29 -0
@@ -180,6 +180,7 @@ xfs="" vhost_net="no" vhost_scsi="no" kvm="no" +rdma="" gprof="no" debug_tcg="no" debug="no"
@@ -929,6 +930,10 @@ for opt do ;; --enable-gtk) gtk="yes" ;; + --enable-rdma) rdma="yes" + ;; + --disable-rdma) rdma="no" + ;; --with-gtkabi=*) gtkabi="$optarg" ;; --enable-tpm) tpm="yes"
@@ -1087,6 +1092,8 @@ echo " --enable-bluez enable bluez stack connectivity" echo " --disable-slirp disable SLIRP userspace network connectivity" echo " --disable-kvm disable KVM acceleration support" echo " --enable-kvm enable KVM acceleration support" +echo " --disable-rdma disable RDMA-based migration support" +echo " --enable-rdma enable RDMA-based migration support" echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)" echo " --disable-nptl disable usermode NPTL support" echo " --enable-nptl enable usermode NPTL support"
@@ -1789,6 +1796,23 @@ EOF libs_softmmu="$sdl_libs $libs_softmmu" fi +if test "$rdma" != "no" ; then + cat > $TMPC <<EOF +#include <rdma/rdma_cma.h> +int main(void) { return 0; } +EOF + rdma_libs="-lrdmacm -libverbs" + if compile_prog "-Werror" "$rdma_libs" ; then + rdma="yes" + libs_softmmu="$libs_softmmu $rdma_libs" + else + if test "$rdma" = "yes" ; then + feature_not_found "rdma" + fi + rdma="no" + fi +fi + ########################################## # VNC TLS/WS detection if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
@@ -3518,6 +3542,7 @@ echo "Linux AIO support $linux_aio" echo "ATTR/XATTR support $attr" echo "Install blobs $blobs" echo "KVM support $kvm" +echo "RDMA support $rdma" echo "TCG interpreter $tcg_interpreter" echo "fdt support $fdt" echo "preadv support $preadv"
@@ -4468,6 +4493,10 @@ if [ "$pixman" = "internal" ]; then echo "config-host.h: subdir-pixman" >> $config_host_mak fi +if test "$rdma" = "yes" ; then +echo "CONFIG_RDMA=y" >> $config_host_mak +fi + if [ "$dtc_internal" = "yes" ]; then echo "config-host.h: subdir-dtc" >> $config_host_mak fi
include/migration/migration.h +4 -0
@@ -77,6 +77,10 @@ void fd_start_incoming_migration(const char *path, Error **errp);void fd_start_outgoing_migration (MigrationState *s,const char *fdname,Error **errp); +void rdma_start_outgoing_migration (void *opaque,const char *host_port,Error **errp); + +void rdma_start_incoming_migration (const char *host_port,Error **errp); +void migrate_fd_error (MigrationState *s);void migrate_fd_connect (MigrationState *s);
migration-rdma.c new file +2809 -0
2,809 lines not on this page · raw message
migration.c +8 -0
@@ -78,6 +78,10 @@ void qemu_start_incoming_migration(const char *uri, Error **errp)if (strstart (uri,"tcp:" , &p))tcp_start_incoming_migration (p, errp); +#ifdef CONFIG_RDMA + else if (strstart(uri, "x-rdma:", &p)) +rdma_start_incoming_migration (p, errp); +#endif #if !defined(WIN32 ) else if (strstart(uri, "exec:", &p)) exec_start_incoming_migration(p, errp);
@@ -407,6 +411,10 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,if (strstart (uri,"tcp:" , &p)) {tcp_start_outgoing_migration (s, p, &local_err); +#ifdef CONFIG_RDMA + }else if (strstart (uri,"x-rdma:" , &p)) { +rdma_start_outgoing_migration (s, p, &local_err); +#endif #if !defined(WIN32 ) } else if (strstart(uri, "exec:", &p)) {exec_start_outgoing_migration (s, p, &local_err);
Signature · 1 line
1.7.10.4
PATCH v7 6/12 rdma: export qemu_fflush()
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
RDMA uses this to flush the control channel before sending its own message to handle page registrations.
--- include/migration/qemu-file.h | 1 + savevm.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/migration/qemu-file.h +1 -0
@@ -112,6 +112,7 @@ void qemu_file_reset_rate_limit(QEMUFile *f);void qemu_file_set_rate_limit (QEMUFile *f,int64_t new_rate);int64_t qemu_file_get_rate_limit (QEMUFile *f);int qemu_file_get_error (QEMUFile *f); +void qemu_fflush (QEMUFile *f);static inline void qemu_put_be64s (QEMUFile *f,const uint64_t *pv) {
savevm.c +1 -1
@@ -588,7 +588,7 @@ static inline bool qemu_file_is_writable(QEMUFile *f)* If there is writev_buffer QEMUFileOps it uses it otherwise uses * put_buffer ops. */ -static void qemu_fflush (QEMUFile *f) +void qemu_fflush (QEMUFile *f) {ssize_t ret =0 ;
Signature · 1 line
1.7.10.4
PATCH v7 2/12 rdma: introduce qemu_update_position()
In reply to [email protected]From: "Michael R. Hines" <[email protected]>
RDMA writes happen asynchronously, and thus the performance accounting also needs to be able to occur asynchronously. This allows anybody to call into savevm.c to update both f->pos as well as into arch_init.c to update the acct_info structure with up-to-date values when the RDMA transfer actually completes.
--- arch_init.c | 12 ++++++++++++ include/migration/migration.h | 2 ++ include/migration/qemu-file.h | 1 + savevm.c | 5 +++++ 4 files changed, 20 insertions(+)
arch_init.c +12 -0
@@ -498,6 +498,18 @@ static int ram_save_block(QEMUFile *f, bool last_stage)static uint64_t bytes_transferred; +void acct_update_position (QEMUFile *f,size_t size,bool zero) +{ +uint64_t pages = size /TARGET_PAGE_SIZE ; +if (zero) { + acct_info.dup_pages += pages; + }else { + acct_info.norm_pages += pages; + bytes_transferred += size; +qemu_update_position (f, size); + } +} +static ram_addr_t ram_save_remaining (void ) {return migration_dirty_pages;
include/migration/migration.h +2 -0
@@ -92,6 +92,8 @@ uint64_t ram_bytes_remaining(void);uint64_t ram_bytes_transferred (void );uint64_t ram_bytes_total (void ); +void acct_update_position (QEMUFile *f,size_t size,bool zero); +extern SaveVMHandlers savevm_ram_handlers;uint64_t dup_mig_bytes_transferred (void );
include/migration/qemu-file.h +1 -0
@@ -93,6 +93,7 @@ void qemu_put_be32(QEMUFile *f, unsigned int v);void qemu_put_be64 (QEMUFile *f,uint64_t v);int qemu_get_buffer (QEMUFile *f,uint8_t *buf,int size);int qemu_get_byte (QEMUFile *f); +void qemu_update_position (QEMUFile *f,size_t size);static inline unsigned int qemu_get_ubyte (QEMUFile *f) {
savevm.c +5 -0
@@ -670,6 +670,11 @@ int qemu_get_fd(QEMUFile *f)return -1 ; } +void qemu_update_position (QEMUFile *f,size_t size) +{ + f->pos += size; +} +/** Closes the file * * Returns negative error value if any error happened on previous operations or
Signature · 1 line
1.7.10.4
Quoted 7 lines · Chegu Vinod
Attempted to migrate a smaller guest 10Vcpu/64GB (the guest was just idle) with the pin-all option.
It took ~20 sec to do the pin of the guest's RAM (this is the time when the guest is "frozen") and then the actual migration started... and took about ~26 secs to complete.. i.e. "info migrate" reported the total migration time as ~26secs.
From a user point of view the total clock time from when the migration operation was actually initiated to the time the guest resumed on the target host it was : ~20 + ~26 = ~46 secs ...hence my question.
(CC'ing qemu-devel, now.)
Ah, ok, yes, I see now - that's a bug that I would recommend reporting to the QEMU maintainer, actually:
Here is the sequence of events inside of QEMU:
1. issue the migrate command on the QEMU monitor:
2. qmp_migrate() gets called
3. (tcp|rdma|unix|etc)_start_outgoing_migration() gets called <= pinning occurs here
4. start migration_thread() pthread() <= take first timestamp
5. migration complete <= take another timestamp and subtract for total time
6. exit migration_thread()
The problem, as you can see is that "take first timestamp" needs to happen earlier in step #2.
This is definitely a "nuisance", but not specific to RDMA, and I think a patch should be submitted, probably by one of the maintainers which moves the timestamp up to a higher level.
Does that make sense?
- Michael
Quoted 7 lines · Chegu Vinod
Quoted 6 lines
1. start QEMU with the lock option *first*
2. Then enable x-rdma-pin-all
3. Then perform the migrationWhat happens here? Does pinning "in advance" help you?
Quoted 9 lines
Yes it does help by avoiding the freeze time at the start of the pin-all migration.
I already mentioned about this in in my earlier responses as an option to consider for larger guests (https://lists.gnu.org/archive/html/qemu-devel/2013-05/msg00435.html).
But pinning all of guest memory has a few drawbacks...as you may already know.
Just to be sure I just double checked it again with your v7 bits . Started a 64GB/10VCPU guest (started qemu with the"-realtime mlock=on" option) and as expected the guest startup took about 20 seconds longer (i.e. time taken to mlock the 64GB of guest RAM) but the pin-all migration started fine...i.e. didn't observe any freezes at the start of the migration
(CC-ing qemu-devel).
OK, that's good to know. This means that we need to bringup the mlock() problem as a "larger" issue in the linux community instead of the QEMU community.
In the meantime, how about I make update to the RDMA patch which does the following:
1. Solution #1:
If user requests "x-rdma-pin-all", then
If QEMU has enabled "-realtime mlock=on"
Then, allow the capability
Else
Disallow the capability
2. Solution #2: Create NEW qemu monitor command which locks memory *in advance* before the migrate command occurs, to clearly
indicate to the user
that the cost of locking memory must be paid
before the migration starts.
Which solution do you prefer? Or do you have alternative idea?
Quoted 4 lines
https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg04161.html
Again this is a generic linux mlock/clearpage related issue and not directly related to your changes.
Do you have any ideas on how linux can be improved to solve this? Is there any ongoing work that you know of on mlock() performance?
Is there, perhaps, some way for linux to "parallelize" the mlock()/clearpage operation?
- Michael
Il 13/06/2013 10:55, Michael R. Hines ha scritto:
Quoted 42 lines · Chegu Vinod
Quoted 17 lines
Quoted 6 lines
1. start QEMU with the lock option *first*
2. Then enable x-rdma-pin-all
3. Then perform the migrationWhat happens here? Does pinning "in advance" help you?
Yes it does help by avoiding the freeze time at the start of the pin-all migration.
I already mentioned about this in in my earlier responses as an option to consider for larger guests
(https://lists.gnu.org/archive/html/qemu-devel/2013-05/msg00435.html).But pinning all of guest memory has a few drawbacks...as you may already know.
Quoted 8 lines
Just to be sure I just double checked it again with your v7 bits . Started a 64GB/10VCPU guest (started qemu with the"-realtime mlock=on" option) and as expected the guest startup took about 20 seconds longer (i.e. time taken to mlock the 64GB of guest RAM) but the pin-all migration started fine...i.e. didn't observe any freezes at the start of the migration
(CC-ing qemu-devel).
OK, that's good to know. This means that we need to bringup the
mlock()problem as a "larger" issue in the linux community instead of the QEMU community.In the meantime, how about I make update to the RDMA patch which does the following:
1. Solution #1:
If user requests "x-rdma-pin-all", then
If QEMU has enabled "-realtime mlock=on"
Then, allow the capability
Else
Disallow the capability
Quoted 8 lines
2. Solution #2: Create NEW qemu monitor command which locks memory *in advance*
before the migrate command occurs, to clearly
indicate to the user
that the cost of locking memory must be paid
before the migration starts.Which solution do you prefer? Or do you have alternative idea?
Let's just document it in the release notes. There's time to fix it.
Regarding the timestamp problem, it should be fixed in the RDMA code. You did find a bug, but xyz_start_outgoing_migration should be asynchronous and the pinning should happen in the setup phase. This is because the setup phase is already running outside the big QEMU lock and the guest would not be frozen.
I think the patches are ready for merging, because incremental work makes it easier to discuss the changes(*) but you really need to do two things before 1.6, or I would rather revert them.
(1) move the pinning to the setup phase
(2) add a debug mode where every pass unpins all the memory and restarts. Speed doesn't matter, this is so that the protocol supports it from the beginning, and any caching heuristics need to be done on the source side. As all debug modes, it will be somewhat prone to bitrot, but at least there is a reference implementation for anyone who laters wants to add caching.
I think (2) is very important so that, for example, during fault tolerance you can reduce a bit the pinned size for smaller workloads, even without ballooning.
(*) for example, why the introduction of acct_update_position? Is it a fix for a bug that always existed, or driven by some other changes?
Paolo
Quoted 24 lines · Paolo Bonzini
Quoted 24 lines
(CC-ing qemu-devel).
OK, that's good to know. This means that we need to bringup the
mlock()problem as a "larger" issue in the linux community instead of the QEMU community.In the meantime, how about I make update to the RDMA patch which does the following:
1. Solution #1:
If user requests "x-rdma-pin-all", then
If QEMU has enabled "-realtime mlock=on"
Then, allow the capability
Else
Disallow the capability2. Solution #2: Create NEW qemu monitor command which locks memory *in advance*
before the migrate command occurs, to clearly
indicate to the user
that the cost of locking memory must be paid
before the migration starts.
Quoted 8 lines
Quoted 1 line
Which solution do you prefer? Or do you have alternative idea?
Let's just document it in the release notes. There's time to fix it.
Regarding the timestamp problem, it should be fixed in the RDMA code. You did find a bug, but
xyz_start_outgoing_migrationshould be asynchronous and the pinning should happen in the setup phase. This is because the setup phase is already running outside the big QEMU lock and the guest would not be frozen.
I think you misunderstood the symptom. The pinning is *already* happening in the setup phase (xyz_start_outgoing_migration), not inside the the migration_thread().
The problem is in Linux: The guest appears to be frozen not because of any locks but because the pinning itself (allocating and clearing memory) is slowing down the virtual machine so much that it looks like its not running.
Quoted 3 lines
I think the patches are ready for merging, because incremental work makes it easier to discuss the
changes(*)but you really need to do two things before 1.6, or I would rather revert them.
Yes, could someone go ahead and pull them? They are very well bug-tested.
Quoted 2 lines
(1) move the pinning to the setup phase
This is already done in the existing patchset.
Quoted 11 lines
(2) add a debug mode where every pass unpins all the memory and restarts. Speed doesn't matter, this is so that the protocol supports it from the beginning, and any caching heuristics need to be done on the source side. As all debug modes, it will be somewhat prone to bitrot, but at least there is a reference implementation for anyone who laters wants to add caching.
I think (2) is very important so that, for example, during fault tolerance you can reduce a bit the pinned size for smaller workloads, even without ballooning.
I agree that this is a necessary feature (dynamic source registration), but it is a lot more complicated than a simple unpin of everything before every pass. As you suggested, I would rather not introduce unused code, but rather wait until someone in the future has a full-functional, testable, implementation.
Actually - I am already working on a fault-tolerance implementation as we speak and will be posting it soon, so it's likely I will submit a patch to do something like this at that time.
Quoted 3 lines
(*) for example, why the introduction of
acct_update_position? Is it a fix for a bug that always existed, or driven by some other changes?
This is important because RDMA writes do not happen sycnrhonously. It is impossible to update the accounting inside of save_live_iterate() because the RDMA operations are still outstanding.
It is only until they have completed later that we can actually know whether what the accounting statistics really are.
- Michael
Il 13/06/2013 17:17, Michael R. Hines ha scritto:
Quoted 10 lines · Paolo Bonzini
Quoted 5 lines
Regarding the timestamp problem, it should be fixed in the RDMA code. You did find a bug, but
xyz_start_outgoing_migrationshould be asynchronous and the pinning should happen in the setup phase. This is because the setup phase is already running outside the big QEMU lock and the guest would not be frozen.I think you misunderstood the symptom. The pinning is *already* happening in the setup phase (
xyz_start_outgoing_migration), not inside the themigration_thread().
I was referring to ram_control_before_iterate(f, RAM_CONTROL_SETUP). Even better, that would be a good reason to remove the
+ * Please leave in place. These calls generate reserved messages in + * the RDMA protocol in order to pre-register RDMA memory in the + * future before the bulk round begins.
comment that I don't like. :)
xyz_start_outgoing_migration is the connect phase if you want to give it a name.
The connect phase runs with the big QEMU lock taken, so any interrupt will freeze VCPUs until the pinning ends.
Quoted 3 lines
Quoted 1 line
(1) move the pinning to the setup phase
This is already done in the existing patchset.
See above, it isn't. :)
Quoted 11 lines
Quoted 10 lines
(2) add a debug mode where every pass unpins all the memory and restarts. Speed doesn't matter, this is so that the protocol supports it from the beginning, and any caching heuristics need to be done on the source side. As all debug modes, it will be somewhat prone to bitrot, but at least there is a reference implementation for anyone who laters wants to add caching.
I think (2) is very important so that, for example, during fault tolerance you can reduce a bit the pinned size for smaller workloads, even without ballooning.
Quoted 6 lines
I agree that this is a necessary feature (dynamic source registration), but it is a lot more complicated than a simple unpin of everything before every pass.
As you suggested, I would rather not introduce unused code, but rather wait until
someone in the future has a full-functional, testable, implementation.
I know it's complicated. But I think it needs to be part of the design that the complication lies only in the source. Starting with a simple-minded (borderline stupid) implementation that is as slow as TCP is enough to complete this missing part of the design. Everything else is "just" an optimization on top.
Quoted 10 lines
Quoted 3 lines
(*) for example, why the introduction of
acct_update_position? Is it a fix for a bug that always existed, or driven by some other changes?This is important because RDMA writes do not happen sycnrhonously. It is impossible to update the accounting inside of
save_live_iterate()because the RDMA operations are still outstanding.It is only until they have completed later that we can actually know whether what the accounting statistics really are.
So it was always there. Good, but you should have written it in the cover letter.
Juan, are you going to pick this up, or should Anthony do it? (Michael:
in any case, do not send a pull request yourself).
Paolo
Quoted 17 lines · Paolo Bonzini
Il 13/06/2013 17:17, Michael R. Hines ha scritto:
Quoted 9 lines · Paolo Bonzini
Quoted 5 lines
Regarding the timestamp problem, it should be fixed in the RDMA code. You did find a bug, but
xyz_start_outgoing_migrationshould be asynchronous and the pinning should happen in the setup phase. This is because the setup phase is already running outside the big QEMU lock and the guest would not be frozen.I think you misunderstood the symptom. The pinning is *already* happening in the setup phase (
xyz_start_outgoing_migration), not inside the themigration_thread().I was referring to
ram_control_before_iterate(f, RAM_CONTROL_SETUP). Even better, that would be a good reason to remove the(quoted diff) +3
-0+ * Please leave in place. These calls generate reserved messages in + * the RDMA protocol in order to pre-register RDMA memory in the + * future before the bulk round begins.
Quoted 7 lines
comment that I don't like. :)
xyz_start_outgoing_migrationis the connect phase if you want to give it a name.The connect phase runs with the big QEMU lock taken, so any interrupt will freeze VCPUs until the pinning ends.
Excellent suggestions. I've re-submitted the patch already with these modifications as v8.
Thanks, Paolo.
Quoted 3 lines
Juan, are you going to pick this up, or should Anthony do it? (Michael:
in any case, do not send a pull request yourself).
Understood =).
[Qemu-devel] RDMA: please pull and re-test freezing fixes
In reply to Michael R. HinesChegu,
I believe I've fixed all the pinning / freezing issues per Paolo's recommendations.
I've re-submitted as v8 - Can you "git pull" from github and re-test?
Thanks,
- Michael
Re: [Qemu-devel] RDMA: please pull and re-test freezing fixes
Chegu,
I sent a V9 to the mailing list:
The version goes even further, by explicitly timing the pinning latency and pushing the value out to QMP so the user clearly knows which component of total migration time is consumed by pinning.
If you're satisfied, I'd appreciate if I could add your Reviewed-By: =)
- Michael
Quoted 9 lines · Michael R. Hines
Chegu,
I believe I've fixed all the pinning / freezing issues per Paolo's recommendations.
I've re-submitted as v8 - Can you "git pull" from github and re-test?
Thanks,
- Michael
Re: [Qemu-devel] RDMA: please pull and re-test freezing fixes
Quoted 9 lines · Michael R. Hines
Chegu,
I sent a V9 to the mailing list:
The version goes even further, by explicitly timing the pinning latency and pushing the value out to QMP so the user clearly knows which component of total migration time is consumed by pinning.
If you're satisfied, I'd appreciate if I could add your Reviewed-By: =)
Pl. see below...and yes you can add me.
Thanks,
Vinod
The migration speed was set to 40G and the downtime to 2sec for all experiments below.
Note: Idle guests are not interesting due to tons of zero pages etc...but including them here to highlght the overhead of pinning.
1) 20vcpu/64GB guest: (kind of a larger sized Cloud-type guest)
a) Idle guest with No pinning (default) :
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 51062 milliseconds
downtime: 1948 milliseconds
pin-all: 0 milliseconds
transferred ram: 1816547 kbytes
throughput: 6872.23 mbps
remaining ram: 0 kbytes
total ram: 67117632 kbytes
duplicate: 16331552 pages
skipped: 0 pages
normal: 450038 pages
normal bytes: 1800152 kbytes
b) Idle guest with Pinning :
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 47451 milliseconds
downtime: 2639 milliseconds
pin-all: 22780 milliseconds
transferred ram: 67136643 kbytes
throughput: 25222.91 mbps
remaining ram: 0 kbytes
total ram: 67117632 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 16780064 pages
normal bytes: 67120256 kbytes
There weere no freezes observed in the guest at the start of the migration but the qemu monitor prompt was not responsive for the duration of the memory pinning.
Total migration time was affected by the cost pinning at the start of the migration as shown above( This issue can be pursued and optimized later).
c) Pining + guest running a Java warehouse workload (I cranked the workload up to keep the guest 95+% busy)
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: active
total time: 412706 milliseconds
expected downtime: 499 milliseconds
pin-all: 22758 milliseconds
transferred ram: 657243669 kbytes
throughput: 25241.89 mbps
remaining ram: 7281848 kbytes
total ram: 67117632 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 164270810 pages
normal bytes: 657083240 kbytes
dirty pages rate: 369925 pages
No Convergence ! (For workloads where the memory dirty rate is very high there are other alternatives that have been discussed in the past...)
---
Enterprise type guests tend to get fatter (more memory per cpu) than the larger Cloud guests...so here are a coupld of them.
a) 20VCPU/256G Idle guest :
Default:
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 259259 milliseconds
downtime: 3924 milliseconds
pin-all: 0 milliseconds
transferred ram: 5522078 kbytes
throughput: 6586.06 mbps
remaining ram: 0 kbytes
total ram: 268444224 kbytes
duplicate: 65755168 pages
skipped: 0 pages
normal: 1364124 pages
normal bytes: 5456496 kbytes
Pinned:
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 219053 milliseconds
downtime: 4277 milliseconds
pin-all: 118153 milliseconds
transferred ram: 268512809 kbytes
throughput: 22209.32 mbps
remaining ram: 0 kbytes
total ram: 268444224 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 67111817 pages
normal bytes: 268447268 kbytes
b) 40VCPU/512GB Idle guest :
Default:
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 670577 milliseconds
downtime: 6139 milliseconds
pin-all: 0 milliseconds
transferred ram: 10279256 kbytes
throughput: 6150.93 mbps
remaining ram: 0 kbytes
total ram: 536879680 kbytes
duplicate: 131704099 pages
skipped: 0 pages
normal: 2537017 pages
normal bytes: 10148068 kbytes
Pinned:
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 527576 milliseconds
downtime: 6314 milliseconds
pin-all: 312984 milliseconds
transferred ram: 537129685 kbytes
throughput: 20177.27 mbps
remaining ram: 0 kbytes
total ram: 536879680 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 134249644 pages
normal bytes: 536998576 kbytes
No freezes in the guest due to memory pinning. (Freezes were only due to the dirty bitmap synchup stuff which is being done while BQL is held. Juan is working on addresing already for qemu 1.6)
Re: [Qemu-devel] RDMA: please pull and re-test freezing fixes
In reply to Michael R. HinesThese are great results. Even the one that doesn't converge is good, because it shows that your patch for CPU throttling earlier on the mailing list is still very necessary.
Thanks a lot, I will send out a V10 patch to everybody's results.
- Michael
Would you be interested in me posting them to the wiki?
Quoted 11 lines · Michael R. Hines
Chegu,
I sent a V9 to the mailing list:
The version goes even further, by explicitly timing the pinning latency and
pushing the value out to QMP so the user clearly knows which component of total migration time is consumed by pinning.If you're satisfied, I'd appreciate if I could add your Reviewed-By: =)
Pl. see below...and yes you can add me.
Thanks,
Vinod
The migration speed was set to 40G and the downtime to 2sec for all experiments below.
Note: Idle guests are not interesting due to tons of zero pages etc...but including them here to highlght the overhead of pinning.
1) 20vcpu/64GB guest: (kind of a larger sized Cloud-type guest)
a) Idle guest with No pinning (default) :
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 51062 milliseconds
downtime: 1948 milliseconds
pin-all: 0 milliseconds
transferred ram: 1816547 kbytes
throughput: 6872.23 mbps
remaining ram: 0 kbytes
total ram: 67117632 kbytes
duplicate: 16331552 pages
skipped: 0 pages
normal: 450038 pages
normal bytes: 1800152 kbytes
b) Idle guest with Pinning :
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 47451 milliseconds
downtime: 2639 milliseconds
pin-all: 22780 milliseconds
transferred ram: 67136643 kbytes
throughput: 25222.91 mbps
remaining ram: 0 kbytes
total ram: 67117632 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 16780064 pages
normal bytes: 67120256 kbytes
There weere no freezes observed in the guest at the start of the migration but the qemu monitor prompt was not responsive for the duration of the memory pinning.
Total migration time was affected by the cost pinning at the start of the migration as shown above( This issue can be pursued and optimized later).
c) Pining + guest running a Java warehouse workload (I cranked the workload up to keep the guest 95+% busy)
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: active
total time: 412706 milliseconds
expected downtime: 499 milliseconds
pin-all: 22758 milliseconds
transferred ram: 657243669 kbytes
throughput: 25241.89 mbps
remaining ram: 7281848 kbytes
total ram: 67117632 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 164270810 pages
normal bytes: 657083240 kbytes
dirty pages rate: 369925 pages
No Convergence ! (For workloads where the memory dirty rate is very high there are other alternatives that have been discussed in the past...)
---
Enterprise type guests tend to get fatter (more memory per cpu) than the larger Cloud guests...so here are a coupld of them.
a) 20VCPU/256G Idle guest :
Default:
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 259259 milliseconds
downtime: 3924 milliseconds
pin-all: 0 milliseconds
transferred ram: 5522078 kbytes
throughput: 6586.06 mbps
remaining ram: 0 kbytes
total ram: 268444224 kbytes
duplicate: 65755168 pages
skipped: 0 pages
normal: 1364124 pages
normal bytes: 5456496 kbytes
Pinned:
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 219053 milliseconds
downtime: 4277 milliseconds
pin-all: 118153 milliseconds
transferred ram: 268512809 kbytes
throughput: 22209.32 mbps
remaining ram: 0 kbytes
total ram: 268444224 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 67111817 pages
normal bytes: 268447268 kbytes
b) 40VCPU/512GB Idle guest :
Default:
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 670577 milliseconds
downtime: 6139 milliseconds
pin-all: 0 milliseconds
transferred ram: 10279256 kbytes
throughput: 6150.93 mbps
remaining ram: 0 kbytes
total ram: 536879680 kbytes
duplicate: 131704099 pages
skipped: 0 pages
normal: 2537017 pages
normal bytes: 10148068 kbytes
Pinned:
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 527576 milliseconds
downtime: 6314 milliseconds
pin-all: 312984 milliseconds
transferred ram: 537129685 kbytes
throughput: 20177.27 mbps
remaining ram: 0 kbytes
total ram: 536879680 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 134249644 pages
normal bytes: 536998576 kbytes
No freezes in the guest due to memory pinning. (Freezes were only due to the dirty bitmap synchup stuff which is being done while BQL is held. Juan is working on addresing already for qemu 1.6)
The migration speed was set to 40G and the downtime to 2sec for all experiments below.
Note: Idle guests are not interesting due to tons of zero pages etc...but including them here to highlght the overhead of pinning.
1) 20vcpu/64GB guest: (kind of a larger sized Cloud-type guest)
a) Idle guest with No pinning (default) :
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 51062 milliseconds
downtime: 1948 milliseconds
pin-all: 0 milliseconds
transferred ram: 1816547 kbytes
throughput: 6872.23 mbps
remaining ram: 0 kbytes
total ram: 67117632 kbytes
duplicate: 16331552 pages
skipped: 0 pages
normal: 450038 pages
normal bytes: 1800152 kbytes
b) Idle guest with Pinning :
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 47451 milliseconds
downtime: 2639 milliseconds
pin-all: 22780 milliseconds
transferred ram: 67136643 kbytes
throughput: 25222.91 mbps
remaining ram: 0 kbytes
total ram: 67117632 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 16780064 pages
normal bytes: 67120256 kbytes
There weere no freezes observed in the guest at the start of the migration but the qemu monitor prompt was not responsive for the duration of the memory pinning.
Total migration time was affected by the cost pinning at the start of the migration as shown above( This issue can be pursued and optimized later).
c) Pining + guest running a Java warehouse workload (I cranked the workload up to keep the guest 95+% busy)
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: active
total time: 412706 milliseconds
expected downtime: 499 milliseconds
pin-all: 22758 milliseconds
transferred ram: 657243669 kbytes
throughput: 25241.89 mbps
remaining ram: 7281848 kbytes
total ram: 67117632 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 164270810 pages
normal bytes: 657083240 kbytes
dirty pages rate: 369925 pages
No Convergence ! (For workloads where the memory dirty rate is very high there are other alternatives that have been discussed in the past...)
---
Enterprise type guests tend to get fatter (more memory per cpu) than the larger Cloud guests...so here are a coupld of them.
a) 20VCPU/256G Idle guest :
Default:
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 259259 milliseconds
downtime: 3924 milliseconds
pin-all: 0 milliseconds
transferred ram: 5522078 kbytes
throughput: 6586.06 mbps
remaining ram: 0 kbytes
total ram: 268444224 kbytes
duplicate: 65755168 pages
skipped: 0 pages
normal: 1364124 pages
normal bytes: 5456496 kbytes
Pinned:
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 219053 milliseconds
downtime: 4277 milliseconds
pin-all: 118153 milliseconds
transferred ram: 268512809 kbytes
throughput: 22209.32 mbps
remaining ram: 0 kbytes
total ram: 268444224 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 67111817 pages
normal bytes: 268447268 kbytes
b) 40VCPU/512GB Idle guest :
Default:
capabilities: xbzrle: off x-rdma-pin-all: off
Migration status: completed
total time: 670577 milliseconds
downtime: 6139 milliseconds
pin-all: 0 milliseconds
transferred ram: 10279256 kbytes
throughput: 6150.93 mbps
remaining ram: 0 kbytes
total ram: 536879680 kbytes
duplicate: 131704099 pages
skipped: 0 pages
normal: 2537017 pages
normal bytes: 10148068 kbytes
Pinned:
capabilities: xbzrle: off x-rdma-pin-all: on
Migration status: completed
total time: 527576 milliseconds
downtime: 6314 milliseconds
pin-all: 312984 milliseconds
transferred ram: 537129685 kbytes
throughput: 20177.27 mbps
remaining ram: 0 kbytes
total ram: 536879680 kbytes
duplicate: 0 pages
skipped: 0 pages
normal: 134249644 pages
normal bytes: 536998576 kbytes
No freezes in the guest due to memory pinning. (Freezes were only due to the dirty bitmap synchup stuff which is being done while BQL is held. Juan is working on addresing already for qemu 1.6)