* [PATCH 0/3] Set runstate to RUN_STATE_RESTORE_VM when started with "-loadvm"
@ 2022-08-13 1:10 Joelle van Dyne
2022-08-13 1:10 ` [PATCH 1/3] Revert "usbredir: avoid queuing hello packet on snapshot restore" Joelle van Dyne
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Joelle van Dyne @ 2022-08-13 1:10 UTC (permalink / raw)
To: qemu-devel
Previously, there was a bug in usbredir which prevented "-loadvm" from working
because libusbredir's usbredirparser_unserialize() fails when a HELLO packet is
sent as part of the device's initalization.
The fix was to not send HELLO when in the RUN_STATE_PRELAUNCH state. However,
recently we found that this breaks when QEMU is started with "-S" because it
is in the RUN_STATE_PRELAUNCH state while halted before boot as well.
This patch attempts to re-fix the issue by setting the run state to
RUN_STATE_RESTORE_VM when started with "-loadvm" and recognizing that state
in usbredir's initalization.
To make sure there's no unintended side effects, we searched for
"RUN_STATE_RESTORE_VM" in the code base and found only references in
migration/savevm.c, monitor/hmp-cmds.c, and replay/replay-debugging.c. None of
these seems to be affected by RUN_STATE_RESTORE_VM before RUN_STATE_RUNNING.
Joelle van Dyne (3):
Revert "usbredir: avoid queuing hello packet on snapshot restore"
vl: on -loadvm set run state to "restore-vm"
usbredir: avoid queuing hello packet on snapshot restore
hw/usb/redirect.c | 2 +-
softmmu/runstate.c | 1 +
softmmu/vl.c | 3 +++
3 files changed, 5 insertions(+), 1 deletion(-)
--
2.28.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3] Revert "usbredir: avoid queuing hello packet on snapshot restore"
2022-08-13 1:10 [PATCH 0/3] Set runstate to RUN_STATE_RESTORE_VM when started with "-loadvm" Joelle van Dyne
@ 2022-08-13 1:10 ` Joelle van Dyne
2022-11-21 12:26 ` Ján Tomko
2022-08-13 1:10 ` [PATCH 2/3] vl: on -loadvm set run state to "restore-vm" Joelle van Dyne
2022-08-13 1:10 ` [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore Joelle van Dyne
2 siblings, 1 reply; 12+ messages in thread
From: Joelle van Dyne @ 2022-08-13 1:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Joelle van Dyne, Gerd Hoffmann
Run state is also in RUN_STATE_PRELAUNCH while "-S" is used.
This reverts commit 12d182898a4866e4be418e2abac286b497cfa1b2.
Signed-off-by: Joelle van Dyne <j@getutm.app>
---
hw/usb/redirect.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 1bd30efc3e..fd7df599bc 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1280,8 +1280,7 @@ static void usbredir_create_parser(USBRedirDevice *dev)
}
#endif
- if (runstate_check(RUN_STATE_INMIGRATE) ||
- runstate_check(RUN_STATE_PRELAUNCH)) {
+ if (runstate_check(RUN_STATE_INMIGRATE)) {
flags |= usbredirparser_fl_no_hello;
}
usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE,
--
2.28.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] vl: on -loadvm set run state to "restore-vm"
2022-08-13 1:10 [PATCH 0/3] Set runstate to RUN_STATE_RESTORE_VM when started with "-loadvm" Joelle van Dyne
2022-08-13 1:10 ` [PATCH 1/3] Revert "usbredir: avoid queuing hello packet on snapshot restore" Joelle van Dyne
@ 2022-08-13 1:10 ` Joelle van Dyne
2022-08-22 10:11 ` Daniel P. Berrangé
2022-08-13 1:10 ` [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore Joelle van Dyne
2 siblings, 1 reply; 12+ messages in thread
From: Joelle van Dyne @ 2022-08-13 1:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Joelle van Dyne, Paolo Bonzini
This allows us to differentiate between a fresh boot and a restore boot.
Signed-off-by: Joelle van Dyne <j@getutm.app>
---
softmmu/runstate.c | 1 +
softmmu/vl.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index 1e68680b9d..fa3dd3a4ab 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -76,6 +76,7 @@ typedef struct {
static const RunStateTransition runstate_transitions_def[] = {
{ RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE },
+ { RUN_STATE_PRELAUNCH, RUN_STATE_RESTORE_VM },
{ RUN_STATE_DEBUG, RUN_STATE_RUNNING },
{ RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE },
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 706bd7cff7..29586d94ff 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3131,6 +3131,9 @@ void qemu_init(int argc, char **argv, char **envp)
add_device_config(DEV_DEBUGCON, optarg);
break;
case QEMU_OPTION_loadvm:
+ if (!loadvm) {
+ runstate_set(RUN_STATE_RESTORE_VM);
+ }
loadvm = optarg;
break;
case QEMU_OPTION_full_screen:
--
2.28.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore
2022-08-13 1:10 [PATCH 0/3] Set runstate to RUN_STATE_RESTORE_VM when started with "-loadvm" Joelle van Dyne
2022-08-13 1:10 ` [PATCH 1/3] Revert "usbredir: avoid queuing hello packet on snapshot restore" Joelle van Dyne
2022-08-13 1:10 ` [PATCH 2/3] vl: on -loadvm set run state to "restore-vm" Joelle van Dyne
@ 2022-08-13 1:10 ` Joelle van Dyne
2022-08-13 5:30 ` Victor Toso
2 siblings, 1 reply; 12+ messages in thread
From: Joelle van Dyne @ 2022-08-13 1:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Joelle van Dyne, Gerd Hoffmann
When launching QEMU with "-loadvm", usbredir_create_parser() should avoid
setting up the hello packet (just as with "-incoming". On the latest version
of libusbredir, usbredirparser_unserialize() will return error if the parser
is not "pristine."
Signed-off-by: Joelle van Dyne <j@getutm.app>
---
hw/usb/redirect.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index fd7df599bc..47fac3895a 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1280,7 +1280,8 @@ static void usbredir_create_parser(USBRedirDevice *dev)
}
#endif
- if (runstate_check(RUN_STATE_INMIGRATE)) {
+ if (runstate_check(RUN_STATE_INMIGRATE) ||
+ runstate_check(RUN_STATE_RESTORE_VM)) {
flags |= usbredirparser_fl_no_hello;
}
usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE,
--
2.28.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore
2022-08-13 1:10 ` [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore Joelle van Dyne
@ 2022-08-13 5:30 ` Victor Toso
2022-08-13 5:33 ` Joelle van Dyne
0 siblings, 1 reply; 12+ messages in thread
From: Victor Toso @ 2022-08-13 5:30 UTC (permalink / raw)
To: Joelle van Dyne; +Cc: qemu-devel, Gerd Hoffmann
Hi,
On Fri, Aug 12, 2022 at 06:10:31PM -0700, Joelle van Dyne wrote:
> When launching QEMU with "-loadvm", usbredir_create_parser() should avoid
> setting up the hello packet (just as with "-incoming". On the latest version
> of libusbredir, usbredirparser_unserialize() will return error if the parser
> is not "pristine."
That was wrong in the usbredir side. The fix [0] was merged and
included in the latest 0.13.0 release
[0] https://gitlab.freedesktop.org/spice/usbredir/-/merge_requests/61
> Signed-off-by: Joelle van Dyne <j@getutm.app>
> ---
> hw/usb/redirect.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index fd7df599bc..47fac3895a 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -1280,7 +1280,8 @@ static void usbredir_create_parser(USBRedirDevice *dev)
> }
> #endif
>
> - if (runstate_check(RUN_STATE_INMIGRATE)) {
> + if (runstate_check(RUN_STATE_INMIGRATE) ||
> + runstate_check(RUN_STATE_RESTORE_VM)) {
> flags |= usbredirparser_fl_no_hello;
> }
> usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE,
> --
> 2.28.0
>
>
Cheers,
Victor
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore
2022-08-13 5:30 ` Victor Toso
@ 2022-08-13 5:33 ` Joelle van Dyne
2022-08-13 5:50 ` Victor Toso
0 siblings, 1 reply; 12+ messages in thread
From: Joelle van Dyne @ 2022-08-13 5:33 UTC (permalink / raw)
To: Victor Toso; +Cc: Joelle van Dyne, QEMU Developers, Gerd Hoffmann
On Fri, Aug 12, 2022 at 10:30 PM Victor Toso <victortoso@redhat.com> wrote:
>
> Hi,
>
> On Fri, Aug 12, 2022 at 06:10:31PM -0700, Joelle van Dyne wrote:
> > When launching QEMU with "-loadvm", usbredir_create_parser() should avoid
> > setting up the hello packet (just as with "-incoming". On the latest version
> > of libusbredir, usbredirparser_unserialize() will return error if the parser
> > is not "pristine."
>
> That was wrong in the usbredir side. The fix [0] was merged and
> included in the latest 0.13.0 release
This is good to know. Should the entire runstate_check in
usbredir_create_parser be removed?
>
> [0] https://gitlab.freedesktop.org/spice/usbredir/-/merge_requests/61
>
> > Signed-off-by: Joelle van Dyne <j@getutm.app>
> > ---
> > hw/usb/redirect.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> > index fd7df599bc..47fac3895a 100644
> > --- a/hw/usb/redirect.c
> > +++ b/hw/usb/redirect.c
> > @@ -1280,7 +1280,8 @@ static void usbredir_create_parser(USBRedirDevice *dev)
> > }
> > #endif
> >
> > - if (runstate_check(RUN_STATE_INMIGRATE)) {
> > + if (runstate_check(RUN_STATE_INMIGRATE) ||
> > + runstate_check(RUN_STATE_RESTORE_VM)) {
> > flags |= usbredirparser_fl_no_hello;
> > }
> > usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE,
> > --
> > 2.28.0
> >
> >
>
> Cheers,
> Victor
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore
2022-08-13 5:33 ` Joelle van Dyne
@ 2022-08-13 5:50 ` Victor Toso
2022-08-13 5:57 ` Joelle van Dyne
0 siblings, 1 reply; 12+ messages in thread
From: Victor Toso @ 2022-08-13 5:50 UTC (permalink / raw)
To: Joelle van Dyne; +Cc: QEMU Developers, Gerd Hoffmann
Hi,
On Fri, Aug 12, 2022 at 10:33:54PM -0700, Joelle van Dyne wrote:
> On Fri, Aug 12, 2022 at 10:30 PM Victor Toso <victortoso@redhat.com> wrote:
> >
> > Hi,
> >
> > On Fri, Aug 12, 2022 at 06:10:31PM -0700, Joelle van Dyne wrote:
> > > When launching QEMU with "-loadvm", usbredir_create_parser() should avoid
> > > setting up the hello packet (just as with "-incoming". On the latest version
> > > of libusbredir, usbredirparser_unserialize() will return error if the parser
> > > is not "pristine."
> >
> > That was wrong in the usbredir side. The fix [0] was merged and
> > included in the latest 0.13.0 release
>
> This is good to know. Should the entire runstate_check in
> usbredir_create_parser be removed?
From my POV your patch looks correct and would avoid migration
issues such as [1] with usbredir 0.12.0 that was not patched
[1] https://bugzilla.redhat.com/show_bug.cgi?id=2096008
So, I'd keep the check and the patch :)
> > [0] https://gitlab.freedesktop.org/spice/usbredir/-/merge_requests/61
> >
> > > Signed-off-by: Joelle van Dyne <j@getutm.app>
> > > ---
> > > hw/usb/redirect.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> > > index fd7df599bc..47fac3895a 100644
> > > --- a/hw/usb/redirect.c
> > > +++ b/hw/usb/redirect.c
> > > @@ -1280,7 +1280,8 @@ static void usbredir_create_parser(USBRedirDevice *dev)
> > > }
> > > #endif
> > >
> > > - if (runstate_check(RUN_STATE_INMIGRATE)) {
> > > + if (runstate_check(RUN_STATE_INMIGRATE) ||
> > > + runstate_check(RUN_STATE_RESTORE_VM)) {
> > > flags |= usbredirparser_fl_no_hello;
> > > }
> > > usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE,
> > > --
> > > 2.28.0
> > >
> > >
Cheers,
Victor
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore
2022-08-13 5:50 ` Victor Toso
@ 2022-08-13 5:57 ` Joelle van Dyne
2022-08-13 7:12 ` Victor Toso
0 siblings, 1 reply; 12+ messages in thread
From: Joelle van Dyne @ 2022-08-13 5:57 UTC (permalink / raw)
To: Victor Toso; +Cc: Joelle van Dyne, QEMU Developers, Gerd Hoffmann
On Fri, Aug 12, 2022 at 10:50 PM Victor Toso <victortoso@redhat.com> wrote:
>
> Hi,
>
> On Fri, Aug 12, 2022 at 10:33:54PM -0700, Joelle van Dyne wrote:
> > On Fri, Aug 12, 2022 at 10:30 PM Victor Toso <victortoso@redhat.com> wrote:
> > >
> > > Hi,
> > >
> > > On Fri, Aug 12, 2022 at 06:10:31PM -0700, Joelle van Dyne wrote:
> > > > When launching QEMU with "-loadvm", usbredir_create_parser() should avoid
> > > > setting up the hello packet (just as with "-incoming". On the latest version
> > > > of libusbredir, usbredirparser_unserialize() will return error if the parser
> > > > is not "pristine."
> > >
> > > That was wrong in the usbredir side. The fix [0] was merged and
> > > included in the latest 0.13.0 release
> >
> > This is good to know. Should the entire runstate_check in
> > usbredir_create_parser be removed?
>
> From my POV your patch looks correct and would avoid migration
> issues such as [1] with usbredir 0.12.0 that was not patched
>
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=2096008
>
> So, I'd keep the check and the patch :)
I have to admit I'm not too familiar with the inner workings of
libusbredir. But is it desirable to skip the HELLO packet on "loadvm"?
I wrote this on the assumption that it's correct because libusbredir
enforces it, but if that's wrong, then I'm wondering if maybe we need
the HELLO to re-establish communication (that was the issue I triaged
with "-S", when USB devices did not work due to the HELLO packet not
being sent). In a migration, it makes sense that a SPICE client has
not reset the USB device. However, when re-starting QEMU with
"-loadvm", it's possible the USB device has been disconnected and
reconnected. Ideally, we report that to the guest and let it handle
the reset. Would "usbredirparser_fl_no_hello" prevent that?
>
> > > [0] https://gitlab.freedesktop.org/spice/usbredir/-/merge_requests/61
> > >
> > > > Signed-off-by: Joelle van Dyne <j@getutm.app>
> > > > ---
> > > > hw/usb/redirect.c | 3 ++-
> > > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> > > > index fd7df599bc..47fac3895a 100644
> > > > --- a/hw/usb/redirect.c
> > > > +++ b/hw/usb/redirect.c
> > > > @@ -1280,7 +1280,8 @@ static void usbredir_create_parser(USBRedirDevice *dev)
> > > > }
> > > > #endif
> > > >
> > > > - if (runstate_check(RUN_STATE_INMIGRATE)) {
> > > > + if (runstate_check(RUN_STATE_INMIGRATE) ||
> > > > + runstate_check(RUN_STATE_RESTORE_VM)) {
> > > > flags |= usbredirparser_fl_no_hello;
> > > > }
> > > > usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE,
> > > > --
> > > > 2.28.0
> > > >
> > > >
>
> Cheers,
> Victor
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore
2022-08-13 5:57 ` Joelle van Dyne
@ 2022-08-13 7:12 ` Victor Toso
0 siblings, 0 replies; 12+ messages in thread
From: Victor Toso @ 2022-08-13 7:12 UTC (permalink / raw)
To: Joelle van Dyne; +Cc: QEMU Developers, Gerd Hoffmann
Hi,
On Fri, Aug 12, 2022 at 10:57:08PM -0700, Joelle van Dyne wrote:
> On Fri, Aug 12, 2022 at 10:50 PM Victor Toso <victortoso@redhat.com> wrote:
> >
> > Hi,
> >
> > On Fri, Aug 12, 2022 at 10:33:54PM -0700, Joelle van Dyne wrote:
> > > On Fri, Aug 12, 2022 at 10:30 PM Victor Toso <victortoso@redhat.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Fri, Aug 12, 2022 at 06:10:31PM -0700, Joelle van Dyne wrote:
> > > > > When launching QEMU with "-loadvm", usbredir_create_parser() should avoid
> > > > > setting up the hello packet (just as with "-incoming". On the latest version
> > > > > of libusbredir, usbredirparser_unserialize() will return error if the parser
> > > > > is not "pristine."
> > > >
> > > > That was wrong in the usbredir side. The fix [0] was merged and
> > > > included in the latest 0.13.0 release
> > >
> > > This is good to know. Should the entire runstate_check in
> > > usbredir_create_parser be removed?
> >
> > From my POV your patch looks correct and would avoid migration
> > issues such as [1] with usbredir 0.12.0 that was not patched
> >
> > [1] https://bugzilla.redhat.com/show_bug.cgi?id=2096008
> >
> > So, I'd keep the check and the patch :)
>
> I have to admit I'm not too familiar with the inner workings of
> libusbredir. But is it desirable to skip the HELLO packet on
> "loadvm"?
The hello package is to used for capabilities negotiation and
then stablish a new connection.
> I wrote this on the assumption that it's correct because
> libusbredir enforces it, but if that's wrong, then I'm
> wondering if maybe we need the HELLO to re-establish
> communication (that was the issue I triaged with "-S", when USB
> devices did not work due to the HELLO packet not being sent).
> In a migration, it makes sense that a SPICE client has not
> reset the USB device. However, when re-starting QEMU with
> "-loadvm", it's possible the USB device has been disconnected
> and reconnected.
Yes, or it could be holding the device to reestablish the
connection with the VM. Depends a bit on the backend? I'm not
100% sure.
If user was using a TCP backend and connecting to usbredirserver
(or usbredirect running as a TCP server with --as) then I assume
that QEMU would try to reconnect and keep going like migration.
> Ideally, we report that to the guest and let it handle the
> reset. Would "usbredirparser_fl_no_hello" prevent that?
usbredirparser_fl_no_hello is mainly meant for unserialization
but it can also be used for the application to send/handle its
own hello package too (used for emulated usb devices in
spice-gtk [2]).
All in all, if the device is no longer available on loadvm(), at
the point the VM is restarted, the guest should be notified
similarly to when the device is being unplugged.
[2] https://gitlab.freedesktop.org/spice/spice-gtk/-/commit/78c5a2e93383bd21a121
> > > > [0] https://gitlab.freedesktop.org/spice/usbredir/-/merge_requests/61
> > > >
> > > > > Signed-off-by: Joelle van Dyne <j@getutm.app>
> > > > > ---
> > > > > hw/usb/redirect.c | 3 ++-
> > > > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> > > > > index fd7df599bc..47fac3895a 100644
> > > > > --- a/hw/usb/redirect.c
> > > > > +++ b/hw/usb/redirect.c
> > > > > @@ -1280,7 +1280,8 @@ static void usbredir_create_parser(USBRedirDevice *dev)
> > > > > }
> > > > > #endif
> > > > >
> > > > > - if (runstate_check(RUN_STATE_INMIGRATE)) {
> > > > > + if (runstate_check(RUN_STATE_INMIGRATE) ||
> > > > > + runstate_check(RUN_STATE_RESTORE_VM)) {
> > > > > flags |= usbredirparser_fl_no_hello;
> > > > > }
> > > > > usbredirparser_init(dev->parser, VERSION, caps, USB_REDIR_CAPS_SIZE,
> > > > > --
> > > > > 2.28.0
> > > > >
Cheers,
Victor
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] vl: on -loadvm set run state to "restore-vm"
2022-08-13 1:10 ` [PATCH 2/3] vl: on -loadvm set run state to "restore-vm" Joelle van Dyne
@ 2022-08-22 10:11 ` Daniel P. Berrangé
2022-10-29 23:35 ` Joelle van Dyne
0 siblings, 1 reply; 12+ messages in thread
From: Daniel P. Berrangé @ 2022-08-22 10:11 UTC (permalink / raw)
To: Joelle van Dyne; +Cc: qemu-devel, Paolo Bonzini
On Fri, Aug 12, 2022 at 06:10:30PM -0700, Joelle van Dyne wrote:
> This allows us to differentiate between a fresh boot and a restore boot.
>
> Signed-off-by: Joelle van Dyne <j@getutm.app>
> ---
> softmmu/runstate.c | 1 +
> softmmu/vl.c | 3 +++
> 2 files changed, 4 insertions(+)
What happens if the user launches QEMU with -S and NOT -loadvm, and
then uses the 'loadvm' monitor command to restore the VM state ?
> diff --git a/softmmu/runstate.c b/softmmu/runstate.c
> index 1e68680b9d..fa3dd3a4ab 100644
> --- a/softmmu/runstate.c
> +++ b/softmmu/runstate.c
> @@ -76,6 +76,7 @@ typedef struct {
>
> static const RunStateTransition runstate_transitions_def[] = {
> { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE },
> + { RUN_STATE_PRELAUNCH, RUN_STATE_RESTORE_VM },
>
> { RUN_STATE_DEBUG, RUN_STATE_RUNNING },
> { RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE },
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 706bd7cff7..29586d94ff 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -3131,6 +3131,9 @@ void qemu_init(int argc, char **argv, char **envp)
> add_device_config(DEV_DEBUGCON, optarg);
> break;
> case QEMU_OPTION_loadvm:
> + if (!loadvm) {
> + runstate_set(RUN_STATE_RESTORE_VM);
> + }
> loadvm = optarg;
> break;
> case QEMU_OPTION_full_screen:
> --
> 2.28.0
>
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] vl: on -loadvm set run state to "restore-vm"
2022-08-22 10:11 ` Daniel P. Berrangé
@ 2022-10-29 23:35 ` Joelle van Dyne
0 siblings, 0 replies; 12+ messages in thread
From: Joelle van Dyne @ 2022-10-29 23:35 UTC (permalink / raw)
To: Daniel P. Berrangé; +Cc: Joelle van Dyne, qemu-devel, Paolo Bonzini
On Mon, Aug 22, 2022 at 3:11 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Fri, Aug 12, 2022 at 06:10:30PM -0700, Joelle van Dyne wrote:
> > This allows us to differentiate between a fresh boot and a restore boot.
> >
> > Signed-off-by: Joelle van Dyne <j@getutm.app>
> > ---
> > softmmu/runstate.c | 1 +
> > softmmu/vl.c | 3 +++
> > 2 files changed, 4 insertions(+)
>
> What happens if the user launches QEMU with -S and NOT -loadvm, and
> then uses the 'loadvm' monitor command to restore the VM state ?
Sorry, this email totally slipped past me. The 'loadvm' monitor
command does this:
vm_stop(RUN_STATE_RESTORE_VM);
Which sets the correct state.
>
>
> > diff --git a/softmmu/runstate.c b/softmmu/runstate.c
> > index 1e68680b9d..fa3dd3a4ab 100644
> > --- a/softmmu/runstate.c
> > +++ b/softmmu/runstate.c
> > @@ -76,6 +76,7 @@ typedef struct {
> >
> > static const RunStateTransition runstate_transitions_def[] = {
> > { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE },
> > + { RUN_STATE_PRELAUNCH, RUN_STATE_RESTORE_VM },
> >
> > { RUN_STATE_DEBUG, RUN_STATE_RUNNING },
> > { RUN_STATE_DEBUG, RUN_STATE_FINISH_MIGRATE },
> > diff --git a/softmmu/vl.c b/softmmu/vl.c
> > index 706bd7cff7..29586d94ff 100644
> > --- a/softmmu/vl.c
> > +++ b/softmmu/vl.c
> > @@ -3131,6 +3131,9 @@ void qemu_init(int argc, char **argv, char **envp)
> > add_device_config(DEV_DEBUGCON, optarg);
> > break;
> > case QEMU_OPTION_loadvm:
> > + if (!loadvm) {
> > + runstate_set(RUN_STATE_RESTORE_VM);
> > + }
> > loadvm = optarg;
> > break;
> > case QEMU_OPTION_full_screen:
> > --
> > 2.28.0
> >
> >
>
> With regards,
> Daniel
> --
> |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org -o- https://fstop138.berrange.com :|
> |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] Revert "usbredir: avoid queuing hello packet on snapshot restore"
2022-08-13 1:10 ` [PATCH 1/3] Revert "usbredir: avoid queuing hello packet on snapshot restore" Joelle van Dyne
@ 2022-11-21 12:26 ` Ján Tomko
0 siblings, 0 replies; 12+ messages in thread
From: Ján Tomko @ 2022-11-21 12:26 UTC (permalink / raw)
To: Joelle van Dyne; +Cc: qemu-devel, Gerd Hoffmann, victortoso
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
On a Friday in 2022, Joelle van Dyne wrote:
>Run state is also in RUN_STATE_PRELAUNCH while "-S" is used.
>
>This reverts commit 12d182898a4866e4be418e2abac286b497cfa1b2.
>
>Signed-off-by: Joelle van Dyne <j@getutm.app>
>---
> hw/usb/redirect.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This fixes usb redirect on VM startup for VMs started by libvirt, which
uses -S:
https://bugzilla.redhat.com/show_bug.cgi?id=2144436
Jano
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-11-21 12:27 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-13 1:10 [PATCH 0/3] Set runstate to RUN_STATE_RESTORE_VM when started with "-loadvm" Joelle van Dyne
2022-08-13 1:10 ` [PATCH 1/3] Revert "usbredir: avoid queuing hello packet on snapshot restore" Joelle van Dyne
2022-11-21 12:26 ` Ján Tomko
2022-08-13 1:10 ` [PATCH 2/3] vl: on -loadvm set run state to "restore-vm" Joelle van Dyne
2022-08-22 10:11 ` Daniel P. Berrangé
2022-10-29 23:35 ` Joelle van Dyne
2022-08-13 1:10 ` [PATCH 3/3] usbredir: avoid queuing hello packet on snapshot restore Joelle van Dyne
2022-08-13 5:30 ` Victor Toso
2022-08-13 5:33 ` Joelle van Dyne
2022-08-13 5:50 ` Victor Toso
2022-08-13 5:57 ` Joelle van Dyne
2022-08-13 7:12 ` Victor Toso
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).