[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



On Thu, Apr 09, 2009 at 12:03:18PM -0400, Robert P. J. Day wrote:
> 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.

Both are steps needed for /sys/class/misc/kvm. After that, udev should
create /dev/kvm when it is notified about the new device.

-- 
Eduardo


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]