qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv
@ 2016-02-18 21:01 Thomas Huth
  2016-02-18 22:13 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2016-02-18 21:01 UTC (permalink / raw)
  To: qemu-ppc, david; +Cc: qemu-devel, agraf

Using a CPU type that does not match the host is not possible when using
the kvm-hv kernel module - the PVR is checked in the kernel function
kvm_arch_vcpu_ioctl_set_sregs_hv() and rejected with -EINVAL if it
does not match the host.
However, when the user tries to specify a non-matching CPU type, QEMU
currently only reports "kvm_init_vcpu failed: Invalid argument", and
this is of course not very helpful for the user to solve the problem.
So this patch adds a more descriptive error message that tells the
user to specify "-cpu host" instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target-ppc/kvm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 762d6cf..6545fbe 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -513,6 +513,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
     /* Synchronize sregs with kvm */
     ret = kvm_arch_sync_sregs(cpu);
     if (ret) {
+        if (ret == -EINVAL) {
+            error_report("Register sync failed... If you're using kvm-hv.ko,"
+                         " only \"-cpu host\" is possible!");
+        }
         return ret;
     }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv
  2016-02-18 21:01 [Qemu-devel] [PATCH] ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv Thomas Huth
@ 2016-02-18 22:13 ` Eric Blake
  2016-02-19  0:17   ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2016-02-18 22:13 UTC (permalink / raw)
  To: Thomas Huth, qemu-ppc, david; +Cc: qemu-devel, agraf

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

On 02/18/2016 02:01 PM, Thomas Huth wrote:
> Using a CPU type that does not match the host is not possible when using
> the kvm-hv kernel module - the PVR is checked in the kernel function
> kvm_arch_vcpu_ioctl_set_sregs_hv() and rejected with -EINVAL if it
> does not match the host.
> However, when the user tries to specify a non-matching CPU type, QEMU
> currently only reports "kvm_init_vcpu failed: Invalid argument", and
> this is of course not very helpful for the user to solve the problem.
> So this patch adds a more descriptive error message that tells the
> user to specify "-cpu host" instead.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  target-ppc/kvm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> index 762d6cf..6545fbe 100644
> --- a/target-ppc/kvm.c
> +++ b/target-ppc/kvm.c
> @@ -513,6 +513,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
>      /* Synchronize sregs with kvm */
>      ret = kvm_arch_sync_sregs(cpu);
>      if (ret) {
> +        if (ret == -EINVAL) {
> +            error_report("Register sync failed... If you're using kvm-hv.ko,"
> +                         " only \"-cpu host\" is possible!");

No need to shout at the user; drop the trailing !

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv
  2016-02-18 22:13 ` Eric Blake
@ 2016-02-19  0:17   ` David Gibson
  0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2016-02-19  0:17 UTC (permalink / raw)
  To: Eric Blake; +Cc: Thomas Huth, qemu-ppc, qemu-devel, agraf

[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]

On Thu, Feb 18, 2016 at 03:13:52PM -0700, Eric Blake wrote:
> On 02/18/2016 02:01 PM, Thomas Huth wrote:
> > Using a CPU type that does not match the host is not possible when using
> > the kvm-hv kernel module - the PVR is checked in the kernel function
> > kvm_arch_vcpu_ioctl_set_sregs_hv() and rejected with -EINVAL if it
> > does not match the host.
> > However, when the user tries to specify a non-matching CPU type, QEMU
> > currently only reports "kvm_init_vcpu failed: Invalid argument", and
> > this is of course not very helpful for the user to solve the problem.
> > So this patch adds a more descriptive error message that tells the
> > user to specify "-cpu host" instead.
> > 
> > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > ---
> >  target-ppc/kvm.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> > index 762d6cf..6545fbe 100644
> > --- a/target-ppc/kvm.c
> > +++ b/target-ppc/kvm.c
> > @@ -513,6 +513,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
> >      /* Synchronize sregs with kvm */
> >      ret = kvm_arch_sync_sregs(cpu);
> >      if (ret) {
> > +        if (ret == -EINVAL) {
> > +            error_report("Register sync failed... If you're using kvm-hv.ko,"
> > +                         " only \"-cpu host\" is possible!");
> 
> No need to shout at the user; drop the trailing !

Applied to ppc-for-2.6 with ! removed.  Thanks.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-19  0:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-18 21:01 [Qemu-devel] [PATCH] ppc/kvm: Tell the user what might be wrong when using bad CPU types with kvm-hv Thomas Huth
2016-02-18 22:13 ` Eric Blake
2016-02-19  0:17   ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).