Skip to contentSkip to conversation

Installing kernel headers in kvm-kmod

DISCUSSION Anthony Liguori 4 participants 13 messages Dec 10, 2009 KVM

lore
Share & tools
lore
#0 lore raw

QEMU 0.12.0-rc1 does not support KVM
https://bugs.launchpad.net/bugs/494500

Boils down to the fact that 1) we don't include kernel headers in qemu (whereas qemu-kvm does) and 2) kvm-kmod does not install those headers on make install.

I think we've discussed (2) as being the preferred solution. Does everyone agree with that? Anyone care to volunteer to make the change? :-)

Regards,

Anthony Liguori

#1 lore raw
Quoted 7 lines · Anthony Liguori

QEMU 0.12.0-rc1 does not support KVM
https://bugs.launchpad.net/bugs/494500

Boils down to the fact that 1) we don't include kernel headers in qemu (whereas qemu-kvm does) and 2) kvm-kmod does not install those headers on make install.

I think we've discussed (2) as being the preferred solution. Does everyone agree with that? Anyone care to volunteer to make the change? :-)

While I definitely agree with (2), for the bug you cite Ubuntu should backport KVM_CAP_DESTROY_MEMORY_REGION_WORKS to their kernel (and headers). Distributions shouldn't require kvm-kmod.

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
In reply to Anthony Liguori
Quoted 10 lines · Anthony Liguori

QEMU 0.12.0-rc1 does not support KVM
https://bugs.launchpad.net/bugs/494500

Boils down to the fact that 1) we don't include kernel headers in qemu (whereas qemu-kvm does) and 2) kvm-kmod does not install those headers on make install.

I think we've discussed (2) as being the preferred solution. Does everyone agree with that? Anyone care to volunteer to make the change? :-)

I've pushed a half-tested approach into kvm-kmod's next branch. Feel free to test/fix/enhance it.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 8 lines · Jan Kiszka
Quoted 7 lines · Anthony Liguori

QEMU 0.12.0-rc1 does not support KVM
https://bugs.launchpad.net/bugs/494500

Boils down to the fact that 1) we don't include kernel headers in qemu (whereas qemu-kvm does) and 2) kvm-kmod does not install those headers on make install.

Quoted 5 lines
Quoted 3 lines

I think we've discussed (2) as being the preferred solution. Does everyone agree with that? Anyone care to volunteer to make the change? :-)

I've pushed a half-tested approach into kvm-kmod's next branch. Feel free to test/fix/enhance it.

This would work, but installing to /usr/include/linux/kvm.h will confuse distro package managers a lot, because that location belongs to the glibc or libc-linux-headers or some other package already.

If you want to install the headers from kvm-kmod, I would recommend doing it in a different path, e.g. /usr/include/kvm-kmod/{linux,asm}. qemu can then add -I/usr/include/kvm-kmod to it's default include path and get the kvm-kmod version if that's installed or the distro version otherwise.

It may also be useful to do the equivalent of 'make headers_install' from the kernel, to remove all "#ifdef __KERNEL__" sections and sparse annotations from the header files, but it should also work without that.

Arnd

#4 lore raw
Quoted 18 lines · Arnd Bergmann
Quoted 9 lines · Jan Kiszka
Quoted 7 lines · Anthony Liguori

QEMU 0.12.0-rc1 does not support KVM
https://bugs.launchpad.net/bugs/494500

Boils down to the fact that 1) we don't include kernel headers in qemu (whereas qemu-kvm does) and 2) kvm-kmod does not install those headers on make install.

Quoted 7 lines
Quoted 4 lines

I think we've discussed (2) as being the preferred solution. Does everyone agree with that? Anyone care to volunteer to make the change? :-)

I've pushed a half-tested approach into kvm-kmod's next branch. Feel free to test/fix/enhance it.

Quoted 7 lines

This would work, but installing to /usr/include/linux/kvm.h will confuse distro package managers a lot, because that location belongs to the glibc or libc-linux-headers or some other package already.

If you want to install the headers from kvm-kmod, I would recommend doing it in a different path, e.g. /usr/include/kvm-kmod/{linux,asm}.

Maybe even /usr/local/include/kvm-kmod-$version/...., and a symlink /usr/local/include/kvm-kmod.

Quoted 9 lines

qemu can then add -I/usr/include/kvm-kmod to it's default include path and get the kvm-kmod version if that's installed or the distro version otherwise.

It may also be useful to do the equivalent of 'make headers_install' from the kernel, to remove all "#ifdef __KERNEL__" sections and sparse annotations from the header files, but it should also work without that.

Well, qemu.git needs __user removed.

Signature · 1 line
error compiling committee.c: too many arguments to function
#12 lore raw
In reply to Arnd Bergmann
Quoted 19 lines · Arnd Bergmann
Quoted 8 lines · Jan Kiszka
Quoted 7 lines · Anthony Liguori

QEMU 0.12.0-rc1 does not support KVM
https://bugs.launchpad.net/bugs/494500

Boils down to the fact that 1) we don't include kernel headers in qemu (whereas qemu-kvm does) and 2) kvm-kmod does not install those headers on make install.

Quoted 5 lines
Quoted 3 lines

I think we've discussed (2) as being the preferred solution. Does everyone agree with that? Anyone care to volunteer to make the change? :-)

I've pushed a half-tested approach into kvm-kmod's next branch. Feel free to test/fix/enhance it.

This would work, but installing to /usr/include/linux/kvm.h will confuse distro package managers a lot, because that location belongs to the glibc or libc-linux-headers or some other package already.

Quoted 5 lines

If you want to install the headers from kvm-kmod, I would recommend doing it in a different path, e.g. /usr/include/kvm-kmod/{linux,asm}. qemu can then add -I/usr/include/kvm-kmod to it's default include path and get the kvm-kmod version if that's installed or the distro version otherwise.

Good point. /usr/include/kvm-kmod would be ok for me unless someone wants them elsewhere.

Quoted 5 lines

It may also be useful to do the equivalent of 'make headers_install' from the kernel, to remove all "#ifdef __KERNEL__" sections and sparse annotations from the header files, but it should also work without that.

Yes, I think it's better to let the sync source install those headers for us, then pick up those cleaned versions, carry them in kvm-kmod in addition to the existing ones and finally install them.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#5 lore raw
In reply to Avi Kivity
Quoted 2 lines · Avi Kivity

Maybe even /usr/local/include/kvm-kmod-$version/...., and a symlink /usr/local/include/kvm-kmod.

Depends on how fine-grained you want to do the packaging. Most distributions split packages between code and development packages. The kvm-kmod code is the kernel module, so you want to be able to install it for multiple kernels simultaneously.

Building the package only requires one version of the header and does not depend on the underlying kernel version, only on the version of the module, so it's reasonable to install only one version as the -dev package, and have a dependency in there to match the module version with the header version.

The most complex setup would split the development package into one per kernel version and/or module version, plus an extra package for the module version containing only the symlink. I wouldn't go there.

Quoted 7 lines
Quoted 5 lines

It may also be useful to do the equivalent of 'make headers_install' from the kernel, to remove all "#ifdef __KERNEL__" sections and sparse annotations from the header files, but it should also work without that.

Well, qemu.git needs __user removed.

This one is taken care of by kvm_kmod in the sync script, though it would be cleaner to only do it for the installed version of the header, not for the one used to build kvm.ko.

	Arnd <><
#6 lore raw
Quoted 15 lines · Arnd Bergmann
Quoted 2 lines · Avi Kivity

Maybe even /usr/local/include/kvm-kmod-$version/...., and a symlink /usr/local/include/kvm-kmod.

Depends on how fine-grained you want to do the packaging. Most distributions split packages between code and development packages. The kvm-kmod code is the kernel module, so you want to be able to install it for multiple kernels simultaneously.

Building the package only requires one version of the header and does not depend on the underlying kernel version, only on the version of the module, so it's reasonable to install only one version as the -dev package, and have a dependency in there to match the module version with the header version.

Quoted 4 lines

The most complex setup would split the development package into one per kernel version and/or module version, plus an extra package for the module version containing only the symlink. I wouldn't go there.

I've just (forced-)pushed the "simple" version with /usr/include/kvm-kmod as destination. The user headers are now stored under usr/include in the kvm-kmod sources and installed from there.

Quoted 11 lines
Quoted 7 lines
Quoted 6 lines

It may also be useful to do the equivalent of 'make headers_install' from the kernel, to remove all "#ifdef __KERNEL__" sections and sparse annotations from the header files, but it should also work without that.

Well, qemu.git needs __user removed.

This one is taken care of by kvm_kmod in the sync script, though it would be cleaner to only do it for the installed version of the header, not for the one used to build kvm.ko.

It's easy to drop, but I wonder why it was introduced. To allow reusing the headers for user space?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#7 lore raw
Quoted 5 lines · Jan Kiszka

I've just (forced-)pushed the "simple" version with /usr/include/kvm-kmod as destination. The user headers are now stored under usr/include in the kvm-kmod sources and installed from there.

It's customary to install to /usr/local, not to /usr (qemu does the same).

Signature · 1 line
error compiling committee.c: too many arguments to function
#8 lore raw
Quoted 7 lines · Avi Kivity
Quoted 4 lines · Jan Kiszka

I've just (forced-)pushed the "simple" version with /usr/include/kvm-kmod as destination. The user headers are now stored under usr/include in the kvm-kmod sources and installed from there.

It's customary to install to /usr/local, not to /usr (qemu does the same).

Adjusted accordingly. Moreover, I only install the target arch's header now.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#9 lore raw
Quoted 8 lines · On Thursday 10 December 2009 17:14:40 Jan Kiszka wrote:
Quoted 7 lines · Avi Kivity
Quoted 4 lines · Jan Kiszka

I've just (forced-)pushed the "simple" version with /usr/include/kvm-kmod as destination. The user headers are now stored under usr/include in the kvm-kmod sources and installed from there.

It's customary to install to /usr/local, not to /usr (qemu does the same).

Right. Specifically, an install from source should go to /usr/local/include by default, while a distro package should override the path to go to /usr/include, which the current version easily allows.

This also means that qemu will have to look in three places now, /usr/local/include/kvm-kmod, /usr/include/kvm-kmod and /usr/include. Adding /usr/local/include probably doesn't hurt but should not be necessary.

Quoted 1 line

Adjusted accordingly. Moreover, I only install the target arch's header now.

Looks good now.

Arnd

#10 lore raw
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · On Thursday 10 December 2009 17:14:40 Jan Kiszka wrote:
Quoted 9 lines · Avi Kivity
Quoted 5 lines · Jan Kiszka

I've just (forced-)pushed the "simple" version with /usr/include/kvm-kmod as destination. The user headers are now stored under usr/include in the kvm-kmod sources and installed from there.

It's customary to install to /usr/local, not to /usr (qemu does the same).

Quoted 9 lines

Right. Specifically, an install from source should go to /usr/local/include by default, while a distro package should override the path to go to /usr/include, which the current version easily allows.

This also means that qemu will have to look in three places now, /usr/local/include/kvm-kmod, /usr/include/kvm-kmod and /usr/include. Adding /usr/local/include probably doesn't hurt but should not be necessary.

The only icky bit is that /usr/local/include/kvm-kmod will stick around after the user forgets about it and switches to the kernel headers. I don't see a way around it (it's the generic uninstall problem), so I think we should just live with it.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#11 lore raw
In reply to Avi Kivity
Quoted 23 lines · Avi Kivity
Quoted 22 lines · Arnd Bergmann
Quoted 9 lines · Jan Kiszka
Quoted 7 lines · Anthony Liguori

QEMU 0.12.0-rc1 does not support KVM
https://bugs.launchpad.net/bugs/494500

Boils down to the fact that 1) we don't include kernel headers in qemu (whereas qemu-kvm does) and 2) kvm-kmod does not install those headers on make install.

Quoted 7 lines
Quoted 4 lines

I think we've discussed (2) as being the preferred solution. Does everyone agree with that? Anyone care to volunteer to make the change? :-)

I've pushed a half-tested approach into kvm-kmod's next branch. Feel free to test/fix/enhance it.

This would work, but installing to /usr/include/linux/kvm.h will confuse distro package managers a lot, because that location belongs to the glibc or libc-linux-headers or some other package already.

Quoted 5 lines
Quoted 3 lines

If you want to install the headers from kvm-kmod, I would recommend doing it in a different path, e.g. /usr/include/kvm-kmod/{linux,asm}.

Maybe even /usr/local/include/kvm-kmod-$version/...., and a symlink /usr/local/include/kvm-kmod.

A pkg-config file would be nice. Then we need no symlink. Makes qemu interaction saner.

Regards,

Anthony Liguori