Skip to contentSkip to conversation

qemu: report issues causing the kvm probe to fail

PATCH In review Christian Ehrhardt 2 participants 3 messages Dec 11, 2008 – Dec 15, 2008 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: report issues causing the kvm probe to fail

# HG changeset patch
# User Christian Ehrhardt <[email protected]> # Date 1229005383 -3600
# Node ID d788f32f8f60f3a0d86ab218459089e5186632ca # Parent f7dc67cd9b74c5d7ad322686e58325f879d93468 [PATCH] qemu: report issues causing the kvm probe to fail

From: Christian Ehrhardt <[email protected]>

I ran into the issue of a failign KVM Probe of the qemu configure script three times this week always needing "set -x", inserting an exit, masking the cleanup trap and compiling the c file by hand until I knew what the reason is. I think we could make easier for developers and end users.
Therefore this patch keeps the qemu style configure output which is a list of "$Feature $Status", but extend the "no" result like "KVM Support no" with some more information.

There might be a lot of things going wrong with that probe and I don't want to handle all of them, but if it is one of the known checks e.g. for KVM_API_VERSION then we could grep/awk that out and report it. The patch reports in case of a known case in the style
"KVM support no - (Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS)"

In case more than one #error is triggered it creates a comma separated list in those brackets and in case it is something else than an #error it just reports plain old "no".

---

[diffstat]

 configure |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

[diff]

qemu/configure +13 -6
@@ -1037,12 +1037,14 @@ if test "$kvm" = "yes" ; then
 if test "$kvm" = "yes" ; then
     cat > $TMPC <<EOF
 #include <linux/kvm.h>
-#if !defined(KVM_API_VERSION) || \
-    KVM_API_VERSION < 12 || \
-    KVM_API_VERSION > 12 || \
-    !defined(KVM_CAP_USER_MEMORY) || \
-    !defined(KVM_CAP_SET_TSS_ADDR)
+#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
 #error Invalid KVM version
+#endif
+#if !defined(KVM_CAP_USER_MEMORY)
+#error Missing KVM capability KVM_CAP_USER_MEMORY
+#endif
+#if !defined(KVM_CAP_SET_TSS_ADDR)
+#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
 #endif
 int main(void) { return 0; }
 EOF
@@ -1055,7 +1057,12 @@ EOF
       2>/dev/null ; then
     :
   else
-    kvm="no"
+    kvmprobeerr=`$cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 | grep "error: #error " | awk --field-separator "error: #error " '{if (NR>1) printf(", "); printf("%s",$2);}'`
+    if test "$kvmprobeerr" != "" ; then
+      kvm="no - (${kvmprobeerr})"
+    else
+      kvm="no"
+    fi
   fi
 fi
 
#1 lore raw
Quoted 23 lines · Christian Ehrhardt

I ran into the issue of a failign KVM Probe of the qemu configure script three times this week always needing "set -x", inserting an exit, masking the cleanup trap and compiling the c file by hand until I knew what the reason is. I think we could make easier for developers and end users.
Therefore this patch keeps the qemu style configure output which is a list of "$Feature $Status", but extend the "no" result like "KVM Support no" with some more information.

There might be a lot of things going wrong with that probe and I don't want to handle all of them, but if it is one of the known checks e.g. for KVM_API_VERSION then we could grep/awk that out and report it. The patch reports in case of a known case in the style
"KVM support no - (Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS)"

In case more than one #error is triggered it creates a comma separated list in those brackets and in case it is something else than an #error it just reports plain old "no".

qemu/configure +0 -0
@@ -1037,12 +1037,14 @@ if test "$kvm" = "yes" ; then
 if test "$kvm" = "yes" ; then

qemu/configure if test "$kvm" = "yes" ; then · line 1042

Quoted 10 lines
qemu/configure +1 -5
     cat > $TMPC <<EOF
 #include <linux/kvm.h>
-#if !defined(KVM_API_VERSION) || \
-    KVM_API_VERSION < 12 || \
-    KVM_API_VERSION > 12 || \
-    !defined(KVM_CAP_USER_MEMORY) || \
-    !defined(KVM_CAP_SET_TSS_ADDR)
+#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
 #error Invalid KVM version
 

You might refine this a bit: if KVM_API_VERSION is not defined, most likely linux/kvm.h could not be found, so you might as well report that.

Quoted 2 lines
qemu/configure +1 -0
+#endif
 
Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 29 lines · Avi Kivity
Quoted 28 lines · Christian Ehrhardt

I ran into the issue of a failign KVM Probe of the qemu configure script three times this week always needing "set -x", inserting an exit, masking the cleanup trap and compiling the c file by hand until I knew what the reason is. I think we could make easier for developers and end users.
Therefore this patch keeps the qemu style configure output which is a list of "$Feature $Status", but extend the "no" result like "KVM Support no" with some more information.

There might be a lot of things going wrong with that probe and I don't want to handle all of them, but if it is one of the known checks e.g. for KVM_API_VERSION then we could grep/awk that out and report it. The patch reports in case of a known case in the style
"KVM support no - (Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS)"

In case more than one #error is triggered it creates a comma separated list in those brackets and in case it is something else than an #error it just reports plain old "no".

qemu/configure +0 -3
@@ -1037,12 +1037,14 @@ if test "$kvm" = "yes" ; then
 if test "$kvm" = "yes" ; then
     cat > $TMPC <<EOF
 #include <linux/kvm.h>
-#if !defined(KVM_API_VERSION) || \
-    KVM_API_VERSION < 12 || \
-    KVM_API_VERSION > 12 || \
Quoted 13 lines
Quoted 6 lines
qemu/configure +1 -2
-    !defined(KVM_CAP_USER_MEMORY) || \
-    !defined(KVM_CAP_SET_TSS_ADDR)
+#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || 

KVM_API_VERSION > 12
#error Invalid KVM version

You might refine this a bit: if KVM_API_VERSION is not defined, most likely linux/kvm.h could not be found, so you might as well report that.

Quoted 2 lines

+#endif

Updated v2 should appear on the list soon reporting all gcc "error:" messages.

Signature · 2 lines
Grüsse / regards, Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization