* [Qemu-devel] [PATCH] migration: Guard ram_bytes_remaining against early call
@ 2017-12-15 11:51 Dr. David Alan Gilbert (git)
2017-12-19 4:48 ` Peter Xu
2017-12-27 22:14 ` Juan Quintela
0 siblings, 2 replies; 3+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2017-12-15 11:51 UTC (permalink / raw)
To: qemu-devel, quintela; +Cc: peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Calling ram_bytes_remaining during the early part of setup is unsafe
because the ram_state isn't yet initialised.
This can happen in the sequence:
migrate
migrate_cancel
info migrate
if the migrate sticks trying to connect (e.g. to an unresponsive
destination due to the connect timeout). Here 'info migrate' sees
a state of CANCELLING and so assumes the migrate has partially happened.
partial fix for:
RH bz: https://bugzilla.redhat.com/show_bug.cgi?id=1525899
Reported-by: Xianxian Wang <xianwang@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/ram.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/migration/ram.c b/migration/ram.c
index 021d583b9b..cb1950f3eb 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -237,7 +237,8 @@ static RAMState *ram_state;
uint64_t ram_bytes_remaining(void)
{
- return ram_state->migration_dirty_pages * TARGET_PAGE_SIZE;
+ return ram_state ? (ram_state->migration_dirty_pages * TARGET_PAGE_SIZE) :
+ 0;
}
MigrationStats ram_counters;
--
2.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: Guard ram_bytes_remaining against early call
2017-12-15 11:51 [Qemu-devel] [PATCH] migration: Guard ram_bytes_remaining against early call Dr. David Alan Gilbert (git)
@ 2017-12-19 4:48 ` Peter Xu
2017-12-27 22:14 ` Juan Quintela
1 sibling, 0 replies; 3+ messages in thread
From: Peter Xu @ 2017-12-19 4:48 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, quintela
On Fri, Dec 15, 2017 at 11:51:23AM +0000, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Calling ram_bytes_remaining during the early part of setup is unsafe
> because the ram_state isn't yet initialised.
>
> This can happen in the sequence:
> migrate
> migrate_cancel
> info migrate
>
> if the migrate sticks trying to connect (e.g. to an unresponsive
> destination due to the connect timeout). Here 'info migrate' sees
> a state of CANCELLING and so assumes the migrate has partially happened.
>
> partial fix for:
> RH bz: https://bugzilla.redhat.com/show_bug.cgi?id=1525899
> Reported-by: Xianxian Wang <xianwang@redhat.com>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Now we fetch this as long as !COMPLETE:
if (s->state != MIGRATION_STATUS_COMPLETED) {
info->ram->remaining = ram_bytes_remaining();
info->ram->dirty_pages_rate = ram_counters.dirty_pages_rate;
}
Maybe we should also narrow this down some day. Thanks,
--
Peter Xu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: Guard ram_bytes_remaining against early call
2017-12-15 11:51 [Qemu-devel] [PATCH] migration: Guard ram_bytes_remaining against early call Dr. David Alan Gilbert (git)
2017-12-19 4:48 ` Peter Xu
@ 2017-12-27 22:14 ` Juan Quintela
1 sibling, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2017-12-27 22:14 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, peterx
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Calling ram_bytes_remaining during the early part of setup is unsafe
> because the ram_state isn't yet initialised.
>
> This can happen in the sequence:
> migrate
> migrate_cancel
> info migrate
>
> if the migrate sticks trying to connect (e.g. to an unresponsive
> destination due to the connect timeout). Here 'info migrate' sees
> a state of CANCELLING and so assumes the migrate has partially happened.
>
> partial fix for:
> RH bz: https://bugzilla.redhat.com/show_bug.cgi?id=1525899
> Reported-by: Xianxian Wang <xianwang@redhat.com>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-27 22:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-15 11:51 [Qemu-devel] [PATCH] migration: Guard ram_bytes_remaining against early call Dr. David Alan Gilbert (git)
2017-12-19 4:48 ` Peter Xu
2017-12-27 22:14 ` Juan Quintela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).