From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Ehrhardt Subject: kvm-userspace requires kvm capable kernel headers in default search path of the compiler Date: Wed, 10 Dec 2008 13:50:58 +0100 Message-ID: <493FBB32.8000507@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000406020101010904030507" To: kvm , kvm-ppc , Hollis Blanchard , Avi Kivity Return-path: Sender: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: kvm.vger.kernel.org This is a multi-part message in MIME format. --------------000406020101010904030507 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi everyone, while running a test when updating kvm-userspace for powerpc I found that the current kvm userspace requires kvm kernel headers in the default search path of the used compilers. I used to update and build in the same kvm-userspace directory for a while and this one had an old stale kernel/include directory which fulfilled all the requirements. While testing my current patch series on a new git clone of kvm-userspace I wondered why this doesn't work anymore (it worked in my old directory which also had the updated current source). I switched to x86 to verify that issue there and I found that eventually the issue is in the kvm detection "KVM Probe" part of the qemu configuration in kvm-userspace. It failed not finding kvm headers. gcc -m32 -o /tmp/qemu-conf--21885- -I/home/paelzer/Desktop/kvm-userspace/kernel/include /tmp/qemu-conf--21885-.c /tmp/qemu-conf--21885-.c:1:23: error: linux/kvm.h: No such file or directory /tmp/qemu-conf--21885-.c:3:2: error: #error Invalid KVM version Looking at the include paths it is worth to note that a current git clone of kvm-userspace has no kernel/include directory anymore. A few questions later to some other kvm developers I found that there headers can be found, but in the default search path of the compiler e.g. /usr/include. In my environment with an older gcc cross compiler for powerpc and no up to date linux headers installed for x86 both architectures failed. The Solution to that can be done in several ways: a) we decide that kvm-userspace needs up-to-date kernel headers installed. And modify the KVM Probe at least to tell the user about this possible reason when failing instead of silently switching to "KVM support no". b) if the user already provide a --kerneldir option to specify where the right includes can be found we should give those configure checks a chance to really reach that. Atm it adds the kernel/include path of the kvm-userspace tree which doesn't exist anymore (except as stale old dir in a lot of source trees out there). c) I overlooked something and there is an even better or trivial approach :-) Since this could be solved several very different ways I think its worth a discussion. As I prefer b) I attached a simple patch example how this could look like :-). -- Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization --------------000406020101010904030507 Content-Type: text/x-diff; name="fix-qemu-kerneldir-include.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix-qemu-kerneldir-include.diff" diff --git a/configure b/configure index 63f956c..f772bae 100755 --- a/configure +++ b/configure @@ -3,6 +3,7 @@ prefix=/usr/local kernelsourcedir= kerneldir=/lib/modules/$(uname -r)/build +qemu_kerneldir= cc=gcc ld=ld objcopy=objcopy @@ -56,6 +57,7 @@ while [[ "$1" = -* ]]; do ;; --kerneldir) kerneldir="$arg" + qemu_kerneldir="$arg" ;; --with-patched-kernel) want_module= @@ -84,9 +86,12 @@ while [[ "$1" = -* ]]; do esac done - -#set kenel directory +#set libkvm kernel directory libkvm_kerneldir=$(readlink -f kernel) +# use libkvm_kerneldir for qemu if no kerneldir option was set +if test "$qemu_kerneldir" = "" ; then + qemu_kerneldir=$libkvm_kerneldir +fi case $arch in i?86*|x86_64*) @@ -123,7 +128,7 @@ fi --disable-gcc-check \ --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \ --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \ - --kerneldir="$libkvm_kerneldir" \ + --kerneldir="$qemu_kerneldir" \ --prefix="$prefix" \ ${cross_prefix:+"--cross-prefix=$cross_prefix"} \ ${cross_prefix:+"--cpu=$arch"} "${qemu_opts[@]}" --------------000406020101010904030507-- -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html