[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 042/103] migration: introduce self_announce_delay()
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 042/103] migration: introduce self_announce_delay() |
Date: |
Tue, 17 Jun 2014 20:38:39 +0300 |
From: Jason Wang <address@hidden>
This patch introduces self_announce_delay() to calculate the delay for
the next announce round. This could be used by other device e.g
virtio-net who wants to do announcing by itself.
Signed-off-by: Jason Wang <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/migration/vmstate.h | 8 ++++++++
savevm.c | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 6edce98..799d2d0 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -780,4 +780,12 @@ void vmstate_register_ram(struct MemoryRegion *memory,
DeviceState *dev);
void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
void vmstate_register_ram_global(struct MemoryRegion *memory);
+static inline
+int64_t self_announce_delay(int round)
+{
+ assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
+ /* delay 50ms, 150ms, 250ms, ... */
+ return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
+}
+
#endif
diff --git a/savevm.c b/savevm.c
index f5273f3..e126023 100644
--- a/savevm.c
+++ b/savevm.c
@@ -97,7 +97,7 @@ static void qemu_announce_self_once(void *opaque)
if (--count) {
/* delay 50ms, 150ms, 250ms, ... */
timer_mod(timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) +
- 50 + (SELF_ANNOUNCE_ROUNDS - count - 1) * 100);
+ self_announce_delay(count));
} else {
timer_del(timer);
timer_free(timer);
--
MST
- [Qemu-devel] [PULL 027/103] pc: migrate piix4 & ich9 MemHotplugState, (continued)
- [Qemu-devel] [PULL 027/103] pc: migrate piix4 & ich9 MemHotplugState, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 029/103] pc: propagate memory hotplug event to ACPI device, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 030/103] pc: ACPI BIOS: implement memory hotplug interface, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 031/103] pc: add "hotplug-memory-region-size" property to PC_MACHINE, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 037/103] virtio: Drop superfluous conditionals around g_strdup(), Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 039/103] ich: get rid of spaces in type name, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 040/103] pc: q35: acpi: report error to user on unsupported unplug request, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 038/103] qtest: fix hex2nib for capital characters, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 032/103] pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 041/103] migration: export SELF_ANNOUNCE_ROUNDS, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 042/103] migration: introduce self_announce_delay(),
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 043/103] virtio-net: announce self by guest, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 044/103] Add kvm_eventfds_enabled function, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 045/103] Add chardev API qemu_chr_fe_read_all, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 049/103] vhost: add vhost_get_features and vhost_ack_features, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 050/103] vhost_net should call the poll callback only when it is set, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 051/103] Refactor virtio-net to use generic get_vhost_net, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 052/103] vhost_net_init will use VhostNetOptions to get all its arguments, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 053/103] Add vhost_ops to vhost_dev struct and replace all relevant ioctls, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 054/103] Add vhost-backend and VhostBackendType, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 056/103] vhost-net: vhost-user feature bits support, Michael S. Tsirkin, 2014/06/17