Re: [libvirt] [PATCH] PowerPC : Do not allow an empty model spec for 'host-model'

2015-03-20 Thread Ján Tomko
On Fri, Mar 20, 2015 at 03:25:45PM +0530, Prerna Saxena wrote:
> 
> On Friday 20 March 2015 01:51 PM, Ján Tomko wrote:
> > On Mon, Mar 16, 2015 at 04:56:49PM +0530, Prerna Saxena wrote:
> >> [PATCH] PowerPC : Do not allow an empty model spec for 'host-model'
> >>
> >> On PowerPC, a guest VM having CPU mode as 'host-model'
> >> represents a 'compat' mode VM. This cannot have a NULL
> >> CPU model.
> > I thought the compat= mode was only used when mode == HOST_MODEL
> > and a model is specified. And HOST_MODEL with no model behaves like on
> > x86_64 - copies the features from the host capabilities.
> >
> > Was this functionality broken by commit addce06 or did it never produce
> > useful results?
> >
> > Jan
> > --
> > libvir-list mailing list
> > libvir-list@redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
> Hi Jan,
> 
> This commit does not break anything. It addresses a few corner cases not 
> completely addressed by commits addce06 & 5e4f49ab8aa2.
> PowerPC pseries KVM is a paravirtualized platform, wherein there are only 2 
> allowed vcpu configurations of running a guest :
> 1) Native mode, where the guest sees the same vcpu model as the host -- this 
> is reflected in libvirt by "host-passthrough" mode;
> 2) Compat mode, where the physical processor itself runs in binary 
> compatibility with an older cpu model. This is marked in libvirt by 
> "host-model" mode, which takes on an additional argument -- the
> guest CPU model which needs to be run. This was introduced by commit  addce06.
> 

I see now that neither libvirt nor QEMU have feature flags for PPC.
But there are other machine types than pseries on PPC, some of them
might want host-model to generate a -cpu argument, not -cpu compat=.

> PowerKVM, being a paravirt platform, does not emulate a guest vcpu based on 
> features copied from host. This behaviour is unlike x86 KVM. Hence , the 
> host-model mode on PowerKVM needs to error out in
> case the model which needs to be run in binary compatibility is not specified 
> by user.

Instead of erroring out, can it be filled with a sensible value?
E.g. on a POWER8 host we fill it out with POWER8.

> The reason for this commit was a bug seen even after 5e4f49ab8aa2. A null cpu 
> model XML was causing an incorrect "best-fit" model (just like x86) to be 
> passed to the VM after a save/restore. Hence the
> need for this check.

So even though the correct model was specified, cpuUpdate removes it
after restore? It would be nice to mention that in the commit message.

Jan


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] PowerPC : Do not allow an empty model spec for 'host-model'

2015-03-20 Thread Prerna Saxena

On Friday 20 March 2015 01:51 PM, Ján Tomko wrote:
> On Mon, Mar 16, 2015 at 04:56:49PM +0530, Prerna Saxena wrote:
>> [PATCH] PowerPC : Do not allow an empty model spec for 'host-model'
>>
>> On PowerPC, a guest VM having CPU mode as 'host-model'
>> represents a 'compat' mode VM. This cannot have a NULL
>> CPU model.
> I thought the compat= mode was only used when mode == HOST_MODEL
> and a model is specified. And HOST_MODEL with no model behaves like on
> x86_64 - copies the features from the host capabilities.
>
> Was this functionality broken by commit addce06 or did it never produce
> useful results?
>
> Jan
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
Hi Jan,

This commit does not break anything. It addresses a few corner cases not 
completely addressed by commits addce06 & 5e4f49ab8aa2.
PowerPC pseries KVM is a paravirtualized platform, wherein there are only 2 
allowed vcpu configurations of running a guest :
1) Native mode, where the guest sees the same vcpu model as the host -- this is 
reflected in libvirt by "host-passthrough" mode;
2) Compat mode, where the physical processor itself runs in binary 
compatibility with an older cpu model. This is marked in libvirt by 
"host-model" mode, which takes on an additional argument -- the
guest CPU model which needs to be run. This was introduced by commit  addce06.

PowerKVM, being a paravirt platform, does not emulate a guest vcpu based on 
features copied from host. This behaviour is unlike x86 KVM. Hence , the 
host-model mode on PowerKVM needs to error out in
case the model which needs to be run in binary compatibility is not specified 
by user.
The reason for this commit was a bug seen even after 5e4f49ab8aa2. A null cpu 
model XML was causing an incorrect "best-fit" model (just like x86) to be 
passed to the VM after a save/restore. Hence the
need for this check.

Regards,

-- 
Prerna Saxena

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

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


Re: [libvirt] [PATCH] PowerPC : Do not allow an empty model spec for 'host-model'

2015-03-20 Thread Ján Tomko
On Mon, Mar 16, 2015 at 04:56:49PM +0530, Prerna Saxena wrote:
> 
> [PATCH] PowerPC : Do not allow an empty model spec for 'host-model'
> 
> On PowerPC, a guest VM having CPU mode as 'host-model'
> represents a 'compat' mode VM. This cannot have a NULL
> CPU model.

I thought the compat= mode was only used when mode == HOST_MODEL
and a model is specified. And HOST_MODEL with no model behaves like on
x86_64 - copies the features from the host capabilities.

Was this functionality broken by commit addce06 or did it never produce
useful results?

Jan

> This commit forbids such a guest definition.
> 
> Signed-off-by: Prerna Saxena 
> ---
>  src/cpu/cpu_powerpc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
> index c77374c..62ad92b 100644
> --- a/src/cpu/cpu_powerpc.c
> +++ b/src/cpu/cpu_powerpc.c
> @@ -549,12 +549,12 @@ ppcUpdate(virCPUDefPtr guest,
>const virCPUDef *host)
>  {
>  switch ((virCPUMode) guest->mode) {
> -case VIR_CPU_MODE_HOST_MODEL:
>  case VIR_CPU_MODE_HOST_PASSTHROUGH:
>  guest->match = VIR_CPU_MATCH_EXACT;
>  virCPUDefFreeModel(guest);
>  return virCPUDefCopyModel(guest, host, true);
>  
> +case VIR_CPU_MODE_HOST_MODEL:
>  case VIR_CPU_MODE_CUSTOM:
>  return 0;
>  
> -- 
> 1.8.3.1
> 
> -- 
> Prerna Saxena
> 
> Linux Technology Centre,
> IBM Systems and Technology Lab,
> Bangalore, India
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] PowerPC : Do not allow an empty model spec for 'host-model'

2015-03-16 Thread Prerna Saxena

[PATCH] PowerPC : Do not allow an empty model spec for 'host-model'

On PowerPC, a guest VM having CPU mode as 'host-model'
represents a 'compat' mode VM. This cannot have a NULL
CPU model.
This commit forbids such a guest definition.

Signed-off-by: Prerna Saxena 
---
 src/cpu/cpu_powerpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index c77374c..62ad92b 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -549,12 +549,12 @@ ppcUpdate(virCPUDefPtr guest,
   const virCPUDef *host)
 {
 switch ((virCPUMode) guest->mode) {
-case VIR_CPU_MODE_HOST_MODEL:
 case VIR_CPU_MODE_HOST_PASSTHROUGH:
 guest->match = VIR_CPU_MATCH_EXACT;
 virCPUDefFreeModel(guest);
 return virCPUDefCopyModel(guest, host, true);
 
+case VIR_CPU_MODE_HOST_MODEL:
 case VIR_CPU_MODE_CUSTOM:
 return 0;
 
-- 
1.8.3.1

-- 
Prerna Saxena

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

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