Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 270241

Summary: app-emulation/kvm-85-r2 hangs (on clock_gettime) before reaching guest boot
Product: Gentoo Linux Reporter: Mike Nerone <mike>
Component: Current packagesAssignee: Daniel Gryniewicz (RETIRED) <dang>
Status: RESOLVED INVALID    
Severity: normal CC: cardoe
Priority: High    
Version: 2008.0   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info
strace output
messages sent to kernel log upon kvm invocation

Description Mike Nerone 2009-05-18 00:22:48 UTC
Upon any attempt to start kvm, it hangs with 100% CPU usage strace shows an infinite loop bouncing between clock_gettime and futex. This is my first attempt to run kvm, so I don't have a preexisting working setup to compare anything to. It's more than possible I'm just doing something wrong, but if so, I haven't figured out what. I thought I'd ask some more knowledgeable people before trying 500 combinations of various clock-related kernel configs. :)

Below are the kvm versions I have installed. I will attach emerge --info, the strace output, and some kernel log output that is generated momentarily.

Thanks in advance!

# equery list kvm
[ Searching for package 'kvm' in all categories among: ]
 * installed packages
[I--] [ ~] app-emulation/kvm-85-r2 (0)
[I--] [ ~] app-emulation/kvm-kmod-85 (0)
Comment 1 Mike Nerone 2009-05-18 00:24:04 UTC
Created attachment 191597 [details]
emerge --info
Comment 2 Mike Nerone 2009-05-18 00:25:23 UTC
Created attachment 191599 [details]
strace output
Comment 3 Mike Nerone 2009-05-18 00:26:00 UTC
Created attachment 191601 [details]
messages sent to kernel log upon kvm invocation
Comment 4 Mike Nerone 2009-05-18 00:29:45 UTC
Oh, and the command I execute can be as simple as the following (where test.img was freshly created with kvm-img):

    kvm -hda test.img

But, yes, it also happens it I specify a bootable cd image (I've tried with several):

    kvm -hda test.img -cdrom ~/<INSERT GENTOO, UBUNTU, OR KNOPPIX HERE>.iso -boot d
Comment 5 Daniel Gryniewicz (RETIRED) gentoo-dev 2009-05-28 13:32:51 UTC
Sorry for the delay, I was on vacation.

This sounds vaguely like a mismatch between the kernel modules.  I've seen this before.  The problem is you must install the kvm.ko module from your kernel to build kvm, but if you also install kvm-kmod, you can get kvm.ko from the kernel loaded and kvm_intel.ko or kvm_amd.ko from kvm-kmod installed, which causes problems.

Could you:
- rmmod kvm_intel/kvm_amd/kvm
- go to /lib/modules/<kernelversion>/kernel/arch/x86/ and nuke kvm
- Run depmod -a
- modprobe kvm_intel/kvm_amd
- try again?

If that fails, could you post the output of
egrep "KVM|VIRT" /usr/src/linux/.config
Comment 6 Mike Nerone 2009-05-29 02:10:57 UTC
Bingo! That did it!

What an odd situation with kvm.ko - I hadn't noticed there were two different ones in the module tree. So if I understand correctly, you have to enable kvm.ko in the kernel in order for kvm-kmod to build, but then manually delete the file thus generated. Out of curiosity, is there a better solution on the horizon (I understand this is the kind of thing I choose to deal with because kvm is not yet stable - I'm just wondering about the future).
Comment 7 Daniel Gryniewicz (RETIRED) gentoo-dev 2009-05-29 03:26:07 UTC
I haven't found one yet, but I'm looking.  If you have any ideas, I'm all ears...

Closing.  Thanks for verifying.