After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685544 - What should we do with S3 mode
What should we do with S3 mode
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
3.6.x
Other Linux
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-10-05 09:06 UTC by Alexander Larsson
Modified: 2016-03-31 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vm-configurator: Disable S3/S4 states for new domains (1.78 KB, patch)
2012-10-09 20:07 UTC, Zeeshan Ali
none Details | Review
vm-configurator: Disable S3/S4 states for new domains (1.78 KB, patch)
2012-10-10 20:08 UTC, Zeeshan Ali
none Details | Review
vm-configurator: Disable S3/S4 states for new domains (4.43 KB, patch)
2012-10-11 18:03 UTC, Zeeshan Ali
committed Details | Review

Description Alexander Larsson 2012-10-05 09:06:13 UTC
With bug 685383 fixed we now at least don't break when S3 mode happens. However, in its current form S3 mode is not very useful for boxes.

VMs going into S3 mode after some time idle don't actually use less resources, all that happens is that we unexpectedly disconnect from the vm.

I see two possible approaches here:
1) Disable S3 mode in all boxes created VMs
2) Use the S3 mode as a trigger to boxes saying that the VM is now idle. We can then use this trigger to do something that can actually save resources, such as saving the VM to disk.
Comment 1 Alexander Larsson 2012-10-09 12:07:58 UTC
There seems to be quite some issues with S3/S4 support atm, so maybe it would be best to just disable it for boxes created guests for now.
Comment 2 Zeeshan Ali 2012-10-09 17:31:33 UTC
(In reply to comment #1)
> There seems to be quite some issues with S3/S4 support atm, so maybe it would
> be best to just disable it for boxes created guests for now.

Sure but that would need new API in libvirt-gconfig for this: http://libvirt.org/formatdomain.html#elementsPowerManagement
Comment 3 Zeeshan Ali 2012-10-09 20:07:26 UTC
Created attachment 226141 [details] [review]
vm-configurator: Disable S3/S4 states for new domains

There seems to be some issues with S3 and S4 power state support in
libvirt/qemu. Lets disable these for now in new domains.
Comment 4 Zeeshan Ali 2012-10-09 20:12:38 UTC
(In reply to comment #3)
> Created an attachment (id=226141) [details] [review]
> vm-configurator: Disable S3/S4 states for new domains

This patches requires this libvirt-glib patch:

https://www.redhat.com/archives/libvir-list/2012-October/msg00377.html

Although these two do the right thing and I see this in the XML created by libvirt-gconfig APIs:

  <pm>
    <suspend-to-ram enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>

They seem to be missing from the XML configuration of the domain created for some reason. I don't get any error/warning from libvirt so I'm guessing that at least it accepts this as correct configuration.
Comment 5 Alexander Larsson 2012-10-10 08:55:09 UTC
Hmm, these seems right to me, but I'm not sure we can depend unconditionally on a new libvirt-glib in stable.
Comment 6 Christophe Fergeau 2012-10-10 09:30:49 UTC
(In reply to comment #4)
> Although these two do the right thing and I see this in the XML created by
> libvirt-gconfig APIs:
> 
>   <pm>
>     <suspend-to-ram enabled="no"/>
>     <suspend-to-disk enabled="no"/>
>   </pm>
> 
> They seem to be missing from the XML configuration of the domain created for
> some reason. I don't get any error/warning from libvirt so I'm guessing that at
> least it accepts this as correct configuration.

And does it do the right thing in VMs? For example, no suspend on a f18 VM when it's created with this patch.
Comment 7 Christophe Fergeau 2012-10-10 09:32:23 UTC
(In reply to comment #5)
> Hmm, these seems right to me, but I'm not sure we can depend unconditionally on
> a new libvirt-glib in stable.

Same concerns as Alex.
Comment 8 Zeeshan Ali 2012-10-10 16:06:42 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > Although these two do the right thing and I see this in the XML created by
> > libvirt-gconfig APIs:
> > 
> >   <pm>
> >     <suspend-to-ram enabled="no"/>
> >     <suspend-to-disk enabled="no"/>
> >   </pm>
> > 
> > They seem to be missing from the XML configuration of the domain created for
> > some reason. I don't get any error/warning from libvirt so I'm guessing that at
> > least it accepts this as correct configuration.
> 
> And does it do the right thing in VMs? For example, no suspend on a f18 VM when
> it's created with this patch.

Nope. I didn't expect it to either since what maters is the final xml configuration.
Comment 9 Zeeshan Ali 2012-10-10 20:08:13 UTC
Created attachment 226200 [details] [review]
vm-configurator: Disable S3/S4 states for new domains

v2: Updated as underlying libvirt-glib API changed.

Now that I am running latest libvirtd, this patch works as expected. i-e I do not get the 'suspend' option in F18 live VM.
Comment 10 Alexander Larsson 2012-10-11 09:18:57 UTC
I think this is fine if you add some tweaks to make it a configure time dependency. Unfortunately thats a bit tricky with vala as we want the ifdefs to work with the prebuilt shipped C code.

The way you can do this is turn the ifdef into a runtime if (HAVE_PMSTATE) check. Then you set HAVE_PMSTATE to always 0 or 1 in configure. And additionally, in the !HAVE_PMSTATE case you add some defines such that the code still compiles (doing whatever, it will not run anyway).

You can look at how i did this for the other pmstate stuff.

With that in we do the right thing if you build with the newer libs, but if you have the older libs anyway (which basically has no s3 anyway so are fine) then things keep building.

Then we can remove the hackery after we branch for 3.7.
Comment 11 Zeeshan Ali 2012-10-11 18:03:20 UTC
Created attachment 226285 [details] [review]
vm-configurator: Disable S3/S4 states for new domains

There seems to be some issues with S3 and S4 power state support in
libvirt/qemu. Lets disable these for now in new domains.

This patch includes some hacks to not bump libvirt-gconfig dependency.
If boxes is built against older libvirt-gconfg, the newly added code
simply compiles to NOOP.
Comment 12 Alexander Larsson 2012-10-15 07:43:44 UTC
Review of attachment 226285 [details] [review]:

ack
Comment 13 Zeeshan Ali 2012-10-15 12:36:10 UTC
Attachment 226285 [details] pushed as 969b404 - vm-configurator: Disable S3/S4 states for new domains