1

Recently I started looking at KVM/Qemu as an alternative to VirtualBox and was shocked to notice that these 3 modules seem to be automatically loaded on almost every linux system I checked:

[pgoetz@frog etc]$ lsmod | grep kvm
kvm_intel             311296  0
kvm                   778240  1 kvm_intel
irqbypass              16384  1 kvm

The reason this was shocking is none of these systems were using kvm/Qemu virtualization (although a couple of them were set up for VirtualBox). The systems I checked were running Arch linux, Ubuntu 18.04, Ubuntu 19.10, and CentOS 7.4. The Ubuntu 19.10 was a fresh desktop install with no added software. The only system I found which didn't have the KVM modules loaded was an Ubuntu 18.04.2 (alternative) server install.

Plenty of googling hasn't uncovered the reason for why these modules are loaded. As an experiment, I tried disabling Intel VT in the BIOS on the Ubuntu 19.10 machine, and it still loaded the kvm module (but not kvm_intel)!

It probably doesn't hurt anything to have this module loaded, but I'm curious about the mechanism: how/why is it being loaded on boot?

2

To determine why a module is loaded automatically, a good place to look is the module’s aliases:

$ sudo modinfo kvm-intel|grep alias:
alias:          cpu:type:x86,ven*fam*mod*:feature:*0085*
$ sudo modinfo kvm-amd|grep alias:
alias:          cpu:type:x86,ven*fam*mod*:feature:*00C2*

This means that kvm-intel is loaded on systems with a CPU supporting feature 85h (X86_FEATURE_VMX), and kvm-amd on systems with a CPU supporting feature C2h (X86_FEATURE_SVM).

2
  • Thanks for this useful response. I understand this much, based on this kernel commit: git.kernel.org/linus/644e9cbbe3fc032cc92d0936057e166a994dc246 The part I don't get is if I disable VT-x in BIOS and reboot, the kvm-intel module is no longer loaded, but kvm and irqbypass still are (meaning they're not just being loaded as dependencies of kvm-intel). Would love to get to the bottom of this, because this makes me feel like I don't understand what's going on. – pgoetz Dec 18 '19 at 17:16
  • 1
    You and me both ;-). I forgot your second-last paragraph, there is indeed something else going on, I’ll keep digging... – Stephen Kitt Dec 19 '19 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.