From: Anthony Liguori <aliguori@us.ibm.com>
To: Ryan Harper <ryanh@us.ibm.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [PATCH] Add monitor command for system_reboot
Date: Fri, 08 May 2009 11:59:47 -0500 [thread overview]
Message-ID: <4A046503.8050209@us.ibm.com> (raw)
In-Reply-To: <1241801561-11441-1-git-send-email-ryanh@us.ibm.com>
Ryan Harper wrote:
> Add a new monitor command (system_reboot) for a soft reboot which uses
> system_powerdown to trigger ACPI shutdown in the guest and once shutdown is
> complete, trigger a reset instead of exiting qemu.
>
> Depends on commit a6d6552426dcbf726e5549f08b70c9318d6be14b which enabled ACPI
> power button support.
>
> Tested with Ubuntu 9.04 64-bit guest.
>
> Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
>
> diff --git a/hw/acpi.c b/hw/acpi.c
> index dbaf18a..346d100 100644
> --- a/hw/acpi.c
> +++ b/hw/acpi.c
> @@ -151,7 +151,13 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
> sus_typ = (val >> 10) & 7;
> switch(sus_typ) {
> case 0: /* soft power off */
> - qemu_system_shutdown_request();
> + /* after powerdown, if on system_reboot path, call reset
> + instead of shutdown */
> + if (qemu_reboot_requested()) {
> + qemu_system_reset_request();
> + } else {
> + qemu_system_shutdown_request();
> + }
> break;
>
If qemu_shutdown_requested(), then we'll immediately shutdown the system.
qemu_reboot_requested() has different semantics, it's really a soft
request. I think the name needs to reflect that.
Also, the soft reset flag ought to get reset whenever a VM changes it's
state. That is, if you do a system_reboot, then a system_reset (imagine
that the reboot fails), then you do a normal powerdown in the guest,
instead of shutting off like the user would expect, we'll reboot because
the qemu_reboot_requested() is still true.
A good way to do that would be by registering a reset handler in
hw/acpi.c. In fact, I think that the whole functionality probably
should live in hw/acpi.c.
And I think this also needs to be stored as part of the savevm state for
hw/acpi.c. If you do a system_reboot followed by an immediate live
migration, without the savevm handler, the VM will shutdown completely
after the migration instead of rebooting as expected.
--
Regards,
Anthony Liguori
next parent reply other threads:[~2009-05-08 16:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1241801561-11441-1-git-send-email-ryanh@us.ibm.com>
2009-05-08 16:59 ` Anthony Liguori [this message]
2009-05-08 17:13 ` [Qemu-devel] Re: [PATCH] Add monitor command for system_reboot Ryan Harper
2009-05-08 17:38 ` Anthony Liguori
2009-05-08 17:45 ` Ryan Harper
2009-05-08 18:14 ` Anthony Liguori
2009-05-08 18:26 ` Ryan Harper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A046503.8050209@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=ryanh@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.