[libvirt PATCH 4/5] qemu: probe for "-cpu max" support
Pavel Hrdina
phrdina at redhat.com
Tue Feb 9 16:23:35 UTC 2021
On Tue, Feb 09, 2021 at 01:59:00PM +0000, Daniel P. Berrangé wrote:
> This is a special CPU model similar to "-cpu host", so won't use our
> normal CPU model detection logic.
>
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
> src/qemu/qemu_capabilities.c | 11 +++++++++++
> src/qemu/qemu_capabilities.h | 1 +
> 2 files changed, 12 insertions(+)
>
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index d0378f94bc..ecfb313d0a 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -614,6 +614,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
>
> /* 390 */
> "vhost-user-blk",
> + "cpu-max",
> );
>
>
> @@ -2984,12 +2985,22 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
> virQEMUCapsAccelPtr accel,
> qemuMonitorPtr mon)
> {
> + qemuMonitorCPUDefsPtr defs = accel->cpuModels;
accel->cpuModels is NULL here ... [0]
> + size_t i;
> +
> if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS))
> return 0;
>
> if (virQEMUCapsFetchCPUDefinitions(mon, qemuCaps->arch, &accel->cpuModels) < 0)
> return -1;
>
> + for (i = 0; i < defs->ncpus; i++) {
[0] ... so here it will crash.
> + if (STREQ_NULLABLE(defs->cpus[i].name, "max")) {
> + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_MAX);
> + break;
> + }
> + }
> +
Do we trust QEMU that if accel=kvm supports cpu-max that accel=tcg
supports it as well and is that true on all architectures?
Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210209/74c7539a/attachment-0001.sig>
More information about the libvir-list
mailing list