A dynamic mapping method and system of cloud host with pass-through device

By dynamically allocating the memory space required by the driver through memory address mapping in the virtual layer and the intermediate layer, the problem of excessively long cloud server creation and startup time is solved, resulting in a faster cloud server startup process and improved user experience and system efficiency.

CN119960902BActive Publication Date: 2025-11-25SINA TECH (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies have excessively long creation and startup times for cloud hosts, which affect user experience and system scheduling efficiency. In particular, when creating large-scale heterogeneous virtual machines, a 2-minute wait time exceeds the user's tolerance.

Method used

By synchronously initializing virtual devices at the virtual layer, using intermediate layer data tables for memory address mapping, dynamically allocating the memory space required by the driver, decoupling the DMA memory configuration of the pass-through device from the operating system initialization, and requesting actual memory space only when running the cloud host.

Benefits of technology

This significantly improves the speed at which pass-through devices connect to cloud servers, shortens creation and startup time, and enhances user experience and system efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119960902B_ABST
    Figure CN119960902B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a dynamic mapping method and system of a cloud host with a pass-through device, comprising: in the process of cloud host initialization, obtaining the memory configuration of the cloud host by initializing the first virtual device of the virtual layer, wherein the memory space address required by the driver used by the cloud host is default in the memory configuration; initializing the corresponding memory space in the pass-through device in the process of operating system initialization of the virtual layer; allocating the memory space address required by the driver to the cloud host due to the default of the memory space address required by the configured driver, and associating the allocated memory space address required by the driver with the virtual machine hardware address of the cloud host in the intermediate layer data table; when the cloud host is running, the corresponding memory space is applied in the pass-through device according to the memory space address required by the driver in the memory address mapping relationship, and the pass-through device is passed to the cloud host. The application can accelerate the time of passing the pass-through device to the cloud host.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

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

[0002] In a cloud computing scenario, a large number of cloud hosts accelerate the business performance of the cloud hosts through a device pass-through scheme. Although this scheme accelerates the performance of the cloud hosts, the starting process is time-consuming. For a cloud computing user, the long cloud host creation and starting time greatly affects the experience, especially for a large-specification heterogeneous virtual machine. Taking 350G memory as an example, the creation time needs 2 minutes. When the user creates a virtual machine at this time to quickly recover the business, the 2-minute creation waiting time is completely beyond the tolerance of the user. In addition, for a background management system of cloud computing, the long blocking time greatly affects the system scheduling efficiency. SUMMARY

[0003] The embodiment of the present application provides a dynamic mapping method and system of a cloud host with a pass-through device, which can solve the technical problem that the long cloud host creation and starting time greatly affects the normal use of a user in the prior art.

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

[0005] receiving a request for device pass-through of a cloud host, synchronously initializing a first virtual device in a process of initializing the cloud host through a virtual layer, the first virtual device being used to obtain a memory configuration of the cloud host, the memory configuration comprising: tag information of a pass-through device of the cloud host, and a required memory space address and a corresponding capacity of a driver used by the pass-through device for the cloud host, wherein the required memory space address of the driver configured is default;

[0006] in a process of initializing an operating system of the pass-through device through the virtual layer, initializing a 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 interrupt occurs due to the default of the required memory space address of the driver configured, allocating a required memory space address of the driver matching the corresponding capacity of the required memory space of the driver for the cloud host in the pass-through device, and associating the allocated required memory space address of the driver with a virtual machine hardware address of the cloud host in a memory address mapping column of an intermediate layer data table to form a memory address mapping relationship;

[0008] In running the cloud host, 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 drive required memory space address in the memory address mapping relationship, so as to realize the pass-through of the pass-through device to the cloud host.

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

[0010] a virtual layer, configured to receive a request of device pass-through of a cloud host, and initialize a first virtual device through the virtual layer in a process of initialization of the cloud host, the first virtual device being configured to obtain a memory configuration of the cloud host, the memory configuration comprising: tag information of a pass-through device of the cloud host, and a drive required memory space address and a corresponding capacity of the pass-through device pass-through to the cloud host, wherein the configured drive required memory space address is default;

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

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

[0013] a pass-through unit, configured to obtain the memory address mapping relationship corresponding to the cloud host in the memory address mapping column of the intermediate layer data table in running the cloud host, and apply for the corresponding memory space in the pass-through device according to the drive required memory space address in the memory address mapping relationship, to realize the pass-through of the pass-through device to the cloud host.

[0014] In a third aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing one or more programs, the one or more programs, when executed by a computer device, causing the computer device to execute the dynamic mapping method of the cloud host with the pass-through device.

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

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

[0017] The technical solution has the following beneficial effects: because of the intermediate layer, in the process of initializing the operating system of the pass-through device in the virtual layer, the corresponding memory space in the pass-through device is initialized according to the marking information of the pass-through device, because the address of the corresponding memory space in the pass-through device is default, a physical memory page fault interrupt occurs, the drive required memory space address matching the drive required memory space capacity is allocated for the cloud host in the pass-through device, and the allocated drive required memory space address is associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table, forming a memory address mapping relationship, which is saved in the data table of the intermediate layer. The cloud host is allocated corresponding memory in the strategy of scanning for the cloud host to allocate corresponding memory, and does not need to really scan for the cloud host to allocate corresponding memory, and does not need to scan the entire memory of the pass-through device like in the prior art. The memory configuration of the DMA of the pass-through device of the cloud host is decoupled from the initialization of the drive required memory space of the pass-through device when the operating system of the pass-through device is started. Only when the cloud host is running, the corresponding memory space is applied in the pass-through device according to the drive required memory space address in the memory address mapping relationship, realizing the pass-through of the pass-through device to the cloud host. The speed of the pass-through of the pass-through device to the cloud host is greatly improved, the time is shortened, and the user experience is improved. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative effort.

[0019] Figure 1 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 application;

[0020] Figure 2 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 application;

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

[0022] Figure 4 are two memory areas maintained according to an embodiment of the present application;

[0023] Figure 5 is the intermediate layer of the embodiment of the present application;

[0024] Figure 6 is the data table in the mirror Memory Region of the embodiment of the present application;

[0025] Figure 7 is the memory configuration information saved by the entry of the embodiment of the present application. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0027] The technical terms and abbreviations involved in the embodiments of the present application are explained as follows:

[0028] QEMU is the abbreviation of Quick Emulator (fast emulator), and in the Chinese environment, it is usually directly called "QEMU".

[0029] KVM is the abbreviation of Kernel-based Virtual Machine (kernel-based virtual machine), and in the Chinese environment, it is usually called "KVM".

[0030] Combined together, "QEMU-KVM" usually refers to a high-performance virtualization solution formed by the combination of the QEMU project and the KVM module, which can be understood as "QEMU with KVM". In actual use, people still more directly call its English full name "QEMU-KVM", and do not specially do the Chinese processing.

[0031] SR-IOV (Single Root I / O Virtualization) provides multiple VF (PCIe Virtual Functions) devices on a single PCIe (Peripheral Component Interconnect Express) device and offers a standard interface for configuring VFs. SR-IOV improves I / O performance and efficiency in virtualized environments. For PCIe devices, such as high-performance network interface cards (NICs) and storage controllers, a PCIe device is an I / O device; for example, a disk, network interface card, the connecting bus, and the interface are PCI devices. A PCIe device refers to a computer hardware component that conforms to the PCI Express (Peripheral Component Interconnect Express) standard. PCIe is a high-speed serial computer expansion bus standard that provides point-to-point connectivity, allowing multiple devices to communicate directly with the host (such as the CPU or other host controller) through a dedicated link, instead of sharing bus bandwidth as in 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] The IOMMU (Output Memory Management Unit) translates the virtual addresses (HVA, Host Virtual Address Space) accessed by PCIe devices into physical addresses. To prevent PCIe devices from erroneously accessing memory, some IOMMUs also provide memory access protection mechanisms. For example, they may restrict memory access for each VF virtio driver. The IOMMU is responsible for managing direct memory access to system memory by input / output devices (such as network cards, graphics cards, disk controllers, etc.).

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

[0035] Both frameworks (mdev and VFIO) require hardware support, and now many high-end hardware devices, whether network cards, GPUs, or other hardware acceleration devices, mostly provide support for virtio datapath (part of the virtio technology) and each hardware provides its own control path.

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

[0037] Device passthrough is to directly hang a physical device to a virtual machine, and the virtual machine obtains better performance by directly interacting with the device. The traditional method of transmitting devices to QEMU / KVM virtual machines is PCI passthrough. This old device passthrough method requires KVM to do a lot of work, such as interacting with IOMMU, registering interrupt processing functions, etc. Obviously, this method will make KVM deal with the device too much, and play a role of device driver. This solution is not 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 passthrough devices to virtual machines. Traditionally, device drivers interact with devices by accessing many resources of the device, such as the configuration space of the PCI device, the BAR address space, and the device interrupt. All these resources are allocated and accessed in the kernel mode. In a virtualized environment, after the device is passthrough to the virtual machine, QEMU needs to take over all the virtual machine's access to the device resources.

[0039] As shown in Figure 1 The embodiment of the application provides a dynamic mapping method of a cloud host with a passthrough device, which comprises the following steps:

[0040] S101: receiving a request for device passthrough of a cloud host, and synchronously initializing a first virtual device in a process of initializing the cloud host, the first virtual device being used for obtaining memory configuration of the cloud host, the memory configuration comprising: tag information of a passthrough device of the cloud host, and a required memory space address and corresponding capacity of a driver used by the passthrough device for the cloud host, wherein the required memory space address of the driver is configured by default.

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

[0042] S103: When a physical memory page fault interrupt occurs due to the default of the memory space address required by the configured driver, allocate a memory space address required by the driver with a capacity matching that of the memory space required by the driver for the cloud host in the pass-through device, 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, and form a memory address mapping relationship;

[0043] S104: 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, 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, to realize the pass-through of the pass-through device to the cloud host.

[0044] Because of the setting of the intermediate layer, in the process of initializing the operating system of the pass-through device in the virtual layer, the corresponding memory space in the pass-through device is initialized according to the marking information of the pass-through device. Because of the default of the corresponding memory space address in the pass-through device, a physical memory page fault interrupt occurs, a memory space address required by the driver with a capacity matching that of the memory space required by the driver is allocated for 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, forming a memory address mapping relationship, which is saved in the data table of the intermediate layer. In order to allocate the corresponding memory for the cloud host according to the strategy of scanning the memory space required by the driver for the cloud host, the corresponding memory does not need to be truly scanned for the cloud host, and it is not necessary to 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 passed to the cloud host is decoupled from the initialization of the memory space required by the driver of 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 in the pass-through device is applied for according to the memory space address required by the driver in the memory address mapping relationship, to realize the pass-through of the pass-through device to the cloud host.

[0046] 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.

[0047] Preferably, S103: when the physical memory page fault interrupt occurs due to the default of the configured drive required memory space address, the drive required memory space address corresponding to the capacity matching the drive required memory space of the cloud host is allocated in the pass-through device, the allocated drive required memory space address 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, comprising:

[0048] S103-1: when the physical memory page fault interrupt occurs due to the default of the configured drive required memory space address, the physical memory page number of the pass-through device is queried from the shadow page table maintained by the pass-through device drive component, at least one physical memory page number of the pass-through device is allocated to the cloud host, and the sum of the corresponding physical memory page capacities of the allocated physical memory page numbers is equal to the corresponding capacity of the drive required memory space of the pass-through device used by the cloud host;

[0049] S103-2: set the drive required memory space address in combination with the physical memory page number allocated to the cloud host, the drive required memory space address includes an address starting point and a length, the address starting point refers to the smallest physical memory page number of the allocated physical memory page number, 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 drive required memory space address 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 occurrence of the physical memory page missing of the cloud host, the drive required memory space address matching the corresponding capacity of the drive required memory space of the cloud host is allocated in the pass-through device, that is, the soft link to be mirrored, the drive required memory space address is established. This conforms to the technical solution of the embodiment of the application, which is the characteristic of lazy loading memory, that is, a drive required memory space address does not exist by default, so it will only cause a physical memory page missing interrupt when it is first used. The processing of the physical memory page missing interrupt includes establishing a soft link and supplementing the corresponding physical memory page, that is, the cloud host can apply for real physical memory. Then, according to the identification information of the pass-through device, the allocated drive required memory space address 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 decoupled from the drive required memory space of the pass-through device initialized when the operating system of the pass-through device is started. 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.

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

[0053] S105: Before receiving the request of directly connecting the device to the cloud host for the first time, creating an intermediate layer in the memory of the pass-through device, and creating a data table in the intermediate layer, the data table at least including: a marker information column, a memory configuration column of the cloud host, and a memory mapping column, the memory configuration column being used for saving the memory configuration of the cloud host;

[0054] S106: 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 running of the intermediate layer when starting.

[0055] The purpose of creating the intermediate layer is to initialize the drive required memory space of the pass-through device in the memory configuration in the intermediate layer data table according to the marker information of the pass-through device during the initialization process of the operating system of the pass-through device in the virtual layer, and to allocate the drive required memory space address matching the corresponding capacity of the drive required memory space of the cloud host in the pass-through device of the cloud host due to the physical memory page missing interrupt caused by the default of the configured drive required memory space address, without performing the configuration of the drive required memory space and address in advance. The memory configuration of the DMA of the pass-through device directly connected to the cloud host is decoupled from the drive required memory space of the pass-through device initialized when the operating system of the pass-through device is started. 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. Preferably, the data table further includes: a memory index column;

[0056] The dynamic mapping method of the cloud host with the pass-through device further 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 the corresponding position of the memory index column of the data table according to the identification information of the pass-through device, and the data structure includes: the address start 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 special memory, and is used for memory index.

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

[0059] S108: After forming the memory address mapping relationship, the allocated memory space address required by the driver is filled into the memory configuration column of the data table at the memory space address required by the driver, so as to form 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 the pass-through device further includes:

[0062] After forming the memory address mapping relationship, the multiple physical memory page numbers allocated to the cloud host are recorded at 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, so as to lock the physical memory page numbers and prevent them from being swapped out (such as being swapped to swap) and delaying the swapping of other memories.

[0063] As Figure 2 shown, in combination with the embodiments of the present application, a dynamic mapping system of a cloud host with a pass-through device is provided, which includes:

[0064] a virtual layer 21 configured to receive a request for device pass-through of a cloud host, and to synchronize initialization of a first virtual device in a process of initialization of the cloud host, the first virtual device being configured to acquire memory configuration of the cloud host, the memory configuration including: identification information of a pass-through device of the cloud host, and a memory space address and a corresponding capacity of a driver required by the pass-through device for pass-through to the cloud host, wherein the memory space address required by the driver is configured by default;

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

[0066] when a physical memory page fault interrupt occurs due to a default of a configured driver required memory space address, allocating a driver required memory space address matching a corresponding capacity of the driver required memory space for the cloud host in the pass-through device,

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

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

[0069] Because of the intermediate layer, in a process of initializing an operating system of the pass-through device in the virtual layer, a corresponding memory space in the pass-through device is initialized according to the marking information of the pass-through device. Because of a default of the corresponding memory space address in the pass-through device, a physical memory page fault interrupt occurs. A driver required memory space address matching a corresponding capacity of a driver required memory space is allocated for the cloud host in the pass-through device, and the allocated driver required memory space address is associated with a virtual machine hardware address of the cloud host in a memory address mapping column of an intermediate layer data table, to form a memory address mapping relationship, which is saved in the data table of the intermediate layer. The corresponding memory is allocated for the cloud host in the strategy of scanning for the cloud host to allocate the corresponding memory, without actually scanning for the cloud host to allocate the corresponding memory, and without needing to 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 to the cloud host is decoupled from the initialization of the driver required memory space of the pass-through device when the operating system of the pass-through device is started.

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

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

[0072] Preferably, the pass-through device initialization unit is specifically configured to:

[0073] When a physical memory page fault interrupt occurs due to a default of a configured drive required memory space address, a physical memory page number of the pass-through device is queried from a shadow page table maintained by a pass-through device driver component, at least one physical memory page number of the pass-through device is allocated to the cloud host, and a sum of capacities of the physical memory pages corresponding to the allocated physical memory page numbers is equal to a corresponding capacity of the drive required memory space of the pass-through device passed through to the cloud host.

[0074] A drive required memory space address is set in combination with the allocated physical memory page number of the cloud host, the drive required memory space address includes an address start point and a length, the address start point refers to a minimum physical memory page number of the allocated physical memory page number, and the length refers to a number of the allocated physical memory page numbers.

[0075] With the occurrence of a physical memory page fault of the cloud host, a drive required memory space address of the pass-through device allocated to the cloud host and matching a corresponding capacity of the drive required memory space is established, that is, a soft link to be mirrored, that is, a drive required memory space address is established. This conforms to a characteristic of lazy loading memory of the technical solution of the embodiment of the application, that is, a drive required memory space address does not exist by default, so that a physical memory page fault interrupt is generated only when it is first used. Processing of the physical memory page fault interrupt includes establishing a soft link and supplementing corresponding physical memory pages, that is, the cloud host can apply for real physical memory. Then, according to identification information of the pass-through device, the allocated drive required memory space address is associated with a virtual machine hardware address of the cloud host in a memory address mapping column of an intermediate layer data table, to form a memory address mapping relationship. The memory configuration of the DMA of the pass-through device passed through to the cloud host is decoupled from the drive required memory space of the pass-through device initialized when the operating system of the pass-through device is started. The speed of passing through the pass-through device to the cloud host is greatly improved, time is shortened, and user experience is improved.

[0076] Preferably, the virtual layer 21 is configured to:

[0077] Before the first time a request for device pass-through of a cloud host is received, an intermediate layer is created in memory of the pass-through device, and a data table is created 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 save memory configuration of the cloud host.

[0078] By modifying a startup process of an 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 running of the intermediate layer when starting.

[0079] The purpose of creating the intermediate layer is to initialize the memory space required by the driver of the pass-through device according to the marking information of the pass-through device in the memory configuration in the intermediate layer data table during the process of operating system initialization of the virtual layer, and to cause the physical memory page fault interrupt by default according to the configured address of the memory space required by the driver, so as to allocate the memory space required by the driver with a capacity corresponding to the memory space required by the driver to the pass-through device for the cloud host, without configuring the memory space required by the driver and the address in advance, so as to realize the decoupling of the memory configuration of the DMA of the pass-through device given to the cloud host and the initialization of the memory space required by the driver of the pass-through device during the start of the operating system of the pass-through device. The speed of the pass-through device given to the cloud host is greatly improved, the time is shortened, and the user experience is improved.

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

[0081] The device management component 23 is further configured to:

[0082] After setting the address of the memory space required by the driver, 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 according to the identification information of the pass-through device, and the data structure comprises: the address start point and length included in the address of the memory space required by the driver, and the physical memory page number. The data structure is a condition for forming a special memory, and is used for memory index.

[0083] Preferably, the device management component 23 is further configured to:

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

[0085] The data table further comprises: a memory lock description column;

[0086] The device management component 23 is further configured to:

[0087] After forming the memory address mapping relationship, the plurality of physical memory page numbers allocated to the cloud host are recorded at 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, so as to lock the physical memory page numbers and not to be swapped out (such as swapping to swap), and not to delay the swapping of other memories.

[0088] In combination with the embodiments of the present application, a computer readable storage medium is also provided, which stores one or more programs, when executed by a computer device, causes the computer device to perform the memory mapping method of the cloud virtual host of the device pass-through.

[0089] As shown in the embodiments of the present application, a computer device is provided, comprising: Figure 3

[0090] a processor; and a memory arranged to store computer executable instructions, which when executed cause the processor to perform the memory mapping method of the cloud virtual host of the device pass-through.

[0091] The above technical solutions of the embodiments of the present application will be described in detail below in combination with specific application examples, and technical details not introduced in the implementation process can be referred to the related descriptions in the foregoing.

[0092] The embodiments of the present application provide a general method for the fast start of a computing cloud host through the SR-IOV dynamic mapping method.

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

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

[0095] ​Step 2: an input / output memory management unit (IOMMU) establishes and initializes a mapping of device virtual addresses to physical addresses, mapping of interrupts;

[0096] Wherein, step 1 is completed when the virtual machine starts, and the virtual machine needs to scan the entire Address Space space in order to locate the physical address (mapped to the address in the memory) of the hardware device, which results in that the starting process of the system is slow and inflexible, and the binding of the virtual machine and the VFIO device results in that it is difficult to perform other operations, such as live migration. Step 2 is completed after the virtual machine starts.

[0097] In the embodiment of the application, the dynamic mapping method specifically refers to the mapping of the VFIO device to the memory, and on the basis of the VFIO device, 1, a new Memory Map type is provided, and a mirror memory region is further provided in the memory of the pass-through device, the mirror memory region is used for mapping a MemoryRegion of an IOMMU map (an address space of the entire memory space Address Space, which is allocated to the pass-through device), a data table is created in the intermediate layer, and 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 for storing the memory configuration of the cloud host; 2, the starting process of an operating system Guest OS configured with the pass-through device is updated at the same time, so that the Guest OS starting 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 amount of pass-through device memory region, that is, the mirror memory region, so that the intermediate layer mirror memory region can be supported. Therefore, the cloud host only scans the memory space required by the driver used by the pass-through device to the cloud host, and does not scan the entire memory space Address Space of the pass-through device. Therefore, the management of the input / output memory management unit IOMMU on the memory space required by the driver used by the pass-through device to the cloud host is decoupled from the starting stage of the pass-through device operating system Guest OS, that is, the memory configuration of the physical device DMA mapping and the DMA memory space required by the pass-through device operating system (Guest OS) during the starting of the device are decoupled.

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

[0099] 1. Receiving a request for device passthrough of a cloud host, the cloud host synchronously initializing a first virtual device (fireware, i.e., fw_cfg device) during initialization of a virtual layer (Qemu-kvm) process, and the configuration information saved in the fw_cfg device including flag information of an sriov passthrough device in an entry; wherein the entry is memory configuration information (configuration) inside, and the entry records an address space that needs to be mapped by a VFIO device. That is, memory configuration is first performed in the first virtual device, and the memory configuration includes flag information of a passthrough device of the cloud host, and a memory space address and a corresponding capacity required by a driver used by the passthrough device for the cloud host, wherein the memory space address required by the driver configured is default. Then, initialization is performed.

[0100] 2. During initialization of a passthrough device operating system (Guest OS), the corresponding memory space in the passthrough device is initialized according to the flag information saved in the first virtual device (fw_cfg device), specifically, the memory space used by the passthrough device for the cloud host is initialized by using lazy initialization, so that the entire memory space does not need to be initialized. Because a middle layer is provided, the memory space address required by the driver configured for the cloud host in the memory configuration in the middle layer is default, so the actual physical space is not scanned and initialized.

[0101] 3. During initialization of the operating system of the passthrough device in the virtual layer, when a physical memory page fault interrupt occurs due to the default of the memory space address required by the driver configured, a memory space address required by the driver for the cloud host is allocated in the passthrough device, the allocated memory space address required by the driver is associated with a virtual machine hardware address of the cloud host in a memory address mapping column of a middle layer data table, and a memory address mapping relationship is formed. That is, when an EPT (a function of an intel chip, used to assist memory mapping) page fault interrupt occurs, the register information (the register refers to information of a page fault saved in a corresponding register after the page fault interrupt occurs) includes flag marking, so that it is identified that it is an SR-IOV passthrough device, a memory space address required by the driver for the cloud host is allocated in the passthrough device, the allocated memory space address required by the driver is associated with a virtual machine hardware address of the cloud host in a memory address mapping column of a middle layer data table, and a memory address mapping relationship is formed. That is, when an EPT (a function of an intel chip, used to assist memory mapping) page fault interrupt occurs, the register information (the register refers to information of a page fault saved in a corresponding register after the page fault interrupt occurs) includes flag marking, so that it is identified that it is an SR-IOV passthrough device, a memory space address required by the driver for the cloud host is allocated in the passthrough device, the allocated memory space address required by the driver is associated with a virtual machine hardware address of the cloud host in a memory address mapping column of a middle layer data table, and a memory address mapping relationship is formed.

[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, 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 device to the cloud host.

[0103] The management of the intermediate layer mirror memory region and the shadow page table mirror EPT will be explained in detail below:

[0104] I. Initialize the intermediate mirror memory region

[0105] The original virtual machine memory mapping consisted of the following structure: 1. A mapping from virtual memory pages in the guest operating system to the QEMU process, mapping the virtual machine's memory to physical memory. 2. A mapping from the QEMU process to the host's physical memory, allowing access to physical memory. 3. The vfio-iommu driver maintained a page table that mapped device memory to physical memory (device memory refers to the memory used by the device in the guest, and physical memory refers to the corresponding physical memory of the host machine). This page table stored the memory mapping relationship between virtual addresses and physical addresses, assisting in memory mapping.

[0106] In this embodiment of the invention, a shadow page table (mirror EPT) needs to be maintained in the passthrough device driver component (vfio-iommu). The shadow page table is a subset of the EPT and is only used for the relocation of the memory space required by the driver for the passthrough device 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. For example Figure 4 As shown, in this embodiment of the invention, only two memory regions need to be maintained. One memory region is the IO memory region that is originally mapped by DMA, that is, the memory space required by the driver that the passthrough device passes through to the cloud host. Only the memory configuration is performed first. In the memory configuration, the memory space address and corresponding capacity required by the driver that the passthrough device passes through to the cloud host are configured. However, the configured memory space address required by the driver is defaulted. It will be supplemented when the soft link is established during the initialization, that is, when the actual memory space address required by the driver for the cloud host is allocated to the cloud host.

[0108] 2. For example Figure 5As shown, another memory region is the mirror Memory Region, which is used in the EPT page fault interrupt of the virtual cloud host; when the default memory space address of the configured driver causes a physical memory page fault interrupt, the corresponding physical memory page number of the physical memory page fault of the direct memory access (DMA) is queried in the shadow page table maintained by the pass-through device driver component, 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 driver required memory space used by the pass-through device for the cloud host. The driver required memory space address is set by combining the physical memory page numbers allocated to the cloud host, and the driver required memory space address includes an address start point and a length. The address start point refers to the smallest physical memory page number of the allocated physical memory page number, and the length refers to the number of allocated physical memory page numbers.

[0109] As shown in Figure 6 The data of the intermediate layer mirror Memory Region is mainly the driver required memory space address corresponding to the IO memory space of the mirror, that is, a soft link.

[0110] In this way, as the physical memory page fault of the cloud host occurs, the driver required memory space address of the cloud host allocated in the pass-through device is matched with the corresponding capacity of the driver required memory space, that is, the soft link to be mirrored, that is, the driver required memory space address, is established. This conforms to the technical solution of the embodiment of the application, which is the characteristic of lazy loading memory, that is, a driver required memory space address does not exist by default, so a physical memory page fault interrupt is generated only when it is first used. The processing of the physical memory page fault interrupt includes establishing a soft link and supplementing the corresponding physical memory page, that is, the cloud host can apply for real physical memory. Then, according to the identification information of the pass-through device, the allocated driver required memory space address 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-write function of the IO data is completed in the IO memory region.

[0111] After the memory address mapping relationship is formed, the allocated driver required memory space address is supplemented into the driver required memory space address of 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 (service) data when the VF (network card) performs an IO operation) is not used after initialization and the cloud host is identified.

[0113] AsFigure 7 As shown, the entry in the mirror EPT records information such as the memory space address required by the mirror mapping driver, flags, the length of the memory space address required by the driver, and the like. When DMA data read / write of the cloud host occurs, it is unavailable, which indicates that the memory address mapping relationship corresponding to the entry has not been established. When the physical memory page fault interrupt processing is completed, the flags of the page frame number corresponding to the Address Space are marked as available.

[0114] II. Device management component under VFIO device management

[0115] When the memory address mapping relationship of the intermediate layer mirror Memory Region is established after the memory space address required by the driver is set, the corresponding hardware device also needs to be adjusted correspondingly.

[0116] Here, taking Mellanox ConnectX-5 as an example, VFIO enables applications in the user space to access the memory mapped by the network card device DMA, which is shared memory. The memory allocated by the mlx5 driver in the virtual machine (the driver initializes the memory when loaded, because the driver device needs memory for normal operation) needs to be recorded. 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 special memory, which is used for memory indexing. The data structure includes: the address start point and length included in the memory space address required by the driver, and the physical memory page number. As a special memory for the qemu emulated pass-through device mapping, the two (the memory space required by the driver allocated by the mlx5 driver, and the memory corresponding to the virtual machine hardware address of the qemu emulated device, which are shared memory) are associated through the physical memory page number, so that the memory address mapping of the mirror above can be established.

[0117] After the memory address mapping relationship is formed, according to the identification information of the pass-through device, the plurality of physical memory page numbers allocated to the cloud host are recorded in the corresponding position of the memory locking description column of the intermediate layer data table, so as to lock the physical memory page numbers, that is, the pin related operation in VFIO needs to be modified at the same time, when the VFIO driver identifies the corresponding flags mark, the information of the page frame number is recorded, the pin information lost due to DMA in the previous initialization is supplemented and improved, and is put into the corresponding page descriptor (memory locking description). By pinning the memory, the pinned part of the memory cannot be swapped out (such as swapping to swap), and the swapping of other memory is not affected.

[0118] The vfio_dma_map is used for VFIO memory mapping, and belongs to a part of functions of emoryListener, and is used for listening to the change of memory data. Figure 4 As can be seen, in the embodiment of the application, only the IO memory is DMA mapped, and is the memory temporarily pinned by the vfio_pin_pages function, so the range of the memory to be locked is relatively small.

[0119] The beneficial technical effects obtained by the embodiment of the application are as follows:

[0120] In the prior art, in order to provide efficient DMA access in the application layer for the VFIO device pass-through to the virtual machine, all the memory allocated to the virtual machine needs to be locked before the VFIO device is enabled, and the IOMMU page table needs to be created. And the mapping of HVA->HPA IOMMU fixed causes the memory to be unable to balloon.

[0121] In the embodiment of the application, all the virtual machine memory of the pass-through device does not need to be locked, only the fixed memory of the IOMMU mapping needs to be locked, and the process of cloud host startup and initialization no longer depends on the locked pass-through device of the IOMMU, so as to accelerate the startup time of the cloud host, and decouple the shared memory of the operating system Guest OS of the VFIO device and the pass-through device, thereby bringing flexibility to the management of the pass-through device, such as hot migration of the SR-IOV device. Not dependent on specific device manufacturers and device types, simple to use, and consistent operation experience is brought to cloud computing users.

[0122] It should be understood that the particular order in which the steps of processes presented in the disclosure have been presented makes no limitation as to the scope of the disclosure. Based upon the teachings provided herein, one skilled in the art should appreciate that alternative order explanations of various events encompassed by the disclosure can be presented without departing from the scope of the disclosure. Also, the accompanying method claims could follow the teachings of the description of the exemplary methods recited above, although groups of methods are not required to follow this structure.

[0123] In the foregoing detailed description, various features are grouped together in single embodiments for the purpose of streamlining the disclosure. This method of disclosure should not be interpreted as reflecting a necessity to disclose embodiments in accordance with particular combinations of features; other embodiments can include different combinations of the features presented with both other embodiments and the embodiments. The claims define the scope of the disclosure and the disclosure should not be interpreted as being limited to the embodiments that explicitly recited in the claims.

[0124] The foregoing detailed description has set forth various embodiments of the devices and / or processes via the use of specific terminology. However, the embodiments disclosed herein are not intended to be limited to the specific terminology so selected. Rather, the specific terminology used merely arose out of the preference of the skilled artisans and the non-limiting goal of describing the embodiments more detailed. Thus, no limitation on the scope of the disclosure is intended by the use of such specific terminology.

[0125] The foregoing description includes example of one or more embodiments. Of course, not all possible combinations of components or methods described herein can be necessary to practice the application. Additionally, it should be understood that entities described herein might take the form of a software or hardware implementation, or a combination of these. Therefore, embodiments described herein are to be considered in a descriptive sense only and not limiting. Furthermore, while the subject application has been described herein in terms of specific embodiments, it will be apparent to those of ordinary skill in the art that variations of these embodiments can be used and that it is intended to cover such variations as fall within the scope of the claims, including the patentable scope defined by the claims. Therefore, the specification and drawings are to be regarded in an illustrative rather than a restrictive sense.

[0126] Those skilled in the art will also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention can be implemented by electronic hardware, computer software, or a combination of both. To clearly demonstrate the interchangeability of hardware and software, the functions of the various illustrative components, units, and steps described above have been generally described. Whether such functionality is implemented through hardware or software depends on the specific application and the overall system design requirements. Those skilled in the art can implement the described functions using various methods for each specific application, but such implementation should not be construed 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 this invention can be implemented or operate the described functions using a general-purpose processor, digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof. The general-purpose processor can be a microprocessor; alternatively, it can be any conventional processor, controller, microcontroller, or state machine. The processor can also be implemented using a combination of computing devices, such as a digital signal processor and a microprocessor, multiple microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.

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

[0129] In one or more exemplary designs, the functions described can be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions can be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. Storage media can be any available media that can be accessed by a computer. By way of example, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or other wire-based, fiber- optic based, or wireless based communications, then the coaxial cable, fiber optic cable, twisted pair, DSL, or other wire-based, fiber-optic based, or wireless based communications are included in the definition of medium. Disk and disc, as used herein, includes compact disc (CD), laser disc, optical disc, DVD, floppy disk, and Blu-ray® disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0130] The above description is provided as an example only and is not intended to limit the scope of the present application.

Claims

1. A dynamic mapping method for a cloud host with a pass-through device, characterized in that, include: The system receives a request to pass through a cloud host. During the initialization of the cloud host, it synchronously initializes a first virtual device through a virtual layer. The first virtual device is used to obtain the memory configuration of the cloud host. The memory configuration includes: the marking information of the pass-through device of the cloud host, and the memory space address and corresponding capacity required by the driver that the pass-through device passes through to the cloud host. The memory space address required by the configured driver is defaulted. During the virtual layer's operating system initialization process for the pass-through device, the corresponding memory space within the pass-through device is initialized according to the device's tagging information. When a physical memory page fault occurs due to the default memory space address required by the configured driver, the cloud host is allocated a memory space address that matches the corresponding capacity of the memory space required by the driver within the passthrough 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. When the cloud host is running, the memory address mapping relationship corresponding to the cloud host is obtained from the memory address mapping column of the intermediate layer data table. According to the memory space address required by the driver in the memory address mapping relationship, the corresponding memory space is requested in the pass-through device to realize the pass-through device to the cloud host.

2. The dynamic mapping method for cloud hosts with pass-through devices according to claim 1, characterized in that, When a physical memory page fault occurs due to a default memory space address required by the configured driver, the passthrough device allocates a memory space address for the cloud host that matches the corresponding capacity of the memory space required by the driver. The allocated memory space address is then associated with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table, forming a memory address mapping relationship. This includes: When a physical memory page fault occurs due to the default memory space address required by the configured driver, the physical memory page number of the passthrough device is queried from the shadow page table maintained by the passthrough device driver component. At least one physical memory page number of the passthrough device is allocated 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 passed through by the passthrough device to the cloud host. The memory space address required by the driver is set in combination with the physical memory page number allocated to the cloud host. The memory space address required by the driver includes the address start point and the length. The address start point refers to the smallest physical memory page number of the allocated physical memory page number, and the length refers to the number of allocated physical memory page numbers. Based on the identification information of the pass-through device, the memory space address required by the allocated 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 for a cloud host with a pass-through device according to claim 2, characterized in that, The method further includes: Before receiving the first request for device passthrough to the cloud host, an intermediate layer is created in the memory of the passthrough device, and a data table is created in the intermediate layer. The data table includes at least: a tag information column, a memory configuration column of the cloud host, and a memory mapping column. The memory configuration column is used to store the memory configuration of the cloud host. By modifying the boot process of the operating system of the passthrough device, the intermediate layer is added to the boot process of the operating system of the passthrough device, so that the operating system of the passthrough device supports the operation of the intermediate layer when it starts up.

4. The dynamic mapping method for 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 includes: 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 the corresponding position of the memory index column of the data table according to the identification information of the pass-through device. The data structure includes: the starting point and length of the address included in the memory space address required by the driver, and the physical memory page number.

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

6. The dynamic mapping method for 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 includes: After the memory address mapping relationship is formed, based on the identification information of the pass-through device, multiple physical memory page numbers allocated to the cloud host are recorded in the corresponding position of the memory lock description column of the intermediate layer data table 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: The virtual layer is used to receive requests for device pass-through to the cloud host. During the initialization of the cloud host, the first virtual device is initialized synchronously through the virtual layer. The first virtual device is used to obtain the memory configuration of the cloud host. The memory configuration includes: the marking information of the pass-through device of the cloud host, and the memory space address and corresponding capacity required by the driver used by the pass-through device to pass through to the cloud host. The memory space address required by the configured driver is defaulted. The passthrough device initialization unit is used to initialize the corresponding memory space within the passthrough device according to the marking information of the passthrough device during the initialization of the operating system of the passthrough device in the virtual layer; when a physical memory page fault occurs due to the default memory space address required by the configured driver, the unit allocates a driver-required memory space address within the passthrough device to the cloud host that matches the corresponding capacity of the driver-required memory space. The device management component is used to associate the memory space address required by the allocated driver with the virtual machine hardware address of the cloud host in the memory address mapping column of the intermediate layer data table, so as to form a memory address mapping relationship. The pass-through unit is used to obtain the memory address mapping relationship corresponding to the cloud host from the memory address mapping column of the intermediate layer data table when the cloud host is running, and to 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 device to the cloud host.

8. The dynamic mapping system for a cloud host with a pass-through device according to claim 7, characterized in that, The pass-through device initialization unit is specifically used for: When a physical memory page fault occurs due to the default memory space address required by the configured driver, the physical memory page number of the passthrough device is queried from the shadow page table maintained by the passthrough device driver component. At least one physical memory page number of the passthrough device is allocated 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 passed through by the passthrough device to the cloud host. The memory space address required by the driver is set based on the physical memory page number allocated to the cloud host. The memory space address required by the driver includes an address start point and a length. The address start point refers to the smallest physical memory page number among the allocated physical memory page numbers, and the length refers to the number of allocated physical memory page numbers.

9. A computer-readable storage medium storing one or more programs, which, when executed by a computer device, cause the computer device to perform the dynamic mapping method for 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 perform the dynamic mapping method of 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