Data access method, device and system based on virtual machine device direct access
Through the VF set, the virtual machine device in the host is directly connected to the virtual machine device and the virtual machine is directly connected to a virtual device, which solves the problems of virtual machine data processing complexity and host processor overhead, and achieves the effect of simplifying the processing process and reducing overhead.
Patent Information
- Application Number
- CN202210557053.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-19
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-05-19
AI Technical Summary
In cloud service scenarios, the data processing complexity of virtual machines leads to a large overhead of host processors, especially when peripheral devices access data to virtual machines through virtual devices.
Through the VF set, the peripheral device passes through the virtual machine device in the host. The peripheral device passes through the virtual machine as a virtual device. Through the virtual device, the virtual machine interacts with the virtual machine information on the control plane, and determines the VF for data access from the VF set to avoid bandwidth allocation on the virtual machine side.
Simplifies the processing process of virtual machines, reduces the data processing complexity of virtual machines and the overhead of host processors.
Smart Images

Figure CN114756332B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a data access method, device and system based on virtual machine device direct access. Background Art
[0002] In some cloud service scenarios, based on SR-IOV technology, a physical function (PF) of a peripheral device can generate multiple virtual functions (VF), and directly connect the virtual device corresponding to each VF in the peripheral device to the virtual machine device of the host machine. When the peripheral device accesses data to the virtual machine through the virtual device, the host machine needs to allocate bandwidth through the virtual machine to determine the virtual device in the peripheral device that can access data to the virtual machine. In this case, the data processing of the virtual machine is more complicated, resulting in a large processor overhead for the host machine. Summary of the invention
[0003] The embodiments of the present application provide a data access method, device and system based on virtual machine device direct access, in order to reduce the complexity of data processing of the virtual machine, thereby reducing the processor overhead of the host machine.
[0004] In the first aspect, an embodiment of the present application provides a data access method based on direct connection of a virtual machine device, which is applied to a peripheral device, wherein a VF set in the peripheral device is directly connected to a virtual machine device in a host machine, and the VF set is directly connected as a virtual device in the virtual machine of the host machine. The method comprises: receiving a data access request sent by the virtual machine through a first VF in the VF set, wherein the data access request is used to request the peripheral device to perform data access to target data in a memory space corresponding to a first data access address; determining at least one second VF for performing data access from the VF set according to the data access amount of the target data; and performing data access to the target data in the memory space corresponding to the first data access address through the at least one second VF.
[0005] In the second aspect, an embodiment of the present application provides a data access method based on direct connection of virtual machine devices, which is applied to a host machine, and the virtual machine in the host machine is directly connected to the VF set device in the peripheral device, and the VF set is directly connected as a virtual device in the virtual machine of the host machine. The method includes: determining a first data access address of the target data; sending a data access request to the first VF in the VF set through the virtual machine, and the data access request is used to request the peripheral device to perform data access to the target data in the memory space corresponding to the first data access address.
[0006] In a third aspect, an embodiment of the present application provides a peripheral device, in which a VF set in the peripheral device is directly connected to a virtual machine device in a host machine, and the VF set is directly connected as a virtual device in the virtual machine of the host machine, and the peripheral device includes: a transceiver unit, used to receive a data access request sent by the virtual machine through a first VF in the VF set, and the data access request is used to request the peripheral device to perform data access to target data in a memory space corresponding to a first data access address; a processing unit, used to determine at least one second VF from the VF set to perform data access based on the data access amount of the target data; a data access unit, used to perform data access to the target data in the memory space corresponding to the first data access address through the at least one second VF.
[0007] In a fourth aspect, an embodiment of the present application provides a host machine, in which a virtual machine in the host machine is directly connected to a VF set device in a peripheral device, and the VF set is directly connected as a virtual device in the virtual machine of the host machine. The host machine includes: a processing unit, used to determine a first data access address of target data; a transceiver unit, used to send a data access request to the first VF in the VF set through the virtual machine, and the data access request is used to request the peripheral device to access the target data in the memory space corresponding to the first data access address.
[0008] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method provided in the first aspect or the second aspect.
[0009] In a sixth aspect, an embodiment of the present application provides a device direct-pass system, comprising: a peripheral device and a host machine; the VF set in the peripheral device is directly connected to the virtual machine device of the host machine, and the VF set is directly connected as a virtual device in the virtual machine of the host machine; the host machine is used to send a data access request to the first VF in the VF set through the virtual machine, and the data access request is used to request the peripheral device to access the target data in the memory space corresponding to the first data access address; the peripheral device is used to receive the data access request sent by the virtual machine through the first VF in the VF set.
[0010] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method provided in the first aspect or the second aspect is implemented.
[0011] In an eighth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the method provided in the first aspect or the second aspect.
[0012] In an embodiment of the present application, a VF set is directly connected to a virtual machine VM device in a host machine, and the VF set is directly connected as a virtual device in the virtual machine. The virtual device exchanges control plane information with the virtual machine through a first VF in the VF set, thereby avoiding control plane information exchange between the virtual machine and multiple VFs, and simplifying the processing process of the virtual machine; and, the peripheral device determines at least one second VF for data access from the VF set, thereby avoiding bandwidth allocation on the virtual machine side, reducing the complexity of data processing of the virtual machine, and reducing the overhead of the host machine processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 A schematic diagram of a virtual machine VM device direct connection scenario 100 provided in an embodiment of the present application is shown;
[0014] Figure 2 A schematic diagram of a device direct access system 200 provided in an embodiment of the present application;
[0015] Figure 3 A schematic diagram of an interactive process of a data access method 300 based on virtual machine device direct communication provided in an embodiment of the present application;
[0016] Figure 4 A schematic block diagram of a device 400 provided in an embodiment of the present application;
[0017] Figure 5 A schematic structural diagram of an electronic device 500 provided in an embodiment of the present application;
[0018] Figure 6 A schematic diagram of the structure of a cloud server 600 provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0019] Figure 1 A schematic diagram of a virtual machine (VM) device direct connection scenario 100 provided in an embodiment of the present application is shown.
[0020] Combination Figure 1 As shown, the host machine 110 can be an implementation of a cloud service end, for example, a server in the cloud or a server in a cloud server cluster. The host machine 110 provides a remote service carrier for cloud services, and cloud services exist on the server in the form of virtual machines 110-1 to 110-n.
[0021] Peripheral devices 120 are auxiliary devices connected to the host in a computer system, which can be referred to as peripherals, for example, network cards, disks, and other devices that may be connected to the host, such as mice, keyboards, printers, projectors, speakers, cameras, etc.
[0022] Optionally, the peripheral device 120 may be a device that complies with the Peripheral Component Interconnect Express (PCIe) protocol. A device that complies with the PCIe protocol may also be referred to as a PCIe device.
[0023] There are multiple VFs in the peripheral device 120, such as Figure 1 120 - 1 to 120 - m in FIG. ...
[0024] The virtual machines 110 - 1 to 110 - n in the host machine 110 can respectively perform device direct communication (or virtualization direct communication) with the VF in the peripheral device 120 , so that the VF in the peripheral device 120 can directly access data to the virtual machine in the host machine 110 without going through the virtual machine monitor (Virtual Machine Monitor, VMM) (or hypervisor) 140.
[0025] When the virtual machines 110-1 to 110-n in the host machine 110 and the VFs in the peripheral device 120 are connected directly, data access can be achieved between the host machine 110 and the peripheral device 120 through the direct channel. In the Multi-Host scenario, the host machine 110 and the peripheral device 120 can access data through multiple direct channels (such as Figure 1 130-1~130-p) in realize data access.
[0026] Generally speaking, a VF in the peripheral device 120 accesses the memory mapped by the virtual machine in the host machine 110 through a direct channel to achieve data access.
[0027] When the peripheral device 120 is a PCIe device, data is accessed between the peripheral device 120 and the host machine 110 through PCIe channels 130-1 to 130-p. Generally speaking, the number of PCIe channels 130-1 to 130-p may be the same as the number of VFs 120-1 to 120-m, or the number of PCIe channels 130-1 to 130-p may be less than the number of VFs 120-1 to 120-m.
[0028] The embodiment of the present application is only described by taking the peripheral device 120 meeting the PCIe protocol as an example, but it does not constitute any limitation to the present application. For example, the peripheral device 120 can also be a device meeting the PCI protocol, and when the peripheral device 120 is a device meeting the PCI protocol, the peripheral device 120 and the host machine 110 perform data access through the PCI channels 130-1 to 130-p.
[0029] VMM 140 can be used to establish and execute one or more VMs, which can be implemented as at least one of software, firmware, and hardware. Generally speaking, VMM 140 can be deployed in host machine 110. Of course, the embodiments of the present application do not exclude other deployment methods of VMM 140, for example, VMM 140 can be deployed independently of host machine 110.
[0030] Currently, in virtualization scenarios, there are mainly two types of device pass-through solutions:
[0031] Solution 1: The PF of the peripheral device 120 is completely directly passed to a virtual machine in the host machine 110.
[0032] Solution 2: Peripheral device 120 is based on SR-IOV technology. One PF generates multiple VFs, and each VF is directly connected to a virtual machine in host machine 110. For example, VF 120-1 and VF 120-2 are directly connected to virtual machine 110-1, and VF 120-n is directly connected to virtual machine 110-n. It should be noted that a VF is an independent peripheral device for a virtual machine.
[0033] Taking the peripheral device 120 as a network card as an example, VF 120-1 and VF 120-2 are two network cards for virtual machine 110-1. When virtual machine 110-1 needs to send data to a network (such as the Internet or a local area network), it can notify VF 120-1 and / or 120-2 to access the corresponding memory address of virtual machine 110-1 in host machine 110, read the data, and send the read data to the network through VF 120-1 and / or 120-2; when virtual machine 110-1 needs to receive data from the network, it can notify VF 120-1 and / or 120-2 to access the corresponding memory address of virtual machine 110-1 in host machine 110, and write the data obtained from the network.
[0034] In the above-mentioned solution 2, virtual machine 110-1 is directly connected to more than one VF, and can determine which VF or VFs to implement data access based on the device capabilities of the virtual devices to which each VF is directly connected. For example, assuming that peripheral device 120 is implemented as a network card, virtual network card 1 and virtual network card 2 in peripheral device 120 are both directly connected to virtual machine 120-1 in host machine 110. When the virtual machine needs to interact with the network for data, it needs to determine the virtual network card for data access based on the bandwidth of virtual network card 1 and virtual network card 2. That is, the virtual machine needs to access the data of the corresponding virtual network card after allocating bandwidth to the virtual network card to implement data interaction with the network. In this case, the data processing process of the host machine is relatively complicated, resulting in a large processor overhead of the host machine.
[0035] In response to the above technical problems, the embodiment of the present application introduces a VF set in a peripheral device. On the one hand, the VF set is directly connected to the virtual machine VM device in the host machine, and the VF set is directly connected as a virtual device in the virtual machine. The virtual device interacts with the virtual machine on the control plane through a VF in the VF set (such as the first VF in the following text), avoiding the virtual machine from interacting with multiple VFs on the control plane, and simplifying the processing process of the virtual machine; on the other hand, the peripheral device determines the VF for data access from the VF set (such as at least one second VF in the following text), avoiding bandwidth allocation on the virtual machine side, reducing the complexity of data processing of the virtual machine, and reducing the overhead of the host machine processor.
[0036] In the above text, n, m, and p are all positive integers.
[0037] Figure 2 Schematic diagram of a device direct access system 200 provided in an embodiment of the present application. Figure 2 As shown, the system 200 includes a host machine 210 and a peripheral device 220. A virtual machine 211 in the host machine 210 is directly connected to a VF set device in the peripheral device 220, and the VF set generally includes multiple VFs (for example, including Figure 2 Of course, this application does not exclude the possibility that the VF set includes one VF. Figure 2 As shown, for the virtual machine in the host machine, the VF set is directly connected to a virtual device, for example, the device information of the VF set as a whole (such as the group identifier, PCI information, register information, bandwidth, etc. of the VF set) can be viewed in the virtual machine; or for the virtual machine in the host machine, the VF set is one of the VFs (i.e., the first VF), for example, the identifier of the first VF, the PCI information, register information, bandwidth, and other device information of the VF set can be viewed in the virtual machine.
[0038] The data access method for direct access to a virtual machine VM device provided in the embodiment of the present application can be applied to the above Figure 2in the system shown.
[0039] The data access method based on virtual machine VM device direct communication provided in the embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0040] It should be understood that the following is only for the convenience of understanding and explanation, and the method provided by the embodiment of the present application is described in detail by taking the interaction between the peripheral device and the host as an example. The peripheral device may be Figure 1 The peripheral device 120 shown, the host machine may be, for example, Figure 1 The host machine 110 in the.
[0041] However, it should be understood that this should not constitute any limitation on the execution subject of the method provided in the present application. As long as the method provided in the embodiment of the present application can be implemented by running a program that records the code of the method provided in the embodiment of the present application, it can be used as the execution subject of the method provided in the embodiment of the present application. For example, the peripheral device shown in the following embodiment can also be replaced by a component in the peripheral device, such as a chip, a chip system, or other functional modules that can call and execute programs, and the host machine can also be replaced by a component in the host machine, such as a chip, a chip system, or other functional modules that can call and execute programs.
[0042] Figure 3 The following is a schematic diagram of an interactive process of a data access method 300 based on a virtual machine VM device direct access provided in an embodiment of the present application. Figure 3 As shown, the method 300 includes some or all of the following processes:
[0043] S310, the host machine determines a first data access address of target data;
[0044] S320, the host machine sends a data access request to the first VF in the VF set through the virtual machine; correspondingly, the peripheral device receives the data access request sent by the virtual machine through the first VF in the VF set;
[0045] S330, the peripheral device determines at least one second VF for performing data access from the VF set according to the data access amount of the target data;
[0046] S340: The peripheral device accesses the target data in the memory space corresponding to the first data access address through at least one second VF.
[0047] The target data is the data to be accessed. Taking the peripheral device as a network card as an example, the target data may be data sent by the virtual machine to the network, or the target data may be data sent by the network to the virtual machine. The data interaction between the virtual machine and the network may be data interaction between the virtual machine and other devices (or virtual machines) in the network.
[0048] The virtual machine has a corresponding memory space in the host machine's memory, and the first data access address may correspond to the virtual machine's memory space or a portion of the virtual machine's memory space. Still taking the peripheral device as a network card as an example, when the target data is data sent by the virtual machine to the network, the target data is stored in the memory space corresponding to the first data access address; when the target data is data sent by the network to the virtual machine, the memory space corresponding to the first data access address is used to write the target data.
[0049] It should be noted that the first VF may be any VF in the VF set, for example Figure 3 The VF set directly connected to the virtual machine VM device may include VFs 1-x. For example, the host machine may randomly specify a VF from the VF set as the first VF through the virtual machine monitor. The first VF may be used to simulate the control plane function of the peripheral device.
[0050] In the above S320, the host machine can send a data access request to the first VF through the virtual machine, or send a data access request to the VF set. Regardless of whether the host machine sends a data access request to the first VF or sends a data access request to the VF set, the peripheral device can receive the data access request through the first VF.
[0051] It should be noted that the data access request is used to request the peripheral device to access the target data in the memory space corresponding to the first data access address. Optionally, the data access request carries the first data access address, or the first data access address can be sent separately to the peripheral device.
[0052] In some embodiments, a virtual machine in a host machine may perform data interaction with a first VF in a peripheral device to obtain data access capabilities of a VF set. Exemplarily, the host machine may obtain device information sent by the first VF through the virtual machine, and determine the data access capabilities of the VF set based on the device information. The device information may include the identifier of the first VF / VF set listed above, PCI information of the VF set, register information of the VF set, bandwidth of the VF set, etc. The bandwidth of the VF set may be, for example, the sum of the bandwidths of each VF in the VF set.
[0053] After receiving the data access request, the peripheral device needs to determine at least one second VF in the VF set for performing data access. The at least one second VF may not include the first VF, for example, when the VF set includes VF120-1 and 120-2 and the first VF is 120-1, the at least one second VF is 120-2; or the at least one second VF may include the first VF, for example, the first VF is 120-1 in the VF set, and the at least one second VF includes VF120-1 and 120-2.
[0054] The peripheral device determines at least one second VF from the VF set, and the at least one second VF can be determined based on the data access volume of the target data. As mentioned above, data access is performed between the VF and the virtual machine through a direct channel, and each data channel has a certain bandwidth limit. If the data volume of the target data exceeds the bandwidth of a direct channel, data access can be performed through more direct channels, that is, the number of direct channels can be determined according to the data volume of the target data. Accordingly, each VF corresponds to a direct channel. Assuming that the peripheral device determines that data access needs to be achieved through two direct channels, it is necessary to determine two second VFs from the VF set.
[0055] Optionally, the data access volume of the target data may be carried in the data access request, or may be determined by the peripheral device based on data received from the network.
[0056] Exemplarily, each VF can be directly connected to multiple virtual machines, so when the peripheral device determines the second VF from the VF set, it needs to consider whether the VF is used for data access of other virtual machines, and determine the remaining data load of the VF when the VF is also used for data access of other virtual machines. Therefore, the peripheral device needs to determine the second VF based on the load of each VF in the VF. In other words, the peripheral device can determine the second VF from the VF set based on the load balancing algorithm.
[0057] Exemplarily, the peripheral device can determine at least one second VF from the VF set in combination with the data access volume of the target data and the data load volume of each VF in the VF set. For example, if the data access volume is large, two second VFs are required to implement data access. However, based on the load balancing algorithm, only one second VF can be determined from the search device set. Then the peripheral device can access the data through the one second VF.
[0058] Exemplarily, the peripheral device may determine, through device firmware, at least one second VF for performing data access from the VF set.
[0059] Furthermore, the peripheral device performs data access to the target data in the memory space corresponding to the first data access address through the determined at least one second VF. Assuming that the peripheral device is implemented as a network card, the peripheral device can read the target data from the memory space corresponding to the first data access address through at least one second VF and send the target data to the network, or the peripheral device can receive the target data from the network through at least one second VF and write the target data into the memory space corresponding to the first data access address to achieve data access.
[0060] Assuming that the peripheral device is implemented as a network card, when the peripheral device reads the target data from the memory space corresponding to the first data access address through the second VF, the virtual machine can release the memory space corresponding to the first data access address; when the peripheral device receives the target data from the network through at least one second VF and writes the target data into the memory space corresponding to the first data access address, the virtual machine can perform packet receiving processing on the target data. Of course, the embodiment of the present application mainly implements the data access process of the target data, and does not limit the use of the target data.
[0061] In some embodiments, the above S340 can be implemented as follows: the peripheral device determines at least one second data access address corresponding to at least one second VF according to the first data access address, each second data access address corresponds to a different memory space, and the memory space corresponding to each second data access address is included in the memory space corresponding to the first data access address. Then, the peripheral device accesses the target data in the memory space corresponding to each second data access address through at least one second VF. Based on this, at least one second VF can implement data access in the memory space corresponding to each second data access address in a parallel manner, thereby increasing bandwidth.
[0062] In some embodiments, the second data access address may be a guest physical address (GPA). In the process of the peripheral device accessing data through at least one second VF based on each second data access address, the host needs to convert each second data access address from the GPA to a host physical address (Host Physical Address, HPA). Furthermore, the peripheral device finds the memory space of the corresponding virtual machine in the host through each second VF from the second data access address after address conversion to achieve data access. Exemplarily, for a second VF in at least one second VF, the host can map the second data access address of the second VF from the GPA to the HPA according to the device page table of the second VF. Among them, the device page table is used to represent the mapping relationship between the GPA and the HPA.
[0063] It should be noted that each VF in the VF set corresponds to a device page table. In the embodiment of the present application, the device page tables corresponding to each VF in the VF set can be the same. The host machine can use the VMM (for example Figure 1 The VMM 140 in the VF set may establish a device page table for each VF in the VF set, or the host machine may establish a device page table for the first VF through the VMM, and establish the same device page table as the first VF for other VFs in the VF set.
[0064] In some embodiments, the specific implementation of the above S340 may also include: the peripheral device receives an interrupt request sent by any one or more second VFs in at least one second VF, and in response to the interrupt request, interrupts the data access of the second VF. The interrupt request carries an interrupt identifier, and the host machine can determine the virtual machine identifier in the interrupt mapping table of the second VF based on the interrupt identifier, and then control the virtual machine interrupt data access corresponding to the virtual machine identifier. Among them, the interrupt mapping table is used to represent the mapping relationship between the interrupt identifier and the virtual machine. The interrupt identifier can be pre-configured by the host machine for the VF. Each VF can have multiple types of interrupt requests, and each type of interrupt request corresponds to an interrupt identifier.
[0065] It should be noted that each VF in the VF set corresponds to an interrupt mapping table. In the embodiment of the present application, the interrupt mapping tables corresponding to the VFs in the VF set are the same. The host machine can use the VMM (for example Figure 1 The VMM 140 in the VF set may establish an interrupt mapping table for each VF in the VF set, or the host machine may establish an interrupt mapping table for the first VF through the VMM, and establish the same interrupt mapping table as the first VF for other VFs in the VF set.
[0066] Therefore, in an embodiment of the present application, the VF set is directly connected to the virtual machine VM device in the host machine, and the VF set is directly connected as a virtual device in the virtual machine. The one virtual device exchanges control plane information with the virtual machine through the first VF in the VF set, avoiding control plane information exchange between the virtual machine and multiple VFs, thereby simplifying the processing process of the virtual machine; and the peripheral device determines at least one second VF for data access from the VF set, avoiding bandwidth allocation on the virtual machine side, reducing the complexity of data processing of the virtual machine, and reducing the overhead of the host processor.
[0067] It should be noted that the descriptions such as “first” and “second” in this article are used to distinguish different data, devices, etc., and do not represent the order of precedence, nor do they limit “first” and “second” to different types.
[0068] Figure 4 4 is a schematic block diagram of a device 400 provided in an embodiment of the present application. Figure 4 As shown, the device 400 may include a transceiver unit 410 and a processing unit 420 .
[0069] Optionally, the device 400 may correspond to the peripheral device in the above method embodiment, for example, it may be an implementation of the peripheral device, or a component configured in the peripheral device (such as a chip or a chip system, etc.). When the device 400 corresponds to the peripheral device in the above method embodiment, the device 400 may include a transceiver unit 410, a processing unit 420 and a data access unit 430.
[0070] Among them, the transceiver unit 410 can be used to receive a data access request sent by the virtual machine through the first VF in the VF set, and the data access request is used to request the peripheral device to access the target data in the memory space corresponding to the first data access address; the processing unit 420 can be used to determine at least one second VF from the VF set to perform data access according to the data access amount of the target data; the data access unit 430 can be used to access the target data in the memory space corresponding to the first data access address through the at least one second VF.
[0071] In some embodiments, the first VF is used to emulate a control plane function of a peripheral device.
[0072] In some embodiments, the data access unit 430 is specifically used to: determine, based on the first data access address, at least one second data access address corresponding to each of the at least one second VFs, the memory space corresponding to the second data access address being included in the memory space corresponding to the first data access address; and perform data access to the target data in the memory space corresponding to each of the at least one second data access address through the at least one second VF.
[0073] In some embodiments, the processing unit 420 is specifically used to: determine at least one second VF that performs data access from the VF set according to the data access amount of the target data and the data load amount of each VF in the VF set through device firmware.
[0074] In some embodiments, the data access request carries the data access amount.
[0075] It should be understood that the specific process of each unit executing the above corresponding steps has been described in detail in the above method embodiment, and for the sake of brevity, it will not be repeated here.
[0076] Optionally, the device 400 may correspond to the host machine in the above method embodiment, for example, it may be an implementation of the host machine, or a component (such as a chip or chip system, etc.) configured in the host machine. When the device 400 corresponds to the host machine in the above method embodiment, the device 400 may include a transceiver unit 410 and a processing unit 420.
[0077] Among them, the processing unit 420 can be used to determine a first data access address of the target data; the transceiver unit 410 can be used to send a data access request to the first VF in the VF set through the virtual machine, and the data access request is used to request the peripheral device to access the target data in the memory space corresponding to the first data access address.
[0078] In some embodiments, the first VF is used to simulate the control plane function of the peripheral device; the device information sent by the first VF is obtained through the virtual machine, and the device information is used to determine the data access capability of the VF set.
[0079] In some embodiments, the processing unit 420 is further used to: in the process of accessing data through at least one second VF, obtain at least one second data access address corresponding to the at least one second VF, the at least one second VF is determined from the VF set based on the data access volume of the target data, the memory space corresponding to the second data access address is included in the memory space corresponding to the first data access address, and the second data access address is a virtual machine physical address; for each second VF in the at least one second VF, according to the device page table of the second VF, map the second data access address of the second VF from the virtual machine physical address to the host machine physical address, and the device page table is used to represent the mapping relationship between the virtual machine physical address and the host machine physical address.
[0080] In some embodiments, the processing unit 420 is further configured to: establish, through a virtual machine monitor, a device page table for each VF in the VF set, wherein the device page tables for each VF in the VF set are the same.
[0081] In some embodiments, the transceiver unit 410 is also used to receive an interrupt request sent by the peripheral device through the second VF, and the interrupt request carries an interrupt identifier; the processing unit 420 is also used to determine the virtual machine identifier in the interrupt mapping table of the second VF according to the interrupt identifier; the processing unit is also used to control the virtual machine corresponding to the virtual machine identifier to interrupt data access.
[0082] In some embodiments, the processing unit 420 is further configured to establish, through a virtual machine monitor, an interrupt mapping table corresponding to each VF in the VF set, and the interrupt mapping table of each VF in the VF set is the same.
[0083] In some embodiments, the processing unit 420 is further configured to obtain device information sent by the first VF through the virtual machine, where the device information is used to determine data access capability of the VF set.
[0084] In some embodiments, the processing unit 420 is further configured to designate, through a virtual machine monitor, a VF in the VF set as the first VF.
[0085] It should be understood that the specific process of each unit executing the above corresponding steps has been described in detail in the above method embodiment, and for the sake of brevity, it will not be repeated here.
[0086] Figure 5 A schematic structural diagram of an electronic device 500 provided in an embodiment of the present application. Figure 5The electronic device 500 shown can be implemented as a peripheral device or a host machine, and is used to implement the steps performed by the peripheral device or the host machine in the above method embodiment. The electronic device 500 includes a processor 520, which can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0087] In some embodiments, Figure 6 As shown, the electronic device 500 may further include a memory 530. The processor 520 may call and run a computer program from the memory 530 to implement the method in the embodiment of the present application.
[0088] The memory 530 may be a separate device independent of the processor 520 , or may be integrated into the processor 520 .
[0089] In some embodiments, Figure 6 As shown, the electronic device 500 may further include a transceiver 510, and the processor 520 may control the transceiver 510 to communicate with other devices, specifically, may send information or data to other devices, or receive information or data sent by other devices.
[0090] The transceiver 510 may include a transmitter and a receiver. The transceiver 510 may further include an antenna, and the number of the antennas may be one or more.
[0091] In some embodiments, the electronic device 500 can implement the corresponding processes of each method on the peripheral device or host side in the embodiments of the present application. For the sake of brevity, they will not be repeated here.
[0092] Figure 6 The following is a schematic diagram of the structure of a cloud server 600 provided in an exemplary embodiment of the present application. The cloud server 600 may be an implementation of the host machine in the above method embodiment. Figure 6 As shown, the host machine 600 includes: a memory 610 and a processor 620 .
[0093] The memory 610 is used to store computer programs and can be configured to store various other data to support operations on the host machine. The memory 610 can be an object storage service (OSS).
[0094] The processor 620 is coupled to the memory 610 and is used to execute the computer program in the memory 610 to implement the method implemented by the host machine in the above method embodiment.
[0095] Further, if Figure 6As shown, the host machine also includes: a firewall 630, a load balancer 640, a communication component 650, a power supply component 660 and other components. Figure 6 Only some components are shown schematically, which does not mean that the host machine only includes Figure 6 Components shown.
[0096] It should be understood that Figure 6 The host machine 500 shown can implement various processes related to the host machine in the above method embodiment. The operations and / or functions of each module in the host machine 500 are respectively to implement the corresponding processes in the above method embodiment. For details, please refer to the description in the above method embodiment. To avoid repetition, the detailed description is appropriately omitted here.
[0097] The present application also provides a processing device, including at least one processor, wherein the at least one processor is used to execute a computer program stored in a memory, so that the processing device executes the method executed by the peripheral device or the host machine in the above method embodiment.
[0098] The embodiment of the present application also provides a processing device, including a processor and an input / output interface. The input / output interface is coupled to the processor. The input / output interface is used to input and / or output information. The information includes at least one of an instruction and data. The processor is used to execute a computer program so that the processing device executes the method executed by the peripheral device or the host machine in the above method embodiment.
[0099] The present application also provides a processing device, including a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the processing device executes the method executed by the peripheral device or the host machine in the above method embodiment.
[0100] It should be understood that the above-mentioned processing device can be one or more chips. For example, the processing device can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a processor (central processor unit, CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0101] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in a processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.
[0102] It should be noted that the processor in the embodiment of the present application can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor can be combined and performed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0103] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0104] According to the method provided in the embodiment of the present application, the present application also provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes the method executed by the peripheral device or host machine in the above method embodiment.
[0105] According to the method provided in the embodiment of the present application, the present application also provides a computer-readable storage medium, which stores a program code. When the program code runs on a computer, the computer executes the method executed by the peripheral device or host machine in the above method embodiment.
[0106] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data access method based on virtual machine device direct access, characterized in that: Applied to a peripheral device, a virtual function VF set in the peripheral device is directly connected to a virtual machine device in a host machine, and the VF set is directly connected as a virtual device in the virtual machine of the host machine, and the method includes: receiving, through a first VF in the VF set, a data access request sent by the virtual machine, the data access request being used to request the peripheral device to perform data access on target data in a memory space corresponding to a first data access address; Determining at least one second VF for performing data access from the VF set according to the data access amount of the target data; The target data is accessed in the memory space corresponding to the first data access address through the at least one second VF.
2. The method according to claim 1, characterized in that The first VF is used to simulate a control plane function of the peripheral device.
3. The method according to claim 1 or 2, characterized in that: The step of accessing the target data in the memory space corresponding to the first data access address through the at least one second VF includes: Determine, according to the first data access address, at least one second data access address corresponding to each of the at least one second VF, wherein the memory space corresponding to the second data access address is included in the memory space corresponding to the first data access address; The target data is accessed in the memory space corresponding to the at least one second data access address through the at least one second VF.
4. The method according to claim 1 or 2, characterized in that: The step of determining at least one second VF for performing data access from the VF set according to the data access amount includes: At least one second VF for performing data access is determined from the VF set through device firmware according to the data access amount of the target data and the data load amount of each VF in the VF set.
5. The method according to claim 1 or 2, characterized in that: The data access request carries the data access amount.
6. A data access method based on virtual machine device direct access, characterized in that: Applied to a host machine, a virtual machine in the host machine is directly connected to a VF set device in a peripheral device, and the VF set is directly connected as a virtual device in the virtual machine of the host machine, and the method includes: determining a first data access address of target data; A data access request is sent to the first VF in the VF set through the virtual machine, wherein the data access request is used to request at least one second VF in the peripheral device to access the target data in the memory space corresponding to the first data access address, and the at least one second VF is determined from the VF set based on the data access amount of the target data.
7. The method according to claim 6, characterized in that The first VF is used to simulate the control plane function of the peripheral device; The device information sent by the first VF is obtained through the virtual machine, where the device information is used to determine the data access capability of the VF set.
8. The method according to claim 6 or 7, characterized in that: The method further comprises: In a process of accessing data through at least one second VF, obtaining at least one second data access address corresponding to each of the at least one second VFs, wherein the memory space corresponding to the second data access address is included in the memory space corresponding to the first data access address, and the second data access address is a virtual machine physical address; For each second VF in the at least one second VF, according to a device page table of the second VF, a second data access address of the second VF is mapped from a virtual machine physical address to a host machine physical address, wherein the device page table is used to represent a mapping relationship between a virtual machine physical address and a host machine physical address.
9. The method according to claim 8, characterized in that The method further comprises: A device page table of each VF in the VF set is established through a virtual machine monitor, and the device page tables of each VF in the VF set are the same.
10. The method according to claim 8, characterized in that The method further comprises: receiving an interrupt request sent by the peripheral device through the second VF, wherein the interrupt request carries an interrupt identifier; According to the interrupt identifier, determining the virtual machine identifier in the interrupt mapping table of the second VF; The virtual machine corresponding to the virtual machine identifier is controlled to interrupt data access.
11. The method according to claim 10, characterized in that The method further comprises: An interrupt mapping table corresponding to each VF in the VF set is established through a virtual machine monitor, and the interrupt mapping table of each VF in the VF set is the same.
12. The method according to claim 6 or 7, characterized in that: The method further comprises: A VF in the VF set is designated as the first VF by a virtual machine monitor.
13. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 12.
14. A device direct access system, characterized in that: include: Peripheral device and host machine; the VF set in the peripheral device is directly connected to the virtual machine device of the host machine, and the VF set is directly connected as a virtual device in the virtual machine of the host machine; The host machine is used to send a data access request to the first VF in the VF set through the virtual machine, and the data access request is used to request the peripheral device to access the target data in the memory space corresponding to the first data access address; The peripheral device is used to determine at least one second VF for performing data access from the VF set according to the data access amount of the target data, and to access the target data in the memory space corresponding to the first data access address through the at least one second VF.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method according to any one of claims 1 to 5 or any one of claims 6 to 12 is implemented.
16. A computer program product, characterized in that The computer program product stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 5 or any one of claims 6 to 12 is implemented.
Citation Information
Patent Citations
Method, device, equipment and medium for accessing data
CN112148418A