qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu: report issues causing the kvm probe to fail
@ 2008-12-11 16:40 ehrhardt
  2008-12-11 21:18 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: ehrhardt @ 2008-12-11 16:40 UTC (permalink / raw)
  To: aliguori, qemu-devel; +Cc: ehrhardt, hollisb

From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

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

I sent a similar patch matching kvm-userspace upstream version of this file to
kvm@vger.kernel.org to keep both in sync as much as possible.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---

[diffstat]
 configure |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

[diff]
diff --git a/configure b/configure
index c534441..416a13b 100755
--- a/configure
+++ b/configure
@@ -929,14 +929,18 @@ fi
 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) || \
-    !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
+#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
+#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
+#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
+#endif
 int main(void) { return 0; }
 EOF
   if test "$kerneldir" != "" ; then
@@ -948,7 +952,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
 

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

* Re: [Qemu-devel] [PATCH] qemu: report issues causing the kvm probe to fail
  2008-12-11 16:40 [Qemu-devel] [PATCH] qemu: report issues causing the kvm probe to fail ehrhardt
@ 2008-12-11 21:18 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2008-12-11 21:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehrhardt, hollisb

ehrhardt@linux.vnet.ibm.com wrote:
> +    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);}'`
>   

We don't currently use awk in configure.  Is awk available on all the 
crazy platforms QEMU builds on?  Is it possible to do this without 
introducing a new configure dependency?

A graceful fail if awk isn't present (disabling KVM support) would be 
fine too.

Regards,

Anthony Liguori

> +    if test "$kvmprobeerr" != "" ; then
> +      kvm="no - (${kvmprobeerr})"
> +    else
> +      kvm="no"
> +    fi
>    fi
>  fi
>  
>
>
>   

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

end of thread, other threads:[~2008-12-11 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-11 16:40 [Qemu-devel] [PATCH] qemu: report issues causing the kvm probe to fail ehrhardt
2008-12-11 21:18 ` Anthony Liguori

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