public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: Fix boot CPU setup for the case it is unsupported
@ 2010-03-04  9:00 Jan Kiszka
  2010-03-04 16:07 ` David S. Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2010-03-04  9:00 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, David S. Ahern

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

Commit 52b03dd702 incorrectly failed KVM initialization in case the
kernel did not support KVM_CAP_SET_BOOT_CPU_ID. Fix this, and also
improve error propagation of kvm_create_context at this chance.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

OK, it really was me. :)

 qemu-kvm-x86.c |    9 +++++++--
 qemu-kvm.c     |    4 +++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 7a5925a..7d42fdc 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -672,7 +672,7 @@ static const VMStateDescription vmstate_kvmclock= {
 
 int kvm_arch_qemu_create_context(void)
 {
-    int i;
+    int i, r;
     struct utsname utsname;
 
     uname(&utsname);
@@ -696,7 +696,12 @@ int kvm_arch_qemu_create_context(void)
         vmstate_register(0, &vmstate_kvmclock, &kvmclock_data);
 #endif
 
-    return kvm_set_boot_cpu_id(0);
+    r = kvm_set_boot_cpu_id(0);
+    if (r < 0 && r != -ENOSYS) {
+        return r;
+    }
+
+    return 0;
 }
 
 static void set_msr_entry(struct kvm_msr_entry *entry, uint32_t index,
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 222ca97..e417f21 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -2091,8 +2091,10 @@ static int kvm_create_context(void)
         return -1;
     }
     r = kvm_arch_qemu_create_context();
-    if (r < 0)
+    if (r < 0) {
         kvm_finalize(kvm_state);
+        return -1;
+    }
     if (kvm_pit && !kvm_pit_reinject) {
         if (kvm_reinject_control(kvm_context, 0)) {
             fprintf(stderr, "failure to disable in-kernel PIT reinjection\n");


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

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

* Re: [PATCH] qemu-kvm: Fix boot CPU setup for the case it is unsupported
  2010-03-04  9:00 [PATCH] qemu-kvm: Fix boot CPU setup for the case it is unsupported Jan Kiszka
@ 2010-03-04 16:07 ` David S. Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Ahern @ 2010-03-04 16:07 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm





On 03/04/2010 02:00 AM, Jan Kiszka wrote:
> Commit 52b03dd702 incorrectly failed KVM initialization in case the
> kernel did not support KVM_CAP_SET_BOOT_CPU_ID. Fix this, and also
> improve error propagation of kvm_create_context at this chance.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> OK, it really was me. :)
> 
>  qemu-kvm-x86.c |    9 +++++++--
>  qemu-kvm.c     |    4 +++-
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
> index 7a5925a..7d42fdc 100644
> --- a/qemu-kvm-x86.c
> +++ b/qemu-kvm-x86.c
> @@ -672,7 +672,7 @@ static const VMStateDescription vmstate_kvmclock= {
>  
>  int kvm_arch_qemu_create_context(void)
>  {
> -    int i;
> +    int i, r;
>      struct utsname utsname;
>  
>      uname(&utsname);
> @@ -696,7 +696,12 @@ int kvm_arch_qemu_create_context(void)
>          vmstate_register(0, &vmstate_kvmclock, &kvmclock_data);
>  #endif
>  
> -    return kvm_set_boot_cpu_id(0);
> +    r = kvm_set_boot_cpu_id(0);
> +    if (r < 0 && r != -ENOSYS) {
> +        return r;
> +    }
> +
> +    return 0;
>  }
>  
>  static void set_msr_entry(struct kvm_msr_entry *entry, uint32_t index,
> diff --git a/qemu-kvm.c b/qemu-kvm.c
> index 222ca97..e417f21 100644
> --- a/qemu-kvm.c
> +++ b/qemu-kvm.c
> @@ -2091,8 +2091,10 @@ static int kvm_create_context(void)
>          return -1;
>      }
>      r = kvm_arch_qemu_create_context();
> -    if (r < 0)
> +    if (r < 0) {
>          kvm_finalize(kvm_state);
> +        return -1;
> +    }
>      if (kvm_pit && !kvm_pit_reinject) {
>          if (kvm_reinject_control(kvm_context, 0)) {
>              fprintf(stderr, "failure to disable in-kernel PIT reinjection\n");
> 

Works for me: FC12 host, FC12 guest.

David

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

end of thread, other threads:[~2010-03-04 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04  9:00 [PATCH] qemu-kvm: Fix boot CPU setup for the case it is unsupported Jan Kiszka
2010-03-04 16:07 ` David S. Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox