[PATCH] Modify virCPUarmCompare to perform compare actions

Jiri Denemark jdenemar at redhat.com
Mon Sep 7 11:15:41 UTC 2020

On Mon, Sep 07, 2020 at 09:21:02 +0800, Zhenyu Zheng wrote:
> Thanks alot for the reply,
> This sounds like a valid use case (not sure it is that useful), but we
> > need to be careful. But we should make sure implementing this does not
> > break anything. This means, we need to do different things depending on
> > the type of the CPU definition we are asked to compare. Guest CPU
> > definitions should keep the old behaviour (return IDENTICAL) and host
> > CPU definitions can be compared to the host CPU. But when doing so,
> > don't get too influenced by x86 code, which I believe is way too
> > complicated for ARM. Specifically you don't need to create armCompute
> > and mess with guestData and other stuff there as all you want to do is
> > compare the two CPU definitions. In x86 the same function is used for
> > several things, but that's not the case for ARM.
> for this, what I have in mind now is that we can check
> and if that is the case, we compare CPU vendors and models to allow only
> identical definitions to pass, like the implementation of
> https://gitlab.com/libvirt/libvirt/-/blob/master/src/cpu/cpu_ppc64.c#L505 ,

This doesn't sound like a good idea. PPC is quite special in the way it
uses host-model and host-passthrough. But anyway, it's actually easier
to just return IDENTICAL for host-passthrough CPUs (and all other guest
CPUs) than copying the host CPU from capabilities and comparing it to

> (this is because when a VM is in host-passthrough mode, its' CPU xml
> reflects the original host CPU
> definition, and we actually compare the source host and destination host
> CPU definitions,

The CPU definition of a domain with host-passthrough remains the same.
That is, it doesn't reflect the original host CPU definition, it's still
just host-passthrough. The only way to compare source and destinations
host CPUs is by taking the host CPU def from one host and passing it to
cpu-compare called on the other host.


More information about the libvir-list mailing list