Skip to contentSkip to conversation

ppc: add helpful message when KVM fails to start VCPU

PATCH Applied Laurent Vivier 2 participants 2 messages May 18, 2015 – May 19, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc: add helpful message when KVM fails to start VCPU

On POWER8 systems, KVM checks if VCPU is running on primary threads, and that secondary threads are offline. If this is not the case, ioctl() fails with errno set to EBUSY.

QEMU aborts with a non explicit error message:

$ ./qemu-system-ppc64 --nographic -machine pseries,accel=kvm
error: kvm run failed Device or resource busy

To help user to diagnose the problem, this patch adds an informative error message.

There is no easy way to check if SMT is enabled before starting the VCPU, and as this case is the only one setting errno to EBUSY, we just check the errno value to display a message.

---
 kvm-all.c | 8 ++++++++
 1 file changed, 8 insertions(+)
kvm-all.c +8 -0
index 17a3771..7b57826 100644
@@ -1828,6 +1828,14 @@ int kvm_cpu_exec(CPUState *cpu)
             }
             fprintf(stderr, "error: kvm run failed %s\n",
                     strerror(-run_ret));
+#ifdef TARGET_PPC
+            if (run_ret == -EBUSY) {
+                fprintf(stderr,
+                        "This is probably because your SMT is enabled.\n"
+                        "VCPU can only run on primary threads with all "
+                        "secondary threads offline.\n");
+            }
+#endif
             ret = -1;
             break;
         }
Signature · 1 line
2.1.0
#1 lore raw
Quoted 8 lines · Laurent Vivier

On POWER8 systems, KVM checks if VCPU is running on primary threads, and that secondary threads are offline. If this is not the case, ioctl() fails with errno set to EBUSY.

QEMU aborts with a non explicit error message:

$ ./qemu-system-ppc64 --nographic -machine pseries,accel=kvm
error: kvm run failed Device or resource busy
Quoted 8 lines

To help user to diagnose the problem, this patch adds an informative error message.

There is no easy way to check if SMT is enabled before starting the VCPU, and as this case is the only one setting errno to EBUSY, we just check the errno value to display a message.

Thanks, applied to my queue for 2.4.

Paolo

Quoted 24 lines
---
 kvm-all.c | 8 ++++++++
 1 file changed, 8 insertions(+)
kvm-all.c +8 -0
index 17a3771..7b57826 100644
@@ -1828,6 +1828,14 @@ int kvm_cpu_exec(CPUState *cpu)
             }
             fprintf(stderr, "error: kvm run failed %s\n",
                     strerror(-run_ret));
+#ifdef TARGET_PPC
+            if (run_ret == -EBUSY) {
+                fprintf(stderr,
+                        "This is probably because your SMT is enabled.\n"
+                        "VCPU can only run on primary threads with all "
+                        "secondary threads offline.\n");
+            }
+#endif
             ret = -1;
             break;
         }