[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [RFC] exporting KVM host power saving capabilities through libvirt



Hi,

Linux host systems running KVM support various power management
capabilities.  Most of the features like DVFS and sleep states can be
independently exploited by the host system itself based on system
utilisation subject to policies set by the administrator.

However, system-wide low power states like S3 and S4 would require
external communication and interaction with the systems management
stack in order to be used.  The first steps in this direction would be
to allow systems management stack to discover host power saving
capabilities like S3 and S4 along with various other host CPU
capabilities.

Libvirt seems to be the main glue layer between the platform and the
systems-management stack.  Adding host power savings capabilities as
part of libvirt host discovery mechanism seems to be one possible
approach without addition of any new APIs or agents.

libvirt has virConnectGetCapabilities() that would export an XML file
describing the capabilities of the host platform and guest features.

KVM hypervisor's capability to support S3 can be exported as a host
feature in the XML as follows:

<host>
    <uuid>94a3492f-2635-2491-8c87-8de976fad119</uuid>
    <cpu>
      <arch>x86_64</arch>
      <features>        <<<=== New host feature fields
        <S3/>
        <S4/>
      </features>
      <model>Westmere</model>
      <vendor>Intel</vendor>
      <topology sockets='1' cores='2' threads='2'/>
      <feature name='rdtscp'/>
      <feature name='xtpr'/>
      <feature name='tm2'/>
      <feature name='est'/>
      <feature name='vmx'/>     <<<= These are host CPU features

System management software that works through libvirt, already queries
this capabilities XML file and hence no new API is needed.

As simple discovery mechanism can be added to libvirt as follows:

Index: libvirt-0.9.0/src/qemu/qemu_capabilities.c
===================================================================
--- libvirt-0.9.0.orig/src/qemu/qemu_capabilities.c
+++ libvirt-0.9.0/src/qemu/qemu_capabilities.c
@@ -738,6 +738,14 @@ virCapsPtr qemuCapsInit(virCapsPtr old_c
     virCapabilitiesAddHostMigrateTransport(caps,
                                            "tcp");

+    /* Add host energy management host capabilities */
+
+    /* if "pm-is-supported --suspend" == 0 */
+    virCapabilitiesAddHostFeature(caps, "S3");
+
+    /* if "pm-is-supported --hibernate" == 0 */
+    virCapabilitiesAddHostFeature(caps, "S4");
+
     /* First the pure HVM guests */
     for (i = 0 ; i < ARRAY_CARDINALITY(arch_info_hvm) ; i++)
         if (qemuCapsInitGuest(caps, old_caps,


Please let me know your comments, I will code a working prototype
shortly and post for review/discussion.

Thanks,
Vaidy



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]