From patchwork Thu Jan 8 13:54:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ehrhardt@linux.vnet.ibm.com X-Patchwork-Id: 1370 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n08DoYRF001939 for ; Thu, 8 Jan 2009 05:50:34 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756404AbZAHNyM (ORCPT ); Thu, 8 Jan 2009 08:54:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756430AbZAHNyM (ORCPT ); Thu, 8 Jan 2009 08:54:12 -0500 Received: from mtagate7.de.ibm.com ([195.212.29.156]:35318 "EHLO mtagate7.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756356AbZAHNyK (ORCPT ); Thu, 8 Jan 2009 08:54:10 -0500 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.13.8/8.13.8) with ESMTP id n08Ds85i080992 for ; Thu, 8 Jan 2009 13:54:08 GMT Received: from d12av03.megacenter.de.ibm.com (d12av03.megacenter.de.ibm.com [9.149.165.213]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n08Ds9qY3190816 for ; Thu, 8 Jan 2009 14:54:09 +0100 Received: from d12av03.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av03.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n08Ds88E021618 for ; Thu, 8 Jan 2009 14:54:08 +0100 Received: from localhost.localdomain (dyn-9-152-212-28.boeblingen.de.ibm.com [9.152.212.28]) by d12av03.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n08Ds8jI021614; Thu, 8 Jan 2009 14:54:08 +0100 From: ehrhardt@linux.vnet.ibm.com To: aliguori@us.ibm.com Cc: ehrhardt@linux.vnet.ibm.com, avi@qumranet.com, qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [PATCH] qemu: report issues causing the kvm probe to fail v3 Date: Thu, 8 Jan 2009 14:54:08 +0100 Message-Id: <1231422848-32179-1-git-send-email-ehrhardt@linux.vnet.ibm.com> X-Mailer: git-send-email 1.5.4.3 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: 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 --- configure | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/qemu/configure b/qemu/configure --- a/qemu/configure +++ b/qemu/configure @@ -1002,13 +1002,17 @@ if test "$kvm" = "yes" ; then if test "$kvm" = "yes" ; then cat > $TMPC < -#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 @@ -1021,7 +1025,16 @@ EOF > /dev/null 2>/dev/null ; then : else - kvm="no" + kvm="no"; + if [ -x "`which awk 2>/dev/null`" ] && \ + [ -x "`which grep 2>/dev/null`" ]; then + kvmerr=`$cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \ + | grep "error: " \ + | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` + if test "$kvmerr" != "" ; then + kvm="no - (${kvmerr})" + fi + fi fi fi