qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 5/5] qmp: add SUSPEND_DISK event
@ 2012-08-09 17:30 Luiz Capitulino
  2012-08-09 17:34 ` Luiz Capitulino
  2012-08-09 19:51 ` Eric Blake
  0 siblings, 2 replies; 5+ messages in thread
From: Luiz Capitulino @ 2012-08-09 17:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: mkletzan, kraxel, gleb

Emitted when the guest makes a request to enter S4 state.

There are three possible ways of having this event, as described here:

 http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg02307.html

I've decided to add a new event and make it indepedent of SHUTDOWN.
This means that the SHUTDOWN event will eventually follow the
SUSPEND_DISK event.

I've choosen this way because of two reasons:

 1. Having an indepedent event makes it possible to query for its
    existence by using query-events

 2. In the future, we may allow the user to change what QEMU should
    do as a result of the guest entering S4. So it's a good idea to
    keep both events separated

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---

This is on top of:

 [PATCH 0/4]: qmp: WAKEUP event related fixes

 QMP/qmp-events.txt | 14 ++++++++++++++
 hw/acpi.c          |  2 ++
 monitor.c          |  1 +
 monitor.h          |  1 +
 4 files changed, 18 insertions(+)

diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
index 2001a71..1c51bee 100644
--- a/QMP/qmp-events.txt
+++ b/QMP/qmp-events.txt
@@ -252,6 +252,20 @@ Example:
 { "event": "SUSPEND",
      "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
 
+SUSPEND_DISK
+------------
+
+Emitted when the guest makes a request to enter S4 state.
+
+Data: None.
+
+Example:
+
+{ "event": "SUSPEND_DISK",
+     "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
+
+Note: QEMU shutdowns when entering S4 state.
+
 VNC_CONNECTED
 -------------
 
diff --git a/hw/acpi.c b/hw/acpi.c
index effc7ec..f7950be 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -22,6 +22,7 @@
 #include "hw.h"
 #include "pc.h"
 #include "acpi.h"
+#include "monitor.h"
 
 struct acpi_table_header {
     uint16_t _length;         /* our length, not actual part of the hdr */
@@ -386,6 +387,7 @@ void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val, char s4)
             break;
         default:
             if (sus_typ == s4) { /* S4 request */
+                monitor_protocol_event(QEVENT_SUSPEND_DISK, NULL);
                 qemu_system_shutdown_request();
             }
             break;
diff --git a/monitor.c b/monitor.c
index 49dccfe..4f3c595 100644
--- a/monitor.c
+++ b/monitor.c
@@ -456,6 +456,7 @@ static const char *monitor_event_names[] = {
     [QEVENT_BLOCK_JOB_CANCELLED] = "BLOCK_JOB_CANCELLED",
     [QEVENT_DEVICE_TRAY_MOVED] = "DEVICE_TRAY_MOVED",
     [QEVENT_SUSPEND] = "SUSPEND",
+    [QEVENT_SUSPEND_DISK] = "SUSPEND_DISK",
     [QEVENT_WAKEUP] = "WAKEUP",
     [QEVENT_BALLOON_CHANGE] = "BALLOON_CHANGE",
 };
diff --git a/monitor.h b/monitor.h
index 5f4de1b..4ef9a04 100644
--- a/monitor.h
+++ b/monitor.h
@@ -40,6 +40,7 @@ typedef enum MonitorEvent {
     QEVENT_BLOCK_JOB_CANCELLED,
     QEVENT_DEVICE_TRAY_MOVED,
     QEVENT_SUSPEND,
+    QEVENT_SUSPEND_DISK,
     QEVENT_WAKEUP,
     QEVENT_BALLOON_CHANGE,
 
-- 
1.7.11.2.249.g31c7954.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] qmp: add SUSPEND_DISK event
  2012-08-09 17:30 [Qemu-devel] [PATCH 5/5] qmp: add SUSPEND_DISK event Luiz Capitulino
@ 2012-08-09 17:34 ` Luiz Capitulino
  2012-08-09 19:51 ` Eric Blake
  1 sibling, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2012-08-09 17:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: mkletzan, kraxel, gleb

On Thu, 9 Aug 2012 14:30:32 -0300
Luiz Capitulino <lcapitulino@redhat.com> wrote:

> Emitted when the guest makes a request to enter S4 state.

Oops, sorry for the bad subject. It should be just '[PATCH]'.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] qmp: add SUSPEND_DISK event
  2012-08-09 17:30 [Qemu-devel] [PATCH 5/5] qmp: add SUSPEND_DISK event Luiz Capitulino
  2012-08-09 17:34 ` Luiz Capitulino
@ 2012-08-09 19:51 ` Eric Blake
  2012-08-09 20:48   ` Luiz Capitulino
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Blake @ 2012-08-09 19:51 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: mkletzan, qemu-devel, gleb, kraxel

[-- Attachment #1: Type: text/plain, Size: 1987 bytes --]

On 08/09/2012 11:30 AM, Luiz Capitulino wrote:
> Emitted when the guest makes a request to enter S4 state.
> 
> There are three possible ways of having this event, as described here:
> 
>  http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg02307.html
> 
> I've decided to add a new event and make it indepedent of SHUTDOWN.
> This means that the SHUTDOWN event will eventually follow the
> SUSPEND_DISK event.
> 
> I've choosen this way because of two reasons:
> 
>  1. Having an indepedent event makes it possible to query for its
>     existence by using query-events
> 
>  2. In the future, we may allow the user to change what QEMU should
>     do as a result of the guest entering S4. So it's a good idea to
>     keep both events separated

Indeed makes sense as a separate event.

> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
> 
> This is on top of:
> 
>  [PATCH 0/4]: qmp: WAKEUP event related fixes
> 
>  QMP/qmp-events.txt | 14 ++++++++++++++
>  hw/acpi.c          |  2 ++
>  monitor.c          |  1 +
>  monitor.h          |  1 +
>  4 files changed, 18 insertions(+)
> 
> diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
> index 2001a71..1c51bee 100644
> --- a/QMP/qmp-events.txt
> +++ b/QMP/qmp-events.txt
> @@ -252,6 +252,20 @@ Example:
>  { "event": "SUSPEND",
>       "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
>  
> +SUSPEND_DISK
> +------------
> +
> +Emitted when the guest makes a request to enter S4 state.
> +
> +Data: None.
> +
> +Example:
> +
> +{ "event": "SUSPEND_DISK",
> +     "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
> +
> +Note: QEMU shutdowns when entering S4 state.

s/shutdowns/shuts down/

Is that true when you use the -no-shutdown flag?  Do you get this event
if you did not use the -no-shutdown flag?

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] qmp: add SUSPEND_DISK event
  2012-08-09 19:51 ` Eric Blake
@ 2012-08-09 20:48   ` Luiz Capitulino
  2012-08-09 20:52     ` Luiz Capitulino
  0 siblings, 1 reply; 5+ messages in thread
From: Luiz Capitulino @ 2012-08-09 20:48 UTC (permalink / raw)
  To: Eric Blake; +Cc: mkletzan, qemu-devel, gleb, kraxel

On Thu, 09 Aug 2012 13:51:10 -0600
Eric Blake <eblake@redhat.com> wrote:

> On 08/09/2012 11:30 AM, Luiz Capitulino wrote:
> > Emitted when the guest makes a request to enter S4 state.
> > 
> > There are three possible ways of having this event, as described here:
> > 
> >  http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg02307.html
> > 
> > I've decided to add a new event and make it indepedent of SHUTDOWN.
> > This means that the SHUTDOWN event will eventually follow the
> > SUSPEND_DISK event.
> > 
> > I've choosen this way because of two reasons:
> > 
> >  1. Having an indepedent event makes it possible to query for its
> >     existence by using query-events
> > 
> >  2. In the future, we may allow the user to change what QEMU should
> >     do as a result of the guest entering S4. So it's a good idea to
> >     keep both events separated
> 
> Indeed makes sense as a separate event.
> 
> > 
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> > 
> > This is on top of:
> > 
> >  [PATCH 0/4]: qmp: WAKEUP event related fixes
> > 
> >  QMP/qmp-events.txt | 14 ++++++++++++++
> >  hw/acpi.c          |  2 ++
> >  monitor.c          |  1 +
> >  monitor.h          |  1 +
> >  4 files changed, 18 insertions(+)
> > 
> > diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
> > index 2001a71..1c51bee 100644
> > --- a/QMP/qmp-events.txt
> > +++ b/QMP/qmp-events.txt
> > @@ -252,6 +252,20 @@ Example:
> >  { "event": "SUSPEND",
> >       "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
> >  
> > +SUSPEND_DISK
> > +------------
> > +
> > +Emitted when the guest makes a request to enter S4 state.
> > +
> > +Data: None.
> > +
> > +Example:
> > +
> > +{ "event": "SUSPEND_DISK",
> > +     "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
> > +
> > +Note: QEMU shutdowns when entering S4 state.
> 
> s/shutdowns/shuts down/
> 
> Is that true when you use the -no-shutdown flag?  Do you get this event
> if you did not use the -no-shutdown flag?

Yes, the event is orthogonal to the -no-shutdown flag, but qemu won't
shut down if -no-shutdown is passed. I'll fix that note.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] qmp: add SUSPEND_DISK event
  2012-08-09 20:48   ` Luiz Capitulino
@ 2012-08-09 20:52     ` Luiz Capitulino
  0 siblings, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2012-08-09 20:52 UTC (permalink / raw)
  To: Eric Blake; +Cc: mkletzan, qemu-devel, gleb, kraxel

On Thu, 9 Aug 2012 17:48:34 -0300
Luiz Capitulino <lcapitulino@redhat.com> wrote:

> On Thu, 09 Aug 2012 13:51:10 -0600
> Eric Blake <eblake@redhat.com> wrote:
> 
> > On 08/09/2012 11:30 AM, Luiz Capitulino wrote:
> > > Emitted when the guest makes a request to enter S4 state.
> > > 
> > > There are three possible ways of having this event, as described here:
> > > 
> > >  http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg02307.html
> > > 
> > > I've decided to add a new event and make it indepedent of SHUTDOWN.
> > > This means that the SHUTDOWN event will eventually follow the
> > > SUSPEND_DISK event.
> > > 
> > > I've choosen this way because of two reasons:
> > > 
> > >  1. Having an indepedent event makes it possible to query for its
> > >     existence by using query-events
> > > 
> > >  2. In the future, we may allow the user to change what QEMU should
> > >     do as a result of the guest entering S4. So it's a good idea to
> > >     keep both events separated
> > 
> > Indeed makes sense as a separate event.
> > 
> > > 
> > > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > > ---
> > > 
> > > This is on top of:
> > > 
> > >  [PATCH 0/4]: qmp: WAKEUP event related fixes
> > > 
> > >  QMP/qmp-events.txt | 14 ++++++++++++++
> > >  hw/acpi.c          |  2 ++
> > >  monitor.c          |  1 +
> > >  monitor.h          |  1 +
> > >  4 files changed, 18 insertions(+)
> > > 
> > > diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
> > > index 2001a71..1c51bee 100644
> > > --- a/QMP/qmp-events.txt
> > > +++ b/QMP/qmp-events.txt
> > > @@ -252,6 +252,20 @@ Example:
> > >  { "event": "SUSPEND",
> > >       "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
> > >  
> > > +SUSPEND_DISK
> > > +------------
> > > +
> > > +Emitted when the guest makes a request to enter S4 state.
> > > +
> > > +Data: None.
> > > +
> > > +Example:
> > > +
> > > +{ "event": "SUSPEND_DISK",
> > > +     "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
> > > +
> > > +Note: QEMU shutdowns when entering S4 state.
> > 
> > s/shutdowns/shuts down/
> > 
> > Is that true when you use the -no-shutdown flag?  Do you get this event
> > if you did not use the -no-shutdown flag?
> 
> Yes, the event is orthogonal to the -no-shutdown flag, but qemu won't
> shut down if -no-shutdown is passed. I'll fix that note.

Oh, wait.

QEMU still shut downs, but with -no-shutdown it won't exit. So I think the
note doesn't need any changes.

Eric, you're confusing me :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-09 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-09 17:30 [Qemu-devel] [PATCH 5/5] qmp: add SUSPEND_DISK event Luiz Capitulino
2012-08-09 17:34 ` Luiz Capitulino
2012-08-09 19:51 ` Eric Blake
2012-08-09 20:48   ` Luiz Capitulino
2012-08-09 20:52     ` Luiz Capitulino

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).