diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-01-27 10:36:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-27 10:36:24 +0000 |
commit | 4bf6d3aaf40f10dcc4b3e9587db7531b44dd1fb8 (patch) | |
tree | 274b7fc9b5fa7f1ab578860ebeb0b6797ef8dfbd /samples/server.c | |
parent | 6fd7eea5a9b177813832fa386eea794a659789f0 (diff) | |
download | libvfio-user-4bf6d3aaf40f10dcc4b3e9587db7531b44dd1fb8.zip libvfio-user-4bf6d3aaf40f10dcc4b3e9587db7531b44dd1fb8.tar.gz libvfio-user-4bf6d3aaf40f10dcc4b3e9587db7531b44dd1fb8.tar.bz2 |
implement fake guest thread in client/server live migration sample (#264)
* add fake guest thread in migration sample
This patch adds a thread that pretends to be the guest VM (while the
client itself is the VMM) in the live migration sample. Our goal is to
have the fake guest modifying device state while live migration is
ongoing and when live migration has finished the device state should be
correct in the destination server.
Currently this doesn't work because the server blindly applies device
state when resuming, which is wrong because some device state must be
applied to specific offsets. To fix this we have to include the offset
and length (along with BAR1 data) in the migration stream.
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/server.c')
-rw-r--r-- | samples/server.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/samples/server.c b/samples/server.c index 324e47e..ad5ce34 100644 --- a/samples/server.c +++ b/samples/server.c @@ -137,6 +137,22 @@ bar1_access(vfu_ctx_t *vfu_ctx, char * const buf, } if (is_write) { + /* + * FIXME this doesn't work for the following reason: + * The amount of migration data the server generates during the pre-copy + * and stop-and-copy phases is larger than the size of BAR1, however + * during the resuming state, the server blindly appends to BAR1, + * since it cannot know that a particular piece of migration data has + * to be written to a specific offset. To fix this we have to include + * offset and length, along with the actual data, when reading migration + * data. + */ +#if 0 + if (server_data->migration.state == VFU_MIGR_STATE_PRE_COPY) { + /* dirty the whole thing */ + server_data->migration.pending_bytes = server_data->bar1_size; + } +#endif memcpy(server_data->bar1 + offset, buf, count); } else { memcpy(buf, server_data->bar1, count); |