[libvirt] [PATCH v2 0/3] Implement CPU model driver for PowerPC

Michal Privoznik mprivozn at redhat.com
Wed Oct 17 08:22:19 UTC 2012


On 15.10.2012 11:07, Li Zhang 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 at ltckvmopal2 kvm-test]# /bin/virsh cpu-compare cap.xml
>    CPU described in cap.xml is identical to host CPU
> 
>    [root at 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 at ltckvmopal2 kvm-test]# /bin/virsh cpu-compare cap.xml
>    CPU described in cap.xml is incompatible with host CPU
> 
>    [root at 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.
>    * Replace while with for loop in 2 places according to Michal Privoznik's suggestion.
>    * Add powerpc.c to po/PORTFILES.in 
> 
> 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
> 
>  po/POTFILES.in         |    1 +
>  src/cpu/cpu.h          |    3 +
>  src/cpu/cpu_map.xml    |   14 ++
>  src/cpu/cpu_powerpc.c  |  591 ++++++++++++++++++++++++++++++++++++++++++++++--
>  src/cpu/cpu_ppc_data.h |   33 +++
>  5 files changed, 624 insertions(+), 18 deletions(-)
>  create mode 100644 src/cpu/cpu_ppc_data.h
> 

I've reviewed second version too, ACKed all patches, applied small fixed
I've found and pushed the whole series. Thanks!

Michal




More information about the libvir-list mailing list