qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] s390x kvm and smp
@ 2011-05-04 10:43 Christian Borntraeger
  2011-05-04 10:59 ` Jan Kiszka
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2011-05-04 10:43 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Carsten Otte, qemu-devel

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)

--- a/cpus.c
+++ b/cpus.c
@@ -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

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

* Re: [Qemu-devel] s390x kvm and smp
  2011-05-04 10:43 [Qemu-devel] s390x kvm and smp Christian Borntraeger
@ 2011-05-04 10:59 ` Jan Kiszka
  2011-05-04 16:13   ` Christian Borntraeger
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2011-05-04 10:59 UTC (permalink / raw)
  To: Christian Borntraeger; +Cc: Carsten Otte, Alexander Graf, qemu-devel

On 2011-05-04 12:43, Christian Borntraeger wrote:
> 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)
> 
> --- a/cpus.c
> +++ b/cpus.c
> @@ -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?

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

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

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

* Re: [Qemu-devel] s390x kvm and smp
  2011-05-04 10:59 ` Jan Kiszka
@ 2011-05-04 16:13   ` Christian Borntraeger
  2011-05-04 17:11     ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2011-05-04 16:13 UTC (permalink / raw)
  To: Jan Kiszka, Alexander Graf; +Cc: Carsten Otte, qemu-devel

On 04/05/11 12:59, Jan Kiszka wrote:
> 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.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -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,

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

* Re: [Qemu-devel] s390x kvm and smp
  2011-05-04 16:13   ` Christian Borntraeger
@ 2011-05-04 17:11     ` Alexander Graf
  2011-05-05  7:29       ` [Qemu-devel] [PATCH] s390x: fix smp support for kvm Christian Borntraeger
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2011-05-04 17:11 UTC (permalink / raw)
  To: Christian Borntraeger; +Cc: Jan Kiszka, qemu-devel@nongnu.org, Carsten Otte





Am 04.05.2011 um 18:13 schrieb Christian Borntraeger <borntraeger@de.ibm.com>:

> On 04/05/11 12:59, Jan Kiszka wrote:
>> 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.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

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

Alex

> 

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

* [Qemu-devel] [PATCH] s390x: fix smp support for kvm
  2011-05-04 17:11     ` Alexander Graf
@ 2011-05-05  7:29       ` Christian Borntraeger
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Borntraeger @ 2011-05-05  7:29 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Jan Kiszka, qemu-devel@nongnu.org, Carsten Otte

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.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -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,

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

end of thread, other threads:[~2011-05-05  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 10:43 [Qemu-devel] s390x kvm and smp Christian Borntraeger
2011-05-04 10:59 ` Jan Kiszka
2011-05-04 16:13   ` Christian Borntraeger
2011-05-04 17:11     ` Alexander Graf
2011-05-05  7:29       ` [Qemu-devel] [PATCH] s390x: fix smp support for kvm Christian Borntraeger

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).