Hi,

I read x86 CPU model driver and have some understanding.
Then do some work on Power as x86.
Maybe there some problems.

Can someone help review these patches?

Thanks in advance. :-)

On Tue, Oct 9, 2012 at 3:58 PM, Li Zhang <zhlci...@gmail.com> wrote:
> CPU model driver is to get host's CPU information and it also provides
> one mechanism to expose host's CPU information to guests during migration.
>
> When migrating one guest from one machine to another machine, it will
> compare the CPU information. If it is incomptible, it won't start the
> guest.
>
> On x86, it uses CPUID instruction to get information. When migrating
> the guest, if the CPU defined in guest XML file is incompatible with
> host CPU, cpu-baseline will find out best features to expose to guest.
> Refer to
>  [http://berrange.com/posts/2010/02/15
>   /guest-cpu-model-configuration-in-libvirt-with-qemukvm/].
>
> On PowerPC, it can get CPU version by mfpvr instruction. So, if PVR is
>  different from definition in guest XML file by cpu-compare, it will fail
> to start guest. The CPU infromation can be got by cpu-baseline. But only
> CPU vendor and model can be shown, there are no features as x86.
> So on PowrePC, it assumes that migration only occurs between the machines
> with the same type CPUs on PowerPC.
>
> In this driver, there are definitions of models and PVRs for CPUs supported
> on PowerPC. The relationship between models and PVRs are as the following:
> For one specific CPU model, its PVR is unique. And also for one PVR code,
> the PVR code is also unique.
>
> So from the PVR code of CPU data, it's easy to get model and vendor 
> information.
>
> It is tested on my Power machine which CPU PVR is Power7_v2.3.
>  * cap.xml has the same definition as the host.
>    [root@ltckvmopal2 kvm-test]# /bin/virsh cpu-compare cap.xml
>    CPU described in cap.xml is identical to host CPU
>
>    [root@ltckvmopal2 kvm-test]# /bin/virsh cpu-baseline cap.xml
>    <cpu mode='custom' match='exact'>
>     <model fallback='allow'>POWER7_v2.3</model>
>     <vendor>IBM</vendor>
>    </cpu>
>
>  * cap.xml has differnt model as the host.
>    [root@ltckvmopal2 kvm-test]# /bin/virsh cpu-compare cap.xml
>    CPU described in cap.xml is incompatible with host CPU
>
>    [root@ltckvmopal2 kvm-test]# /bin/virsh cpu-baseline cap.xml
>    <cpu mode='custom' match='exact'>
>      <model fallback='allow'>POWER7_v2.1</model>
>      <vendor>IBM</vendor>
>    </cpu>
>
>  *v1 -> v2:
>    * Fix coding style's problems in several places.
>    * Seperate doc-fix from the coding
>
> Li Zhang (3):
>   libvirt: Add one file cpu_ppc_data.h to define CPU data for PPC
>   libvirt: Implement CPU model driver for PowerPC
>   Doc-fix for PowerPC CPU model driver
>
>  src/cpu/cpu.h          |    3 +
>  src/cpu/cpu_map.xml    |   14 ++
>  src/cpu/cpu_powerpc.c  |  589 
> ++++++++++++++++++++++++++++++++++++++++++++++--
>  src/cpu/cpu_ppc_data.h |   33 +++
>  4 files changed, 621 insertions(+), 18 deletions(-)
>  create mode 100644 src/cpu/cpu_ppc_data.h
>
> --
> 1.7.7.6
>



-- 

Best Regards
-Li

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to