All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
To: kvm <kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	kvm-ppc <kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Hollis Blanchard
	<hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	Avi Kivity <avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: kvm-userspace requires kvm capable kernel headers in default search
Date: Wed, 10 Dec 2008 12:50:58 +0000	[thread overview]
Message-ID: <493FBB32.8000507@linux.vnet.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2457 bytes --]

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


[-- Attachment #2: fix-qemu-kerneldir-include.diff --]
[-- Type: text/x-diff, Size: 1125 bytes --]

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[@]}"

WARNING: multiple messages have this Message-ID (diff)
From: Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: kvm <kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	kvm-ppc <kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Hollis Blanchard
	<hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	Avi Kivity <avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: kvm-userspace requires kvm capable kernel headers in default search path of the compiler
Date: Wed, 10 Dec 2008 13:50:58 +0100	[thread overview]
Message-ID: <493FBB32.8000507@linux.vnet.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2404 bytes --]

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


[-- Attachment #2: fix-qemu-kerneldir-include.diff --]
[-- Type: text/x-diff, Size: 1125 bytes --]

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[@]}"

             reply	other threads:[~2008-12-10 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-10 12:50 Christian Ehrhardt [this message]
2008-12-10 12:50 ` kvm-userspace requires kvm capable kernel headers in default search path of the compiler Christian Ehrhardt
2008-12-12  0:35 ` Hollis Blanchard
2008-12-14  7:57   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=493FBB32.8000507@linux.vnet.ibm.com \
    --to=ehrhardt@linux.vnet.ibm.com \
    --cc=avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.