Method, computer device and medium for vDPA memory mapping

By optimizing the memory mapping process of vDPA devices, treating the loading of different vDPA devices differently, and generating and utilizing mapping relationship sets, the problem of inefficient virtual machine memory mapping is solved, achieving shorter startup and shutdown times and flexible device scale adaptation. match.

CN118426913BActive Publication Date: 2024-09-24ZHUHAI XINGYUN ZHILIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410893043.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-09-24
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

In heterogeneous computing scenarios, in virtualized data path acceleration (vDPA) technology, the existing technology suffers from inefficient memory mapping and redundant memory mapping problems, which results in long virtual machine startup and shutdown times, affecting response speed and overall efficiency.

Method used

Optimize the memory mapping process by treating the loading of the first vDPA device and the second vDPA device differently, use system calls to lock the physical memory address range, generate a mapping relationship set, and use the generated mapping relationship to configure the virtualization data of the second vDPA device. Path acceleration, avoid repeated mapping, and improve memory mapping efficiency.

Benefits of technology

It improves memory mapping efficiency, shortens the startup and shutdown time of virtual machines, can flexibly adapt to changes in vDPA device scale, and solves data inconsistency issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118426913B
    Figure CN118426913B
Patent Text Reader

Abstract

The present application relates to the field of computer technology and provides a method, computer device and medium for vDPA memory mapping. The method includes: a first virtual machine determines at least one associated vDPA device; sends configuration information to a corresponding host machine; a first vDPA driver receives memory information of a physical memory; in response to the loading of the first vDPA device, locks the physical address range indicated by the memory information in the physical memory through a system call, and then generates a mapping relationship set for at least one vDPA device, and uses the first mapping relationship in the mapping relationship set to implement virtualized data path acceleration of the first vDPA device; in response to the loading of the second vDPA device, uses the first mapping relationship to configure the second mapping relationship in the mapping relationship set to implement virtualized data path acceleration of the second vDPA device. In this way, the memory mapping efficiency is improved and the virtual machine switch time is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, computer device, and medium for vDPA memory mapping. Background Art

[0002] In application scenarios such as heterogeneous computing, virtualized data path acceleration (virtio data path acceleration, vDPA) is also called virtualized hardware acceleration. vDPA is achieved through data plane hardware acceleration and control plane software simulation. In the scenario of data processing unit (DPU), in order for the DPU to simulate multiple different types of vDPA devices to the host, the DPU needs to simulate the entire bus topology and different types of vDPA devices. The host needs to install the vDPA driver to load and use the vDPA device, and map the physical memory space used by the virtual machine. In the existing technology, there are problems such as low memory mapping efficiency and redundant memory mapping, which results in a long startup and shutdown time of the virtual machine, which is not conducive to improving response speed and overall efficiency.

[0003] To this end, the present application provides a method, computer device and medium for vDPA memory mapping to address the technical difficulties in the prior art. Summary of the invention

[0004] In a first aspect, the present application provides a method for vDPA memory mapping. The method includes: a first virtual machine determines at least one vDPA device associated with the first virtual machine, wherein the at least one vDPA device includes a first vDPA device and a second vDPA device; the first virtual machine sends configuration information of the first virtual machine to a host machine corresponding to the first virtual machine, wherein the configuration information of the first virtual machine indicates the number of the at least one vDPA device and the physical memory size required by each of the at least one vDPA devices; a first vDPA driver of the first virtual machine receives memory information of a first physical memory of the host machine, wherein the memory information of the first physical memory indicates at least one physical memory address in the first physical memory allocated by the host machine based on the configuration information of the first virtual machine. The invention relates to a first vDPA driver, wherein each of the at least one physical memory address block indicates a continuously distributed physical address range; the first vDPA driver, in response to the loading of the first vDPA device, locks the physical address range indicated by the memory information of the first physical memory in the first physical memory through a system call, and then generates a mapping relationship set for the at least one vDPA device, and uses a first mapping relationship in the mapping relationship set to implement virtualized data path acceleration of the first vDPA device; the first vDPA driver, in response to the loading of the second vDPA device, uses the first mapping relationship to configure a second mapping relationship in the mapping relationship set so as to implement virtualized data path acceleration of the second vDPA device.

[0005] Through the first aspect of the present application, by optimizing the memory mapping of the vDPA device and treating the loading of the first vDPA device and the loading of the second vDPA device differently, the memory mapping efficiency is improved, which helps to save the switching time of the virtual machine, helps to shorten the startup and shutdown time of the virtual machine, and can flexibly adapt to changes in the scale of the vDPA device and solve data inconsistency problems.

[0006] In a possible implementation manner of the first aspect of the present application, the at least one vDPA device is a currently deployed vDPA device of the first virtual machine.

[0007] In a possible implementation manner of the first aspect of the present application, the at least one vDPA device includes a currently deployed vDPA device of the first virtual machine and a vDPA device to be deployed of the first virtual machine.

[0008] In a possible implementation manner of the first aspect of the present application, the at least one vDPA device is a maximum number of vDPA devices supported by the first virtual machine through dynamic deployment.

[0009] In a possible implementation of the first aspect of the present application, the first vDPA device is the vDPA device of the first virtual machine, the second vDPA device is the vDPA device of the second virtual machine, the first virtual machine is the primary system, and the second virtual machine is a backup system relative to the primary system.

[0010] In a possible implementation of the first aspect of the present application, the first vDPA device is the vDPA device of the first virtual machine, the second vDPA device is the vDPA device of the third virtual machine, the first virtual machine corresponds to an old system of a hot migration operation, and the third virtual machine corresponds to a new system of the hot migration operation.

[0011] In a possible implementation of the first aspect of the present application, a data processor is deployed on the host machine, and the virtualized data path acceleration of each of the at least one vDPA devices is implemented through the data processor, the first mapping relationship includes a mapping of a first host virtual address accessed by a central processor of the host machine to a first host physical address and a mapping of a first input-output virtual address accessed by the data processor to the first host physical address, the first host virtual address, the first host physical address and the first input-output virtual address are all associated with the first vDPA device.

[0012] In a possible implementation of the first aspect of the present application, the second mapping relationship includes a mapping of a second host virtual address for access by the central processing unit to a second host physical address and a mapping of a second input / output virtual address for access by the data processor to the second host physical address, and the second host virtual address, the second host physical address and the second input / output virtual address are all associated with the first vDPA device.

[0013] In a possible implementation of the first aspect of the present application, generating the mapping relationship set includes generating the first mapping relationship, wherein generating the first mapping relationship includes: determining the physical memory address block corresponding to the first vDPA device in the at least one physical memory address block, using the physical address range indicated by the physical memory address block corresponding to the first vDPA device in the at least one physical memory address block as the basic physical address, and using the basic physical address to establish a mapping between the host physical address and the host virtual address and a mapping between the host physical address and the input and output virtual address.

[0014] In a possible implementation of the first aspect of the present application, the first mapping relationship is used to configure the second mapping relationship in the mapping relationship set, including: determining the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block, and configuring the second mapping relationship using the physical address range indicated by the basic physical address and the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block.

[0015] In a possible implementation manner of the first aspect of the present application, generating the mapping relationship set includes address conversion between physical addresses and virtual addresses.

[0016] In a possible implementation of the first aspect of the present application, the physical memory address block corresponding to the first vDPA device in the at least one physical memory address block does not overlap with the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block.

[0017] In a possible implementation manner of the first aspect of the present application, the physical address corresponding to the first mapping relationship does not overlap with the physical address corresponding to the second mapping relationship.

[0018] In a possible implementation manner of the first aspect of the present application, the virtual address corresponding to the first mapping relationship does not overlap with the virtual address corresponding to the second mapping relationship.

[0019] In a possible implementation manner of the first aspect of the present application, the physical memory size required by each of the at least one vDPA devices is equal.

[0020] In a possible implementation manner of the first aspect of the present application, the number of physical memory address blocks corresponding to the first vDPA device in the at least one physical memory address block is at least two.

[0021] In a possible implementation manner of the first aspect of the present application, the at least one vDPA device is distinguished by a virtual machine identifier and a vDPA device identifier.

[0022] In a possible implementation of the first aspect of the present application, a physical address range indicated by a physical address memory block corresponding to each vDPA device in the at least one vDPA device in the at least one physical memory address block matches a physical memory size required by the vDPA device.

[0023] In a second aspect, an embodiment of the present application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method according to any one of the implementation modes of any of the above aspects when executing the computer program.

[0024] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects.

[0025] In a fourth aspect, an embodiment of the present application further provides a computer program product, which includes instructions stored on a computer-readable storage medium, and when the instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0027] Figure 1 A flowchart of a method for vDPA memory mapping provided in an embodiment of the present application;

[0028] Figure 2 A schematic diagram of multiple virtual machines and physical memory provided in an embodiment of the present application;

[0029] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0031] It should be understood that, in the description of this application, "at least one" means one or more, and "a plurality of" means two or more. In addition, unless otherwise specified, the words "first", "second", etc. are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.

[0032] Figure 1 A flowchart of a method for vDPA memory mapping provided in an embodiment of the present application is provided. Figure 1As shown, the method includes the following steps.

[0033] Step S110: The first virtual machine determines at least one vDPA device associated with the first virtual machine, wherein the at least one vDPA device includes a first vDPA device and a second vDPA device.

[0034] Step S112: The first virtual machine sends configuration information of the first virtual machine to a host machine corresponding to the first virtual machine, wherein the configuration information of the first virtual machine indicates the number of the at least one vDPA device and the physical memory size required by each of the at least one vDPA devices.

[0035] Step S114: The first vDPA driver of the first virtual machine receives memory information of the first physical memory of the host machine, wherein the memory information of the first physical memory indicates at least one physical memory address block in the first physical memory allocated by the host machine based on the configuration information of the first virtual machine, and each of the at least one physical memory address block indicates a continuously distributed physical address range.

[0036] Step S116: The first vDPA driver, in response to the loading of the first vDPA device, locks the physical address range indicated by the memory information of the first physical memory in the first physical memory through a system call, then generates a mapping relationship set for the at least one vDPA device, and uses a first mapping relationship in the mapping relationship set to implement virtualized data path acceleration of the first vDPA device.

[0037] Step S118: In response to the loading of the second vDPA device, the first vDPA driver uses the first mapping relationship to configure a second mapping relationship in the mapping relationship set to implement virtualized data path acceleration of the second vDPA device.

[0038] See also Figure 1 , Figure 1The method for vDPA memory mapping shown is applied to the use scenarios of virtualized data path acceleration (virtio data path acceleration, vDPA), such as cloud computing, data centers, high-performance servers, etc. Virtualized data path acceleration, also known as vDPA, is also called virtualized hardware acceleration. Through the data plane hardware acceleration and control plane software simulation, the hardware device supports the data plane interface, and the control plane interface can maintain the device-specific mode. Through the vDPA technology, the difficulty of the network card to support the virtualized interface is reduced. The data queue layout of the network card needs to be changed to the vDPA method, such as using a circular queue structure to enter the vring. The control plane logic of the network card also needs to be adapted so that the network card can provide data plane hardware support and control plane interface software driver conversion, so that high-performance data plane transmission and reception can be achieved by using vDPA. The use scenario of vDPA can be combined with the application of the data processing unit (DPU), and multiple different types of vDPA devices can be simulated on the host machine through the DPU. To this end, the DPU needs to simulate the entire bus topology, for example, the entire peripheral component interconnect express (PCIe) topology, and the DPU also needs to simulate different types of vDPA devices. The host needs to install the vDPA driver to load and use the vDPA device, and at the same time map the physical memory space used by the virtual machine. If each vDPA device in the virtual machine maps the physical memory used by the virtual machine once, that is, the host physical address (HPA), including the mapping from the host physical address to the host virtual address (HVA) and the mapping from the host physical address to the input and output virtual address (IO Virtual Address, IOVA), this means that the same physical memory is mapped multiple times. As the scale of the vDPA device increases, a lot of time is consumed (generally, it takes about 2 seconds for a vDPA device to map the physical memory of a virtual machine once), resulting in low memory mapping efficiency and redundant memory mapping, which results in a long startup and shutdown time for the virtual machine, which is not conducive to improving response speed and overall efficiency. On the other hand, in order to ensure the normal use of each vDPA device, it is necessary to avoid data inconsistency caused by address overlap. At the same time, the ability to dynamically issue and recycle devices and the impact of adding and removing corresponding vDPA devices must also be considered. Figure 1The present application further describes in detail a method, a computer device, and a medium for vDPA memory mapping, which not only ensure a higher memory mapping efficiency and a shorter virtual machine switch time, but also flexibly adapt to changes in the scale of vDPA devices and solve data inconsistency problems.

[0039] Continue reading Figure 1In step S110, the first virtual machine determines at least one vDPA device associated with the first virtual machine, wherein the at least one vDPA device includes a first vDPA device and a second vDPA device. Here. Considering the possibility of dynamic adjustment, the at least one vDPA device associated with the first virtual machine may include a currently deployed vDPA device, and may also include a vDPA device to be deployed. Therefore, the at least one vDPA device associated with the first virtual machine may be the maximum number of vDPA devices supported by the first virtual machine through dynamic deployment. For example, assuming that the upper limit of the vDPA devices that the first virtual machine can support is 10, of which 8 vDPA devices have been deployed, then the at least one vDPA device associated with the first virtual machine may be 8 or 10, depending on the requirements of the usage scenario, such as the possibility of dynamic adjustment. Then, in step S112, the first virtual machine sends the configuration information of the first virtual machine to the host machine corresponding to the first virtual machine, wherein the configuration information of the first virtual machine indicates the number of the at least one vDPA device and the physical memory size required by each of the at least one vDPA devices. For example, the configuration information of the first virtual machine may indicate a total of 4 vDPA devices, each of which requires a physical memory size of, for example, 1000 megabits (MB). Then, in step S114, the first vDPA driver of the first virtual machine receives memory information of the first physical memory of the host machine, wherein the memory information of the first physical memory indicates at least one physical memory address block in the first physical memory allocated by the host machine based on the configuration information of the first virtual machine, and each of the at least one physical memory address block indicates a continuously distributed physical address range. Here, the memory information of the first physical memory of the host machine corresponds to the configuration information of the first virtual machine, and the memory information of the first physical memory indicates at least one physical memory address block in the first physical memory allocated by the host machine based on the configuration information of the first virtual machine. It should be understood that the physical memory size corresponding to each of the at least one physical memory address blocks may be consistent or inconsistent, and different physical memory address blocks may be adjacent or non-adjacent, and each of the at least one physical memory address block indicates a continuously distributed physical address range. In this way, based on at least one physical memory address block in the first physical memory allocated according to the configuration information of the first virtual machine, each physical address memory block indicates a continuously distributed physical address range, and different physical memory address blocks correspond to multiple physical address ranges, and there may be gaps between these multiple physical address ranges.For example, assuming that the configuration information of the first virtual machine indicates that a vDPA device requires a physical memory size of 1000 Mbits, the memory information of the first physical memory may indicate that a physical memory address block has a size of 1000 Mbits, or may indicate that two physical memory address blocks each have a size of 500 Mbits, or may indicate that three physical memory address blocks have a size of 200 Mbits, a size of 300 Mbits, and a size of 500 Mbits, respectively. In this way, based on the configuration information of the first virtual machine, at least one physical memory address block is allocated, and the continuous physical address range within each physical memory address block is used to help improve data reading efficiency and to help establish a mapping for virtualized data path acceleration.

[0040] Continue reading Figure 1 In step S116, the first vDPA driver, in response to the loading of the first vDPA device, locks the physical address range indicated by the memory information of the first physical memory in the first physical memory through a system call, then generates a mapping relationship set for the at least one vDPA device, and uses the first mapping relationship in the mapping relationship set to implement virtualized data path acceleration of the first vDPA device. In this way, for the loading of the first vDPA device, that is, initialization, the physical address range indicated by the memory information of the first physical memory in the first physical memory is locked through a system call, the memory information of the first physical memory of the host machine corresponds to the configuration information of the first virtual machine, and the memory information of the first physical memory indicates at least one physical memory address block in the first physical memory allocated by the host machine based on the configuration information of the first virtual machine. In this way, the loading of the first vDPA device, that is, initialization, includes locking the physical address range for the at least one vDPA device through a system call. In other words, the loading of the first vDPA device not only locks the physical address range for the first vDPA device through a system call, but also locks the physical address range for other vDPA devices in the at least one vDPA device except the first vDPA device, such as the second vDPA device, through a system call. In this way, the first vDPA driver generates a mapping relationship set for the at least one vDPA device, the mapping relationship set including a first mapping relationship for implementing virtualized data path acceleration of the first vDPA device, and also including a second mapping relationship for implementing virtualized data path acceleration of the second vDPA device. The loading of the first vDPA device includes the generation of a mapping relationship set, and therefore includes the generation of all mapping relationships for the at least one vDPA device, which improves the memory mapping efficiency and helps save the switching time of the virtual machine.

[0041] Continue reading Figure 1In step S118, the first vDPA driver, in response to the loading of the second vDPA device, uses the first mapping relationship to configure the second mapping relationship in the mapping relationship set so as to realize the virtualized data path acceleration of the second vDPA device. It can be seen that, unlike the loading of the first vDPA device, which includes locking the physical address range and generating the mapping relationship set through system calls, the loading of the second vDPA device here does not involve system calls and physical memory locking, nor does it involve using the physical memory address block to establish a mapping relationship, but directly uses the generated first mapping relationship and the mapping relationship set to configure the second mapping relationship. In some embodiments, the first mapping relationship used for the first vDPA device can be used as a reference through address calculation, and the physical address and virtual address associated with the first mapping relationship can be determined, so that re-mapping can be skipped, and the second mapping relationship used for the second vDPA device can be directly configured using address calculation. In some embodiments, the number of times the vDPA device inside the first virtual machine uses the first physical memory can be calculated by a counter. After loading the first vDPA device, the number of times the counter is used can be increased to 1, and then after loading the second vDPA device, the number of times the counter is used can be increased to 2, and so on. By reading the number of times recorded in the counter, the number of times the first physical memory is used can be determined. Only the loading, i.e., initialization, of the first vDPA device needs to involve system calls and physical memory locking, and needs to involve using physical memory address blocks to establish a mapping relationship. As described above, the loading of the first vDPA device not only locks the physical address range for the first vDPA device through a system call, but also locks the physical address range for other vDPA devices other than the first vDPA device in the at least one vDPA device, such as the second vDPA device, through a system call. For the loading or initialization of other vDPA devices other than the first vDPA device, such as the second vDPA device, the first mapping relationship generated can be used as a reference, and the reference address related to the first mapping relationship can be converted into a new physical address and a new virtual address through address calculation, so that a new mapping relationship can be directly configured to skip memory mapping again, and there is no address overlap problem between the second mapping relationship and the first mapping relationship, so that changes in the scale of vDPA devices can be flexibly adapted and data inconsistency problems can be solved. The usage of the first physical memory can be recorded by increasing and decreasing the counter, for example, the usage count of the counter is increased after a vDPA device is loaded and a corresponding mapping relationship is configured, and the usage count of the counter is decreased after a vDPA device is closed.It should be understood that the mapping relationship set for the at least one vDPA device, that is, the set of all mapping relationships for the at least one vDPA device, is generated when the first vDPA device is loaded, and only when the counter is zero, that is, all vDPA devices including the first vDPA device are closed, the first mapping relationship will be released and the mapping relationship set will be closed. In this way, through the optimization of the memory mapping of the vDPA device, the mapping between the physical address and the virtual address is only performed for the first vDPA device of the first virtual machine, and then the mapping relationship that has been established is used to directly configure the mapping relationship for other vDPA devices of the first virtual machine, so as to realize the virtualized data path acceleration of the vDPA device under the first virtual machine, which not only ensures a higher memory mapping efficiency and a shorter virtual machine switch time, but also can flexibly adapt to the changes in the scale of the vDPA device and solve the problem of data inconsistency.

[0042] In conclusion, Figure 1 The method for vDPA memory mapping shown improves the memory mapping efficiency by optimizing the memory mapping of the vDPA device and treating the loading of the first vDPA device and the loading of the second vDPA device differently, helps save the switching time of the virtual machine, helps shorten the startup and shutdown time of the virtual machine, and can flexibly adapt to changes in the scale of the vDPA device and solve data inconsistency problems.

[0043] In a possible implementation, the at least one vDPA device is a currently deployed vDPA device of the first virtual machine. This is conducive to flexible adaptation to the needs of usage scenarios.

[0044] In a possible implementation, the at least one vDPA device includes a currently deployed vDPA device of the first virtual machine and a vDPA device to be deployed of the first virtual machine. This is conducive to flexible adaptation to the needs of the usage scenario and can provide the possibility of dynamic adjustment.

[0045] In a possible implementation, the at least one vDPA device is the maximum number of vDPA devices supported by the first virtual machine through dynamic deployment. This is conducive to flexible adaptation to the needs of usage scenarios and can provide the possibility of dynamic adjustment.

[0046] In a possible implementation, the first vDPA device is the vDPA device of the first virtual machine, the second vDPA device is the vDPA device of the second virtual machine, the first virtual machine is the main system, and the second virtual machine is the backup system relative to the main system. This is conducive to flexible adaptation to the needs of the usage scenario, and can meet the application requirements of the main system and the backup system. The backup system is used to switch in when the main system is upgraded or fails to ensure that the data service is not interrupted. Therefore, through the optimization of the memory mapping of the vDPA device, the memory mapping efficiency of the main system and the backup system is improved, and the virtual machine switch time of the backup system is shortened, which is conducive to rapid response.

[0047] In a possible implementation, the first vDPA device is the vDPA device of the first virtual machine, the second vDPA device is the vDPA device of the third virtual machine, the first virtual machine corresponds to the old system of the hot migration operation, and the third virtual machine corresponds to the new system of the hot migration operation. In this way, it is conducive to flexible adaptation to the needs of the use scenario, and can meet the application requirements of the hot migration operation. The hot migration operation means migrating from the old system to the new system. Therefore, through the optimization of the memory mapping of the vDPA device, the memory mapping efficiency of the old system and the new system is improved, and the virtual machine switch time of the new system is shortened, which is conducive to rapid response.

[0048] In a possible implementation, a data processor is deployed on the host machine, and the virtualized data path acceleration of each of the at least one vDPA device is implemented by the data processor, the first mapping relationship includes a mapping of a first host virtual address accessed by the central processor of the host machine to a first host physical address and a mapping of a first input / output virtual address accessed by the data processor to the first host physical address, and the first host virtual address, the first host physical address and the first input / output virtual address are all associated with the first vDPA device. The usage scenario of vDPA can be combined with the application of the data processor, and a plurality of different types of vDPA devices can be simulated by the data processor, and data plane pass-through and data plane hardware acceleration can be implemented with the help of the data processor, that is, the virtualized data path acceleration of each of the at least one vDPA device is implemented by the data processor. Here, the first mapping relationship is used to implement the virtualized data path acceleration of the first vDPA device, and therefore, the first mapping relationship includes two parts, namely, a mapping of a first host virtual address accessed by the central processor of the host machine to a first host physical address and a mapping of a first input / output virtual address accessed by the data processor to the first host physical address. This improves memory mapping efficiency and helps save virtual machine switching time.

[0049] In some embodiments, the second mapping relationship includes a mapping of a second host virtual address for access by the central processor to a second host physical address and a mapping of a second input / output virtual address for access by the data processor to the second host physical address, and the second host virtual address, the second host physical address and the second input / output virtual address are all associated with the first vDPA device. The usage scenario of vDPA can be combined with the application of the data processor, and a plurality of different types of vDPA devices can be simulated by the data processor, and data plane pass-through and data plane hardware acceleration can be realized with the help of the data processor, that is, the virtualized data path acceleration of at least one vDPA device is realized by the data processor. Here, the second mapping relationship includes two parts, namely, a mapping of a second host virtual address for access by the central processor to a second host physical address and a mapping of a second input / output virtual address for access by the data processor to the second host physical address. In this way, the memory mapping efficiency is improved, which helps to save the switching time of the virtual machine.

[0050] In a possible implementation, generating the mapping relationship set includes generating the first mapping relationship, wherein generating the first mapping relationship includes: determining the physical memory address block corresponding to the first vDPA device in the at least one physical memory address block, using the physical address range indicated by the physical memory address block corresponding to the first vDPA device in the at least one physical memory address block as the basic physical address, and using the basic physical address to establish a mapping between the host physical address and the host virtual address and a mapping between the host physical address and the input and output virtual address. For the loading, i.e., initialization, of the first vDPA device, the physical address range indicated by the memory information of the first physical memory in the first physical memory is locked through a system call, the memory information of the first physical memory of the host corresponds to the configuration information of the first virtual machine, and the memory information of the first physical memory indicates at least one physical memory address block in the first physical memory allocated by the host based on the configuration information of the first virtual machine. In this way, the loading, i.e., initialization of the first vDPA device includes locking the physical address range for the at least one vDPA device through a system call. In other words, the loading of the first vDPA device not only locks the physical address range for the first vDPA device through a system call, but also locks the physical address range for other vDPA devices, such as the second vDPA device, in the at least one vDPA device except the first vDPA device through a system call. In this way, the first vDPA driver generates a mapping relationship set for the at least one vDPA device, and the mapping relationship set includes a first mapping relationship for realizing virtualized data path acceleration of the first vDPA device. In this way, the physical address range indicated by the physical memory address block corresponding to the first vDPA device in the at least one physical memory address block is used as the basic physical address, thereby realizing the use of the generated first mapping relationship as a reference, improving the memory mapping efficiency, and helping to save the switching time of the virtual machine.

[0051] In some embodiments, using the first mapping relationship to configure the second mapping relationship in the mapping relationship set includes: determining the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block, and configuring the second mapping relationship using the physical address range indicated by the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block. In this way, the generated first mapping relationship can be used as a reference, and the reference address related to the first mapping relationship can be converted into a new physical address and a new virtual address through address calculation, so that a new mapping relationship can be directly configured to skip memory mapping again, and there is no address overlap problem between the second mapping relationship and the first mapping relationship, so that changes in the scale of vDPA devices can be flexibly adapted and data inconsistency problems can be solved.

[0052] In a possible implementation, generating the mapping relationship set includes address conversion between physical addresses and virtual addresses. Thus, using the generated first mapping relationship as a reference, the reference address related to the first mapping relationship is converted into a new physical address and a new virtual address through address calculation, so that the new mapping relationship can be directly configured to skip memory mapping again, and there is no address overlap problem between the second mapping relationship and the first mapping relationship, so that the change of the vDPA device scale can be flexibly adapted and the data inconsistency problem can be solved.

[0053] In a possible implementation, the physical memory address block corresponding to the first vDPA device in the at least one physical memory address block does not overlap with the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block. In this way, flexible adaptation to changes in the scale of vDPA devices and resolution of data inconsistency issues are achieved.

[0054] In a possible implementation manner, the physical address corresponding to the first mapping relationship does not overlap with the physical address corresponding to the second mapping relationship. In this way, flexible adaptation to changes in the scale of vDPA devices and resolution of data inconsistency issues are achieved.

[0055] In a possible implementation manner, the virtual address corresponding to the first mapping relationship does not overlap with the virtual address corresponding to the second mapping relationship. In this way, flexible adaptation to changes in the scale of the vDPA device and resolution of data inconsistency issues are achieved.

[0056] In a possible implementation, the physical memory size required by each of the at least one vDPA devices is equal. The physical memory sizes corresponding to each of the at least one physical memory address blocks may be consistent or inconsistent, and different physical memory address blocks may be adjacent or non-adjacent, and each of the at least one physical memory address block indicates a continuously distributed physical address range. In this way, each of the at least one physical memory address blocks in the first physical memory allocated based on the configuration information of the first virtual machine indicates a continuously distributed physical address range, and different physical memory address blocks correspond to multiple segments of physical address ranges, and there may be gaps between these multiple segments of physical address ranges. For example, assuming that the configuration information of the first virtual machine indicates that a vDPA device requires a physical memory size of 1000 megabits, the memory information of the first physical memory may indicate that a physical memory address block has a size of 1000 megabits, may indicate that two physical memory address blocks each have a size of 500 megabits, or may indicate that three physical memory address blocks have sizes of 200 megabits, 300 megabits, and 500 megabits, respectively. In this way, based on the configuration information of the first virtual machine, at least one physical memory address block is allocated, and the continuously distributed physical address range within each physical memory address block is utilized to help improve data reading efficiency and to help establish a mapping for virtualized data path acceleration.

[0057] In a possible implementation, the number of physical memory address blocks corresponding to the first vDPA device in the at least one physical memory address block is at least two. This helps improve data reading efficiency and helps establish a mapping for virtualized data path acceleration.

[0058] In a possible implementation, the at least one vDPA device is distinguished by a virtual machine identifier and a vDPA device identifier, which helps to distinguish vDPA devices and improve overall efficiency.

[0059] In a possible implementation, the physical address range indicated by the physical address memory block corresponding to each vDPA device in the at least one vDPA device in the at least one physical memory address block matches the physical memory size required by the vDPA device. This helps to improve data reading efficiency and helps to establish a mapping for virtualized data path acceleration.

[0060] Figure 2 A schematic diagram of multiple virtual machines and physical memory provided in an embodiment of the present application. Figure 2As shown, virtual machine A210 includes vDPA device A212 and vDPA device B214, and virtual machine B220 includes vDPA device C222 and vDPA device D224. Both virtual machine A210 and virtual machine B220 use the physical memory space of physical memory 230. In some embodiments, virtual machine A210 is the main system, and virtual machine B220 is the backup system relative to the main system. In some embodiments, virtual machine A210 corresponds to the old system of the hot migration operation, and virtual machine B220 corresponds to the new system of the hot migration operation. The vDPA device memory mapping of virtual machine A210 and virtual machine B220 can be referred to Figure 1 The method for vDPA memory mapping is shown. For example, virtual machine A210 can be used as the first virtual machine, vDPA device A212 of virtual machine A210 can be used as the first vDPA device, and vDPA device driver of virtual machine A210 can be used as the first vDPA driver. In this way, through the optimization of vDPA device memory mapping, physical address and virtual address mapping is performed only for vDPA device A212 of virtual machine A210, and then the mapping relationship that has been established is used to directly configure the mapping relationship for other vDPA devices of virtual machine A210, thereby realizing virtualized data path acceleration of vDPA devices under virtual machine A210, which not only ensures higher memory mapping efficiency and shorter virtual machine switch time, but also can flexibly adapt to changes in the scale of vDPA devices and solve data inconsistency problems. Further, when virtual machine A210 and virtual machine B220 are respectively the main system and the backup system, or respectively the old system for hot migration operation and the new system for hot migration operation, the second vDPA device can be a vDPA device under virtual machine B220, such as vDPA device C222, which helps to flexibly adapt to the needs of usage scenarios.

[0061] In conclusion, Figure 2 The multiple virtual machines shown have improved memory mapping efficiency through optimization of vDPA device memory mapping, which helps to save the switching time of the virtual machines, helps to shorten the startup and shutdown time of the virtual machines, and can flexibly adapt to changes in the scale of vDPA devices and solve data inconsistency problems.

[0062] Figure 33 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application, and the computing device 300 includes: one or more processors 310, a communication interface 320 and a memory 330. The processor 310, the communication interface 320 and the memory 330 are interconnected via a bus 340. Optionally, the computing device 300 may also include an input / output interface 350, and the input / output interface 350 is connected to an input / output device for receiving parameters set by a user, etc. The computing device 300 can be used to implement some or all of the functions of the device embodiment or system embodiment in the above-mentioned embodiment of the present application; the processor 310 can also be used to implement some or all of the operating steps of the method embodiment in the above-mentioned embodiment of the present application. For example, the specific implementation of the various operations performed by the computing device 300 can refer to the specific details in the above-mentioned embodiments, such as the processor 310 is used to perform some or all of the steps in the above-mentioned method embodiment or some or all of the operations in the above-mentioned method embodiment. For another example, in an embodiment of the present application, the computing device 300 may be used to implement part or all of the functions of one or more components in the above-mentioned apparatus embodiment. In addition, the communication interface 320 may be specifically used to perform the communication functions necessary to implement the functions of these apparatuses and components, and the processor 310 may be specifically used to perform the processing functions necessary to implement the functions of these apparatuses and components.

[0063] It should be understood that Figure 3 The computing device 300 may include one or more processors 310, and the multiple processors 310 may provide processing capabilities in a parallel connection mode, a serial connection mode, a serial-parallel connection mode, or any connection mode, or the multiple processors 310 may form a processor sequence or a processor array, or the multiple processors 310 may be divided into a main processor and an auxiliary processor, or the multiple processors 310 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 3 The computing device 300 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 300 may include Figure 3 More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.

[0064] The processor 310 may have a variety of specific implementation forms. For example, the processor 310 may include a central processing unit (CPU), a graphic processing unit (GPU), a neural-network processing unit (NPU), a tensor processing unit (TPU) or a data processing unit (DPU), etc., and the embodiment of the present application does not specifically limit it. The processor 310 may also be a single-core processor or a multi-core processor. The processor 310 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The processor 310 may also be implemented using a logic device with built-in processing logic alone, such as an FPGA or a digital signal processor (DSP). The communication interface 320 may be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface may be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface may be a cellular network interface or a wireless local area network interface, etc.

[0065] The memory 330 may be a non-volatile memory, such as a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The memory 330 may also be a volatile memory, which may be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM). The memory 330 may also be used to store program codes and data, so that the processor 310 calls the program codes stored in the memory 330 to execute some or all of the operation steps in the above method embodiment, or to execute the corresponding functions in the above device embodiment. Figure 3 Show more or fewer components, or have different component configurations.

[0066] The bus 340 may be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 340 may be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 340 may also include a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0067] The method and device provided in the embodiments of the present application are based on the same inventive concept. Since the principles of solving the problems in the methods and devices are similar, the embodiments, implementation methods, examples or implementation methods of the methods and devices can refer to each other, and the repeated parts will not be repeated. The embodiments of the present application also provide a system, which includes multiple computing devices, and the structure of each computing device can refer to the structure of the computing device described above. The functions or operations that can be implemented by the system can refer to the specific implementation steps in the above method embodiments and / or the specific functions described in the above device embodiments, which will not be repeated here.

[0068] The present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer device (such as one or more processors), the method steps in the above method embodiment can be implemented. The specific implementation of the processor of the computer-readable storage medium in executing the above method steps can refer to the specific operations described in the above method embodiment and / or the specific functions described in the above device embodiment, which will not be repeated here.

[0069] It should be understood by those skilled in the art that the embodiments of the present application may be provided as methods, systems, or computer program products. The present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. The embodiments of the present application may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media. Available media can be magnetic media (such as floppy disks, hard disks, tapes), optical media, or semiconductor media. Semiconductor media can be solid-state hard disks, random access memory, flash memory, read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, or any other form of suitable storage media.

[0070] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. Each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0071] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. The steps in the method of the embodiment of the present application can be adjusted in order, merged or deleted according to actual needs; the modules in the system of the embodiment of the present application can be divided, merged or deleted according to actual needs. If these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. A method for vDPA memory mapping, It is characterized in that The method comprises: The first virtual machine determines at least one vDPA device associated with the first virtual machine, wherein the at least one vDPA device includes a first vDPA device and a second vDPA device; The first virtual machine sends configuration information of the first virtual machine to a host machine corresponding to the first virtual machine, wherein the configuration information of the first virtual machine indicates the number of the at least one vDPA device and the physical memory size required by each of the at least one vDPA devices; The first vDPA driver of the first virtual machine receives memory information of a first physical memory of the host machine, wherein the memory information of the first physical memory indicates at least one physical memory address block in the first physical memory allocated by the host machine based on the configuration information of the first virtual machine, and each physical memory address block in the at least one physical memory address block indicates a continuously distributed physical address range; The first vDPA driver, in response to loading of the first vDPA device, locks a physical address range indicated by memory information of the first physical memory in the first physical memory through a system call, then generates a mapping relationship set for the at least one vDPA device, and implements virtualized data path acceleration of the first vDPA device using a first mapping relationship in the mapping relationship set; The first vDPA driver, in response to the loading of the second vDPA device, uses the first mapping relationship to configure a second mapping relationship in the mapping relationship set so as to implement virtualized data path acceleration of the second vDPA device, A data processor is deployed on the host machine, and virtualized data path acceleration of each of the at least one vDPA device is implemented by the data processor, the first mapping relationship includes a mapping of a first host virtual address accessed by a central processor of the host machine to a first host physical address and a mapping of a first input / output virtual address accessed by the data processor to the first host physical address, the first host virtual address, the first host physical address, and the first input / output virtual address are all associated with the first vDPA device, The second mapping relationship includes a mapping of a second host virtual address for access by the central processor to a second host physical address and a mapping of a second input / output virtual address for access by the data processor to the second host physical address, wherein the second host virtual address, the second host physical address and the second input / output virtual address are all associated with the first vDPA device. Generating the mapping relationship set includes generating the first mapping relationship, wherein generating the first mapping relationship includes: determining a physical memory address block corresponding to the first vDPA device in the at least one physical memory address block, using a physical address range indicated by the physical memory address block corresponding to the first vDPA device in the at least one physical memory address block as a basic physical address, and using the basic physical address to establish a mapping between a host physical address and a host virtual address and a mapping between the host physical address and an input / output virtual address, Utilizing the first mapping relationship to configure the second mapping relationship in the mapping relationship set includes: determining the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block, and configuring the second mapping relationship using the basic physical address and the physical address range indicated by the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block.

2. The method according to claim 1, It is characterized in that The at least one vDPA device is a currently deployed vDPA device of the first virtual machine.

3. The method according to claim 1, It is characterized in that The at least one vDPA device includes a currently deployed vDPA device of the first virtual machine and a vDPA device to be deployed of the first virtual machine.

4. The method according to claim 1, It is characterized in that The at least one vDPA device is a maximum number of vDPA devices supported by the first virtual machine through dynamic deployment.

5. The method according to claim 1, It is characterized in that The first vDPA device is a vDPA device of the first virtual machine, the second vDPA device is a vDPA device of the second virtual machine, the first virtual machine is a primary system, and the second virtual machine is a backup system relative to the primary system.

6. The method according to claim 1, It is characterized in that The first vDPA device is a vDPA device of the first virtual machine, the second vDPA device is a vDPA device of a third virtual machine, the first virtual machine corresponds to an old system of a hot migration operation, and the third virtual machine corresponds to a new system of the hot migration operation.

7. The method according to claim 1, It is characterized in that Generating the mapping relationship set includes address conversion between physical addresses and virtual addresses.

8. The method according to claim 1, It is characterized in that The physical memory address block corresponding to the first vDPA device in the at least one physical memory address block does not overlap with the physical memory address block corresponding to the second vDPA device in the at least one physical memory address block.

9. The method according to claim 1, It is characterized in that The physical address corresponding to the first mapping relationship does not overlap with the physical address corresponding to the second mapping relationship.

10. The method according to claim 1, It is characterized in that The virtual address corresponding to the first mapping relationship does not overlap with the virtual address corresponding to the second mapping relationship.

11. The method according to claim 1, It is characterized in that The at least one vDPA device each requires an equal amount of physical memory.

12. The method according to claim 1, It is characterized in that The number of physical memory address blocks corresponding to the first vDPA device in the at least one physical memory address block is at least two.

13. The method according to claim 1, It is characterized in that The at least one vDPA device is distinguished by a virtual machine identifier and a vDPA device identifier.

14. The method according to claim 1, It is characterized in that The physical address range indicated by the physical address memory block corresponding to each vDPA device in the at least one vDPA device in the at least one physical memory address block matches the physical memory size required by the vDPA device.

15. A computer device, It is characterized in that The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 14 when executing the computer program.

16. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 14.