Kernel-based Virtual Machine: Difference between revisions

Content deleted Content added
m Jenks24 moved page Kernel-based virtual machine to Kernel-based Virtual Machine: Requested at WP:RM/TR as an uncontroversial technical move. (permalink)
Better reference for z/Architecture and PPC, and also a reference for IA-64. Add another reference for "s390" really meaning "s390x", i.e. z/Architecture.
 
(137 intermediate revisions by 79 users not shown)
Line 1:
{{short description|Virtualization module in the Linux kernel}}
<!-- {{Redirect|KVM}} -->
{{Distinguish|KVM switch}}
 
{{Infobox software
| name = KVM
| logo = [[File:Kvmbanner-logo2 1.png|160px]]
| screenshotlogo size = [[File:Kvm running various guests.png|300px]]160px
| caption screenshot = ScreenshotQEMU of QEMU/KVM6.2 running [[NetBSD]], [[OpenSolaris]] and [[Kubuntu]] guests on an [[Arch Linux]]OpenIndiana hostscreenshot.png
| author screenshot size = [[Qumranet]]300px
| caption = Screenshot of QEMU/KVM running [[NetBSD]] and [[OpenIndiana]] guests on an [[Arch Linux]] host.
| developer = [[Open Virtualization Alliance]] (OVA)
| author = [[Qumranet]]
| latest_release_version = 1.2.0
| developer = The [[Linux Kernel]] community
| latest_release_date = {{Start date and age|2012|09|05}}
| operating_system = [[Unix-like]]
| programming_language = [[C (programming language)|C]]
| platform = [[ARM architecture|ARM]], [[IA-64PowerPC]], [[PowerPCz/Architecture]], [[IBM ESA/390|S/390IA-32]], [[x86-64]], [[x86RISC-64V]]
| genre = [[Hypervisor]]
| license = [[GNU General Public License|GNU GPL]] or [[GNU Lesser General Public License|LGPL]]
| website = {{URL|www.linux-kvm.org}}
}}
 
'''Kernel-based Virtual Machine''' ('''KVM''') is a [[free and open-source]] [[virtualization]] infrastructuremodule forin the [[Linux kernel]] that turnsallows itthe into[[Kernel (operating system)|kernel]] to function as a [[hypervisor]]. It was merged into the Linux kernel[[Mainline Linux|mainline inLinux kernel]] in version 2.6.20, which was released on February 5, 2007.<ref name="2620notes">{{cite web
| url = http://kernelnewbies.org/Linux_2_6_20#head-bca4fe7ffe454321118a470387c2be543ee51754
| title = Linux kernel 2.6.20, Section 2.2. Virtualization support through KVM
| date = 2007-02-05
| accessdateaccess-date = 2014-06-16
| website = kernelnewbies.org}}</ref> KVM requires a processor with [[hardware virtualization]] extensions, such as [[Intel VT]] or [[AMD-V]].<ref>[http://www.linux-kvm.org/page/FAQ#What_do_I_need_to_use_KVM.3F KVM FAQ: What do I need to use KVM?]</ref> KVM has also been ported to other operating systems such as [[FreeBSD]]<ref>{{cite web|url=http://www.freebsd.org/news/status/report-2007-07-2007-10.html#Porting-Linux-KVM-to-FreeBSD|title=FreeBSD Quarterly Status Report: Porting Linux KVM to FreeBSD}}</ref> and [[illumos]]<ref>{{cite web|url=http://dtrace.org/blogs/bmc/2011/08/15/kvm-on-illumos/|title=KVM on illumos|date=15 August 2011 }}</ref> in the form of loadable kernel modules.
| website = kernelnewbies.org
}}</ref> KVM requires a processor with [[hardware-assisted virtualization|hardware virtualization extension]].<ref>[http://www.linux-kvm.org/page/FAQ#What_do_I_need_to_use_KVM.3F KVM FAQ: What do I need to use KVM?]</ref> KVM has also been ported to [[FreeBSD]]<ref>{{cite web|url=http://www.freebsd.org/news/status/report-2007-07-2007-10.html#Porting-Linux-KVM-to-FreeBSD|title=FreeBSD Quarterly Status Report: Porting Linux KVM to FreeBSD}}</ref> and [[illumos]]<ref>{{cite web|url=http://dtrace.org/blogs/bmc/2011/08/15/kvm-on-illumos/|title=KVM on illumos}}</ref> in the form of loadable kernel modules.
 
KVM was originally designed for [[x86]] processors but has since been [[porting|ported]] to [[z/Architecture]],<ref name="2626notes">{{cite web
KVM originally supported [[x86]] processors and has been [[porting|ported]] to [[IBM ESA/390|S/390]],<ref>[http://article.gmane.org/gmane.comp.emulators.kvm.devel/2570 Gmane - Mail To News And Back Again<!-- Bot generated title -->]</ref> [[PowerPC]],<ref>[http://news.gmane.org/gmane.comp.emulators.kvm.devel/2595 Gmane Loom<!-- Bot generated title -->]</ref> and [[IA-64]]. An [[ARM architecture|ARM]] port was merged during the 3.9 kernel merge window.<ref>[http://columbia.github.com/linux-kvm-arm KVM/ARM Open Source Project]</ref>
| url = https://kernelnewbies.org/Linux_2_6_26#KVM_ported_to_IA64.2C_PPC_and_S390
| title = Linux_2_6_26
| at = 1.2. KVM ported to IA64, PPC and S390
| date = 2008-07-13
| access-date = 2025-08-23
| website = kernelnewbies.org}}</ref><ref>{{cite web |url=https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0c632db637d68ad39d9f97f452ce176253f5f4e |title=KVM: s390: arch backend for the kvm kernel module |date=2008-04-27}}</ref> [[PowerPC]],<ref name="2626notes" /> [[IA-64]],<ref name="2626notes" /> and [[ARM architecture|ARM]].<ref>{{cite web |url=https://systems.cs.columbia.edu/projects/kvm-arm/ |title=KVM/ARM: An Open-Source ARM Virtualization System}}</ref><ref>{{Cite web |url=https://columbia.github.com/linux-kvm-arm |title=KVM/ARM Open Source Project |access-date=2017-11-01 |archive-url=https://web.archive.org/web/20130310052146/http://columbia.github.com/linux-kvm-arm/ |archive-date=2013-03-10 |url-status=dead }}</ref><ref>{{Cite journal|url=https://dl.acm.org/doi/10.1145/2654822.2541946 | title = KVM/ARM: The Design and Implementation of the Linux ARM Hypervisor | author1 = Christoffer Dall | author2 = Jason Nieh | journal = SIGARCH Comput. Archit. News | publisher = ACM International Conference on Architectural Support for Programming Languages and Operating Systems | date = 2014| volume = 42 | issue = 1 | pages = 333–348 | doi = 10.1145/2654822.2541946 }}</ref>
The IA-64 port was removed in 2014.<ref>{{Cite web|url=https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=003f7de6258900e17f6206e8e417d76c75ca549f | title=kernel/git/torvalds/linux.git: KVM: ia64: remove}}</ref>
 
AKVM supports [[hardware-assisted virtualization]] for a wide variety of guest operating systems work with KVM, including many flavours and versions of Linux, [[BSD]], [[Solaris (operating system)|Solaris]], [[Microsoft Windows|Windows]], [[Haiku (operating system)|Haiku]], [[ReactOS]], [[Plan 9 from Bell Labs|Plan 9]], [[AROS Research Operating System|AROS]], [[macOS]], and even other Linux systems.<ref>{{cite web | url = http://www.linux-kvm.org/page/Guest_Support_Status | title = KVM wiki: Guest support status | accessdateaccess-date =2007-05-27 }}</ref> and [[OS X]].<ref>{{cite web|url=http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/|title=Running Mac OS X as a QEMU/KVM Guest|accessdateaccess-date=2014-08-20}}</ref> In addition, Android 2.2, [[GNU/Hurd]]<ref>{{cite web|url=httphttps://www.gnu.org/software/hurd/hurd/status.html |title=status |publisher=Gnu.org |access-date= |accessdate=2014-02-12}}</ref> ([[Debian]] K16), [[MINIX 3|Minix]] 3.1.2a, Solaris 10 U3 and [[Darwin (operating system)|Darwin]] 8.0.1, together with other operating systems and some newer versions of these listed, are known to work with certain limitations.<ref>{{cite web|url=http://www.linux-kvm.org/page/Guest_Support_Status |title=Guest Support Status - KVM |publisher=Linux-kvm.org |access-date= |accessdate=2014-02-12}}</ref>
 
Additionally, KVM provides [[Paravirtualizationparavirtualization]] support for certain devices is available for Linux, [[OpenBSD]],<ref>{{cite web |url=httphttps://wwwman.openbsd.org/cgi-bin/manvirtio.cgi?query=virtio&manpath=OpenBSD%20Current&sektion=4&format=html|title=OpenBSD man page virtio(4) |deadurlaccess-date=no |accessdate=20132018-0702-1504}}</ref> FreeBSD,<ref>{{cite web |url=http://people.freebsd.org/~kuriyama/virtio/|title=virtio binary packages for FreeBSD|accessdateaccess-date=2012-10-29}}</ref> [[NetBSD]],<ref>{{cite web |url=http://netbsd.gw.com/cgi-bin/man-cgi?virtio++NetBSD-current |title= NetBSD man page virtio(4) |deadurl=no |accessdateaccess-date=2013-07-15 |archive-date=2019-11-13 |archive-url=https://web.archive.org/web/20191113035952/https://netbsd.gw.com/cgi-bin/man-cgi?virtio++NetBSD-current |url-status=dead }}</ref> Plan 9<ref>{{cite web |url=httphttps://code.google.com/p/plan9front/wiki/qemu |title=plan9front |deadurl=no |accessdateaccess-date=2013-02-11}}</ref> and Windows guests using the ''VirtIO'' [[API]].<ref>{{cite web |url=httphttps://lwn.net/Articles/239238/ |title=An API for virtual I/O: virtio |date=2007-07-11 |accessdateaccess-date=2014-04-16 |publisher=[[LWN.net]]}}</ref> API. This supportsincludes a paravirtual [[Ethernet card]], a paravirtual disk I/O controller,<ref>{{cite web |url=http://linux-iscsi.org/wiki/vHost |title=SCSI target for KVM wiki |publisher=linux-iscsi.org |date=2012-08-07 |accessdateaccess-date=2012-08-12 |archive-date=2020-06-05 |archive-url=https://web.archive.org/web/20200605120413/http://linux-iscsi.org/wiki/VHost |url-status=dead }}</ref> a [[balloon device for adjusting guest memory usagedriver]], and a [[VGA]] graphics interface using [[SPICE (protocol)|SPICE]] or [[VMware]] drivers.
 
==History==
[[Avi Kivity]] began the development of KVM in mid-2006 at [[Qumranet]], a technology [[startup company]]<ref>[http://kerneltrap.org/node/8088 Interview: Avi Kivity] {{webarchive|url=https://web.archive.org/web/20070426033902/http://kerneltrap.org/node/8088 |date=2007-04-26 }} on [[KernelTrap]]</ref> that was acquired by [[Red Hat]] in 2008.<ref>{{cite web
| url = http://www.redhat.com/en/about/press-releases/qumranet
| title = Red Hat Advances Virtualization Leadership with Qumranet, Inc. Acquisition
| date = 4 September 2008
| access-date = 16 June 2015
| publisher = [[Red Hat]]}}</ref>
 
KVM surfaced in October 2006<ref>{{Cite web|url=https://www.itworldcanada.com/article/kvm-15-equipped-with-live-migration/7901|title=KVM 15 equipped with live migration &#124; IT World Canada News|date=7 March 2007}}</ref> and was merged into the Linux kernel mainline in version 2.6.20, released on 5 February 2007.<ref name="2620notes" />
 
KVM is maintained by Paolo Bonzini.<ref>{{cite web
| url = http://www.linux.com/news/featured-blogs/200-libby-clark/821899-git-success-stories-and-tips-from-kvm-maintainer-paolo-bonzini
| title = Git Success Stories and Tips from KVM Maintainer Paolo Bonzini
| date = 7 April 2015
| access-date = 17 June 2015
| author = Libby Clark
| publisher = [[Linux.com]]
| archive-url = https://web.archive.org/web/20160315095510/http://www.linux.com/news/featured-blogs/200-libby-clark/821899-git-success-stories-and-tips-from-kvm-maintainer-paolo-bonzini
| archive-date = 15 March 2016
| url-status = dead
| df = dmy-all}}</ref>
 
== Internals ==
[[File:Kernel-based Virtual Machine.svg|thumb|right|upright=1.8|A high-level overview of the KVM/QEMU virtualization environment<ref>{{cite web
| url = http://www-01.ibm.com/support/knowledgecenter/api/content/nl/en-us/linuxonibm/liaav/LPCKVMSSPV2.1.pdf
| title = KVM/QEMU Storage Stack Performance Discussion
| year = 2010
| accessdateaccess-date = January 3, 2015
| author1 = Khoa Huynh
| author2 = Stefan Hajnoczi
| publisher = Linux Plumbers Conference
| website = ibm.comIBM
}}{{dead link
| format = PDF
| date = January 2018
}}</ref>{{rp|3}}]]
| bot = InternetArchiveBot
| fix-attempted = yes}}</ref>{{rp|3}}]]
 
ByKVM itself,provides KVMdevice doesabstraction notbut performno anyprocessor emulation. Instead, itIt exposes the <tt>{{mono|/dev/kvm</tt>}} interface, which a userspaceuser mode host can then use to:
* Set up the guest VM's address space. The host must also supply a firmware image (usually a custom BIOS when emulating PCs) that the guest can use to bootstrap into its main OS.
* Feed the guest simulated I/O.
* Map the guest's video display back onto the system host.
 
Originally, a forked version of [[QEMU]] was provided to launch guests and deal with hardware emulation that is not handled by the kernel. That support was eventually merged into the upstream project. There are now numerous Virtual Machine Monitors (VMMs) which can utilise the KVM interface including kvmtool, crosvm and [[Firecracker_(software)|Firecracker]] and numerous specialised VMMs built with frameworks such as rust-vmm.
On Linux, [[QEMU]] versions 0.10.1 and later is one such userspace host. QEMU uses KVM when available to virtualize guests at near-native speeds, but otherwise falls back to software-only emulation.
 
Internally, KVM uses [[SeaBIOS]] as an open source implementation of a 16-bit x86 [[BIOS]].<ref>{{cite web|url=http://www.seabios.org/SeaBIOS |title=SeaBIOS |publisher=seabios.org |date=2013-12-21 |accessdateaccess-date=2014-06-16}}</ref>
 
==LicensingFeatures==
KVM has had support for [[Hot swapping|hot swappable vCPUs]],<ref>{{Cite web|url=https://access.redhat.com/articles/1339413|title=Hot Plugging Virtual CPUs with Red Hat Enterprise Virtualization Manager|date=16 February 2016 }}</ref> dynamic memory management,<ref>{{Cite web|url=https://www.linux-kvm.org/page/FAQ#Is_dynamic_memory_management_for_guests_supported.3F|title=Faq - KVM}}</ref> and [[Live Migration]] since February 2007.<ref>{{Cite web|url=https://lwn.net/Articles/223754/|title = KVM-15 release &#91;LWN.net&#93;}}</ref><ref>{{Cite web|url=https://www.linux-kvm.org/page/Migration|title = Migration - KVM}}</ref> It also reduces the impact that memory write-intensive workloads have on the migration process.<ref>{{Cite web|url=https://www.berrange.com/posts/2016/05/12/analysis-of-techniques-for-ensuring-migration-completion-with-kvm/|title=Daniel P. Berrangé » Blog Archive » Analysis of techniques for ensuring migration completion with KVM}}</ref>
KVM's parts are licensed under various GNU licenses:<ref>Licensing info from Ubuntu 7.04 <tt>/usr/share/doc/kvm/copyright</tt></ref>
* KVM kernel module: GPL v2
* KVM user module: LGPL v2
* QEMU virtual CPU core library (libqemu.a) and QEMU PC system emulator: LGPL
* Linux user mode QEMU emulator: GPL
* BIOS files (bios.bin, vgabios.bin and vgabios-cirrus.bin): LGPL v2 or later
 
==Emulated hardware==
==History==
Avi Kivity began the development of KVM at [[Qumranet]], a technology [[startup company]]<ref>[http://kerneltrap.org/node/8088 Interview: Avi Kivity] on [[KernelTrap]]</ref> that was acquired by [[Red Hat]] in 2008.<ref>{{cite web
| url = http://www.redhat.com/en/about/press-releases/qumranet
| title = Red Hat Advances Virtualization Leadership with Qumranet, Inc. Acquisition
| date = 4 September 2008 | accessdate = 16 June 2015
| publisher = [[Red Hat]]
}}</ref>
 
KVM itself emulates very little hardware, instead deferring to a higher level client application such as [[QEMU]], crosvm, or [[Firecracker (software)|Firecracker]] for device emulation.
KVM was merged into the Linux kernel mainline in kernel version 2.6.20, which was released on 5 February 2007.<ref name="2620notes" />
 
KVM provides the following emulated devices:
KVM is maintained by Paolo Bonzini.<ref>{{cite web
 
| url = http://www.linux.com/news/featured-blogs/200-libby-clark/821899-git-success-stories-and-tips-from-kvm-maintainer-paolo-bonzini
* Virtual [[CPU]] and memory<ref>{{cite web | url=https://www.kernel.org/doc/html/latest/virt/kvm/api.html#kvm-create-irqchip | title=The Definitive KVM (Kernel-based Virtual Machine) API Documentation — the Linux Kernel documentation }}</ref>
| title = Git Success Stories and Tips from KVM Maintainer Paolo Bonzini
* VirtIO
| date = 7 April 2015 | accessdate = 17 June 2015
| author = Libby Clark | publisher = [[Linux.com]]
}}</ref>
 
== Graphical management tools ==
[[File:Libvirt support.svg|thumb|300px|[[libvirt]] supports KVM]]
 
* [[Kimchi (software)|Kimchi]]{{snd}} web-based virtualization management tool for KVM
* [[Virtual Machine Manager]]{{snd}} supports creating, editing, starting, and stopping KVM-based virtual machines, as well as live or cold drag-and-drop migration of VMs between hosts.
* [[Proxmox Virtual Environment]]{{snd}} an open-source virtualization management package including KVM and [[OpenVZLXC]]. It has a bare-metal installer, a web-based remote management GUI, a HA cluster stack, unified storage, flexible network, and optional commercial support.
* [[OpenQRM]]{{snd}} management platform for managing heterogeneous data center infrastructures.
* [[GNOME Boxes]]{{snd}} Gnome interface for managing libvirt guests on Linux.
* [[oVirt]]{{snd}} open-source virtualization management tool for KVM built on top of [[libvirt]]
 
==Licensing==
== Emulated hardware ==
The kernel-mode component of KVM is a part of the [[Linux kernel]], itself licensed under [[GNU General Public License#Version 2|GNU General Public License, version 2]].<ref name="Linux_Licensing">{{Cite web|url=https://www.kernel.org/doc/html/latest/process/license-rules.html#kernel-licensing|title=Linux kernel licensing rules — The Linux Kernel documentation|website=www.kernel.org|access-date=2020-01-06|archive-date=7 March 2020|archive-url=https://web.archive.org/web/20200307065451/https://www.kernel.org/doc/html/latest/process/license-rules.html#kernel-licensing|url-status=live}}</ref>
{| class="wikitable"
|-
! Class !! Device
|-
| [[Video card]] || Cirrus CLGD 5446 PCI VGA card, dummy VGA card with [[Bochs]] [[VESA]] extensions,<ref name=qemu-doc>[http://wiki.qemu.org/download/qemu-doc.html wiki.qemu.org – QEMU Emulator User Documentation], read 2010-05-06</ref> or [[Virgil (software)|Virgil]] as a virtual 3D GPU<ref>{{cite web |url=http://airlied.livejournal.com/77553.html |title=Introducing Virgil - 3D virtual GPU for qemu |date=2013-07-18}}</ref>
|-
| [[PCI (bus)|PCI]] || [[Intel 440FX|i440FX]] host [[Conventional PCI#PCI bus bridges|PCI bridge]] and [[PIIX3]] PCI to ISA bridge<ref name=qemu-doc/>
|-
| [[Input device]] || [[PS/2 connector|PS/2]] Mouse and Keyboard<ref name=qemu-doc/>
|-
| [[Sound card]] || [[Sound Blaster 16]], ENSONIQ AudioPCI [[ES1370]], [[Gravis Ultrasound GF1]], CS4231A compatible<ref name=qemu-doc/>
|-
| [[Ethernet]] [[Network card]] || AMD Am79C970A ([[Am7990]]), E1000 (Intel 82540EM, 82573L, 82544GC), [[NE2000]], and Realtek [[RTL8139]]
|-
| [[Watchdog timer]] || Intel 6300ESB or IB700
|-
| [[Random-access memory|RAM]] || between 50&nbsp;MB and 32&nbsp;TB
|-
| [[Central processing unit|CPU]] || 1 – 160&nbsp;CPUs
|}
 
== Implementations ==
* [[Debian]] 5.0 and above
* [[Gentoo Linux]]
* [[illumos]]-based distributions
* [[OpenIndiana]]
* [[Red Hat Enterprise Linux]] (RHEL) 5.4 and above
* [[SmartOS]]
* [[SUSE Linux Enterprise Server]] (SLES) 11 SP1 and above
* [[Ubuntu (operating system)|Ubuntu]] 10.04 LTS and above
* [[Univention Corporate Server]]
 
== See also ==
{{Portal|Free and open-source software|Linux}}
 
{{Div col||colwidth=20em}}
* [[CloudStack]]
* [[Comparison of platform virtualization software]]
* [[Hyper-V]]
* [[Kernel same-page merging]] (KSM)
* [[Lguest]]
* [[libguestfs]]
* [[libvirt]]
* [[Open Virtualization Alliance]]
* [[OpenNebula]]
* [[OpenStack]]
* [[oVirtRed Hat Virtualization]]
* [[Vx32]]
* [[Xen]]
{{Divdiv col end}}
 
==References==
{{Reflist|30em}}
 
==Bibliography==
* {{cite web|access-date=2017-02-10|title=Ten years of KVM|url=https://lwn.net/Articles/705160/|website=lwn.net|author=Amit Shah|date=2016-11-02}}
 
==External links==
* [http://public.dhe.ibm.com/software/dw/linux390/perf/ZSW03346USEN.pdf Best practices for the Kernel-based Virtual Machine] {{Webarchive|url=https://web.archive.org/web/20191106035557/http://public.dhe.ibm.com/software/dw/linux390/perf/ZSW03346USEN.pdf |date=2019-11-06 }}, IBM, second edition, April 2012
* {{Official website|www.linux-kvm.org}}
* [https://web.archive.org/web/20141021055601/http://www.linux-kvm.org/wiki/images/f/f9/2012-forum-virtio-blk-performance-improvement.pdf Virtio-blk Performance Improvement], KVM Forum 2012, November 8, 2012, by Asias He
* [http://www-01.ibm.com/support/knowledgecenter/api/content/nl/en-us/linuxonibm/liaat/liaatbestpractices_pdf.pdf#navpanes=0&toolbar=0 Best practices for the Kernel-based Virtual Machine], IBM, second edition, April 2012
* [https://web.archive.org/web/20101128114720/http://qemu-buch.de/e/Content Wikibook QEMU & KVM]
* [http://www.linux-kvm.org/wiki/images/f/f9/2012-forum-virtio-blk-performance-improvement.pdf Virtio-blk Performance Improvement], KVM Forum 2012, November 8, 2012, by Asias He
* [https://chromium.googlesource.com/chromiumos/platform/crosvm/ crosvm - Chrome OS virtual machine monitor]
* [http://qemu-buch.de/e/Content Wikibook QEMU & KVM]
* [https://firecracker-microvm.github.io/ Firecracker VMM for KVM]
 
{{Virtualization products}}
Line 148 ⟶ 145:
 
{{Authority control}}
 
{{DEFAULTSORT:Kernel-based Virtual Machine}}
[[Category:Free emulation software]]
Line 154 ⟶ 152:
[[Category:Linux kernel features]]
[[Category:Virtualization software]]
[[Category:Virtualization-related software for Linux]]
[[Category:Red Hat software]]