QEMU 0.12.0 does not support KVM with Kernel < 2.6.29, bug in ./configure and kvm-all.c

Bug #494500 reported by rowa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

I tryed to compile QEMU 0.12.0-rc1 with KVM support without success.

Here my configuration:

uname -a
Linux bla 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:45:36 UTC 2009 x86_64 GNU/Linux

dpkg -l | grep kvm
ii kvm 1:84+dfsg-0ubuntu11

This KVM modul works fine.

I've installed this packets:

sudo apt-get install make wget zlib1g-dev libsdl-gfx1.2-dev
sudo apt-get install gcc libsdl1.2-dev zlib1g-dev libasound2-dev linux-kernel-headers-`uname-r` pkg-config libgnutls-dev libpci-dev

The compiling of QEMU 0.12.0-rc1 wihout KVM support was OK.

./configure --enable-kvm
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install recent kvm-kmod from http://sourceforge.net/projects/kvm.
ERROR
ERROR: User requested feature kvm
ERROR: configure was not able to find it
ERROR

I can't change the kernel because Ubuntu 9.10 are too buggy.
So I tryed to install the latest kvm modul.

wget \
http://sourceforge.net/projects/kvm/files/kvm-kmod/2.6.32/kvm-kmod-2.6.32.tar.bz2/download
tar xjvf kvm-kmod-2.6.32.tar.bz2
cd kvm-kmod-2.6.32
./configure && make
sudo make install
sudo rmmod kvm_intel kvm_adm kvm
sudo make install
sudo rmmod kvm_intel kvm
sudo modprobe kvm_intel

dmesg | grep kvm
[81811.678377] loaded kvm module (kvm-kmod-2.6.32)

I tryed to compile QEMU with kvm support but I got the same error.

./configure --enable-kvm
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install recent kvm-kmod from http://sourceforge.net/projects/kvm.
ERROR
ERROR: User requested feature kvm
ERROR: configure was not able to find it
ERROR

What is wrong?

See also http://qemu-buch.de/de/index.php/QEMU-KVM-Buch/_Installation

Revision history for this message
rowa (robertwa) wrote :

Will be fixed this big problem in QEMU 0.12.0 rc2?

QEMU without KQEMU support is bad.
But QEMU without KVM support is its dead.

 :-(

Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

This is a bug in kvm-kmod, not qemu. It should install the headers during make install.

If you pass --kerneldir=/path/to/kvm-kmod/include, it should work.

Revision history for this message
rowa (robertwa) wrote :

I thought qemu and kvm is in one packet now. :-(

I've tryed this:

./configure --enable-kvm --kerneldir=~/source/kvm-kmod-2.6.32/include/linux/

#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install recent kvm-kmod from http://sourceforge.net/projects/kvm.
ERROR
ERROR: User requested feature kvm
ERROR: configure was not able to find it
ERROR

As you can see it is the same error. Here are the content of the include directory:

ls -l ~/source/kvm-kmod-2.6.32/include/
insgesamt 20

drwxr-xr-x 3 bla bla 4096 2009-12-06 18:39 arch
lrwxrwxrwx 1 bla bla 7 2009-12-09 13:14 asm -> asm-x86
drwxr-xr-x 2 bla bla 4096 2009-12-06 18:39 asm-ia64
drwxr-xr-x 2 bla bla 4096 2009-12-06 18:39 asm-x86
drwxr-xr-x 2 bla bla 4096 2009-12-06 18:39 linux
drwxr-xr-x 3 bla bla 4096 2009-12-06 18:39 trace

As described I used the last version of kvm-kmod. This is kvm-kmod-2.6.32. Maybe this doesn't fit to my kernel 2.6.28-11-server?

rowa (robertwa)
description: updated
Revision history for this message
rowa (robertwa) wrote :

My questions about this bug:

What is the reason of the error KVM_CAP_DESTROY_MEMORY_REGION_WORKS?

Why ist the recent kvm-kmod not include in QEMU? I thought qemu and kvm is in one packet now.

Will this bug be fixed in QEMU 0.12.0?

Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

It's a bug in the Ubuntu kernel. You're also running into a bug in kvm-kmod that it doesn't install it's headers properly.

Neither of these are qemu bugs. Open a bug against the Ubuntu kernel for them to include the appropriate fix.

Changed in qemu:
status: New → Invalid
Revision history for this message
rowa (robertwa) wrote :

Sorry, but you didn't anser my questions :-(

What is the reason of the error KVM_CAP_DESTROY_MEMORY_REGION_WORKS?

Why ist the recent kvm-kmod not include in QEMU? I thought qemu and kvm is in one packet now.

Changed in qemu:
status: Invalid → New
Revision history for this message
rowa (robertwa) wrote :

There is the same problem with QEMU 0.12.0 rc2 :-(

Revision history for this message
rowa (robertwa) wrote :

A bug in the Ubuntu kernel and a bug in kvm-kmod too?

I thought qemu and kvm is in one packet now.

Is the kernel in Ubuntu different to the normal Linux kernel?
If it is not possible to compile QEMU under Ubuntu it will its dead :-(

Sorry for my questions but I try to figure out what the problem is.

Changed in qemu:
status: New → Won't Fix
Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

Do not reopen this bug

There was a bug in the 2.6.28 kernel that will result in a kernel oops with newer qemus. It was fixed in 2.6.29 and a kvm feature bit was added to allow for graceful failure. Kvm kmod does not have this bug but since its not installing its headers, qemu does not realize the modules are fixed. This is not a qemu problem.

Changed in qemu:
status: Won't Fix → Invalid
Revision history for this message
rowa (robertwa) wrote :

Sorry, for reopen this bug. But there is a bug the output of th configure script:

./configure --enable-kvm --kerneldir=~/source/kvm-kmod-2.6.32/include/linux/

#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install recent kvm-kmod from http://sourceforge.net/projects/kvm.

As I understand you it is not possible to use kernel before 2.6.29 with QEMU 0.12.0 rc2 and kvm kmod (there are obviously no solution).
It tooks me time to try to "install recent kvm-kmod from http://sourceforge.net/projects/kvm". :-(

Please change this error messages in the configure script to make this clear.

As I understand you the Kvm kmod are not included in QEMU. Why not?

The installation of QEMU+KVM could be easyer.

Changed in qemu:
status: Invalid → New
Revision history for this message
rowa (robertwa) wrote :

This bug was alrady decribed in #348391 for QEMU0.10.0 .

I've tryed the solution of https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/348391/comments/6

I 've commented out the 8 lines in kvm-all.c:

/*
    if (!kvm_check_extension(s, KVM_CAP_DESTROY_MEMORY_REGION_WORKS)) {
        ret = -EINVAL;

        fprintf(stderr,
                "KVM kernel module broken (DESTROY_MEMORY_REGION).\n%s",
                upgrade_note);
        goto err;
    }
*/

I've deleted this lines in configure
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
#endif

After this I 'compiled again:

make clean
./configure --enable-kvm
make
sudo make install

QEMU 0.12.0 rc2 works with kvm under Kernel 2.6.28-11-server in Ubuntu 9.04

qemu -enable-kvm -monitor stdio
QEMU 0.11.92 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled

Please fix this bug in QEMU.

rowa (robertwa)
summary: - QEMU 0.12.0-rc1 does not support KVM
+ QEMU 0.12.0-rc2 does not support KVM with Kernel < 2.6.29, bug in
+ ./configure and kvm-all.c
rowa (robertwa)
Changed in qemu:
assignee: nobody → Anthony Liguori (anthony-codemonkey)
Revision history for this message
rowa (robertwa) wrote : Re: QEMU 0.12.0-rc2 does not support KVM with Kernel < 2.6.29, bug in ./configure and kvm-all.c

Please don't forget to fix this bug for QEMU 0.12.0

Thanks

Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

For the last time, this is not a QEMU bug. Your kernel headers are wrong, that's what you need to fix.

Changed in qemu:
status: New → Won't Fix
rowa (robertwa)
Changed in qemu:
status: Won't Fix → New
Revision history for this message
rowa (robertwa) wrote :

Do you mean the message in the script configure is not a bug in QEMU?

#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install recent kvm-kmod from http://sourceforge.net/projects/kvm.

I did exactly what this mesage mean without succes. So this message is wrong or not exact. I found a solution for this bug(s) (see above). But this fix is very different to this message.

I am using the normal headers of a normal Ubuntu 9.04. Ubuntu is one of the most used distribution (maybe the most used). Maybe a lot of users will have this problem too.

I think it is better to change the message above for more help. If you know which version of headers are wrong why didn't you write it here ore in this message of the script configure?

Revision history for this message
rowa (robertwa) wrote :
Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

The only reason you are not getting a kernel oops is that you've installed the kvm-kmod module.

If we remove this check, and someone builds and runs qemu on a stock Ubuntu 9.10 install, it will oops there kernel in a very nasty way potentially leading to data corruption on the host. Removing the check is not an option.

This is an Ubuntu kernel bug, not a qemu bug.

Revision history for this message
rowa (robertwa) wrote :

As I understand you it works in Ubuntu 9.04 and not in Ubuntu 9.10?

I mean it is very easy to modify the script "configure" to check this.

Why don't you write it in the message of script "configure".

Maybe better is a link to a URL with more and updated help for this problem. It is possible users of other distributions will have the same problem.

In my opinion this messages confused a lot of users.

Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

You are confusing yourself.

rm -rf /lib/modules/$(uname -r)/extra/kvm*

Then reboot, and try your "patched" version. Your kernel will oops. That's why this message is here. You've partially upgraded your kernel by installing kvm-kmod and now your headers don't match the modules you have installed.

It will work fine in 9.10. It will not work in a stock 9.04 install. That was a typo in my last message.

The message explains this very clearly by saying you need at least a 2.6.29 kernel. 9.04 includes a 2.6.28 kernel.

Revision history for this message
rowa (robertwa) wrote :

The message in "configure" says

"or install recent kvm-kmod from http://sourceforge.net/projects/kvm".

I did exactly this. I didn't work. I was confused by your messages.

Why do you write this?

I think it is better to write in the script "configure":

"NOTE: To enable KVM support, update your kernel to 2.6.29+."

It is not nice for the most users but clear.

Better is what I wrote in #17:

"Maybe better is a link to a URL with more and updated help for this problem. It is possible users of other distributions will have the same problem. "

(I think this little change take less time than this discussion.)

Please fix this for QEMU 0.12.0.

Revision history for this message
rowa (robertwa) wrote :

I'm a bit surprised about this discussion.

I report this heavy bug. You wrote this is not our problem, this is a bug in the kernel headers or/and in the kvm-kmod.
You close this bug report without to give a proof of your statement and without to give a right solution. :-(

I'm a user of qemu not a developer. I found this heavy bug but it is not my job to fix this bug. This is YOUR job.

If this bug depends on other products YOU have to write bug reports to this product. I can't do this. I have not the knowledge.

Where are YOUR bug reports to the kernel headers and kvm-kmod?

What did you to find a solution for this problem?

Revision history for this message
rowa (robertwa) wrote :

This heavy bug is NOT fixed in QEMU 0.12.0!

What is happen with the development of QEMU?

summary: - QEMU 0.12.0-rc2 does not support KVM with Kernel < 2.6.29, bug in
+ QEMU 0.12.0 does not support KVM with Kernel < 2.6.29, bug in
./configure and kvm-all.c
Revision history for this message
rowa (robertwa) wrote :
Revision history for this message
rowa (robertwa) wrote :

The same problem in QEMU 0.12.1 :-(

./configure --enable-kvm
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install recent kvm-kmod from http://sourceforge.net/projects/kvm.
ERROR
ERROR: User requested feature kvm
ERROR: configure was not able to find it
ERROR

Revision history for this message
rowa (robertwa) wrote :

My gess was right (see #3).

Don't install the "recent version of kvm-kmod". You have to install the _right_ version for your kernel version.

In contrary to #2 and #5 you can use the packet kvm-source in Ubuntu:

sudo apt-get install kvm-source

After this you can compile qemu 0.12.1 with kvm-support under a kernel < 2.6.29

See also

http://qemu-forum.ipi.fi/viewtopic.php?f=4&t=5367&p=15849#p15849

http://qemu-buch.de/d/Installation

Fazit:

There are no bugs in the Ubuntu kernel. or in kvm-kmod.

There is a bug in the script configure!

Please fix this bug! Change "recent version of kvm-kmod" to "right version of kvm-kmod".

Thank you for your "help" :-(

Revision history for this message
rowa (robertwa) wrote :

No fix in QEMU 0.12.2

Is it too hard to correct a short text?

Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

kvm-source is an Ubuntu specific package that installs a DKMS version of what's essentially kvm-kmod. Effectively, you're replacing this the broken version of KVM in the standard Ubuntu kernel with the DKMS version provided by kvm-source and that's why it now works.

This is a distro problem and has nothing to do with upstream QEMU. If you feel this is still an issue, please file a bug with Ubuntu and let them sort it out.

Changed in qemu:
status: New → Won't Fix
rowa (robertwa)
Changed in qemu:
status: Won't Fix → New
Revision history for this message
rowa (robertwa) wrote :

kvm-source works fine. I have not reaasaon to write a bug report to Ubuntu.

Again:

The problem is the message in the script ''configure'':

Please fix this bug! Change "recent version of kvm-kmod" to "right version of kvm-kmod".

This will be cunfused a lot of users. I installed the latest version of kvm-mod fist. This was the problem. With the right version of kvm-mode (kvm-source) it works fine.

Please make this clear in the script configure and change the text!

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Rowa-

Anthony has marked this bug "Won't Fix". Please do not reopen this bug.

If there is something you would like to change in the configure script, please create a patch and send it to the qemu-devel@ mailing list for review and inclusion in QEMU.

Anthony has closed this bug saying that he's not going to work on this bug. If you would like to do so, by all means send a patch to qemu-devel@ mailing list for peer review. But do not reopen this bug.

Changed in qemu:
status: New → Won't Fix
assignee: Anthony Liguori (anthony-codemonkey) → nobody
Revision history for this message
rowa (robertwa) wrote :

Hi Dustin,

I can't understand your bureaucracy. Instead of changing a word in the script configure you make a lot bureaucracy.

This is the bug tracker for QEMU - right? So this is the place for report bugs. A mailing list not a good tool for bug reports.

Instead of to find an easy way for user who would like to improve your product you frighten off this people.

Please respect my work. Improve your product not your bureaucracy.

---

Is there any reason not to change the text in the script configure?

Robert

Changed in qemu:
status: Won't Fix → New
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Send a patch, or respect the decision of the maintainer.

Changed in qemu:
status: New → Won't Fix
Revision history for this message
rowa (robertwa) wrote :

Here is my patch:

Change the text in the scirpt configure from:

----
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install recent kvm-kmod from http://sourceforge.net/projects/kvm.
----

to

----
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install the right version of kvm-kmod from http://sourceforge.net/projects/kvm.
----

Please keep this bug report open until the bub is fixed.

Changed in qemu:
status: Won't Fix → New
Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

The proposed wording is incorrect and if you'd take the time to read the previous comments in the bug, you would understand why.

You've proposed a bug, it's been declared as invalid. If you want to continue to argue about it, take that argument to the mailing list. This is _not_ what a bug tracker is for.

You are not being helpful. You are wasting everyone's time because you are not taking the time to understand the root of the problem. Please stop opening this bug, you are being destructive.

Changed in qemu:
status: New → Invalid
Revision history for this message
rowa (robertwa) wrote :

Sorry, but I did'nt close bug reports of not fixed bugs.

Instead of saying "Thank you for helping us to improve our product" you close bugs without a comment.

Please keep this bug report open until this bug is fixed in the next qemu verision.

Changed in qemu:
status: Invalid → New
Revision history for this message
rowa (robertwa) wrote :

Not fixed in QEMU 0.12.3.

Revision history for this message
rowa (robertwa) wrote :

Not fixed in QEMU 0.12.4. :-(

Revision history for this message
Jes Sorensen (jes-sorensen) wrote :

As pointed out repeatedly, this is _not_ a bug in QEMU

Stop reopening the bug!

Changed in qemu:
status: New → Invalid
Revision history for this message
rowa (robertwa) wrote :

@Jes Sorensen

This is a bug in the script configure of qemu. So this is a bug in QEMU.

Changed in qemu:
status: Invalid → New
Revision history for this message
Iggy (iggy-theiggy) wrote :

Recent kvm-kmod's install headers, so the text is actually correct now.

I'd say this bug can be closed now.

Revision history for this message
rowa (robertwa) wrote :

Does the _lastest_ kvm-kmod's install the right headers for the used kernel, for example kernel 2.6.28-11?

As I wrote in this bug I had problems with a kernel 2.6.28-11 and the _latest_ version of kvm-kmod. It works only with the right (not the latest) version of kvm-kmod.

I'll check it in some days.

Thanks

Revision history for this message
rowa (robertwa) wrote :

It works now:

sudo apt-get remove kvm-source
wget \
 http://download.savannah.gnu.org/releases/qemu/qemu-0.12.4.tar.gz
tar xzvf qemu-0.12.4.tar.gz
cd qemu-0.12.4
./configure --enable-kvm
make
sudo checkinstall --pkgname=qemu-self-compiled
qemu -monitor stdio -enable-kvm
(qemu) info kvm

Changed in qemu:
status: New → Fix Committed
Aurelien Jarno (aurel32)
Changed in qemu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.