On Fri, Apr 11, 2025 at 13:43:39 +0200, Markus Armbruster wrote: > Daniel P. Berrangé <berra...@redhat.com> writes: > > On Fri, Apr 11, 2025 at 12:40:46PM +0200, Markus Armbruster wrote: > >> Daniel P. Berrangé <berra...@redhat.com> writes: > >> > 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. > >> > >> How do the existing query-cpu-FOO fall short of what management > >> applications such as libvirt needs? > > > > It has been along while since I looked at them, but IIRC they were > > returning static info about CPU models, whereas libvirt wanted info > > on the currently requested '-cpu ARGS' > > Libvirt developers, please work with us on design of new commands or > improvements to existing ones to better meet libvirt's needs in this > area.
The existing commands (query-cpu-definitions, query-cpu-model-expansion) are useful for probing before starting a domain. But what we use qom-get for is to get a view of the currently instantiated virtual CPU created by QEMU according to -cpu when we're starting a domain. In other words, we start QEMU with -S and before starting vCPUs we need to know exactly what features were enabled and if any feature we requested was disabled by QEMU. Currently we query QOM for CPU properties as that's what we were advised to use ages ago. The reason behind querying such info is ensuring stable guest ABI during migration. Asking QEMU for a specific CPU model and features does not mean we'll get exactly what we asked for (this is not a bug) so we need to record the differences so that we can start QEMU for incoming migration with a CPU matching exactly the one provided on the source. As Peter said, the current way is terribly inefficient as it requires several hundreds of QMP commands so the goal is to have a single QMP command that would tell us all we need to know about the virtual CPU. That is all enabled features and all features that could not be enabled even though we asked for them. Jirka