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

Re: [libvirt] [PATCH] qemu: New XML to disable memory merge at guest startup



On 17/04/13 22:54, Eric Blake wrote:
On 04/17/2013 08:22 AM, Osier Yang wrote:
QEMU introduced command line "-mem-merge=on|off" (defaults to on) to
enable/disable the memory merge (KSM) at guest startup. This exposes
it by new XML:
   <memoryBacking>
     <nosharepages/>
   </memoryBacking>

The XML tag is same with what we used internally for old RHEL.
Good - that means that RHEL 6 (and any other downstream distro that was
already borrowing the RHEL extension) will not break when rebasing to
pick up this change from upstream in place of their downstream extension
(RHEL will actually want to add a followup patch on top of this that
_also_ tries the older -redhat-disable-KSM downstream spelling of the
option, but that's a problem for RHEL and not this list).

---
  docs/formatdomain.html.in                          | 13 +++++++---
  docs/schemas/domaincommon.rng                      |  5 ++++
  src/conf/domain_conf.c                             | 20 ++++++++++-----
  src/conf/domain_conf.h                             |  1 +
  src/qemu/qemu_capabilities.c                       |  4 +++
  src/qemu/qemu_capabilities.h                       |  1 +
  src/qemu/qemu_command.c                            | 11 ++++++++
  .../qemuxml2argv-nosharepages.args                 |  4 +++
  .../qemuxml2argvdata/qemuxml2argv-nosharepages.xml | 29 ++++++++++++++++++++++
  tests/qemuxml2argvtest.c                           |  1 +
  tests/qemuxml2xmltest.c                            |  1 +
  11 files changed, 80 insertions(+), 10 deletions(-)
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nosharepages.args
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nosharepages.xml
Couple of problems:

+      <dd>The optional <code>memoryBacking</code> element has two
+        optional elements. The element <code>hugepages</code> tells
+        the hypervisor that the guest should have its memory allocated
+        using hugepages instead of the normal native page size. And the
+        optional element <code>nosharepages</code> tells the hypervisor
+        that share pages (memory merge, KSM) should be disabled on guest
+        startup.
Please add a "since" tag, mentioning that nosharepages was added in 1.0.5.

+++ b/docs/schemas/domaincommon.rng
@@ -495,6 +495,11 @@
                <empty/>
              </element>
            </optional>
+          <optional>
+            <element name="nosharepages">
+              <empty/>
+            </element>
+          </optional>
Please add an <interleave> around the two optional sub-elements, so that
users can specify them in either order (as written, RNG would reject
<memoryBacking><nosharepages/><hugepages/></memoryBacking>).

@@ -1082,6 +1083,9 @@ virQEMUCapsComputeCmdFlags(const char *help,
      if (strstr(help, "-machine"))
          virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT);
+ if (strstr(help, "-mem-merge"))
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_MEM_MERGE);
This would only scrape the existence of -mem-merge in qemu 1.2 and
earlier, since we don't read -help in 1.3 and later.  But qemu 1.2
doesn't have -mem-merge, so this bit will never get set.  You need to
instead populate the new capability based on a QMP probe, not string
scraping.  But I don't know offhand what that probe would be; you may
need to ask on the qemu list.
hum, there is no way to query the qemu config schema via qmp
yet...

https://www.redhat.com/archives/libvir-list/2013-January/msg01656.html

The patch from Amos looks fine to me except:

1) I think either libvirt  or qemu won't want the hmp command anymore,
    as long as a new command is introduced.
2) the name should be query-config-schema, as query-config sounds like
   we are trying to get the current config of the guest
3) If no option name is specified, it's good to output all the config schema
   qemu supports.

I asked Amos to repost the patch, let's see if we can get the support soon.

Osier


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