* [PATCH] runstate: allow inmigrate -> debug transition on snapshot restore
@ 2026-04-02 19:43 Trieu Huynh
2026-04-06 13:48 ` Fabiano Rosas
0 siblings, 1 reply; 3+ messages in thread
From: Trieu Huynh @ 2026-04-02 19:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Trieu Huynh, Paolo Bonzini
From: Trieu Huynh <vikingtc4@gmail.com>
When a VM snapshot is taken while the guest is paused by a gdbstub
(RUN_STATE_DEBUG), the saved runstate is 'debug', for instance:
(gdb) monitor info status
VM status: paused (debug)
On restore, the destination starts in 'inmigrate' and transitions
to the saved runstate, but the 'inmigrate -> debug' transition
was missing from the table, causing an abort:
$ ./qemu-system-x86_64 -machine pc,accel=kvm:tcg -m 128M
-display none -gdb tcp::1235 -incoming "exec:cat /tmp/snap.img"
> /tmp/qemu-restore.log 2>&1
Aborted (core dumped)
$ cat /tmp/qemu-restore.log
qemu-system-x86_64: invalid runstate transition: 'inmigrate'
-> 'debug'
Fix it by adding the missing one (Point out by the author
Dustin Spicuzza)
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1231
Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
---
system/runstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/system/runstate.c b/system/runstate.c
index 2d4e95a216..97a6a1c736 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -94,6 +94,7 @@ static const RunStateTransition runstate_transitions_def[] = {
{ RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH },
{ RUN_STATE_INMIGRATE, RUN_STATE_POSTMIGRATE },
{ RUN_STATE_INMIGRATE, RUN_STATE_COLO },
+ { RUN_STATE_INMIGRATE, RUN_STATE_DEBUG },
{ RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED },
{ RUN_STATE_INTERNAL_ERROR, RUN_STATE_FINISH_MIGRATE },
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] runstate: allow inmigrate -> debug transition on snapshot restore
2026-04-02 19:43 [PATCH] runstate: allow inmigrate -> debug transition on snapshot restore Trieu Huynh
@ 2026-04-06 13:48 ` Fabiano Rosas
2026-04-07 19:39 ` Trieu Huynh
0 siblings, 1 reply; 3+ messages in thread
From: Fabiano Rosas @ 2026-04-06 13:48 UTC (permalink / raw)
To: Trieu Huynh, qemu-devel; +Cc: Trieu Huynh, Paolo Bonzini, Alex Bennée
Trieu Huynh <vikingtc4@gmail.com> writes:
> From: Trieu Huynh <vikingtc4@gmail.com>
>
> When a VM snapshot is taken while the guest is paused by a gdbstub
> (RUN_STATE_DEBUG), the saved runstate is 'debug', for instance:
> (gdb) monitor info status
> VM status: paused (debug)
>
> On restore, the destination starts in 'inmigrate' and transitions
> to the saved runstate, but the 'inmigrate -> debug' transition
> was missing from the table, causing an abort:
>
> $ ./qemu-system-x86_64 -machine pc,accel=kvm:tcg -m 128M
> -display none -gdb tcp::1235 -incoming "exec:cat /tmp/snap.img"
> > /tmp/qemu-restore.log 2>&1
> Aborted (core dumped)
> $ cat /tmp/qemu-restore.log
> qemu-system-x86_64: invalid runstate transition: 'inmigrate'
> -> 'debug'
>
> Fix it by adding the missing one (Point out by the author
> Dustin Spicuzza)
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1231
(note to self: stop giving time estimates)
>
> Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
I think this is reasonable as a standalone change:
Reviewed-by: Fabiano Rosas <farosas@suse.de>
As I mentioned in the Gitlab issue, it raises the question of whether
there's more to be done in terms of migrating the gdbstub
connection. Probably too niche of an use-case?
> ---
> system/runstate.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/system/runstate.c b/system/runstate.c
> index 2d4e95a216..97a6a1c736 100644
> --- a/system/runstate.c
> +++ b/system/runstate.c
> @@ -94,6 +94,7 @@ static const RunStateTransition runstate_transitions_def[] = {
> { RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH },
> { RUN_STATE_INMIGRATE, RUN_STATE_POSTMIGRATE },
> { RUN_STATE_INMIGRATE, RUN_STATE_COLO },
> + { RUN_STATE_INMIGRATE, RUN_STATE_DEBUG },
>
> { RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED },
> { RUN_STATE_INTERNAL_ERROR, RUN_STATE_FINISH_MIGRATE },
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] runstate: allow inmigrate -> debug transition on snapshot restore
2026-04-06 13:48 ` Fabiano Rosas
@ 2026-04-07 19:39 ` Trieu Huynh
0 siblings, 0 replies; 3+ messages in thread
From: Trieu Huynh @ 2026-04-07 19:39 UTC (permalink / raw)
To: Fabiano Rosas; +Cc: qemu-devel, Paolo Bonzini, Alex Bennée
On Mon, Apr 06, 2026 at 10:48:44AM -0300, Fabiano Rosas wrote:
> Trieu Huynh <vikingtc4@gmail.com> writes:
>
> > From: Trieu Huynh <vikingtc4@gmail.com>
> >
> > When a VM snapshot is taken while the guest is paused by a gdbstub
> > (RUN_STATE_DEBUG), the saved runstate is 'debug', for instance:
> > (gdb) monitor info status
> > VM status: paused (debug)
> >
> > On restore, the destination starts in 'inmigrate' and transitions
> > to the saved runstate, but the 'inmigrate -> debug' transition
> > was missing from the table, causing an abort:
> >
> > $ ./qemu-system-x86_64 -machine pc,accel=kvm:tcg -m 128M
> > -display none -gdb tcp::1235 -incoming "exec:cat /tmp/snap.img"
> > > /tmp/qemu-restore.log 2>&1
> > Aborted (core dumped)
> > $ cat /tmp/qemu-restore.log
> > qemu-system-x86_64: invalid runstate transition: 'inmigrate'
> > -> 'debug'
> >
> > Fix it by adding the missing one (Point out by the author
> > Dustin Spicuzza)
> >
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1231
>
> (note to self: stop giving time estimates)
>
> >
> > Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
>
> I think this is reasonable as a standalone change:
>
> Reviewed-by: Fabiano Rosas <farosas@suse.de>
>
Thanks for the review.
> As I mentioned in the Gitlab issue, it raises the question of whether
> there's more to be done in terms of migrating the gdbstub
> connection. Probably too niche of an use-case?
>
Agreed that it's a niche use-case. The immediate pain point was the
hard abort on restore, which this patch addresses. Migrating the
actual gdbstub connection state across snapshots would be a separate
and considerably more involved effort. Since the restored VM would
still need the user to re-attach gdb manually anyway, so the practical
value is limited.
> > ---
> > system/runstate.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/system/runstate.c b/system/runstate.c
> > index 2d4e95a216..97a6a1c736 100644
> > --- a/system/runstate.c
> > +++ b/system/runstate.c
> > @@ -94,6 +94,7 @@ static const RunStateTransition runstate_transitions_def[] = {
> > { RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH },
> > { RUN_STATE_INMIGRATE, RUN_STATE_POSTMIGRATE },
> > { RUN_STATE_INMIGRATE, RUN_STATE_COLO },
> > + { RUN_STATE_INMIGRATE, RUN_STATE_DEBUG },
> >
> > { RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED },
> > { RUN_STATE_INTERNAL_ERROR, RUN_STATE_FINISH_MIGRATE },
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-07 19:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 19:43 [PATCH] runstate: allow inmigrate -> debug transition on snapshot restore Trieu Huynh
2026-04-06 13:48 ` Fabiano Rosas
2026-04-07 19:39 ` Trieu Huynh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.