diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-01-25 17:39:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-25 17:39:35 +0000 |
commit | f2fe9d8e4fc4c5eb80dc61cc243a18087cc12ca3 (patch) | |
tree | 06c6a12d428fbfadbcccf0dea780c393f076f6ca /lib/migration.c | |
parent | 915a5b01f34a61cacef5ae5b50a215d13628b8b0 (diff) | |
download | libvfio-user-f2fe9d8e4fc4c5eb80dc61cc243a18087cc12ca3.zip libvfio-user-f2fe9d8e4fc4c5eb80dc61cc243a18087cc12ca3.tar.gz libvfio-user-f2fe9d8e4fc4c5eb80dc61cc243a18087cc12ca3.tar.bz2 |
add pre-copy phase in live migration example (#247)
This patch adds a simplistic pre-copy phase in the live migration
sample. The end goal is have a separate thread in the client to
modify device state while the device is in the pre-copy phase. This will
be done in later patches.
BAR1 is saved during the pre-copy phase and BAR0 is saved during the
stop-and-copy phase. This is purely for convenience. There are quite a
few assumptions and FIXMEs, even in the client code. We plan to address
them in future patches.
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/migration.c')
-rw-r--r-- | lib/migration.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/migration.c b/lib/migration.c index 31a8d9d..c4eb6f6 100644 --- a/lib/migration.c +++ b/lib/migration.c @@ -450,6 +450,12 @@ migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, assert(migr != NULL); assert(buf != NULL); + /* + * FIXME don't call the device callback if the migration state is in not in + * pre-copy/stop-and-copy/resuming state, since the behavior is undefined + * in that case. + */ + if (pos + count <= sizeof(struct vfio_device_migration_info)) { ret = migration_region_access_registers(vfu_ctx, buf, count, pos, is_write); |