[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH] Modify virCPUarmCompare to perform compare actions



So the suitable way of doing this will be checking for `VIR_CPU_TYPE_HOST`
and perform a comparison in this case and still return IDENTICAL for all other
cases right? Then the upper layer caller(like OpenStack Nova) will have to
pass source host cpu info as a parameter. 

BR,

Zhenyu


On Mon, Sep 7, 2020 at 7:16 PM Jiri Denemark <jdenemar redhat com> wrote:
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
> `VIR_CPU_MODE_HOST_PASSTHROUGH`
> 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
itself.

> (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.

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]