* [Qemu-devel] [PULL 1/3] hmp: fix info cpus for sparc targets
2012-10-24 13:34 [Qemu-devel] [PULL 0/3] QMP queue Luiz Capitulino
@ 2012-10-24 13:34 ` Luiz Capitulino
2012-10-24 13:34 ` [Qemu-devel] [PULL 2/3] qmp: handle stop/cont in INMIGRATE state Luiz Capitulino
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2012-10-24 13:34 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
From: Aurelien Jarno <aurelien@aurel32.net>
On sparc targets, info cpus returns this kind of output:
| info cpus
| * CPU #0: pc=0x0000000000424d18pc=0x0000000000424d18npc=0x0000000000424d1c thread_id=19460
pc is printed twice, there is no space between pc, pc and npc.
With this patch, pc is not printed anymore when has_npc is set. In addition
the space is printed before pc/nip/npc/PC instead of after the colon so that
multiple prints are possible. This result on the following kind of input on
sparc targets:
| info cpus
| * CPU #0: pc=0x0000000000424d18 npc=0x0000000000424d1c thread_id=19460
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
hmp.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hmp.c b/hmp.c
index 2b97982..9df84e3 100644
--- a/hmp.c
+++ b/hmp.c
@@ -245,20 +245,19 @@ void hmp_info_cpus(Monitor *mon)
active = '*';
}
- monitor_printf(mon, "%c CPU #%" PRId64 ": ", active, cpu->value->CPU);
+ monitor_printf(mon, "%c CPU #%" PRId64 ":", active, cpu->value->CPU);
if (cpu->value->has_pc) {
- monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
+ monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->pc);
}
if (cpu->value->has_nip) {
- monitor_printf(mon, "nip=0x%016" PRIx64, cpu->value->nip);
+ monitor_printf(mon, " nip=0x%016" PRIx64, cpu->value->nip);
}
if (cpu->value->has_npc) {
- monitor_printf(mon, "pc=0x%016" PRIx64, cpu->value->pc);
- monitor_printf(mon, "npc=0x%016" PRIx64, cpu->value->npc);
+ monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->npc);
}
if (cpu->value->has_PC) {
- monitor_printf(mon, "PC=0x%016" PRIx64, cpu->value->PC);
+ monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->PC);
}
if (cpu->value->halted) {
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL 2/3] qmp: handle stop/cont in INMIGRATE state
2012-10-24 13:34 [Qemu-devel] [PULL 0/3] QMP queue Luiz Capitulino
2012-10-24 13:34 ` [Qemu-devel] [PULL 1/3] hmp: fix info cpus for sparc targets Luiz Capitulino
@ 2012-10-24 13:34 ` Luiz Capitulino
2012-10-24 13:34 ` [Qemu-devel] [PULL 3/3] migration: go to paused state after finishing incoming migration with -S Luiz Capitulino
2012-10-29 14:35 ` [Qemu-devel] [PULL 0/3] QMP queue Aurelien Jarno
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2012-10-24 13:34 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
From: Paolo Bonzini <pbonzini@redhat.com>
Right now, stop followed by an incoming migration will let the
virtual machine start. cont before an incoming migration instead
will fail.
This is bad because the actual behavior is not predictable; it is
racy with respect to the start of the incoming migration. That's
because incoming migration is blocking, and thus will delay the
processing of stop/cont until the end of the migration.
In addition, there's nothing that really prevents the user from
typing the block device's passwords before incoming migration is
done, so returning the DeviceEncrypted error is also helpful in
the QMP case.
Both things can be fixed by just toggling the autostart variable when
stop/cont are called in INMIGRATE state.
Note that libvirt is currently working around the race by looping
if the MigrationExpected answer is returned. After this patch, the
command will return right away without ever raising an error.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
qapi-schema.json | 23 ++++++++++++++---------
qerror.h | 3 ---
qmp.c | 17 +++++++++++------
3 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/qapi-schema.json b/qapi-schema.json
index c615ee2..6b14edc 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -22,15 +22,11 @@
# @KVMMissingCap: the requested operation can't be fulfilled because a
# required KVM capability is missing
#
-# @MigrationExpected: the requested operation can't be fulfilled because a
-# migration process is expected
-#
# Since: 1.2
##
{ 'enum': 'ErrorClass',
'data': [ 'GenericError', 'CommandNotFound', 'DeviceEncrypted',
- 'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap',
- 'MigrationExpected' ] }
+ 'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
##
# @add_client
@@ -149,7 +145,11 @@
#
# @finish-migrate: guest is paused to finish the migration process
#
-# @inmigrate: guest is paused waiting for an incoming migration
+# @inmigrate: guest is paused waiting for an incoming migration. Note
+# that this state does not tell whether the machine will start at the
+# end of the migration. This depends on the command-line -S option and
+# any invocation of 'stop' or 'cont' that has happened since QEMU was
+# started.
#
# @internal-error: An internal error that prevents further guest execution
# has occurred
@@ -1210,7 +1210,9 @@
# Since: 0.14.0
#
# Notes: This function will succeed even if the guest is already in the stopped
-# state
+# state. In "inmigrate" state, it will ensure that the guest
+# remains paused once migration finishes, as if the -S option was
+# passed on the command line.
##
{ 'command': 'stop' }
@@ -1299,11 +1301,14 @@
# Since: 0.14.0
#
# Returns: If successful, nothing
-# If the QEMU is waiting for an incoming migration, MigrationExpected
# If QEMU was started with an encrypted block device and a key has
# not yet been set, DeviceEncrypted.
#
-# Notes: This command will succeed if the guest is currently running.
+# Notes: This command will succeed if the guest is currently running. It
+# will also succeed if the guest is in the "inmigrate" state; in
+# this case, the effect of the command is to make sure the guest
+# starts once migration finishes, removing the effect of the -S
+# command line option if it was passed.
##
{ 'command': 'cont' }
diff --git a/qerror.h b/qerror.h
index c91708c..5e98a39 100644
--- a/qerror.h
+++ b/qerror.h
@@ -165,9 +165,6 @@ void assert_no_error(Error *err);
#define QERR_MIGRATION_NOT_SUPPORTED \
ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'"
-#define QERR_MIGRATION_EXPECTED \
- ERROR_CLASS_MIGRATION_EXPECTED, "An incoming migration is expected before this command can be executed"
-
#define QERR_MISSING_PARAMETER \
ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
diff --git a/qmp.c b/qmp.c
index 36c54c5..2c8d559 100644
--- a/qmp.c
+++ b/qmp.c
@@ -85,7 +85,11 @@ void qmp_quit(Error **err)
void qmp_stop(Error **errp)
{
- vm_stop(RUN_STATE_PAUSED);
+ if (runstate_check(RUN_STATE_INMIGRATE)) {
+ autostart = 0;
+ } else {
+ vm_stop(RUN_STATE_PAUSED);
+ }
}
void qmp_system_reset(Error **errp)
@@ -144,10 +148,7 @@ void qmp_cont(Error **errp)
{
Error *local_err = NULL;
- if (runstate_check(RUN_STATE_INMIGRATE)) {
- error_set(errp, QERR_MIGRATION_EXPECTED);
- return;
- } else if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
+ if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
runstate_check(RUN_STATE_SHUTDOWN)) {
error_set(errp, QERR_RESET_REQUIRED);
return;
@@ -162,7 +163,11 @@ void qmp_cont(Error **errp)
return;
}
- vm_start();
+ if (runstate_check(RUN_STATE_INMIGRATE)) {
+ autostart = 1;
+ } else {
+ vm_start();
+ }
}
void qmp_system_wakeup(Error **errp)
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL 3/3] migration: go to paused state after finishing incoming migration with -S
2012-10-24 13:34 [Qemu-devel] [PULL 0/3] QMP queue Luiz Capitulino
2012-10-24 13:34 ` [Qemu-devel] [PULL 1/3] hmp: fix info cpus for sparc targets Luiz Capitulino
2012-10-24 13:34 ` [Qemu-devel] [PULL 2/3] qmp: handle stop/cont in INMIGRATE state Luiz Capitulino
@ 2012-10-24 13:34 ` Luiz Capitulino
2012-10-29 14:35 ` [Qemu-devel] [PULL 0/3] QMP queue Aurelien Jarno
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2012-10-24 13:34 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
From: Paolo Bonzini <pbonzini@redhat.com>
At the end of migration the machine has started already, and cannot be
destroyed without losing the guest's data. Hence, prelaunch is the
wrong state. Go to the paused state instead. QEMU would reach that
state anyway (after running the guest for the blink of an eye) if the
"stop" command had been received after the start of migration.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
migration.c | 2 +-
vl.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/migration.c b/migration.c
index 62e0304..e9a5822 100644
--- a/migration.c
+++ b/migration.c
@@ -102,7 +102,7 @@ void process_incoming_migration(QEMUFile *f)
if (autostart) {
vm_start();
} else {
- runstate_set(RUN_STATE_PRELAUNCH);
+ runstate_set(RUN_STATE_PAUSED);
}
}
diff --git a/vl.c b/vl.c
index ee3c43a..188af45 100644
--- a/vl.c
+++ b/vl.c
@@ -341,7 +341,7 @@ static const RunStateTransition runstate_transitions_def[] = {
{ RUN_STATE_DEBUG, RUN_STATE_RUNNING },
{ RUN_STATE_INMIGRATE, RUN_STATE_RUNNING },
- { RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH },
+ { RUN_STATE_INMIGRATE, RUN_STATE_PAUSED },
{ RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED },
{ RUN_STATE_INTERNAL_ERROR, RUN_STATE_FINISH_MIGRATE },
--
1.7.12.315.g682ce8b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PULL 0/3] QMP queue
2012-10-24 13:34 [Qemu-devel] [PULL 0/3] QMP queue Luiz Capitulino
` (2 preceding siblings ...)
2012-10-24 13:34 ` [Qemu-devel] [PULL 3/3] migration: go to paused state after finishing incoming migration with -S Luiz Capitulino
@ 2012-10-29 14:35 ` Aurelien Jarno
3 siblings, 0 replies; 5+ messages in thread
From: Aurelien Jarno @ 2012-10-29 14:35 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: aliguori, qemu-devel
On Wed, Oct 24, 2012 at 11:34:37AM -0200, Luiz Capitulino wrote:
> The changes (since a8170e5e97ad17ca169c64ba87ae2f53850dab4c) are available
> in the following repository:
>
> git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
>
> Aurelien Jarno (1):
> hmp: fix info cpus for sparc targets
>
> Paolo Bonzini (2):
> qmp: handle stop/cont in INMIGRATE state
> migration: go to paused state after finishing incoming migration with
> -S
>
> hmp.c | 11 +++++------
> migration.c | 2 +-
> qapi-schema.json | 23 ++++++++++++++---------
> qerror.h | 3 ---
> qmp.c | 17 +++++++++++------
> vl.c | 2 +-
> 6 files changed, 32 insertions(+), 26 deletions(-)
>
Thanks, pulled.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread