
On Tue, Nov 08, 2016 at 03:02:31PM +0100, Pavel Hrdina wrote:
On Wed, Nov 02, 2016 at 10:22:33AM +0100, Jiri Denemark wrote:
CPU related capabilities may differ depending on accelerator used when probing. Let's use KVM if available and fall back to TCG.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> ---
Notes: Or should we perhaps start probing QEMU in both TCG and KVM mode since some capabilities may actually differ depending on the accelerator? Probing QEMU twice for both TCG and KVM would be cleaner and we could real capabilities for both QEMU and KVM domain types. And the two ugly patches at the end of this series would not be needed anymore. However running QEMU twice was always considered harmful, which is why I came up with this a bit ugly solution.
As we've discussed this outside of mailing list, QEMU is planing to rewrite the way how they initialize itself and we will be able to probe TCG and KVM differences no matter what accel was used to start the QEMU process. This means that we will have to store the difference somehow for both TCG and KVM.
As you've mentioned it would be cleaner solution to have both capabilities available so I would say that we should go for it. To reduce the impact of probing twice (until QEMU rewrites the probing) we can probe only once for the best capabilities (KVM if available otherwise for TCG) and probe for the second one only when it is explicitly required by some guest. In most cases during libvirtd lifetime there are only KVM or TCG guests.
Note: adding Dan to CC for his opinion.
NB, the reason we don't want to run each QEMU binary more than once to probe features is that it quickly becomes non-scalable due to combinatorial expansion. We already have 28 system emulators, and so running QEMU twice would mean 56 invokations, three times gives 84 invokations, etc. KVM is a little bit special though. Out of those 28 binaries, at most 2 of them can be run in KVM mode - eg on x86_64 host, only the x86_64 and i686 system emulators can run KVM - all the others are 100% TCG based. So in the very special case of KVM, I think it is acceptable to run QEMU twice, as this is not creating a combinatorial expansion in number of emulators we must invoke - it adds at most 2 extra invokations. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|