[libvirt] [PATCH 2/3 v4] [UPDATED] PowerPC : Add support for launching VMs in 'compat' mode.

Prerna Saxena prerna at linux.vnet.ibm.com
Wed Oct 29 11:34:22 UTC 2014


On Tuesday 28 October 2014 05:32 PM, Daniel P. Berrange wrote:
> On Tue, Oct 28, 2014 at 04:43:59PM +0530, Prerna Saxena wrote:
>> Apologies, I accidentally posted the older version. Pls ignore the
>> previously posted patch 2/3. The updated patch is here :
>>
>> >From a98d6787dc4f1d39ae36d78799ecf36018377ec7 Mon Sep 17 00:00:00 2001
>> From: Prerna Saxena <prerna at linux.vnet.ibm.com>
>> Date: Tue, 28 Oct 2014 15:05:59 +0530
>> Subject: [PATCH 2/3] PowerPC : Add support for launching VMs in 'compat' mode.
>>
>> PowerISA allows processors to run VMs in binary compatibility ("compat")
>> mode supporting an older version of ISA. QEMU has recently added support to
>> explicitly denote a VM running in compatibility mode through commit 6d9412ea
>> & 8dfa3a5e85.
>> Now, a "compat" mode VM can be run by invoking this qemu commandline on a
>> POWER8 host:  -cpu host,compat=power7.
>>
>> This patch allows libvirt to extend the "fallback" semantics of cpu model to
>> describe this new mode for PowerKVM guests.
>> As an example:
>> When a user wants to request a power7 vm to run in compatibility mode on
>> a Power8 host, this can be described in XML as follows :
>>   <cpu mode='host-model' match='exact'>
>>     <model fallback='compat'>power7</model>
> I don't really see any point in adding the fallback='compat' 
> attribute. That is  basically always implied if you use
> mode=host-model in combination with a named model.
Hi Daniel,
Running in compatibility mode is not identical to running natively on an older processor.
Reproducing the example from : http://www.redhat.com/archives/libvir-list/2014-October/msg00359.html

On PowerKVM, we can run VMs in 2 possible vCPU configurations:
1) Host native mode: Where host is power7; guest VMs also see power7 vcpus.
    Required qemu command line : "-cpu host"

2) Compat mode: In this case, the host CPU is Power8, but it can run in binary compatibility mode with an older version of ISA(such as power7). So it will exhibit only those features that were
available in an older generation of Power ISA. The guest will see a "power7" vCPU even though it is running on a physical "power8" chip. This is a hardware feature that is enabled via a qemu/kvm switch.

Required QEMU command line for PowerKVM : "-cpu host,compat=power7"

My patch attempts to define semantics for this second mode of execution.

A VM running in compat mode will not just differ in terms of qemu command line, but also in behaviour when contrasted with the host native mode. In other words, applications running on  "power7"
native VM  will see different CPU as compared to applications running on a compat-mode "power7" VM over a Power8 host. From a VM management perspective, this difference needs to be brought out in XML.

Also, "compat" mode is one way of emulating an older processor chip, but it may not be the _only_ way.

Hence the virtualization stack needs to explicitly distinguish a compat-mode VM.

In my v2 post, you had suggested that model fallback 'compat' be based on  "host-model" cpu mode in place of "custom". I have sent out v3 and v4 based on this suggestion.

Hope this XML schema is acceptable:
<cpu mode='host-model'>
   <model fallback='compat'>power7</model>
 </cpu>

I am looking forward to community inputs on what is a good place to introduce "compat" tag in XML schema. Will be happy to spin a v5 if another place seems more appropriate for the "compat" CPU tag.

Regards,

-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India




More information about the libvir-list mailing list