[fedora-virt] how can i see if the running kernel has kvm support?

Robert P. J. Day rpjday at crashcourse.ca
Thu Apr 9 16:03:18 UTC 2009

On Wed, 8 Apr 2009, Eduardo Habkost wrote:

> On Wed, Apr 08, 2009 at 04:05:41PM -0400, Robert P. J. Day wrote:

> > regardless of whether kvm support is built-in or whether it's
> > modular and the modules have been loaded, is there some indication
> > -- say under /proc or /sys -- that shows the current state of kvm
> > support in the kernel?
> >
> >   if i had the config file for the running kernel, i could of
> > course look at that, but let's assume that i have no such thing,
> > and that kvm support is built-in so i can't even check for, say,
> > /sys/module/kvm. is there a userspace way to probe and determine
> > kvm support?
> You can try looking at /sys/class/misc/kvm.

  and /dev/kvm as well, as glauber pointed out.  i took a quick look
at the kernel source file virt/kvm/kvm_main.c, and i can see the
kvm_init() routine which contains the snippet:


        r = kvm_arch_hardware_setup();
        if (r < 0)
                goto out_free_0a;

        r = sysdev_class_register(&kvm_sysdev_class);
        if (r)
                goto out_free_3;

        r = sysdev_register(&kvm_sysdev);
        if (r)
                goto out_free_4;


        kvm_chardev_ops.owner = module;
        kvm_vm_fops.owner = module;
        kvm_vcpu_fops.owner = module;

        r = misc_register(&kvm_dev);
        if (r) {
                printk(KERN_ERR "kvm: misc device register failed\n");
                goto out_free;


  just to clarify, those last few lines appear to create the device
file /dev/kvm, while the ones above involving sysdev_class_register()
and sysdev_register() will handle /sys/class/misc/kvm, correct?  just
being curious and nosing around the kernel code.


Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Linked In:                             http://www.linkedin.com/in/rpjday
Twitter:                                       http://twitter.com/rpjday

More information about the Fedora-virt mailing list