qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Krempa <pkrempa@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
	Steve Sistare <steven.sistare@oracle.com>,
	qemu-devel@nongnu.org, John Snow <jsnow@redhat.com>,
	Cleber Rosa <crosa@redhat.com>, Eric Blake <eblake@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eduardo Habkost <eduardo@habkost.net>,
	Fabiano Rosas <farosas@suse.de>,
	Laurent Vivier <lvivier@redhat.com>,
	devel@lists.libvirt.org
Subject: Re: [PATCH V1 0/6] fast qom tree get
Date: Fri, 11 Apr 2025 11:11:49 +0100	[thread overview]
Message-ID: <Z_jq5drO_25w0bC6@redhat.com> (raw)
In-Reply-To: <Z_YolW1Nw6Q_tsz6@angien.pipo.sk>

On Wed, Apr 09, 2025 at 09:58:13AM +0200, Peter Krempa via Devel wrote:
> On Wed, Apr 09, 2025 at 09:39:02 +0200, Markus Armbruster via Devel wrote:
> > Hi Steve, I apologize for the slow response.
> > 
> > Steve Sistare <steven.sistare@oracle.com> writes:
> > 
> > > Using qom-list and qom-get to get all the nodes and property values in a
> > > QOM tree can take multiple seconds because it requires 1000's of individual
> > > QOM requests.  Some managers fetch the entire tree or a large subset
> > > of it when starting a new VM, and this cost is a substantial fraction of
> > > start up time.
> > 
> > "Some managers"... could you name one?
> 
> libvirt is at ~500 qom-get calls during an average startup ...
> 
> > > To reduce this cost, consider QAPI calls that fetch more information in
> > > each call:
> > >   * qom-list-get: given a path, return a list of properties and values.
> > >   * qom-list-getv: given a list of paths, return a list of properties and
> > >     values for each path.
> > >   * qom-tree-get: given a path, return all descendant nodes rooted at that
> > >     path, with properties and values for each.
> > 
> > Libvirt developers, would you be interested in any of these?
> 
> YES!!!

Not neccessarily, see below... !!!! 

> 
> The getter with value could SO MUCH optimize the startup sequence of a
> VM where libvirt needs to probe CPU flags:
> 
> (note the 'id' field in libvirt's monitor is sequential)
> 
> buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"realized"},"id":"libvirt-8"}
> buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"hotplugged"},"id":"libvirt-9"}
> buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"hotpluggable"},"id":"libvirt-10"}
> 
> [...]
> 
> buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"hv-apicv"},"id":"libvirt-470"}
> buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"xd"},"id":"libvirt-471"}
> buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"sse4_1"},"id":"libvirt-472"}
> buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"unavailable-features"},"id":"libvirt-473"}
> 
> First and last line's timestamps:
> 
> 2025-04-08 14:44:28.882+0000: 1481190: info : qemuMonitorIOWrite:340 : QEMU_MONITOR_IO_WRITE: mon=0x7f4678048360 buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"realized"},"id":"libvirt-8"}
> 
> 2025-04-08 14:44:29.149+0000: 1481190: info : qemuMonitorIOWrite:340 : QEMU_MONITOR_IO_WRITE: mon=0x7f4678048360 buf={"execute":"qom-get","arguments":{"path":"/machine/unattached/device[0]","property":"unavailable-features"},"id":"libvirt-473"}
> 
> Libvirt spent ~170 ms probing cpu flags.

One thing I would point out is that qom-get can be considered an
"escape hatch" to get information when no better QMP command exists.
In this case, libvirt has made the assumption that every CPU feature
is a QOM property.

Adding qom-list-get doesn't appreciably change that, just makes the
usage more efficient.

Considering the bigger picture QMP design, when libvirt is trying to
understand QEMU's CPU feature flag expansion, I would ask why we don't
have something like a "query-cpu" command to tell us the current CPU
expansion, avoiding the need for poking at QOM properties directly.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-04-11 10:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 21:09 [PATCH V1 0/6] fast qom tree get Steve Sistare
2025-03-03 21:09 ` [PATCH V1 1/6] qom: qom_resolve_path Steve Sistare
2025-05-06 14:25   ` Philippe Mathieu-Daudé
2025-03-03 21:09 ` [PATCH V1 2/6] qom: qom-tree-get Steve Sistare
2025-03-03 21:09 ` [PATCH V1 3/6] python: use qom-tree-get Steve Sistare
2025-03-03 21:10 ` [PATCH V1 4/6] tests/qtest/qom-test: unit test for qom-tree-get Steve Sistare
2025-03-03 21:10 ` [PATCH V1 5/6] qom: qom-list-getv Steve Sistare
2025-03-03 21:10 ` [PATCH V1 6/6] tests/qtest/qom-test: unit test for qom-list-getv Steve Sistare
2025-04-09  7:39 ` [PATCH V1 0/6] fast qom tree get Markus Armbruster
2025-04-09  7:58   ` Peter Krempa
2025-04-11 10:11     ` Daniel P. Berrangé [this message]
2025-04-11 10:40       ` Management applications and CPU feature flags (was: [PATCH V1 0/6] fast qom tree get) Markus Armbruster
2025-04-11 10:43         ` Daniel P. Berrangé
2025-04-11 11:43           ` Management applications and CPU feature flags Markus Armbruster
2025-04-11 12:00             ` David Hildenbrand
2025-04-11 13:23             ` Jiri Denemark
2025-04-11 13:58               ` Cornelia Huck
2025-04-15 11:33                 ` Jiří Denemark
2025-04-09 12:42   ` [PATCH V1 0/6] fast qom tree get Steven Sistare
2025-04-09 13:34     ` Markus Armbruster
2025-04-09 14:06       ` Steven Sistare
2025-04-09 14:44         ` Markus Armbruster
2025-04-09 15:14           ` Steven Sistare
2025-04-10  5:57             ` Markus Armbruster
2025-04-28  8:04     ` Markus Armbruster
2025-04-28 16:18       ` Steven Sistare
2025-04-29  6:02         ` Markus Armbruster
2025-05-02 16:19           ` Steven Sistare

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=Z_jq5drO_25w0bC6@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=devel@lists.libvirt.org \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=jsnow@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=steven.sistare@oracle.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 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).