From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMGVb-0003zh-TA for qemu-devel@nongnu.org; Mon, 12 Jan 2009 01:42:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMGVa-0003zV-0r for qemu-devel@nongnu.org; Mon, 12 Jan 2009 01:42:46 -0500 Received: from [199.232.76.173] (port=57420 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMGVZ-0003zS-Qr for qemu-devel@nongnu.org; Mon, 12 Jan 2009 01:42:45 -0500 Received: from mtagate4.de.ibm.com ([195.212.29.153]:47477) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LMGVZ-0001z1-AD for qemu-devel@nongnu.org; Mon, 12 Jan 2009 01:42:45 -0500 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.13.8/8.13.8) with ESMTP id n0C6ga1N047678 for ; Mon, 12 Jan 2009 06:42:36 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 n0C6ga7u4317268 for ; Mon, 12 Jan 2009 07:42:36 +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 n0C6ga9Y007145 for ; Mon, 12 Jan 2009 07:42:36 +0100 Message-ID: <496AE65A.1000701@linux.vnet.ibm.com> Date: Mon, 12 Jan 2009 07:42:34 +0100 From: Christian Ehrhardt MIME-Version: 1.0 References: <1231503054-10618-1-git-send-email-ehrhardt@linux.vnet.ibm.com> <496760F3.7020902@amd.com> In-Reply-To: <496760F3.7020902@amd.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH] qemu: fix configuring kvm probe when using --kerneldir Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andre Przywara Cc: aliguori@us.ibm.com, Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org Andre Przywara wrote: > ehrhardt@linux.vnet.ibm.com wrote: >> From: Christian Ehrhardt >> >> There is already a variable kvm_cflags which gets the path of the kern= el >> includes when using --kerneldir. But eventually with newer kernels we=20 >> all will >> need arch/$arch/include too (my case was a incldue of asm/kvm.h which=20 >> was not >> found anymore). Headers in a full kernel source are not flattened to >> one arch like they are if e.g. installed kernel headers are used. > I also stumbled over this recently (in kvm-userspace.git), but I had=20 > problems with the qemu part not including KVM support because in=20 > qemu/configure the KVM build test failed due to the missing asm/kvm.h. > I saw that --kerneldir gets not propagated to qemu, but=20 > libkvm_kerneldir instead, which is hardcoded to point to `pwd`/kernel.=20 > Shouldn't that be fixed, too? > I use kvm-userspace.git and a not-installed kernel from kvm.git for=20 > compiling, so I say "./configure --kerneldir=3D/src/kvm.git=20 > --with-patched-kernel". I eventually hacked KVM's configure to=20 > propagate --kerneldir to qemu and added arch/x86/include to the=20 > include path in qemu/configure. This is of course a hack (that's why I=20 > don't append it here), but it worked ;-) > If someone proposes a clean and easy way to solve this, I'd be happy=20 > to write a patch. I know this issue and reported it ~a month ago. I also had issues=20 compiling against a --kerneldir kernel because the libkvm_kerneldir was=20 propagated. Eventually in the discussion it came up that we don't need=20 to fix configure "technically", but maybe we should find a way to better=20 inform users/develop=FCers about this (I guess up to 99% that this works=20 for you in kvm-userspace too): (in a clean kvm-userspace) cd kernel make sync LINUX=3Dpath/to/your/kerneldir cd .. ./configure opt=3Dwhateveryouwant This way your kerneldir is synced and flattened into kvm-userspace and=20 propagating libkvm_kerneldir is fine since that are your kerneldir=20 headers now. Maybe a "fix" would be that if --kerneldir is provided to configure it=20 has to ensure that THIS kerneldir is synced in before continuing. You should be aware that the fix I sent on Friday was for plain qemu=20 which doesn't have that kernel subdir indirection and therefore works a=20 bit different. >> To fix that, the includes added to cflags depending on --kerneldir=20 >> should also >> contian the arch includes. The patch adds a special check for x86=20 >> because its >> source layout recently changed, all others directly use=20 >> arch/$cpu/include if >> existent. > This is one problem I also noticed. $cpu is not the same as the Linux'=20 > arch name, is there a suitable variable or do we have to do a large=20 > switch/case? I looked around and there was no real 1:1 matching variable. But=20 fortunately $cpu is similar enough to simplify that swicth/case a lot=20 like I did in my patch here. > Regards, > Andre. > > >> >> Signed-off-by: Christian Ehrhardt >> --- >> >> [diffstat] >> configure | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> [diff] >> diff --git a/configure b/configure >> --- a/configure >> +++ b/configure >> @@ -963,6 +963,12 @@ EOF >> EOF >> if test "$kerneldir" !=3D "" ; then >> kvm_cflags=3D-I"$kerneldir"/include >> + if test \( "$cpu" =3D "i386" -o "$cpu" =3D "x86_64" \) \ >> + -a -d "$kerneldir/arch/x86/include" ; then >> + kvm_cflags=3D"$kvm_cflags -I$kerneldir/arch/x86/include" >> + elif test -d "$kerneldir/arch/$cpu/include" ; then >> + kvm_cflags=3D"$kvm_cflags -I$kerneldir/arch/$cpu/include" >> + fi >> else >> kvm_cflags=3D"" >> fi --=20 Gr=FCsse / regards,=20 Christian Ehrhardt IBM Linux Technology Center, Open Virtualization