In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what is IO device virtualization". In daily operation, I believe that many people have doubts about what is IO device virtualization. The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what is IO device virtualization"! Next, please follow the editor to study!
IO virtualization is the most complex part of computer virtualization because it involves the coordination of CPU, operating system, Hypervisor, and IO devices. IO virtualization has also experienced the transformation from software simulation virtualization, quasi-virtualization to full hardware virtualization.
1.IO software simulates virtualization and class virtualization
IO device virtualization scenario should not only focus on IO device simulation, but also pay attention to the interaction between vCPU and virtual IO devices. Many conditions are intertwined, which makes the whole problem very complicated. The performance cost of IO virtualization is mainly reflected in three aspects: the cost of the driver accessing the device register; the cost of the device accessing the driver through interrupt and DMA; and the cost of device simulation itself. Therefore, IO virtualization performance is optimized mainly from five perspectives:
Reduce the cost of IO access registers: on the one hand, turn part of IO access into MMIO access, so that you do not need to fall into Hypervisor;. On the other hand, it is the cost of optimizing VM-exit/VM-entry handover.
Reduce the number of IO visits, such as simplifying notification mechanisms, simplifying virtualized device functions, and so on.
Optimize interrupts: mainly such as interrupt hardware virtualization of APIC or polling drivers that do not require interrupts.
Reduce the cost of DMA access: implement Pass Through mode through IOMMU and so on.
Reduce the cost of device simulation: the hardware device is mainly realized through the hardware SR-IOV mechanism.
As shown in figure 3.30 (a), the devices seen in the virtual machine are generally simulated by Hypervisor. The functions of virtual devices can be less than or more than physical devices, and even simulate some characteristics that do not exist, and simulate hardware devices that do not exist. Through the way of IO software simulation, we call it IO device software simulation virtualization. In the IO software simulation virtualization solution, the client VM needs Hypervisor to intercept each request instruction to use the underlying hardware resources, and then simulate the behavior of these instructions. We all know that the action of Hypervisor to intercept instructions is the process of intercepting instructions from VM-exit, processing simulation and then VM-entry. This process is very expensive, every instruction must be like this, and the performance overhead must be very huge.
As shown in figure 3.30 (b), the class virtualization method provided by Virtio, the client completes the front-end driver of the device, and Hypervisor cooperates with the client to complete the corresponding back-end driver, so that the efficient virtualization process can be realized through the interaction mechanism between the two.
Figure 3.30 IO device Virtualization
The Virtio framework, shown in figure 3.31, uses Virtqueue to implement its IO mechanism, and each Virtqueue is a Queue that carries a large amount of data. VRing is the specific implementation of Virtqueue, for VRing there will be a corresponding descriptor table to describe. Virtio is a general driver and device interface framework, which implements many different types of analog devices and device drivers, such as Virtio-net, Virtio-blk, Virtio-scsi and so on, based on Virtio.
Figure 3.31 Virtio Framework
The performance advantage of Virtio virtualization over traditional IO device software simulation is that a lot of control and state information do not need to interact through register read and write operations, but by writing the relevant data structures of Virtqueue to let the driver (Driver) and the device (Device) interact. And in the data exchange, only when a certain batch of data changes need to be handled by the other party will notify each other, the driver notifies the device by writing the Kick register, and the device notifies the driver through the interrupt.
2.IO full hardware Virtualization
Two indicators for evaluating IO virtualization technology-performance and versatility. Performance, of course, is closer to IO performance in a non-virtualized environment, while versatility is that IO virtualization is as transparent to the guest operating system as possible. To achieve high performance, the most direct way is to let the client directly use the real hardware device; for versatility, it is necessary to find a way for the driver that comes with the client operating system to discover and manipulate the device.
The client directly operates the device facing two problems: first, how to make the client directly access the real IO address space of the device (including IO and MMIO); second, how to make the DMA of the device directly access the memory space of the client. The EPT technology of memory hardware virtualization can solve the first problem. VT-d technology is used to solve the second problem. VT-d technology mainly introduces address remapping (IOMMU+IOTLB), which is responsible for providing remapping and direct allocation of devices. DMA access from the device side will enter the address remapping for address translation, so that the device can access the specific memory area of the corresponding client.
Although VT-d technology can directly transmit physical IO devices to virtual machines, a computer system is limited by interfaces, and the number of physical devices that can be connected is limited after all. Therefore, PCIe SR-IOV technology arises at the historic moment. Through PCIe SR-IOV technology, a physical IO device can virtualize multiple virtual devices and allocate them to virtual machines.
As shown in figure 3.30 (c), SR-IOV introduces two functional types of PCIe:
PFs (Physical Functions): all PCIe devices, including the management SR-IOV function.
VFs (Virtual Functions): a lightweight PCIe device that can only perform the necessary configuration and data transfer.
Hypervisor allocates VF to virtual machines and transmits data directly between virtual machines and hardware devices through DMA data mapping provided by hardware-assisted technologies such as IOMMU.
At this point, the study on "what is IO device virtualization" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.