diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-01-28 15:48:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-28 15:48:20 +0000 |
commit | 1f95428c8165713d534118c5fc51b39b8edfa083 (patch) | |
tree | 4217e82885bac72c320b6c0dd9bb1c19bc6cff8c /samples/client.c | |
parent | 91cf408657a07384d112930eef03e482ac7617be (diff) | |
download | libvfio-user-1f95428c8165713d534118c5fc51b39b8edfa083.zip libvfio-user-1f95428c8165713d534118c5fc51b39b8edfa083.tar.gz libvfio-user-1f95428c8165713d534118c5fc51b39b8edfa083.tar.bz2 |
client/server: make number of migration iterations deterministic (#277)
The number of migration iterations would depend on whether or how many
times the fake guest thread would touch BAR1.
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/client.c')
-rw-r--r-- | samples/client.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/samples/client.c b/samples/client.c index b6a4853..731f5d6 100644 --- a/samples/client.c +++ b/samples/client.c @@ -866,13 +866,7 @@ migrate_from(int sock, int migr_reg_index, size_t *nr_iters, err(EXIT_FAILURE, "failed to create pthread"); } - /* - * TODO The server generates migration data while it's in pre-copy state. - * - * FIXME the server generates 4 rounds of migration data while in pre-copy - * state and 1 while in stop-and-copy state. Don't assume this. - */ - *nr_iters = 5; + *nr_iters = 2; *migr_iters = malloc(sizeof(struct iovec) * *nr_iters); if (*migr_iters == NULL) { err(EXIT_FAILURE, NULL); @@ -891,7 +885,8 @@ migrate_from(int sock, int migr_reg_index, size_t *nr_iters, strerror(-ret)); } - _nr_iters = do_migrate(sock, migr_reg_index, 3, *migr_iters); + _nr_iters = do_migrate(sock, migr_reg_index, 1, *migr_iters); + assert(_nr_iters == 1); printf("stopping fake guest thread\n"); fake_guest_data.done = true; __sync_synchronize(); @@ -901,8 +896,6 @@ migrate_from(int sock, int migr_reg_index, size_t *nr_iters, err(EXIT_FAILURE, "failed to join fake guest pthread"); } - _nr_iters += do_migrate(sock, migr_reg_index, 1, (*migr_iters) + _nr_iters); - printf("setting device state to stop-and-copy\n"); device_state = VFIO_DEVICE_STATE_SAVING; |