Skip to contentSkip to conversation

s390x kvm and smp

Qemu-devel New Christian Borntraeger 3 participants 5 messages May 4, 2011 – May 5, 2011

lore
Share & tools
lore
#0 lore raw

Alex,

I have trouble getting kvm smp support running. Turns out that qemu does a kvm run even on secondary CPUs which dont have a sane state (initial psw == 0) triggering some program faults. Architecturally these cpus are in the stopped state, so we should not do KVM_RUN. (these CPUs will be started by a SIGP restart later during the boot process)

This patch seems to help (it allows me to boot and use more than 1 cpu)

cpus.c +4 -0
@@ -131,6 +131,10 @@ static void do_vm_stop(int reason)
 
 static int cpu_can_run(CPUState *env)
 {
+    if (env->halted) {
+        return 0;
+    }
+
     if (env->stop) {
         return 0;
     }

but it does not look like the right solution. What are the proper definitions for halted and stopped?

Christian

#1 lore raw
Quoted 24 lines · Christian Borntraeger

Alex,

I have trouble getting kvm smp support running. Turns out that qemu does a kvm run even on secondary CPUs which dont have a sane state (initial psw == 0) triggering some program faults. Architecturally these cpus are in the stopped state, so we should not do KVM_RUN. (these CPUs will be started by a SIGP restart later during the boot process)

This patch seems to help (it allows me to boot and use more than 1 cpu)

cpus.c +4 -0
@@ -131,6 +131,10 @@ static void do_vm_stop(int reason)
 
 static int cpu_can_run(CPUState *env)
 {
+    if (env->halted) {
+        return 0;
+    }
+
     if (env->stop) {
         return 0;
     }
Quoted 2 lines

but it does not look like the right solution. What are the proper definitions for halted and stopped?

s390 just need to return a meaningful value from kvm_arch_process_async_events, e.g. env->halted, see other archs.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 2 lines · Jan Kiszka

s390 just need to return a meaningful value from kvm_arch_process_async_events, e.g. env->halted, see other archs.

Yes indeed. This patch fixes smp for kvm on s390x.

target-s390x/kvm.c +1 -1
@@ -172,7 +172,7 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run *run)
 
 int kvm_arch_process_async_events(CPUState *env)
 {
-    return 0;
+    return env->halted;
 }
 
 void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,
#3 lore raw

Am 04.05.2011 um 18:13 schrieb Christian Borntraeger <[email protected]>:

Quoted 7 lines · Jan Kiszka
Quoted 2 lines

s390 just need to return a meaningful value from kvm_arch_process_async_events, e.g. env->halted, see other archs.

Yes indeed. This patch fixes smp for kvm on s390x.

Now give it a proper patch description and I'll get it in through my tree :)

Alex

Quoted 1 line
#4 lore raw

PATCH 1/1 s390x: fix smp support for kvm

Currently smp support for kvm does not work. Qemu does a kvm run even on secondary CPUs which dont have a sane state (initial psw == 0) triggering some program faults. Architecturally these cpus are in the stopped state, so we should not do the kvm run ioctl. (these CPUs will be started by a SIGP restart later during the boot process)

We need to tell the loop that this cpu should not run. Jan Kiszka pointed out that kvm_arch_process_async_events is the right place to do.

target-s390x/kvm.c +1 -1
@@ -172,7 +172,7 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run *run)
 
 int kvm_arch_process_async_events(CPUState *env)
 {
-    return 0;
+    return env->halted;
 }
 
 void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,