CN115904628A - IO virtualization data processing method and application based on vhost protocol - Google Patents

IO virtualization data processing method and application based on vhost protocol Download PDF

Info

Publication number
CN115904628A
CN115904628A CN202211611358.9A CN202211611358A CN115904628A CN 115904628 A CN115904628 A CN 115904628A CN 202211611358 A CN202211611358 A CN 202211611358A CN 115904628 A CN115904628 A CN 115904628A
Authority
CN
China
Prior art keywords
vhost
blk
protocol
data processing
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211611358.9A
Other languages
Chinese (zh)
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anchao Cloud Software Co Ltd
Original Assignee
Anchao Cloud Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anchao Cloud Software Co Ltd filed Critical Anchao Cloud Software Co Ltd
Priority to CN202211611358.9A priority Critical patent/CN115904628A/en
Publication of CN115904628A publication Critical patent/CN115904628A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses an IO virtualization data processing method based on a vhost protocol and application thereof, wherein the method comprises the following steps: a vsost-blk kernel module is added in a kernel, an initialization function provided by a vsost protocol is called to initialize the vsost-blk kernel module, and the initialization comprises the implementation of a notification function from GuestOS; after receiving the notification of Guest OS, the vhost-blk kernel module acquires the instruction and the data address written by Guest OS from the virtuue sending queue shared with Guest OS; polling a virtuue sending queue shared with GuestOS to determine whether new instructions and data arrive, and if so, taking out and calling a VFS universal entry function to process the data; and if the time limit is exceeded and no data arrives, informing GuestOS that the data processing task is completed and finishing the data processing. The method can effectively realize the acceleration processing of the vhost-blk data based on the vhost protocol, realizes the universality, enhances the IO performance and reduces the complexity and uncertainty of the implementation in the actual production.

Description

Method and application for IO virtualization data processing based on vsost protocol
Technical Field
The present invention relates to the field of data processing, and in particular, to a method and an application for IO virtualization data processing based on a vhost protocol.
Background
With the rapid development of cloud computing and the internet, the data volume required to be processed by enterprises and related units is increasing. In a cloud environment, problems such as frequent system calls and context switching, a large amount of data copy, too large protocol stack overhead, complex concurrent mutual exclusion and the like exist in a traditional IO virtualization technology for a long time, and the traditional IO virtualization technology suffers from scaling due to long access path, long delay and low data throughput, and cannot meet the requirements of cloud computing and a big data era on IO performance. In view of the above difficulties, the most well-known solutions in the industry at present are: an IO virtualization performance acceleration scheme implemented based on the vhost-user protocol using the SPDK (storage performance development kit) storage performance development kit proposed by Intel.
The SPDK provides a set of tools and libraries for writing storage applications in a high performance, extensible user mode. The SPDK provides specific implementation of a virtio back end defined in a ghost-user protocol, and provides three virtual devices, namely ghost-blk, ghost-scsi and ghost-nvme, for GuestOS.
The solution that the SPDK uses the host-user protocol realizes the same function as the host in the user space without passing through the kernel, thereby avoiding the overhead of a large amount of system calls, context switching and a kernel protocol stack. The kernelbypass scheme implemented by SPDK through the vhost-user protocol has significant disadvantages: 1) Adding complexity and uncertainty to the integration into existing operating system environments and non-Intel hardware platforms; 2) The complexity of virtualization management is increased, and the usability is reduced; 3) Most storage manufacturers have relatively little investment in the kernel-bypass scheme, and in the actual production process, a series of unknown problems are difficult to avoid, and a great deal of effort is required to restore the actual problems.
At present, the latest code of Qemu and Linux kernel community main branch is not realized by a vhost-blk device based on a vhost protocol, and a solution which is realized in a kernel by using the vhost protocol, has IO performance superior to that of virtio-blk and simultaneously supports block devices and files to store data like the virtio-blk is not provided so far.
The information disclosed in this background section is only for enhancement of understanding of the general background of the invention and should not be taken as an acknowledgement or any form of suggestion that this information forms the prior art already known to a person skilled in the art.
Disclosure of Invention
The invention aims to provide a method and application for IO (input/output) virtualization data processing based on a ghost protocol, which can provide a scheme with performance close to SPDKghost-blk, more universality and easier implementation.
To achieve the above object, an embodiment of the present invention provides an IO virtualization data processing method based on a vhost protocol.
In one or more embodiments of the invention, the method comprises: a vhost-blk kernel module is added in a kernel, an initialization function provided by a vhost protocol is called to initialize the vhost-blk kernel module, and the initialization includes the realization of a notification function from Guest OS; after receiving the notification of Guest OS, the vhost-blk kernel module acquires the instruction and the data address written by Guest OS from the virtuue sending queue shared with Guest OS; polling whether a virtuue sending queue shared with GuestOS has new instructions and data, and if yes, taking out and calling a VFS universal entry function to process data; and if the time limit is exceeded and no data arrives, informing GuestOS that the data processing task is completed and finishing the data processing.
In one or more embodiments of the present invention, the invoking an initialization function provided by a vhost protocol for initialization includes: and the vhost-blk kernel module receives configuration information sent by the user space through ioctl, and completes initialization and configuration of the vhost-blk.
In one or more embodiments of the invention, the initializing includes implementation of a notify function from GuestOS, including: and executing a Guest OS notification function after receiving the Guest OS notification through the KVM, acquiring a command and a data address written by the Guest OS by the notification function from virtqueue, taking out and calling a universal entry function of the VFS provided by the kernel to process data, and sending a notification of finishing data processing to the KVM after finishing data processing.
In one or more embodiments of the present invention, the sending the notification of completion of data processing to the KVM includes: the process between the KVM and the vhost-blk communicates by calling the eventfd mechanism and the irqfd mechanism.
In one or more embodiments of the invention, the method further comprises: and in the initialization stage of the vsost-blk kernel module, configuring and initializing the vsost-blk through Qemu.
In one or more embodiments of the present invention, the configuring and initializing of the vhost-blk by Qemu includes: in the initialization stage, the initialization of the PCI configuration of the equipment including the manufacturer number, the equipment number and the version number is added, and the configuration of the equipment is inquired and set.
In one or more embodiments of the invention, the method further comprises: and sending a configuration command to a vsost-blk kernel module through ioctl system call to complete initialization and configuration processes of the complete vsost-blk equipment.
In another aspect of the present invention, an apparatus for IO virtualization data processing based on a vhost protocol is provided, which includes an initialization module, an information obtaining module, and a polling module.
The initialization module is used for adding a vsost-blk kernel module in a kernel, calling an initialization function provided by a vsost protocol to initialize the vsost-blk kernel module, and the initialization includes implementation of a notification function from Guest OS.
And the information obtaining module is used for obtaining the instruction and the data address written by the Guest OS from the virtuue sending queue shared with the Guest OS after receiving the notification of the Guest OS.
The polling module is used for polling whether a virtuue sending queue shared with GuestOS has new instructions and data; if yes, taking out and calling a VFS universal entry function to process data; and if no data arrives beyond a period of time, informing GuestOS that the data processing task is finished and finishing the data processing.
In one or more embodiments of the present invention, the initialization module is further configured to: and the vhost-blk kernel module receives the configuration information sent by the user space through ioctl, and completes initialization and configuration of the vhost-blk.
In one or more embodiments of the present invention, the initialization module is further configured to: and executing a Guest OS notification function after receiving the Guest OS notification through the KVM, acquiring a command and a data address written by the Guest OS by the notification function from virtqueue, taking out and calling a universal entry function of the VFS provided by the kernel to process data, and sending a notification of finishing data processing to the KVM after finishing data processing.
In one or more embodiments of the present invention, the initialization module is further configured to: the processes between the KVM and the vhost-blk communicate by invoking the eventfd mechanism and the irqfd mechanism.
In one or more embodiments of the present invention, the initialization module is further configured to: and in the initialization stage of the vsost-blk kernel module, configuring and initializing the vsost-blk through Qemu.
In one or more embodiments of the present invention, the initialization module is further configured to: in the initialization stage, the initialization of the PCI configuration of the equipment including the manufacturer number, the equipment number and the version number is added, and the configuration of the equipment is inquired and set.
In one or more embodiments of the present invention, the initialization module is further configured to: and sending a configuration command to a vsost-blk kernel module through ioctl system call to complete initialization and configuration processes of the complete vsost-blk equipment.
In another aspect of the present invention, there is provided an electronic device including: at least one processor; and a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the method of vhost protocol-based IO virtualized data processing as described above.
In another aspect of the present invention, a computer readable storage medium is provided, having stored thereon a computer program, which when executed by a processor, implements the steps of the method for vhost protocol-based IO virtualization data processing as described.
Compared with the prior art, the method and the application for IO virtualization data processing based on the vsost protocol can achieve the accelerated processing of the vsost-blk data based on the vsost protocol, tests are conducted through the FIO tool, and compared with the most widely applied virtio-blk scheme at present, in all scenes, read data is superior to the virtio-blk, the IO performance is improved by two times at most, write data is improved by two times at most in most scenes, meanwhile, the usage amount of a CPU is basically the same as that of the virtio-blk scheme, generality is achieved, the IO performance is enhanced, and complexity and uncertainty in implementation in actual production are reduced.
Drawings
Fig. 1 is a flow diagram of a method of vhost protocol-based IO virtualization data processing according to an embodiment of the present invention;
FIG. 2 is a flowchart comparing a method of IO virtualization data processing based on a vhost protocol with a virtio-blk scheme according to an embodiment of the invention;
FIG. 3 is a polling flow diagram of a method of IO virtualization data processing based on the vhost protocol according to an embodiment of the invention;
FIG. 4 is a block diagram of an apparatus for a vhost protocol based IO virtualization data processing in accordance with an embodiment of the present invention;
fig. 5 is a hardware block diagram of a computer device for vo virtualization data processing based on the vhost protocol according to an embodiment of the invention.
Detailed Description
The following detailed description of the present invention is provided in conjunction with the accompanying drawings, but it should be understood that the scope of the present invention is not limited to the specific embodiments.
Throughout the specification and claims, unless explicitly stated otherwise, the word "comprise", or variations such as "comprises" or "comprising", will be understood to imply the inclusion of a stated element or component but not the exclusion of any other element or component.
The technical solutions provided by the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
Example 1
Referring to fig. 1, a method for IO virtualization data processing based on the ghost protocol according to the present invention is described, which includes the following steps.
In step S101, a vsost-blk kernel module is added to the kernel, and an initialization function provided by a vsost protocol is called to initialize the vsost-blk kernel module, where the initialization includes implementation of a notification function from guetos.
In this embodiment, the vsost-blk kernel module follows the vsost protocol, calls an initialization function provided by the vsost protocol to initialize, and compared with the vsost-user protocol used by the SPDK, virtualization of the vsost-blk device is completed by the kernel, without relying on an external program SPDK to create and manage the vsost-blk device, thereby reducing implementation complexity and uncertainty in actual production. The vhost protocol defines a backend implementation of virtio for direct communication with GuestOS. In the data exchange process of the virtio scheme, the Qemu simulation equipment is used as a virtio rear end, guestOS is required to communicate with Qemu, multiple data copying and context switching can be caused, and vhost is used as a virtio improvement scheme and does not need the overhead.
In step S102, after receiving the notification of the Guest OS, the vhost-blk kernel module acquires the instruction and the data address written by the Guest OS from the virtuue transmission queue shared with the Guest OS.
Specifically, after receiving the notification from the GuestOS, the processing is continued according to the processing flow of the vhost protocol standard. Inside the notification processing function, the vhost-blk kernel module and the GuestOS perform virtuue sharing, and the vhost-blk kernel module can acquire a batch of instructions and data addresses written by the GuestOS from the sending queue.
In step S103, polling is performed to determine whether new commands and data arrive in the virtuue transmission queue shared by the guest os, and if so, the VFS generic entry function is fetched and called to process the data.
Specifically, polling is triggered sequentially according to a certain algorithm, and the currently executed index is stored during polling, so that the index starting position can be taken when next execution is performed, and the purpose of load balancing is achieved. In the embodiment, the flow can be simplified through polling, performance loss and delay generated by a large part of data processing requests originally sent downwards from Guest OS are saved through polling in the kernel by virtue of vhost-blk, and the frequency of sending the data processing requests to the kernel by the Guest OS is effectively reduced.
In step S104, if the time limit is exceeded and no data arrives, the guest os is notified that the data processing task is completed and ends the present data processing.
Under the framework of the vhost protocol of the embodiment, a time limit is set for data arrival fast, and if no data arrives beyond the time limit, the notification processing from the guest os is ended this time. The latest arriving data to be processed is collected by polling a virtuue sending queue shared by Guest OS, so that the times of system call and request initiated by Guest OS are reduced, the IO performance is further improved, and the SQpoling with another performance enhancement characteristic of a vhost-blk module is realized.
Example 2
Referring to fig. 1 to 3, a method for IO virtualization data processing based on a vhost protocol according to the present invention is described, which includes the following steps.
In step S101, a vhost-blk kernel module is added to the kernel, and an initialization function provided by a vhost protocol is called to initialize the vhost-blk kernel module, where the initialization includes implementing a notification function from guest os.
In the IO virtualization path optimization scheme, virtio is the most widely accepted and applied paravirtualization protocol specification, and is defined by OASIS (advanced standardization for information society), so that a unified communication specification between GuestOS and Qemu is realized. Virtio realizes front-end driving in GuestOS, realizes rear-end driving in Host, and exchanges data between the front end and the rear end through Virtqueue. The back-end driver is emulated by Qemu, specifically as a PCI device as an emulated device of GuestOS, while the front-end driver is located at kernel of GuestOS as a driver of this PCI device.
The vhost protocol defines a backend implementation of virtio, which is a module located in the hostkeenl for communicating directly with the Guest os, and data exchange is performed directly between the Guest and the hostkeenl via virtuue. In the data exchange process of the virtio scheme, the Qemu simulation equipment is used as a virtio back end and needs GuestOS to communicate with Qemu, so that data copying and context switching can be caused for many times, and vhost is used as a virtio improvement scheme and does not need the overhead.
The basic principle of the Vhost-user protocol is the same as that of the Vhost, the functions basically the same as those of the Vhost are realized in the user space, and data exchange is realized through virtquee. Unlike, the virtual backend of the vhost implementation is in kernel, while the vhost-user implementation is in user space.
The SPDK provides a set of tools and libraries for writing storage applications in a high performance, extensible user mode. The SPDK provides specific implementation of a virtio back end defined in a ghost-user protocol, and provides three virtual devices, namely ghost-blk, ghost-scsi and ghost-nvme, for GuestOS. The solution that the SPDK uses the vhost-user protocol to implement realizes the same function as the vhost in the user space without passing through the kernel, which avoids the overhead of a large amount of system calls, context switches and kernel protocol stacks, and the mode of bypassing the kernel to improve the IO performance is generally called kernelbypass.
The kernelbypass scheme implemented by SPDK through the vhost-user protocol has the following disadvantages: 1) The SPDK is an independent third party suite provided by Intel, requires the installation of a series of dependent packages and library files that it requires, and only optimizes and stabilizes the Intel platform, adding complexity and uncertainty to the integration into existing operating system environments and non-Intel hardware platforms. 2) The vhost emulated devices provided by the SPDK must be created and managed using the interface provided by the SPDK, and cannot be directly created and managed by libvirt. This increases the complexity of virtualization management, reducing ease of use. 3) The SPDK violates existing operating modes and design concepts of operating systems, completely bypassing the kernel to interact with the storage hardware. The mode of managing hardware equipment through the kernel has been continued for decades, the stability is good, the investment of most storage manufacturers on the kernel-bypass scheme is relatively small, a series of unknown problems are difficult to avoid in the actual production process, and a great deal of effort is required to restore the actual problems.
In this embodiment, a ghost-blk kernel module is added in the kernel, the initialization function provided by the ghost protocol is called to initialize according to the ghost protocol, the kernel module is added to realize the calling function of the user space ioctl system, and the user space sends configuration information to the ghost-blk kernel module through ioctl, so that complete ghost-blk initialization and configuration are completed.
In step S102, after receiving the notification of the Guest OS, the vhost-blk kernel module acquires the instruction and the data address written by the Guest OS from the virtuue transmission queue shared with the Guest OS.
Specifically, the program is executed after the notification is received by the KVM, the notification function acquires the instruction and the data address written by the guest os from the virtuue, the instruction and the data address are taken out and called by a general entry function of the virtual file system VFS provided by the kernel to process data, and after the data processing is completed, the notification of completing the data processing is sent to the KVM.
In this embodiment, the process between KVM and vhost-blk communicates by calling the eventfd mechanism and irqfd mechanism.
In order to realize IO virtualization data acceleration based on a ghost protocol, the embodiment realizes a ghost-blk device in the kernel, and makes full use of a Virtual File System (VFS) provided by the kernel, so that files and block devices are simultaneously supported, and the goal of universality is achieved; another aspect of the generality comes from the vsost protocol itself, which reduces implementation complexity and uncertainty in actual production, compared to the vsost-user protocol used by the SPDK, where the vsost-blk device virtualization is done by the kernel, rather than relying on an external program SPDK to create and manage the vsost-blk device.
As shown in fig. 2, in a flowchart comparison between the method for IO virtualization data processing based on the vhost protocol and the virtio-blk scheme in this embodiment, at the client end, both schemes are driven by the virtio-blkdrive in the Guest Kernel; in the interaction between the client side and the KVM, the comparison scheme uses virtual/PCI and virtual/VCPU interrupt threads, and the embodiment uses virtual/PCI and virtual/PCI interrupt threads; in the Qemu and HostKernel architectures, a comparison scheme is that Qemuvirtio-blk simulation equipment is arranged in Qemu to interact with a KVM (keyboard video mouse), in the embodiment, vhost-blk is arranged in the HostKernel to interact with the KVM, in the comparison scheme, VMExit and vIRQ/ioctl technologies are used to complete communication between the Qemuvirtio-blk simulation equipment and the KVM, and in the embodiment, an eventfd mechanism and an irqfd mechanism are called to complete communication between the vhost-blk and the KVM; in a VFS interface for calling a virtual file system, qemuvirtio-blk simulation equipment of a comparison scheme is carried out by switching a kernel mode and a user mode through system calling, and the vhost-blk of the embodiment is carried out through VFS calling; in the subsequent flow, the file systems, the Block layers and the storage device Hardware transmitted to are consistent.
In the scheme of the embodiment and the flow of the virtio-blk scheme, communication between GuestOS and Qemu in the virtio-blk scheme causes multiple data copying and context switching. Moreover, virtualization of the vhost-blk device is completed by the kernel, complexity and uncertainty of implementation in actual production are reduced, and a virtual file system VFS provided by the kernel is directly utilized, so that file and block devices are simultaneously supported, and the goal of universality is achieved.
In step S103, within the Guestos notification function, a virtuue transmit queue shared with Guestos is polled for new instructions and data, and if so, a VFS generic entry function is fetched and called to process the data.
In step S104, if the time limit is exceeded and no data arrives, the guest os is notified that the data processing task is completed and ends the present data processing.
As shown in FIG. 3, after the guest-blk kernel module receives the GuestOS notification, the guest-blk kernel module fetches all instructions and data from the virtuue issue queue. And then entering a polling part, polling whether a virtuue sending queue shared with GuestOS has new instructions and data written in, and judging whether the receiving is overtime. If not, judging that new data arrives at the virtuue, calling a VFS universal entry function, processing all the data acquired from the virtuue, returning to a polling state, and entering a new round of polling; if the time is out, the Guest OS judges that no new instructions and data are written into the virtuue within a period of time and informs the Guest OS that the data processing task is completed, and then the polling is finished.
In the vhost protocol framework of this embodiment, by polling the virtuue transmission queue shared with the guest os, the latest data to be processed is collected, thereby reducing the number of times that the guest os initiates system calls and requests, further improving the IO performance, and realizing another performance enhancement characteristic sqppoling of the vhost-blk module.
Specifically, the frequency of initiating the data processing request to the kernel by the Guest OS can be effectively reduced through the polling operation, and the performance loss and delay generated by the data processing request originally initiated downwards from the Guest OS are saved by polling in the kernel through the vhost-blk.
In this embodiment, in the initialization stage of the vhost-blk kernel module, the vhost-blk is configured and initialized through Qemu. In the initialization stage, the initialization of the PCI configuration of the equipment including the manufacturer number, the equipment number and the version number is added, and the configuration of the equipment is inquired and set. And sending a configuration command to a vsost-blk kernel module through ioctl system call to complete initialization and configuration processes of the complete vsost-blk equipment.
Specifically, during the use of the vhost-blk, initialization, basic control, and processing of the configuration command are performed by Qemu, and data processing is not performed.
According to the method and application for processing IO virtualization data based on the vhost protocol, the method for processing the vhost-blk data can be realized based on the vhost protocol, tests are carried out through an FIO tool, compared with the most widely applied virtio-blk scheme at present, in all scenes, read data is superior to the virtio-blk, the IO performance is improved by two times at most, write data is improved by two times at most in most scenes, meanwhile, the CPU usage is basically the same as that of the virtio-blk scheme, the universality is realized, the IO performance is enhanced, and the complexity and uncertainty in practical production are reduced.
Fig. 4 illustrates an apparatus for processing data for virtualization of IO based on the vhost protocol according to an embodiment of the present invention.
In the embodiment of the present invention, the device for IO virtualization data processing based on the vhost protocol includes an initialization module 401, an information acquisition module 402, and a polling module 403.
The initialization module 401 is configured to add a vhost-blk kernel module in a kernel, call an initialization function provided by a vhost protocol to initialize the vhost-blk kernel module, where the initialization includes implementing a notification function from a guest os.
An information obtaining module 402, configured to, after receiving the notification of the guest os, obtain, by the guest-blk kernel module, the instruction and the data address written by the guest os from the virtuue sending queue shared with the guest os.
A polling module 403, configured to poll a virtuue sending queue shared by the GuestOS whether new instructions and data arrive; if yes, taking out and calling a VFS general entry function to process data; and if no data arrives beyond a period of time, informing GuestOS that the data processing task is finished and finishing the data processing.
The initialization module 401 is further configured to: and the vhost-blk kernel module receives configuration information sent by the user space through ioctl, and completes initialization and configuration of the vhost-blk.
The initialization module 401 is further configured to: and executing a Guest OS notification function after receiving the Guest OS notification through the KVM, acquiring the instruction and the data address written by the Guest OS by the notification function from the virtuue, taking out and calling a universal entry function of the virtual file system VFS provided by the kernel to process data, and sending a notification of finishing data processing to the KVM after finishing data processing.
The initialization module 401 is further configured to: the process between the KVM and the vhost-blk communicates by calling the eventfd mechanism and the irqfd mechanism.
The initialization module 401 is further configured to: and in the initialization stage of the vsost-blk kernel module, configuring and initializing the vsost-blk through Qemu.
The initialization module 401 is further configured to: in the initialization stage, the initialization of the PCI configuration of the equipment including manufacturer number, equipment number and version number is added, and the configuration of the equipment is inquired and set.
The initialization module 401 is further configured to: and sending a configuration command to a vhost-blk kernel module through ioctl system call to complete initialization and configuration processes of the complete vhost-blk equipment.
Fig. 5 illustrates a hardware block diagram of a computing device 50 for vhost protocol-based IO virtualization data processing according to embodiments of the present description. As shown in fig. 5, computing device 50 may include at least one processor 501, storage 502 (e.g., non-volatile storage), memory 503, and a communication interface 504, and the at least one processor 501, storage 502, memory 503, and communication interface 504 are connected together via a bus 505. The at least one processor 501 executes at least one computer readable instruction stored or encoded in the memory 502.
It should be appreciated that the computer-executable instructions stored in the memory 502, when executed, cause the at least one processor 501 to perform the various operations and functions described above in connection with fig. 1-5 in the various embodiments of the present description.
In embodiments of the present description, computing device 50 may include, but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile computing devices, smart phones, tablet computers, cellular phones, personal Digital Assistants (PDAs), handsets, messaging devices, wearable computing devices, consumer electronics, and the like.
According to one embodiment, a program product, such as a machine-readable medium, is provided. A machine-readable medium may have instructions (i.e., elements described above as being implemented in software) that, when executed by a machine, cause the machine to perform various operations and functions described above in connection with fig. 1-5 in the various embodiments of the present specification. Specifically, a system or apparatus may be provided which is provided with a readable storage medium on which software program code implementing the functions of any of the above embodiments is stored, and causes a computer or processor of the system or apparatus to read out and execute instructions stored in the readable storage medium.
According to the method and the application for processing the IO virtualization data based on the vhost protocol, disclosed by the embodiment of the invention, the vhost-blk data acceleration processing can be realized based on the vhost protocol, the test is carried out by an FIO tool, compared with the most widely applied virtio-blk scheme at present, the read data is better than the virtio-blk in all scenes, the IO performance is improved by two times at most, the write data is improved by two times at most in most scenes, meanwhile, the CPU usage is basically the same as that of the virtio-blk scheme, the universality is realized, the IO performance is enhanced, and the complexity and uncertainty in the practical production are reduced.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing descriptions of specific exemplary embodiments of the present invention have been presented for purposes of illustration and description. It is not intended to limit the invention to the precise form disclosed, and obviously many modifications and variations are possible in light of the above teaching. The exemplary embodiments were chosen and described in order to explain certain principles of the invention and its practical application to enable one skilled in the art to make and use various exemplary embodiments of the invention and various alternatives and modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims and their equivalents.

Claims (10)

1. A method for IO virtualization data processing based on a vhost protocol, the method comprising:
a vhost-blk kernel module is added in a kernel, an initialization function provided by a vhost protocol is called to initialize the vhost-blk kernel module, and the initialization includes the realization of a notification function from Guest OS;
after receiving the notification of Guest OS, the vhost-blk kernel module acquires the instruction and the data address written by Guest OS from the virtuue sending queue shared with Guest OS;
polling a virtuue sending queue shared with GuestOS to determine whether new instructions and data arrive, and if so, taking out and calling a VFS universal entry function to process the data;
and if the time limit is exceeded and no data arrives, informing GuestOS that the data processing task is completed and finishing the data processing.
2. The method for processing IO virtualized data based on vhost protocol according to claim 1, wherein the invoking the initialization function provided by the vhost protocol for initialization comprises:
and the vhost-blk kernel module receives the configuration information sent by the user space through ioctl, and completes initialization and configuration of the vhost-blk.
3. The method of vhost protocol-based IO virtualization data processing according to claim 1, wherein the initialization comprises an implementation of a notify function from GuestOS comprising:
and executing a Guest OS notification function after receiving the Guest OS notification through the KVM, acquiring a command and a data address written by the Guest OS by the notification function from virtqueue, taking out and calling a universal entry function of the VFS provided by the kernel to process data, and sending a notification of finishing data processing to the KVM after finishing data processing.
4. The method of vhost protocol-based IO virtualization data processing according to claim 3, wherein said sending a notification to KVM of completion of data processing comprises:
the process between the KVM and the vhost-blk communicates by calling the eventfd mechanism and the irqfd mechanism.
5. The method of vhost protocol-based IO virtualization data processing according to claim 1, wherein the method further comprises:
and in the initialization stage of the vsost-blk kernel module, configuring and initializing the vsost-blk through Qemu.
6. The method of vhost protocol-based IO virtualization data processing according to claim 5, wherein configuring and initializing vhost-blk via Qemu comprises:
in the initialization stage, the initialization of the PCI configuration of the equipment including manufacturer number, equipment number and version number is added, and the configuration of the equipment is inquired and set.
7. The method of vhost protocol-based IO virtualization data processing according to claim 5, wherein the method further comprises:
and sending a configuration command to a vsost-blk kernel module through ioctl system call to complete initialization and configuration processes of the complete vsost-blk equipment.
8. An apparatus for IO virtualization data processing based on a vhost protocol, the apparatus comprising:
the initialization module is used for adding a vsost-blk kernel module in a kernel and calling an initialization function provided by a vsost protocol to initialize the vsost-blk kernel module, wherein the initialization comprises the realization of a notification function from GuestOS;
the information obtaining module is used for obtaining the instruction and the data address written by Guest OS from a virtuue sending queue shared with Guest OS after receiving the notification of Guest OS; and
the polling module is used for polling whether a virtuue sending queue shared with GuestOS has new instructions and data; if yes, taking out and calling a VFS universal entry function to process data; and if no data arrives beyond a period of time, informing GuestOS that the data processing task is finished and finishing the data processing.
9. An electronic device, comprising:
at least one processor; and
a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the method of vhost protocol-based IO virtualization data processing of any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of vhost protocol-based IO virtualization data processing according to any of the claims 1 to 7.
CN202211611358.9A 2022-12-14 2022-12-14 IO virtualization data processing method and application based on vhost protocol Pending CN115904628A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211611358.9A CN115904628A (en) 2022-12-14 2022-12-14 IO virtualization data processing method and application based on vhost protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211611358.9A CN115904628A (en) 2022-12-14 2022-12-14 IO virtualization data processing method and application based on vhost protocol

Publications (1)

Publication Number Publication Date
CN115904628A true CN115904628A (en) 2023-04-04

Family

ID=86480463

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211611358.9A Pending CN115904628A (en) 2022-12-14 2022-12-14 IO virtualization data processing method and application based on vhost protocol

Country Status (1)

Country Link
CN (1) CN115904628A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573041A (en) * 2024-01-16 2024-02-20 麒麟软件有限公司 Method for improving virtualized storage performance by improving vhost-scsi

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573041A (en) * 2024-01-16 2024-02-20 麒麟软件有限公司 Method for improving virtualized storage performance by improving vhost-scsi
CN117573041B (en) * 2024-01-16 2024-04-09 麒麟软件有限公司 Method for improving virtualized storage performance by improving vhost-scsi

Similar Documents

Publication Publication Date Title
US11868617B2 (en) Virtualizing non-volatile storage at a peripheral device
US8327174B2 (en) Loading operating systems using memory segmentation and ACPI based context switch
US9081703B2 (en) Method and apparatuses for facilitating sharing device connections between a host and client based on the power mode of the host
US10176007B2 (en) Guest code emulation by virtual machine function
CN113626224B (en) NFC data interaction method and device, electronic equipment and storage medium
CN108124475B (en) Virtual system Bluetooth communication method and device, virtual system, storage medium and electronic equipment
KR20080106908A (en) Migrating a virtual machine that owns a resource such as a hardware device
US20110219373A1 (en) Virtual machine management apparatus and virtualization method for virtualization-supporting terminal platform
WO2013143121A1 (en) Accessing a device on a remote machine
EP2711845A2 (en) PCI express switch with logical device capability
US11954520B2 (en) Micro kernel scheduling method and apparatus
US9003174B2 (en) Method for boosting an electronic device with multiple processing units, and electronic device for implementing the same
US9098431B2 (en) USB redirection for interrupt transactions
CN115904628A (en) IO virtualization data processing method and application based on vhost protocol
CN114417373A (en) Data access method and device for NVMe-oF user mode client
CN117389694B (en) Virtual storage IO performance improving method based on virtio-blk technology
US9304874B2 (en) Virtual machine-guest driven state restoring by hypervisor
KR101614920B1 (en) Sharing input/output(I/O) resources across multiple computing systems and/or environments
CN114675917A (en) Interface rendering method, device, equipment and medium
US11003488B2 (en) Memory-fabric-based processor context switching system
EP3853724B1 (en) I/o completion polling for low latency storage device
CN116107764B (en) Data processing method and system
EP4310679A1 (en) Accelerator control system, accelerator control method, and accelerator control program
CN117555650A (en) Method and device for communication between virtual machines, electronic equipment and storage medium
KR20230093425A (en) Computer systems running multiple operating systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination