On Mon, Feb 20, 2023 at 11:36:36AM +0100, Laszlo Ersek wrote:
On 2/17/23 12:44, Richard W.M. Jones wrote:
> As with the prior commit, prefer -cpu host for all guests (except when
> we have more information from the source hypervisor). Although there
> is the disadvantage that -cpu host is non-migratable, in practice it
> would be very difficult to live migrate a host launched using direct
> qemu commands.
>
> Note that after this change, gcaps_arch_min_version is basically an
> informational field. No output uses it, but it will appear in debug
> output and there's the possibility we might use it for a future output
> mode.
>
> Thanks: Laszlo Ersek
> ---
> lib/types.mli | 6 +++++-
> output/output_qemu.ml | 6 +-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/lib/types.mli b/lib/types.mli
> index 743daa8a14..4a183dd3ae 100644
> --- a/lib/types.mli
> +++ b/lib/types.mli
> @@ -268,7 +268,11 @@ type guestcaps = {
> minimum version. Notably RHEL >= 9 requires at least x86_64-v2.
>
> If the guest is capable of running on QEMU's default VCPU model
> - for the architecture ([-cpu qemu64]) then this is set to [0]. *)
> + for the architecture ([-cpu qemu64]) then this is set to [0].
> +
> + Note this capability is not actually used by any current output
> + mode. It is retained in case we might use it in future, but we
> + might remove it if it is not used. *)
>
> gcaps_virtio_1_0 : bool;
> (** The guest supports the virtio devices that it does at the virtio-1.0
> diff --git a/output/output_qemu.ml b/output/output_qemu.ml
> index 491906ebf9..2bbacb6eda 100644
> --- a/output/output_qemu.ml
> +++ b/output/output_qemu.ml
> @@ -175,11 +175,7 @@ module QEMU = struct
>
> arg "-m" (Int64.to_string (source.s_memory /^ 1024L /^ 1024L));
>
> - (match source.s_cpu_model, guestcaps.gcaps_arch_min_version with
> - | None, 0 -> ()
> - | None, _ -> arg "-cpu" "host"
> - | Some model, _ -> arg "-cpu" model
> - );
> + arg "-cpu" (Option.default "host" source.s_cpu_model);
(Ah yes, we have our own Option module from
common/mlstdutils/std_utils.ml*, not the "standard" one
<
https://v2.ocaml.org/api/Option.html>.)
We should switch to using the standard one, but in this case it
depends on OCaml 4.08. RHEL 7 has OCaml 4.05 and RHEL 8 has
OCaml 4.07.
Nevertheless I checked now if our module is needlessly different from
the official one and there are a few things so it's worth slowly
converging ours to make it easier to drop in future and reduce
surprises.
> if source.s_vcpu > 1 then (
> (match source.s_cpu_topology with
Reviewed-by: Laszlo Ersek <lersek(a)redhat.com>
Thanks,
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top