Re: how can i tell if a running kernel has KVM functionality?

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

 



On Sat, 4 Apr 2009, Matthias Kaehlcke wrote:

> hi robert,
>
> El Sat, Apr 04, 2009 at 08:02:29AM -0400 Robert P. J. Day ha dit:
>
> >   is there an easy way to tell if a running kernel has KVM
> > functionality?  from "make menuconfig", we can see the KVM tristate
> > selections under "Virtualization:"
> >
> >   --- Virtualization
> >   <M>   Kernel-based Virtual Machine (KVM) support
> >   < >     KVM for Intel processors support (NEW)
> >   < >     KVM for AMD processors support (NEW)
> >
> > so if i have no access to the corresponding config file, how can i
> > tell if a kernel has any or all of the above?
> >
> >   first, i know that if you choose to build all of the above as
> > modules, you'll get kvm.ko, kvm-intel.ko and kvm-amd.ko, so i can
> > check the modules.  but if any of that has been built into the kernel,
> > is there a way to tell?  something under /proc, perhaps?
>
> kvm_init() registers the device class 'kvm':
> http://lxr.linux.no/linux+v2.6.29/virt/kvm/kvm_main.c#L2289
>
> i guess it is called at system initialization when kvm support has
> been built into the kernel. if that is the case you could check for
> the existence of /sys/class/kvm

  ah, quite right, i should have checked there.  and let me ask a
couple more questions, which i would normally answer for myself by
testing but, at the moment, i have no system running a kernel with
built-in kvm support.  (as an aside, is anyone out there running a
recent kernel with built-in kvm that can verify the above?)

  if you look at the menuconfig snippet above, you can see that, in
addition to selecting *generic* kvm support, this still won't do you
any good unless you further select one of the two available
(x86-based) kvm hardware extensions (Intel vmx or AMD svm).  so, the
obvious questions:

  * i'm assuming that it's *legal* to select generic kvm support
without selecting additional CPU-specific support, which will only
mean that, if matthias is correct, you'll see /sys/class/kvm even when
you have no actual kvm support.

  * depending on which of the two (or possibly both) CPU-specific virt
support you choose, how could you verify that *those* were currently
supported in your running kernel?

  if they were built modular, i can already see that you'd have the
modules kvm-intel.ko or kvm-amd.ko.  but if they're built in, how
could you tell?  would they show up as subdirs under /sys/class/kvm?
again, anyone who can verify this on an actual system, feel free.
thanks.

rday
--

p.s.  depending on which CPU support you choose, you'd end up
compiling one or both of arch/x86/kvm/{svm,vmx}.c.  i guess i could
just peruse those source files and see if they register something
under /sys.


========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux