diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-01-28 15:32:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-28 15:32:56 +0000 |
commit | 91cf408657a07384d112930eef03e482ac7617be (patch) | |
tree | 816b46eea6f0c5a17b496955f92837f721372ac5 /samples/server.c | |
parent | df2e7e2eb66ff21d3089a941c697d8faf94c9734 (diff) | |
download | libvfio-user-91cf408657a07384d112930eef03e482ac7617be.zip libvfio-user-91cf408657a07384d112930eef03e482ac7617be.tar.gz libvfio-user-91cf408657a07384d112930eef03e482ac7617be.tar.bz2 |
client/server: disarm timer when device is stopped (#276)
When the device is set to stop-and-copy state it must stop operating, which means that if it has been previously programmed to triggers it should refrain from doing so.
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/server.c')
-rw-r--r-- | samples/server.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/samples/server.c b/samples/server.c index 35452c3..11a7b55 100644 --- a/samples/server.c +++ b/samples/server.c @@ -261,11 +261,16 @@ migration_device_state_transition(vfu_ctx_t *vfu_ctx, vfu_migr_state_t state) { struct server_data *server_data = vfu_get_private(vfu_ctx); int ret; + struct itimerval new = { { 0 }, }; printf("migration: transition to device state %d\n", state); switch (state) { case VFU_MIGR_STATE_STOP_AND_COPY: + vfu_log(vfu_ctx, LOG_DEBUG, "disable timer"); + if (setitimer(ITIMER_REAL, &new, NULL) != 0) { + err(EXIT_FAILURE, "failed to disable timer"); + } server_data->migration.pending_bytes = server_data->bar1_size + sizeof(time_t); /* FIXME BAR0 region size */ break; case VFU_MIGR_STATE_PRE_COPY: |