Virtio A common framework for I/O virtualization in a KVM virtual environment

Source: Internet
Author: User
Keywords KVM virtual environment I/O virtualization Virtio universal framework
Tags block console developers development difference driving environment framework

Linux Kernel supports many Hypervisor, such as the KVM, Xen, and VMware VMI. Each Hypervisor has its own unique block, receptacle, console and other equipment models, device-driven diversification of the characteristics and optimization of the various platforms are less common, the need to provide a common framework and standard interface to reduce the Hypervisor The difference between virtualized devices, thereby reducing the burden of driving development.

Virtualization includes processor virtualization, virtualization of memory, and virtualization of I/O, and since 2006, the performance of device I/O virtualization on KVM has emerged, and the virtio developed by Rusty Russell has attracted the attention of developers and has been progressively KVM Virtualization platforms are accepted as the most common framework for their I/O virtualization.

Virtio uses Virtqueue to implement its I/O mechanism, and each virtqueue is a queue that hosts a large amount of data. Vring is the implementation of Virtqueue, which is described by a corresponding descriptor table for vring. The framework is shown in the following illustration:

Figure 1.virtio Frame

Virtio provides an efficient, maintainable, easily developed, and scalable middle-tier API. Virtio uses Feature Bits to extend the function, using vring buffer to transmit data. Devices that use Virtio are not configured to be much different from other PCI devices, except that they apply only to virtualized environments.

Virtio Equipment has the following characteristics:

1. Easy to develop

Virtio PCI devices use a common PCI interrupt and DMA mechanism, which is not a problem for device-driven developers.

2. Efficient

Virtio PCI devices use different vring for input and output to circumvent possible cache impact.

3. Standard

Virtio PCI does not assume that its environment requires support for PCI, and that in fact many virtio devices are already implemented on non-PCI buses that do not require PCI at all.

4. Scalable

The Virtio PCI device contains a set of Feature Bits that can be notified to the guest OS during device installation. The device and drive are coordinated, and the driver can ultimately determine the device characteristics that can be used in the guest OS, based on the features provided by the device and the features that drive itself to support it. This will take into account the compatibility of the device.

Therefore, for the guest OS, just add a PCI device driver and then Hypervisor add vring support for the device to add a virtio device.

In this paper, programmers who have a certain understanding of virtio equipment, Virtio Drive and virtual equipment http://www.aliyun.com/zixun/aggregation/7155.html "> developers to provide a certain reference and help."

Basic concepts

Type of device

The noun ID (vendor number) of the Virtio device is the 0x1af4,device ID (device number) range of 0x1000~0x103f,subsystem Device ID (subsystem device number) as follows:

Table 1. Virtio Device ID

subsystem Device ID Virtio Device 1 Receptacle Card 2 block Device 3 Console 4 Entropy source 5 Memory Balloonin G 6 Iomemory 7 rpmsg 8 SCSI host 9 9P by Mac80211 WLAN

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.