Commit 9fd8d8d70db785c7a18fe6788a66dcf1c095a7ad

Authored by aliguori
1 parent 6d2c5146

report issues causing the kvm probe to fail (Christian Ehrhardt)

The patch applies to upstream qemu as well as kvm-userspace, but since it is
the qemu configure script I think it should go to upstream qemu (Anthony)
first and with the next merge to kvm-userspace. On the other hand it is the kvm
probe so an ack from Avi in case v3 is ok would be reasonable.

*updates*
v2 - it also reports other errors than just #error preprocessor statements
     (requested by Avi)
v3 - In case awk or grep is not installed it now gracfully (silently)
     fails still disabling kvm (requested by Anthony)

This patch is about reporting more details of the issue if configuring kvm
fails. 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".

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



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6334 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 20 additions and 7 deletions
configure
... ... @@ -953,14 +953,18 @@ fi
953 953 if test "$kvm" = "yes" ; then
954 954 cat > $TMPC <<EOF
955 955 #include <linux/kvm.h>
956   -#if !defined(KVM_API_VERSION) || \
957   - KVM_API_VERSION < 12 || \
958   - KVM_API_VERSION > 12 || \
959   - !defined(KVM_CAP_USER_MEMORY) || \
960   - !defined(KVM_CAP_SET_TSS_ADDR) || \
961   - !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
  956 +#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
962 957 #error Invalid KVM version
963 958 #endif
  959 +#if !defined(KVM_CAP_USER_MEMORY)
  960 +#error Missing KVM capability KVM_CAP_USER_MEMORY
  961 +#endif
  962 +#if !defined(KVM_CAP_SET_TSS_ADDR)
  963 +#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
  964 +#endif
  965 +#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
  966 +#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
  967 +#endif
964 968 int main(void) { return 0; }
965 969 EOF
966 970 if test "$kerneldir" != "" ; then
... ... @@ -980,7 +984,16 @@ EOF
980 984 > /dev/null 2>/dev/null ; then
981 985 :
982 986 else
983   - kvm="no"
  987 + kvm="no";
  988 + if [ -x "`which awk 2>/dev/null`" ] && \
  989 + [ -x "`which grep 2>/dev/null`" ]; then
  990 + kvmerr=`$cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
  991 + | grep "error: " \
  992 + | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
  993 + if test "$kvmerr" != "" ; then
  994 + kvm="no - (${kvmerr})"
  995 + fi
  996 + fi
984 997 fi
985 998 fi
986 999  
... ...