Dynamic mapping method and system for cloud host with direct connection equipment

By setting up the intermediate layer in the virtual layer of the cloud host, dynamically map the direct-through device and using the intermediate layer data table for memory address mapping, the problem of cloud host creation and startup time is solved, and a faster mapping and startup process is achieved.

CN119960902AActive Publication Date: 2025-05-09SINA TECH (CHINA) CO LTD

Patent Information

Application Number
CN202411938615.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-05-09
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

In the prior art, cloud host creation and startup time is too long, especially in the heterogeneous virtual airport scenarios with super large specifications, which affects user experience and system scheduling efficiency.

Method used

By setting up an intermediate layer in the virtual layer, dynamically map the direct-through device to the cloud host, and using the intermediate layer data table for memory address mapping, avoiding directly scanning the entire memory space of the direct-through device and improving mapping speed.

Benefits of technology

It greatly improves the mapping speed of cloud host direct-to-device devices, shortens creation and startup time, and improves user experience and system efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119960902A_ABST
    Figure CN119960902A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a dynamic mapping method and system for a cloud host with a direct connection device, and the method comprises the steps: in the initialization process of the cloud host, initializing a first virtual device through a virtual layer to obtain the memory configuration of the cloud host, and enabling a memory space address required by a driver directly connected to the cloud host in the memory configuration to be default; initializing a corresponding memory space in the direct connection equipment in a process of initializing an operating system of the direct connection equipment in the virtual layer; physical memory missing page interruption is caused by default of the configured memory space address required by the driver, the memory space address required by the driver is allocated to the cloud host, and the allocated memory space address required by the driver is associated with a virtual machine hardware address of the cloud host in a middle-layer data table; and when the cloud host is operated, applying for a corresponding memory space in the direct connection device according to the memory space address required by driving in the memory address mapping relationship, so that the direct connection device is directly connected to the cloud host. According to the invention, the time of direct connection of the direct connection device to the cloud host can be accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of server virtualization, and in particular to a dynamic mapping method and system for a cloud host with a pass-through device. Background Art

[0002] In cloud computing scenarios, a large number of cloud hosts accelerate the business performance of cloud hosts through device direct access solutions. Although this solution accelerates the performance of cloud hosts, the startup process is time-consuming. For cloud computing users, the long cloud host creation and startup time greatly affects the experience, especially for large-scale heterogeneous virtual machines. Taking 350G memory as an example, the creation time takes 2 minutes. When users create virtual machines at this time for rapid business recovery, the 2-minute creation waiting time is completely beyond the user's tolerance. In addition, for the background control system of cloud computing, the long blocking time greatly affects the system scheduling efficiency. Summary of the invention

[0003] The embodiment of the present invention provides a method and system for dynamically mapping a cloud host with a pass-through device, which can solve the technical problem in the prior art that the cloud host creation and startup time is too long and affects the normal use of users.

[0004] To achieve the above-mentioned purpose, in a first aspect, an embodiment of the present invention provides a dynamic mapping method of a cloud host with a pass-through device, comprising:

[0005] Receive a request for device direct access to a cloud host, and during the initialization of the cloud host, synchronously initialize a first virtual device through a virtual layer, the first virtual device being used to obtain a memory configuration of the cloud host, the memory configuration including: tag information of a direct access device of the cloud host, and a memory space address and corresponding capacity required by a driver that the direct access device directly provides to the cloud host, wherein the configured memory space address required by the driver is default;

[0006] In the process of initializing the operating system of the pass-through device by the virtual layer, initializing the corresponding memory space in the pass-through device according to the tag information of the pass-through device;

[0007] When a physical memory page fault occurs due to a default configured address of the memory space required by the driver, a memory space address required by the driver matching the corresponding capacity of the memory space required by the driver is allocated to the cloud host in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship;

[0008] When the cloud host is running, the memory address mapping relationship corresponding to the cloud host is obtained in the memory address mapping column of the intermediate layer data table, and the corresponding memory space is applied for in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to realize the pass-through device being passed directly to the cloud host.

[0009] In a second aspect, an embodiment of the present invention provides a dynamic mapping system for a cloud host with a pass-through device, including:

[0010] A virtual layer, used for receiving a request for device direct access to a cloud host, during the initialization of the cloud host, a first virtual device is synchronously initialized through the virtual layer, the first virtual device is used for obtaining the memory configuration of the cloud host, the memory configuration includes: tag information of the direct access device of the cloud host, and the memory space address and corresponding capacity required by the driver used by the direct access device to the cloud host, wherein the configured memory space address required by the driver is default;

[0011] A pass-through device initialization unit, configured to initialize the corresponding memory space in the pass-through device according to the tag information of the pass-through device during the process of initializing the operating system of the pass-through device by the virtual layer; when a physical memory page fault occurs due to a default address of the configured memory space required by the driver, allocate a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver to the cloud host in the pass-through device;

[0012] A device management component, used to associate the allocated memory space address required by the driver with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship;

[0013] A pass-through unit is used to obtain a memory address mapping relationship corresponding to the cloud host in the memory address mapping column of the intermediate layer data table when running the cloud host, and apply for a corresponding memory space in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to realize direct connection of the pass-through device to the cloud host.

[0014] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by a computer device, the computer device executes the aforementioned dynamic mapping method of a cloud host with a pass-through device.

[0015] In a fourth aspect, an embodiment of the present invention provides a computer device, including:

[0016] A processor; and a memory arranged to store computer executable instructions, which, when executed, cause the processor to perform the aforementioned dynamic mapping method for a cloud host with a pass-through device.

[0017] The above technical solution has the following beneficial effects: because the middle layer is set, in the process of initializing the operating system of the pass-through device by the virtual layer, the corresponding memory space in the pass-through device is initialized according to the tag information of the pass-through device. Because the corresponding memory space address in the pass-through device is default, a physical memory page fault interrupt occurs, and the cloud host is allocated a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the middle layer data table to form a memory address mapping relationship, which is stored in the data table of the middle layer. Based on the strategy of scanning the memory space allocated to the cloud host and the memory space required by the driver, the corresponding memory is allocated to the cloud host. There is no need to actually scan the corresponding memory allocated to the cloud host, let alone scan the entire memory of the pass-through device as in the prior art. The memory configuration of the DMA of the pass-through device directly connected to the cloud host is decoupled from the memory space required for the driver of the pass-through device to be initialized when the operating system of the pass-through device is started. Only when the cloud host is running, the corresponding memory space is applied for in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to realize the pass-through device being directly connected to the cloud host. This greatly improves the speed of directly connecting the pass-through device to the cloud host, shortens the time, and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0019] Figure 1 It is a flow chart of a dynamic mapping method of a cloud host with a pass-through device according to an embodiment of the present invention;

[0020] Figure 2 It is a structural diagram of a dynamic mapping system of a cloud host with a pass-through device according to an embodiment of the present invention;

[0021] Figure 3 is a logical structure diagram of a computer device according to an embodiment of the present invention;

[0022] Figure 4 These are two memory areas maintained by an embodiment of the present invention;

[0023] Figure 5 is the middle layer of the embodiment of the present invention;

[0024] Figure 6 It is a data table in the middle layer mirror Memory Region of the embodiment of the present invention;

[0025] Figure 7 It is the memory configuration information stored in the entry of the embodiment of the present invention. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] Definitions of technical terms and abbreviations involved in the embodiments of the present invention:

[0028] QEMU is the abbreviation of Quick Emulator, which is usually called "QEMU" in the Chinese environment.

[0029] KVM is the abbreviation of Kernel-based Virtual Machine, which is usually referred to as "KVM" in the Chinese environment.

[0030] Combined together, "QEMU-KVM" usually refers to a high-performance virtualization solution formed by combining the QEMU project with the KVM module, which can be understood as "QEMU with KVM". In actual use, people are more likely to directly call it the full English name "QEMU-KVM" without special Chinese translation.

[0031] SR-IOV (Single root I / O virtualization) provides multiple VF (PCIe Virtual Functions) devices on a PCIe (Peripheral Component Interconnect Express) device and provides a standard interface for configuring VF; SR-IOV improves I / O performance and efficiency in a virtualized environment. For PCIe devices, such as high-performance network cards and storage controllers, PCIe devices are I / O devices, such as disks, network cards, and the connected buses and interfaces are PCI devices. PCIe devices refer to computer hardware components that comply with the PCI Express (Peripheral Component Interconnect Express) standard. PCIe is a high-speed serial computer expansion bus standard that provides a point-to-point connection method, allowing multiple devices to communicate directly with the host (such as the CPU or other host controller) through a dedicated link, rather than sharing the bus bandwidth like traditional PCI.

[0032] In PCI Express (PCIe) technology, VF (Virtual Function) refers to a virtual function, which is a functional entity under the SR-IOV (Single Root I / O Virtualization) technology framework.

[0033] IOMMU (Output Memory Management Unit) converts the virtual address (HVA (Host virtual address space)) accessed by PCIe devices into physical addresses. In order to prevent PCIe devices from accessing memory incorrectly, some IOMMUs also provide access memory protection mechanisms. For example, limiting the memory access of each VF virtio driver; IOMMU is responsible for managing the direct memory access of input / output devices (such as network cards, graphics cards, disk controllers, etc.) to system memory.

[0034] Currently, there are two pass-through device implementation frameworks in the kernel of the Linux operating system, which implement the mapping of SR-IOV devices: mdev (Mediator devices) and VFIO (Virtual Function I / O). This allows virtual machines to use the drivers of hardware devices (including the respective mdev and vfio drivers under the mdev and VFIO frameworks, which implement SR-IOV device mapping) and functions, and allows virtual machines to use the performance of hardware devices (performance includes data access latency, bandwidth, etc.) to avoid performance loss caused by the virtualization layer.

[0035] Both frameworks (mdev and VFIO) require hardware support. Now many high-end hardware devices, whether network cards, GPUs, or other hardware acceleration devices, have provided support for virtio datapath (virtio technology includes the datapath part). At the same time, each hardware provides its own control path.

[0036] The VFIO framework is based on the mdev framework. VFIO uses IOMMU to limit access to the memory address of each VF, so that the memory mapped by the VF can be directly accessed in the user space.

[0037] Device passthrough is to directly attach the physical device to the virtual machine, and the virtual machine directly interacts with the device to obtain better performance. The traditional method of transparently transmitting devices to QEMU / KVM virtual machines is PCI passthrough. This old device passthrough method requires KVM to complete a lot of work, such as interacting with IOMMU, registering interrupt processing functions, etc. Obviously, this method will make KVM interact too much with the device and play the role of a device driver. This solution is not universal and flexible enough, so VFIO (Virtual Function I / O) was later introduced.

[0038] VFIO is a user-mode driver framework that uses hardware-level I / O virtualization technologies, such as Intel's VT-d and AMD's AMD-Vi, to pass devices directly to virtual machines. Traditionally, device drivers need to access many device resources to interact with devices, such as the configuration space of PCI devices, BAR address space, device interrupts, etc. All of these resources are allocated and accessed in kernel mode. In a virtualized environment, after passing the device directly to the virtual machine, QEMU needs to take over all virtual machines' access to device resources.

[0039] like Figure 1 As shown, in combination with an embodiment of the present invention, a dynamic mapping method for a cloud host with a pass-through device is provided, comprising:

[0040] S101: receiving a request for device direct access to a cloud host, and during the initialization of the cloud host, synchronously initializing a first virtual device through a virtual layer, wherein the first virtual device is used to obtain a memory configuration of the cloud host, wherein the memory configuration includes: tag information of a direct access device of the cloud host, and a memory space address and corresponding capacity required by a driver that the direct access device directly provides to the cloud host, wherein the configured memory space address required by the driver is default;

[0041] S102: during the process of initializing the operating system of the pass-through device by the virtual layer, initializing the corresponding memory space in the pass-through device according to the tag information of the pass-through device;

[0042] S103: When a physical memory page fault occurs due to a default configured address of the memory space required by the driver, a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver is allocated to the cloud host in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship;

[0043] S104: When the cloud host is running, a memory address mapping relationship corresponding to the cloud host is obtained in the memory address mapping column of the intermediate layer data table, and a corresponding memory space is applied for in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to pass the pass-through device directly to the cloud host.

[0044] Because the middle layer is set up, during the process of initializing the operating system of the pass-through device by the virtual layer, the corresponding memory space in the pass-through device is initialized according to the tag information of the pass-through device. Because the corresponding memory space address in the pass-through device is default, a physical memory page fault interrupt occurs. The cloud host is allocated a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the middle layer data table to form a memory address mapping relationship, which is stored in the data table of the middle layer. Based on the strategy of scanning the memory space allocated to the cloud host and the memory space required by the driver, the cloud host is allocated the corresponding memory. There is no need to actually scan the corresponding memory allocated to the cloud host, let alone scan the entire memory of the pass-through device as in the prior art. The memory configuration of the DMA of the pass-through device directly connected to the cloud host is decoupled from the memory space required for the driver to initialize the pass-through device when the operating system of the pass-through device is started.

[0045] Only when the cloud host is running, the corresponding memory space is applied for in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to achieve the pass-through of the pass-through device to the cloud host.

[0046] The speed of directly connecting the pass-through device to the cloud host is greatly improved, the time is shortened, and the user experience is improved.

[0047] Preferably, S103: when a physical memory page fault occurs due to a default configured memory space address required by the driver, a memory space address required by the driver matching the corresponding capacity of the memory space required by the driver is allocated to the cloud host in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship, including:

[0048] S103-1: When a physical memory page fault occurs due to a default address of the memory space required by the configured driver, query the physical memory page number of the pass-through device from the shadow page table maintained by the pass-through device driver component, allocate at least one physical memory page number of the pass-through device to the cloud host, and the sum of the physical memory page capacities corresponding to the allocated physical memory page numbers is equal to the corresponding capacity of the memory space required by the driver that the pass-through device directly provides to the cloud host;

[0049] S103-2: setting a memory space address required by the driver in combination with the physical memory page number allocated to the cloud host, wherein the memory space address required by the driver includes an address starting point and a length, wherein the address starting point refers to the minimum physical memory page number of the allocated physical memory page numbers, and the length refers to the number of the allocated physical memory page numbers;

[0050] S103-3: According to the identification information of the pass-through device, the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship.

[0051] With the appearance of the physical memory page fault of the cloud host, the pass-through device allocates the cloud host the memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver, that is, the soft link of the mirror, that is, the memory space address required by the driver, is established. This is in line with the technical solution of the embodiment of the present application, which is the characteristic of lazy loading memory, that is, a memory space address required by a driver does not exist by default, so a physical memory page fault interrupt will only be generated when it is used for the first time. The processing of the physical memory page fault interrupt includes establishing a soft link and filling the corresponding physical memory page, that is, it can apply for real physical memory for the cloud host. Then, according to the identification information of the pass-through device, the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship. The memory configuration of the DMA of the pass-through device directly connected to the cloud host is realized, and the memory space required for the driver of the pass-through device is initialized when the pass-through device operating system is started. The speed of passing the pass-through device directly to the cloud host is greatly improved, the time is shortened, and the user experience is improved.

[0052] Preferably, the dynamic mapping method of the cloud host with a pass-through device further includes:

[0053] S105: before receiving a request for device direct access to a cloud host for the first time, creating an intermediate layer in the memory of the direct access device, and creating a data table in the intermediate layer, the data table at least including: a tag information column, a memory configuration column of the cloud host, and a memory mapping column, the memory configuration column being used to store the memory configuration of the cloud host;

[0054] S106: adding the intermediate layer to the startup process of the operating system of the pass-through device by modifying the startup process of the operating system of the pass-through device, so that the operating system of the pass-through device supports the operation of the intermediate layer when starting.

[0055] The purpose of creating the middle layer is to initialize the memory space required by the driver of the pass-through device according to the tag information of the pass-through device in the memory configuration in the middle layer data table during the process of initializing the operating system of the pass-through device at the virtual layer, and to cause a physical memory page fault interrupt by default according to the configured memory space address required by the driver, and to allocate the memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver to the cloud host in the pass-through device, without configuring the memory space and address required by the driver in advance. Decoupling the memory configuration of the DMA of the pass-through device directly passed to the cloud host and the memory space required to initialize the driver of the pass-through device when the operating system of the pass-through device is started. The speed of passing the pass-through device directly to the cloud host is greatly improved, the time is shortened, and the user experience is improved. Preferably, the data table also includes: a memory index column;

[0056] The dynamic mapping method of the cloud host with a pass-through device also includes:

[0057] S107: After setting the memory space address required by the driver, a data structure for managing the memory space required by the driver is constructed at a corresponding position of the memory index column of the data table according to the identification information of the pass-through device, wherein the data structure includes: the address starting point and length included in the memory space address required by the driver, and the physical memory page number. The data structure is a condition for forming a dedicated memory and is used for memory indexing.

[0058] Preferably, the dynamic mapping method of the cloud host with a pass-through device further includes:

[0059] S108: After forming the memory address mapping relationship, according to the identification information of the pass-through device, the allocated internal space address required by the driver is added to the memory space address required by the driver in the memory configuration column of the data table, thereby forming complete memory configuration information.

[0060] Preferably, the data table further includes: a memory lock description column;

[0061] The dynamic mapping method of the cloud host with a pass-through device also includes:

[0062] After the memory address mapping relationship is formed, the multiple physical memory page numbers assigned to the cloud host are recorded at the corresponding positions of the memory lock description column of the intermediate layer data table according to the identification information of the pass-through device, so as to lock the physical memory page numbers and prevent them from being swapped out (for example, swapped to swap) and without delaying the exchange of other memories.

[0063] like Figure 2 As shown, in combination with an embodiment of the present invention, a dynamic mapping system for a cloud host with a pass-through device is provided, comprising:

[0064] The virtual layer 21 is used to receive a request for a device pass-through to a cloud host. During the initialization of the cloud host, a first virtual device is synchronously initialized through the virtual layer. The first virtual device is used to obtain the memory configuration of the cloud host. The memory configuration includes: tag information of the pass-through device of the cloud host, and the memory space address and corresponding capacity required by the drive that the pass-through device directly passes to the cloud host, wherein the configured memory space address required by the drive is defaulted;

[0065] A pass-through device initialization unit 22, configured to initialize a corresponding memory space in the pass-through device according to the tag information of the pass-through device during the process of the virtual layer initializing the operating system of the pass-through device;

[0066] When a physical memory page fault occurs due to a default address of the configured memory space required by the driver, a memory space address required by the driver matching the corresponding capacity of the memory space required by the driver is allocated to the cloud host in the pass-through device.

[0067] The device management component 23 is used to associate the allocated memory space address required by the driver with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship;

[0068] The pass-through unit 24 is used to obtain the memory address mapping relationship corresponding to the cloud host in the memory address mapping column of the intermediate layer data table when running the cloud host, and apply for the corresponding memory space in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to realize the pass-through of the pass-through device to the cloud host.

[0069] Because the middle layer is set up, during the process of initializing the operating system of the pass-through device by the virtual layer, the corresponding memory space in the pass-through device is initialized according to the tag information of the pass-through device. Because the corresponding memory space address in the pass-through device is default, a physical memory page fault interrupt occurs. The cloud host is allocated a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the middle layer data table to form a memory address mapping relationship, which is stored in the data table of the middle layer. Based on the strategy of scanning the memory space allocated to the cloud host and the memory space required by the driver, the cloud host is allocated the corresponding memory. There is no need to actually scan the corresponding memory allocated to the cloud host, let alone scan the entire memory of the pass-through device as in the prior art. The memory configuration of the DMA of the pass-through device directly connected to the cloud host is decoupled from the memory space required for the driver to initialize the pass-through device when the operating system of the pass-through device is started.

[0070] Only when the cloud host is running, the corresponding memory space is applied for in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to achieve the pass-through of the pass-through device to the cloud host.

[0071] The speed of directly connecting the pass-through device to the cloud host is greatly improved, the time is shortened, and the user experience is improved.

[0072] Preferably, the direct device initialization unit is specifically used for:

[0073] When a physical memory page fault occurs due to a default address of the configured memory space required by the driver, query the physical memory page number of the pass-through device from the shadow page table maintained by the pass-through device driver component, allocate at least one physical memory page number of the pass-through device to the cloud host, and the sum of the physical memory page capacities corresponding to the allocated physical memory page numbers is equal to the corresponding capacity of the memory space required by the driver that the pass-through device directly provides to the cloud host for use;

[0074] The memory space address required by the driver is set in combination with the physical memory page number assigned to the cloud host. The memory space address required by the driver includes an address starting point and a length. The address starting point refers to the minimum physical memory page number of the assigned physical memory page numbers, and the length refers to the number of the assigned physical memory page numbers.

[0075] With the appearance of the physical memory page fault of the cloud host, the pass-through device allocates the cloud host the memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver, that is, the soft link of the mirror, that is, the memory space address required by the driver, is established. This is in line with the technical solution of the embodiment of the present application, which is the characteristic of lazy loading memory, that is, a memory space address required by a driver does not exist by default, so a physical memory page fault interrupt will only be generated when it is used for the first time. The processing of the physical memory page fault interrupt includes establishing a soft link and filling the corresponding physical memory page, that is, it can apply for real physical memory for the cloud host. Then, according to the identification information of the pass-through device, the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship. The memory configuration of the DMA of the pass-through device directly connected to the cloud host is realized, and the memory space required for the driver of the pass-through device is initialized when the pass-through device operating system is started. The speed of passing the pass-through device directly to the cloud host is greatly improved, the time is shortened, and the user experience is improved.

[0076] Preferably, the virtual layer 21 is used for:

[0077] Before receiving a request for device direct access to a cloud host for the first time, creating an intermediate layer in the memory of the direct access device, and creating a data table in the intermediate layer, the data table at least including: a tag information column, a memory configuration column of the cloud host, and a memory mapping column, the memory configuration column being used to store the memory configuration of the cloud host;

[0078] By modifying the startup process of the operating system of the pass-through device, the intermediate layer is added to the startup process of the operating system of the pass-through device, so that the operating system of the pass-through device supports the operation of the intermediate layer when starting.

[0079] The purpose of creating the middle layer is to initialize the memory space required by the driver of the pass-through device according to the tag information of the pass-through device in the memory configuration in the middle layer data table during the process of initializing the operating system of the pass-through device in the virtual layer, and to cause a physical memory page fault interrupt by default according to the configured memory space address required by the driver, and to allocate the memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver to the cloud host in the pass-through device, without configuring the memory space and address required by the driver in advance. Decoupling the memory configuration of the DMA of the pass-through device directly passed to the cloud host and the memory space required to initialize the driver of the pass-through device when the operating system of the pass-through device is started. The speed of passing the pass-through device to the cloud host is greatly improved, the time is shortened, and the user experience is improved.

[0080] Preferably, the data table further includes: a memory index column;

[0081] The device management component 23 is also used for:

[0082] After setting the memory space address required by the driver, a data structure for managing the memory space required by the driver is constructed at a corresponding position of the memory index column of the data table according to the identification information of the pass-through device, the data structure including: the address starting point and length included in the memory space address required by the driver, and the physical memory page number. The data structure is a condition for forming a dedicated memory and is used for memory indexing.

[0083] Preferably, the device management component 23 is also used for:

[0084] After the memory address mapping relationship is formed, the allocated internal space address required by the driver is added to the memory space address required by the driver in the memory configuration column of the data table according to the identification information of the pass-through device, thereby forming complete memory configuration information.

[0085] 12. The dynamic mapping system for a cloud host with a pass-through device according to claim 9, wherein the data table further comprises: a memory lock description column;

[0086] The device management component 23 is also used for:

[0087] After the memory address mapping relationship is formed, the multiple physical memory page numbers assigned to the cloud host are recorded at the corresponding positions of the memory lock description column of the intermediate layer data table according to the identification information of the pass-through device, so as to lock the physical memory page numbers and prevent them from being swapped out (for example, swapped to swap) and without delaying the exchange of other memories.

[0088] In combination with an embodiment of the present invention, a computer-readable storage medium is also provided, which stores one or more programs. When the one or more programs are executed by a computer device, the computer device executes any one of the aforementioned device-direct memory mapping methods for a cloud virtual host.

[0089] like Figure 3 As shown, in combination with an embodiment of the present invention, a computer device is provided, including:

[0090] A processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor executes any one of the aforementioned methods for memory mapping of a cloud virtual host with device direct access.

[0091] The above technical solution of the embodiment of the present invention is described in detail below in conjunction with specific application examples. For technical details not introduced during the implementation process, please refer to the relevant description in the previous text.

[0092] The embodiment of the present invention provides a general method for quickly starting a computing cloud host through an SR-IOV dynamic mapping method.

[0093] The memory of the cloud host that uses SR-IOV device direct access is no longer delayed for initialization. In the prior art, in the scenario of a large-scale cloud host with relatively large memory, the amount of memory that needs to be initialized is naturally relatively large, and the creation and startup process of the cloud host will take a long time. This is because direct memory access (DMA) access may cover the memory space of the entire virtual machine, and the memory accessed by DMA cannot be swapped out, that is, it always exists in the memory and occupies the memory space. In the prior art, the cloud host with SR-IOV device direct access locks the memory mapped by the device DMA in advance, so after the kernel allocates the direct pass-through device, the corresponding driver will lock the memory pages allocated by DMA; here, taking the VFIO network card device as an example, the specific operation is vfio_iommu_type1_pin_pages, the vfio_pin_pages_remote function locks several consecutive physical memory pages in the memory, and vfio_iommu_map maps the locked memory to the specified device I / O address. vfio_iommu_map will call the iommu_map of the IOMMU hardware layer to complete the actual mapping work. The VFIO device in the prior art directly maps the memory address required by the virtual machine in the following two steps:

[0094] Step 1: Mapping of the entire memory space (Address Space) of the virtual machine and the physical address;

[0095] Step 2: The input / output memory management unit (IOMMU) establishes and initializes the mapping of device virtual addresses to physical addresses and interrupt mapping;

[0096] Among them, step 1 is completed when the virtual machine is started. In order to locate the physical address of the hardware device (the address mapped to the memory), the virtual machine needs to scan the entire Address Space. This process makes the system startup process slow and inflexible. The binding of the virtual machine and the VFIO device makes it difficult to perform other operations, such as hot migration. Step 2 is completed after the virtual machine is started.

[0097] In the embodiment of the present invention, the dynamic mapping method specifically refers to the mapping of the VFIO device to the memory. On the basis of the VFIO device, 1. a new Memory Map type is provided, and an intermediate layer mirror Memory Region is provided in the memory of the pass-through device. The intermediate layer mirror Memory Region is used to map the MemoryRegion of the IOMMU map (a segment of the address space of the entire memory space Address Space, allocated to the pass-through device), and a data table is created in the intermediate layer. The data table at least includes: a tag information column, a memory configuration column of the cloud host, and a memory segment mapping column. The memory configuration column is used to save the memory configuration of the cloud host; 2. At the same time, the startup process of the operating system Guest OS configured with the pass-through device is updated, so that the Guest OS startup process can distinguish which is the memory of the pass-through device and which is the ordinary memory, and the iommu can be set only for a small number of pass-through device memory areas, that is, mirror Memory Region, so as to support the intermediate layer mirror Memory Region. As a result, the cloud host only scans the memory space required by the driver used by the pass-through device directly to the cloud host, and no longer scans the entire memory space Address Space of the pass-through device. This allows the input / output memory management unit IOMMU to decouple the management of the memory space required for the driver of the pass-through device to the cloud host and the pass-through device operating system Guest OS during the startup phase, that is, decoupling the memory configuration of the physical device DMA mapping and the DMA memory space required for initializing the device when the pass-through device operating system (Guest OS) starts.

[0098] The method of the embodiment of the present invention includes the following components: fw_cfg device (first virtual device), device management component, pass-through device driver component and virtualization software Qemu (virtual layer); the main implementation steps of the method of the embodiment of the present invention include:

[0099] 1. Receive a request for device direct access to the cloud host. When the cloud host is initialized in the virtual layer (Qemu-kvm) process, the first virtual device (fireware, i.e., fw_cfg device) is initialized synchronously. The entry in the configuration information saved by the fw_cfg device contains the flag information flags of the sriov direct access device; wherein, the entry is the memory configuration information (configuration) inside, and the entry records the address space that the VFIO device needs to map. That is, the memory configuration is first performed in the first virtual device, and the memory configuration includes: the tag information of the direct access device of the cloud host, and the memory space address and corresponding capacity required by the driver used by the direct access device to the cloud host, wherein the configured memory space address required by the driver is default. Then initialize again.

[0100] 2. When the pass-through device operating system (Guest OS) is initialized, the corresponding memory space in the pass-through device is initialized according to the flags information saved by the first virtual device (fw_cfg device), specifically, by using lazy initialization to initialize the memory space used by the cloud host's pass-through device directly to the cloud host, so there is no need to initialize the entire memory space. Because an intermediate layer is provided, the memory space address required by the driver configured for the cloud host in the memory configuration of the intermediate layer is default, so it is not scanned and initialized to the actual allocated physical space.

[0101] 3. During the process of initializing the operating system of the pass-through device by the virtual layer, when a physical memory page fault occurs due to the default of the configured memory space address required by the driver, the cloud host is allocated a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship. That is, when an EPT page fault occurs in the EPT (a function of the Intel chip, used to assist in memory mapping), the register information (register means that after a page fault occurs, the CPU will have a corresponding register to save some information about the page fault) contains a flags mark, thereby identifying that it is an SR-IOV pass-through device, and the cloud host is allocated a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver in the pass-through device, that is, the cloud host is normally allocated a physical memory page (memory page is the basic unit of the memory management unit), and at the same time, the device management component adjusts the association relationship between the memory space address required by the DMA driver and the virtual machine hardware address of the cloud host in the intermediate layer mirror Memory Region by remapping.

[0102] 4. When running the cloud host, obtain the memory address mapping relationship corresponding to the cloud host in the memory address mapping column of the intermediate layer data table, apply for the corresponding memory space in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, and realize the pass-through device being directly connected to the cloud host.

[0103] The following is a detailed description of the management of the middle layer mirror Memory Region and the shadow page table mirror EPT:

[0104] 1. Initialize the middle layer mirror Memory Region

[0105] The original virtual machine memory mapping includes the following structures: 1. The mapping of virtual memory pages in the cloud host operating system (guest OS) to the fast emulator (qemu) process to map the virtual machine's memory to physical memory. 2. The mapping of the qemu process to the host's physical memory, so that the physical memory can be accessed. 3. The vfio-iommu driver maintains a page table from device memory to physical memory (device memory refers to the memory used by the device in the Guest, and physical memory refers to the physical memory of the host corresponding to this part of memory). The page table stores the memory mapping relationship from virtual address to physical address to assist in memory mapping.

[0106] In the embodiment of the present invention, it is necessary to maintain a shadow page table (mirror EPT) in the pass-through device driver component (vfio-iommu). The shadow page table is a subset of EPT and is only used for relocating the memory space required by the driver for the pass-through device to be directly passed to the cloud host involved in DMA mapping. Therefore, a large storage space is not required to save the shadow page table (mirror EPT).

[0107] 1. If Figure 4 As shown, in the embodiment of the present invention, only two memory areas need to be maintained. One memory area is the IO memory area originally mapped by DMA, that is, the memory space required by the driver that the pass-through device directly provides to the cloud host for use. However, the memory configuration is performed first, and the memory space address and corresponding capacity required by the driver that the pass-through device directly provides to the cloud host for use are configured in the memory configuration. However, the configured memory space address required by the driver is default, and it is supplemented when a soft link is established during the subsequent initialization, that is, when the cloud host is allocated the actual memory space address required by the driver used by the cloud host.

[0108] 2. If Figure 5As shown, another memory region is the mirror Memory Region, which is used by the EPT page fault interrupt of the virtual cloud host; when the configured memory space address required by the driver defaults and causes a physical memory page fault interrupt to occur, a query is made in the shadow page table maintained by the pass-through device driver component to supplement the physical memory page number (page frame number) corresponding to the physical memory page fault of the direct memory access DMA, and the sum of the physical memory page capacities corresponding to the allocated physical memory page numbers is equal to the corresponding capacity of the memory space required by the driver that the pass-through device directly passes to the cloud host, and the memory space address required by the driver is set in combination with the physical memory page number allocated to the cloud host, and the memory space address required by the driver includes an address starting point and a length, wherein the address starting point refers to the minimum physical memory page number of the allocated physical memory page numbers, and the length refers to the number of allocated physical memory page numbers.

[0109] like Figure 6 As shown, the data of the middle-layer mirror Memory Region is mainly the memory space address required by the driver corresponding to the original IO memory space of the mirror, that is, the soft link.

[0110] Among them, with the occurrence of a physical memory page fault of the cloud host, the pass-through device allocates a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver to the cloud host, that is, the soft link of the mirror, that is, the memory space address required by the driver, is established. This is in line with the technical solution of the embodiment of the present application, which is the characteristic of lazy loading memory, that is, a memory space address required by a driver does not exist by default, so a physical memory page fault interrupt will only be generated when it is used for the first time. The processing of the physical memory page fault interrupt includes establishing a soft link and filling the corresponding physical memory page, that is, being able to apply for real physical memory for the cloud host. Then, according to the identification information of the pass-through device, the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship. The read and write functions of IO data are completed in the IO memory area.

[0111] After the memory address mapping relationship is formed, the allocated internal space address required by the driver is added to the memory space address required by the driver in the memory configuration column of the data table according to the identification information of the pass-through device.

[0112] In order to avoid performance degradation caused by initialization, the mirror data (network (business) data when the VF (network card) performs IO operations) is no longer used after it is initialized and recognized by the cloud host.

[0113] like Figure 7 As shown in the figure, the entry in the mirror EPT records the memory space address, flags, and length of the memory space address required by the driver for mirror mapping. When DMA data reading and writing on the cloud host is unavailable, it means that the memory address mapping relationship corresponding to this entry has not been established. When the physical memory page fault interrupt is processed, the flags of the page frame number corresponding to the Address Space are marked as available.

[0114] 2. Device Management Components under VFIO Device Management

[0115] After setting the memory space address required by the driver and establishing the memory address mapping relationship of the middle-layer mirror memory region, the corresponding hardware devices also need to be adjusted accordingly.

[0116] Here, taking Mellanox ConnectX-5 as an example, VFIO enables applications in user space to access the memory mapped by the DMA of the network card device, which is shared memory. It is necessary to record the memory allocated by the mlx5 driver in the virtual machine (the driver will initialize the memory when loading, because the driver device needs memory for normal operation). According to the identification information of the pass-through device, a data structure for managing the memory space required by the driver is constructed at the corresponding position of the memory index column of the data table. The data structure is the condition for forming a dedicated memory and is used for memory indexing. The data structure includes: the address starting point and length included in the address of the memory space required by the driver, and the physical memory page number, as the dedicated memory used by qemu to simulate the pass-through device mapping. The two (the memory space required by the driver allocated by the mlx5 driver, the memory corresponding to the virtual machine hardware address dedicated to the qemu simulated device, and the two are shared memory) are associated through the physical memory page number, so that the above mirror memory address mapping can be established.

[0117] After forming the memory address mapping relationship, the multiple physical memory page numbers assigned to the cloud host are recorded in the corresponding position of the memory lock description column of the intermediate layer data table according to the identification information of the pass-through device to lock the physical memory page number, that is, the pin-related operations in VFIO need to be modified at the same time. When the VFIO driver recognizes the corresponding flags mark, the page frame number information is recorded, and the pin information missing due to DMA during the previous initialization is supplemented and put into the corresponding page descriptor (memory lock description). By pinning the memory, the pinned part of the memory will not be swapped out (for example, swapped to swap) and the swapping of other memories will not be delayed.

[0118] vfio_dma_map is used for vfio memory mapping, which is part of the emoryListener function and is used to monitor changes in memory data. When creating a cloud machine, the qemu process will call vfio_dma_map. The MemoryListener in vfio_dma_map will filter out memory that is not DMA mapped. Figure 4 It can be seen that in the embodiment of the present invention, only the IO memory is DMA mapped, and is also the memory that the vfio_pin_pages function will temporarily pin, so the memory range that needs to be locked is relatively small.

[0119] The beneficial technical effects achieved by the embodiments of the present invention are as follows:

[0120] In the prior art, in order to provide efficient DMA access at the application layer, VFIO devices are directly passed to virtual machines. Before enabling VFIO devices, all memory allocated to the virtual machine needs to be locked and the IOMMU page table needs to be created. In addition, the mapping HVA->HPA IOMMU is fixed, which causes the memory to be unable to balloon.

[0121] In the embodiment of the present invention, it is not necessary to lock all virtual machine memories of the pass-through device, but only the fixed memory mapped by IOMMU needs to be locked. The process of cloud host startup and initialization no longer relies on the memory required by the driver used by the cloud host for the pass-through device locked by IOMMU, thereby accelerating the startup time of the cloud host and decoupling the dependency of the shared memory of the VFIO device and the operating system Guest OS of the pass-through device, thereby bringing flexibility to the management of the pass-through device, such as hot migration of SR-IOV devices. It is not dependent on specific device manufacturers and device types, is simple and easy to use, and brings a consistent operating experience to cloud computing users.

[0122] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of protection of the present disclosure. The attached method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.

[0123] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.

[0124] The disclosed embodiments are described above to enable any person skilled in the art to implement or use the present invention. Various modifications of these embodiments are obvious to those skilled in the art, and the general principles defined herein may also be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments given herein, but is consistent with the broadest scope of the principles and novel features disclosed in this application.

[0125] The above description includes examples of one or more embodiments. Of course, it is impossible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".

[0126] Those skilled in the art may also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention may be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly demonstrate the interchangeability of hardware and software, the various illustrative components, units, and steps described above have generally described their functions. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art may use various methods to implement the described functions for each specific application, but such implementation should not be understood as exceeding the scope of protection of the embodiments of the present invention.

[0127] The various illustrative logic blocks or units described in the embodiments of the present invention can be implemented or operated by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of the above. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.

[0128] The steps of the method or algorithm described in the embodiments of the present invention can be directly embedded in hardware, a software module executed by a processor, or a combination of the two. The software module can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or other storage media of any form in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC, and the ASIC can be arranged in a user terminal. Optionally, the processor and the storage medium can also be arranged in different components in the user terminal.

[0129] In one or more exemplary designs, the above functions described in the embodiments of the present invention can be implemented in hardware, software, firmware or any combination of the three. If implemented in software, these functions can be stored on a computer-readable medium, or transmitted in the form of one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media that facilitate the transfer of computer programs from one place to another. The storage medium can be any available medium that can be accessed by any general or special computer. For example, such computer-readable media can include but are not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that can be used to carry or store program codes in the form of instructions or data structures and other forms that can be read by general or special computers, or general or special processors. In addition, any connection can be appropriately defined as a computer-readable medium, for example, if the software is transmitted from a website site, server or other remote resource through a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wirelessly, such as infrared, wireless and microwave, it is also included in the defined computer-readable medium. The disk and disc include compact disk, laser disk, optical disk, DVD, floppy disk and blue-ray disk. Disks usually copy data magnetically, while discs usually copy data optically with lasers. The above combination can also be included in computer readable media.

[0130] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for dynamic mapping of a cloud host with a pass-through device, characterized in that: include: Receive a request for device direct access to a cloud host, and during the initialization of the cloud host, synchronously initialize a first virtual device through a virtual layer, the first virtual device being used to obtain a memory configuration of the cloud host, the memory configuration including: tag information of a direct access device of the cloud host, and a memory space address and corresponding capacity required by a driver that the direct access device directly provides to the cloud host, wherein the configured memory space address required by the driver is default; In the process of initializing the operating system of the pass-through device by the virtual layer, initializing the corresponding memory space in the pass-through device according to the tag information of the pass-through device; When a physical memory page fault occurs due to a default configured address of the memory space required by the driver, a memory space address required by the driver matching the corresponding capacity of the memory space required by the driver is allocated to the cloud host in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship; When the cloud host is running, the memory address mapping relationship corresponding to the cloud host is obtained in the memory address mapping column of the intermediate layer data table, and the corresponding memory space is applied for in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to realize the pass-through device being passed directly to the cloud host.

2. The dynamic mapping method of a cloud host with a pass-through device according to claim 1, characterized in that: When a physical memory page fault occurs due to a default configured memory space address required by the driver, a memory space address required by the driver matching the corresponding capacity of the memory space required by the driver is allocated to the cloud host in the pass-through device, and the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship, including: When a physical memory page fault occurs due to a default address of the configured memory space required by the driver, query the physical memory page number of the pass-through device from the shadow page table maintained by the pass-through device driver component, allocate at least one physical memory page number of the pass-through device to the cloud host, and the sum of the physical memory page capacities corresponding to the allocated physical memory page numbers is equal to the corresponding capacity of the memory space required by the driver that the pass-through device directly provides to the cloud host for use; The memory space address required by the driver is set in combination with the physical memory page number assigned to the cloud host, where the memory space address required by the driver includes an address starting point and a length, where the address starting point refers to the minimum physical memory page number of the assigned physical memory page numbers, and the length refers to the number of the assigned physical memory page numbers; According to the identification information of the pass-through device, the allocated memory space address required by the driver is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship.

3. The dynamic mapping method of a cloud host with a pass-through device according to claim 2, characterized in that: The method further comprises: Before receiving a request for device direct access to a cloud host for the first time, creating an intermediate layer in the memory of the direct access device, and creating a data table in the intermediate layer, the data table at least including: a tag information column, a memory configuration column of the cloud host, and a memory mapping column, the memory configuration column being used to store the memory configuration of the cloud host; By modifying the startup process of the operating system of the pass-through device, the intermediate layer is added to the startup process of the operating system of the pass-through device, so that the operating system of the pass-through device supports the operation of the intermediate layer when starting.

4. The dynamic mapping method of a cloud host with a pass-through device according to claim 3, characterized in that: The data table also includes: a memory index column; The method further comprises: After setting the memory space address required by the driver, a data structure for managing the memory space required by the driver is constructed at a corresponding position of the memory index column of the data table according to the identification information of the pass-through device, wherein the data structure includes: the address starting point and length included in the memory space address required by the driver, and the physical memory page number.

5. The dynamic mapping method of a cloud host with a pass-through device according to claim 3, characterized in that: The method further comprises: After the memory address mapping relationship is formed, the allocated internal space address required by the driver is added to the memory space address required by the driver in the memory configuration column of the data table according to the identification information of the pass-through device.

6. The dynamic mapping method of a cloud host with a pass-through device according to claim 3, characterized in that: The data table also includes: a memory lock description column; The method further comprises: After the memory address mapping relationship is formed, the multiple physical memory page numbers assigned to the cloud host are recorded at corresponding positions in the memory lock description column of the intermediate layer data table according to the identification information of the pass-through device to lock the physical memory page numbers.

7. A dynamic mapping system for a cloud host with a pass-through device, characterized in that: include: A virtual layer, used for receiving a request for device direct access to a cloud host, during the initialization of the cloud host, a first virtual device is synchronously initialized through the virtual layer, the first virtual device is used for obtaining the memory configuration of the cloud host, the memory configuration includes: tag information of the direct access device of the cloud host, and the memory space address and corresponding capacity required by the driver used by the direct access device to the cloud host, wherein the configured memory space address required by the driver is default; A pass-through device initialization unit, configured to initialize the corresponding memory space in the pass-through device according to the tag information of the pass-through device during the process of initializing the operating system of the pass-through device by the virtual layer; when a physical memory page fault occurs due to a default address of the configured memory space required by the driver, allocate a memory space address required by the driver that matches the corresponding capacity of the memory space required by the driver to the cloud host in the pass-through device; A device management component, used to associate the allocated memory space address required by the driver with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table to form a memory address mapping relationship; A pass-through unit is used to obtain a memory address mapping relationship corresponding to the cloud host in the memory address mapping column of the intermediate layer data table when running the cloud host, and apply for a corresponding memory space in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, so as to realize direct connection of the pass-through device to the cloud host.

8. The dynamic mapping system of a cloud host with a pass-through device according to claim 7, characterized in that: The direct device initialization unit is specifically used for: When a physical memory page fault occurs due to a default address of the configured memory space required by the driver, query the physical memory page number of the pass-through device from the shadow page table maintained by the pass-through device driver component, allocate at least one physical memory page number of the pass-through device to the cloud host, and the sum of the physical memory page capacities corresponding to the allocated physical memory page numbers is equal to the corresponding capacity of the memory space required by the driver that the pass-through device directly provides to the cloud host for use; The memory space address required by the driver is set in combination with the physical memory page number assigned to the cloud host. The memory space address required by the driver includes an address starting point and a length. The address starting point refers to the minimum physical memory page number of the assigned physical memory page numbers, and the length refers to the number of the assigned physical memory page numbers.

9. A computer-readable storage medium storing one or more programs, which, when executed by a computer device, enables the computer device to execute the dynamic mapping method of a cloud host with a pass-through device as described in any one of claims 1-6.

10. A computer device comprising: processor; And, a memory arranged to store computer executable instructions, which, when executed, cause the processor to execute the dynamic mapping method for a cloud host with a pass-through device as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method and system for straight-through device, security processor and storage medium

    CN111966468A

  • Memory virtualization method and system under Shenwei architecture

    CN112363824A

  • Page missing processing method and related equipment

    CN117520215A

  • Virtual machine starting method, host, cloud service system and storage medium

    CN119127383A

  • Computing system, memory page fault processing method, and storage medium

    WO2023165400A1

Cited By

  • Virtual machine memory processing method and device, product, virtualization server and medium

    CN120872507A

  • Virtual machine memory handling methods, devices, products, virtualization servers and media

    CN120872507B