virtio-balloon: reset the statistic timer to load device
PATCH 1/1 virtio-balloon: reset the statistic timer to load device
From: Pavel Butsykin <[email protected]>
If before loading snapshot we had set the timer of statistics, then after applying snapshot the expiry time would be irrelevant for the restored state of the virtual clocks. A simple fix is just to restart the timer after loading snapshot.
For the user it may look like a long delay of statistics update after switch to the snapshot.
--- hw/virtio/virtio-balloon.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/virtio/virtio-balloon.c +4 -0
@@ -426,6 +426,10 @@ static int virtio_balloon_load_device(VirtIODevice *vdev, QEMUFile *f, s->num_pages =qemu_get_be32 (f); s->actual =qemu_get_be32 (f); + +if (balloon_stats_enabled (s)) { +balloon_stats_change_timer (s, s->stats_poll_interval); + }return 0 ; }
Signature · 1 line
2.1.4
Quoted 7 lines · Denis V. Lunev
From: Pavel Butsykin <[email protected]>
If before loading snapshot we had set the timer of statistics, then after applying snapshot the expiry time would be irrelevant for the restored state of the virtual clocks. A simple fix is just to restart the timer after loading snapshot.
Quoted 7 lines
For the user it may look like a long delay of statistics update after switch to the snapshot.
Signed-off-by Pavel Butsykin <[email protected]>Reviewed-by Roman Kagan <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Michael S. Tsirkin <[email protected]>
I'm inclined to think we really should migrate the timer, otherwise user might wait twice as long as expected ...
Quoted 21 lines
--- hw/virtio/virtio-balloon.c | 4 ++++ 1 file changed, 4 insertions(+)hw/virtio/virtio-balloon.c +4
-0@@ -426,6 +426,10 @@ static int virtio_balloon_load_device(VirtIODevice *vdev, QEMUFile *f, s->num_pages =qemu_get_be32 (f); s->actual =qemu_get_be32 (f); + +if (balloon_stats_enabled (s)) { +balloon_stats_change_timer (s, s->stats_poll_interval); + }return 0 ; }Signature · 1 line
2.1.4
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Denis V. Lunev
From: Pavel Butsykin <[email protected]>
If before loading snapshot we had set the timer of statistics, then after applying snapshot the expiry time would be irrelevant for the restored state of the virtual clocks. A simple fix is just to restart the timer after loading snapshot.
For the user it may look like a long delay of statistics update after switch to the snapshot.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Pavel Butsykin <[email protected]>Reviewed-by Roman Kagan <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Michael S. Tsirkin <[email protected]>I'm inclined to think we really should migrate the timer, otherwise user might wait twice as long as expected ...
this is not a big deal. This timer is a part of the QEMU state, which was configured for this exact running instance, not for the guest. Moreover, we have switched to new guest state which can be on the different CPU with different timings etc and thus we should let the guest to run for some time.
In the perfect world you should not save the time to the migration state but save the time at reset callback and restore it here at postload, but this seems over engineering.
Statistics delivery is "best effort", nobody will die if one shot will be missed.
Quoted 24 lines · Denis V. Lunev
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Denis V. Lunev
From: Pavel Butsykin <[email protected]>
If before loading snapshot we had set the timer of statistics, then after applying snapshot the expiry time would be irrelevant for the restored state of the virtual clocks. A simple fix is just to restart the timer after loading snapshot.
For the user it may look like a long delay of statistics update after switch to the snapshot.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Pavel Butsykin <[email protected]>Reviewed-by Roman Kagan <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>CC Michael S. Tsirkin <[email protected]>I'm inclined to think we really should migrate the timer, otherwise user might wait twice as long as expected ...
this is not a big deal. This timer is a part of the QEMU state, which was configured for this exact running instance, not for the guest. Moreover, we have switched to new guest state which can be on the different CPU with different timings etc and thus we should let the guest to run for some time.
Quoted 6 lines
In the perfect world you should not save the time to the migration state but save the time at reset callback and restore it here at postload, but this seems over engineering.
Statistics delivery is "best effort", nobody will die if one shot will be missed.
could you pls select on of the options below to highlight way to merge pls?
1) keep code as is. Restarting timer to new policy is fine
2) restart with the remaining timeout of previous timer
For me 1) is fine, though...
Den