Hi,

Thanks alot for the review and feedback. As for host-passthrough cases, I have some other understandings,
if I understand correctly, what you mean is that if a vm uses host-passthrough, it can migrate to any other
host, since it asks for host-passthrough. In my point of view, I think in real cases, there are few different kinds
of ARM datacenter CPUs on the market, and there CPU capabilities are different, so one might create a vm on
hostA with feature1 and feature2 because it uses host-passthrough and hostA has these features. Now in your
definition(if I understand correctly) of host-passthrough and the current code(returns identical directly), this vm
can be migrated to hostB with only feature1, since there are no limitations. If one has some important application
that dependsĀ on feature2, the app will break as feature2 is not available on hostB. Considering this, I proposed
to add basic checks to compare CPU to limit the migration to only the same CPU models. And once the capability
of ARM driver is enhanced in QEMU or other related projects, we can make the compare API better.

And yes, the code referenced X86 and S390 driver, I have modified them to be workable with ARM and tested
the functions, I was also thinking that in the future there might be possibility that we can compare cpu features
so I kept the data compare case.

Thanks again for the feedback.

Zhenyu



On Tue, Sep 1, 2020 at 10:50 PM Jiri Denemark <jdenemar@redhat.com> wrote:
On Fri, Aug 21, 2020 at 10:20:15 +0800, Zhenyu Zheng wrote:
> Modify virCPUarmCompare in cpu_arm.c to perform
> actual compare actions. Compare host cpu vendor
> and model info with guest cpu as initial implementation,
> as most ARM clouds uses host-passthrogh mode.

In addition to the low-level coding issues found by Daniel Henrique
Barboza, I'd like to ask some high level questions...

What is the point in making this patch (except for copying the logic
from x86 CPU driver, which mostly does not fit ARM world very well)?

As you say, most ARM clouds use host-passthrough, so why would CPU
comparison be needed at all? Host-passthrough CPU is by definition
compatible with any host CPU as it asks for the host CPU itself.

Also IIRC the CPU model names as advertised by libvirt in host
capabilities are only useful for identifying the host CPU, but they
cannot be directly pass to QEMU. As such, you can't use these models
when defining a CPU in a domain XML.

That said, I doubt this patch is useful at all.

Jirka