diff mbox

[11/11] remove smp restriction from kvm

Message ID 1259761702-4041-12-git-send-email-glommer@redhat.com
State New
Headers show

Commit Message

Glauber Costa Dec. 2, 2009, 1:48 p.m. UTC
We don't support smp without irqchip in kernel, so only abort in
that situation

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 kvm-all.c         |   10 +++++-----
 kvm.h             |    2 ++
 target-i386/kvm.c |    7 +++++++
 target-ppc/kvm.c  |    5 +++++
 4 files changed, 19 insertions(+), 5 deletions(-)

Comments

Avi Kivity Dec. 3, 2009, 12:23 p.m. UTC | #1
On 12/02/2009 03:48 PM, Glauber Costa wrote:
> We don't support smp without irqchip in kernel, so only abort in
> that situation
>    


What's the reason for this restriction?
Glauber Costa Dec. 3, 2009, 12:36 p.m. UTC | #2
On Thu, Dec 3, 2009 at 10:23 AM, Avi Kivity <avi@redhat.com> wrote:
> On 12/02/2009 03:48 PM, Glauber Costa wrote:
>>
>> We don't support smp without irqchip in kernel, so only abort in
>> that situation
>>
>
>
> What's the reason for this restriction?

It is temporary. But as far as my testing goes, we don't come even close to
working without in-kernel irqchip.
Avi Kivity Dec. 3, 2009, 12:37 p.m. UTC | #3
On 12/03/2009 02:36 PM, Glauber Costa wrote:
> On Thu, Dec 3, 2009 at 10:23 AM, Avi Kivity<avi@redhat.com>  wrote:
>    
>> On 12/02/2009 03:48 PM, Glauber Costa wrote:
>>      
>>> We don't support smp without irqchip in kernel, so only abort in
>>> that situation
>>>
>>>        
>>
>> What's the reason for this restriction?
>>      
> It is temporary. But as far as my testing goes, we don't come even close to
> working without in-kernel irqchip.
>    

This works well in qemu-kvm.  What's the reason?  it may indicate a bug 
in up.
Glauber Costa Dec. 3, 2009, 12:39 p.m. UTC | #4
On Thu, Dec 3, 2009 at 10:37 AM, Avi Kivity <avi@redhat.com> wrote:
> On 12/03/2009 02:36 PM, Glauber Costa wrote:
>>
>> On Thu, Dec 3, 2009 at 10:23 AM, Avi Kivity<avi@redhat.com>  wrote:
>>
>>>
>>> On 12/02/2009 03:48 PM, Glauber Costa wrote:
>>>
>>>>
>>>> We don't support smp without irqchip in kernel, so only abort in
>>>> that situation
>>>>
>>>>
>>>
>>> What's the reason for this restriction?
>>>
>>
>> It is temporary. But as far as my testing goes, we don't come even close
>> to
>> working without in-kernel irqchip.
>>
>
> This works well in qemu-kvm.  What's the reason?  it may indicate a bug in
> up.

The reason is that we do not handle SIPI in qemu.git yet. Now that the basics
of smp are working, it should not be too difficult to get it working.
Avi Kivity Dec. 3, 2009, 12:40 p.m. UTC | #5
On 12/03/2009 02:39 PM, Glauber Costa wrote:
>
>> This works well in qemu-kvm.  What's the reason?  it may indicate a bug in
>> up.
>>      
> The reason is that we do not handle SIPI in qemu.git yet. Now that the basics
> of smp are working, it should not be too difficult to get it working.
>    

OK.  I think this is worthwhile.
diff mbox

Patch

diff --git a/kvm-all.c b/kvm-all.c
index 22d84a3..b17bd74 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -427,7 +427,12 @@  static int kvm_create_irqchip(KVMState *s)
         return ret;
 
     s->irqchip_in_kernel = 1;
+
 #endif
+    if (!kvm_arch_can_smp() && (smp_cpus > 1)) {
+        fprintf(stderr, "No SMP KVM support, use '-smp 1'\n");
+        ret = -EINVAL;
+    }
     return ret;
 }
 
@@ -440,11 +445,6 @@  int kvm_init(int smp_cpus)
     int ret;
     int i;
 
-    if (smp_cpus > 1) {
-        fprintf(stderr, "No SMP KVM support, use '-smp 1'\n");
-        return -EINVAL;
-    }
-
     s = qemu_mallocz(sizeof(KVMState));
 
 #ifdef KVM_CAP_SET_GUEST_DEBUG
diff --git a/kvm.h b/kvm.h
index 7b9d8b3..91a4bf4 100644
--- a/kvm.h
+++ b/kvm.h
@@ -101,6 +101,8 @@  int kvm_arch_init_vcpu(CPUState *env);
 
 void kvm_arch_reset_vcpu(CPUState *env);
 
+int kvm_arch_can_smp(void);
+
 #ifdef TARGET_I386
 int kvm_set_lapic(CPUState *env, struct kvm_lapic_state *s);
 int kvm_get_lapic(CPUState *env, struct kvm_lapic_state *s);
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 65ad2a1..cea0cf1 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1171,3 +1171,10 @@  int kvm_get_lapic(CPUState *env, struct kvm_lapic_state *s)
 
     return kvm_vcpu_ioctl(env, KVM_GET_LAPIC, s);
 }
+
+int kvm_arch_can_smp(void)
+{
+    if (kvm_irqchip_in_kernel())
+        return 1;
+    return 0;
+}
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index d08639b..cfe467f 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -62,6 +62,11 @@  int kvm_arch_set_irq(KVMState *s, int irq, int level, int *status)
     return -ENOSYS;
 }
 
+int kvm_arch_can_smp(void)
+{
+    return 0;
+}
+
 int kvm_arch_put_registers(CPUState *env)
 {
     struct kvm_regs regs;