A GPU virtual sharing system based on multi-system isolation
By dividing the system into GPU control domain and GPU application domain, and using VFIO transmissive transmission technology, the problem of virtual GPUs generating a large number of interrupts and massive data transmission between multiple isolated operating systems is solved, achieving more efficient GPU resource management and lower error rate.
Patent Information
- Application Number
- CN202411697419.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-26
AI Technical Summary
In the prior art, virtual GPUs between multiple isolated operating systems generate large amounts of interruptions, massive data transmission, and high error rate of multiple isolated operating systems.
By dividing multiple isolation systems into GPU control domain and GPU application domain, the GPU control domain is used to manage GPU hardware resources, and the GPU application domain is used to request GPU hardware resources. The GPU control module receives application data packets from the GPU application domain, determines whether there are free resources, and allocates resources to update the description file and linked list. Use VFIO transmissive transmission technology to directly allocate GPU hardware resources to reduce data transmission and interruption.
It effectively reduces the pressure of data communication and interrupt processing between isolation systems, reduces the delay in GPU data processing, improves real-time, and reduces the error rate and difficulty of use.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of GPU sharing, and in particular to a GPU virtual sharing system based on multi-system isolation. Background Art
[0002] In recent years, with the development of CPU multi-core technology, it has become increasingly common to isolate different cores and hardware resources on a CPU to run different operating systems. Hardware isolation methods such as Jailhouse use virtualized hardware isolation methods to isolate multiple system domains on a multi-core SOC to run different systems. At the same time, through transparent transmission technology, each system domain can access the same hardware device physical address.
[0003] During virtualization, the GPU can be isolated to a certain system domain, and other system domains can use the GPU in a simulated sharing manner. However, simulating the sharing of GPU devices between system domains requires the use of interrupts, and the use of GPUs involves a large amount of data input and output. At the same time, massive data transmission will trigger a large number of interrupts, which undoubtedly greatly increases the pressure on data communication and interrupt processing between isolated systems. In addition, additional data transmission and reception will be added between the two system domains using the GPU, which reduces the real-time performance of GPU data processing and increases useless data transmission in the middle. At the same time, if multiple GPUs are used, different system domains have different support functions for the GPU, which greatly increases the difficulty of use and the error rate. Summary of the invention
[0004] The embodiment of the present invention provides a GPU virtual sharing system based on multi-system isolation to solve the technical problems in the prior art of a large number of interrupts generated by virtual GPUs between multiple isolated operating systems, massive data transmission, and high error rate when multiple isolated operating systems share a GPU.
[0005] An embodiment of the present invention provides a GPU virtual sharing system based on multi-system isolation, including:
[0006] A GPU control domain, wherein the GPU control domain is used to manage the usage of GPU hardware resources;
[0007] A GPU application domain, wherein the GPU application domain is used to request GPU hardware resources for temporary use by the domain;
[0008] The GPU control domain includes:
[0009] A GPU control description file, wherein the GPU control description file is used to describe hardware information of GPU hardware resources and a result of allocating GPU hardware resources;
[0010] GPU control description information linked list, used to describe the GPU hardware resource information used by each GPU application domain;
[0011] A GPU control module, the GPU control module is used to receive a GPU application data packet sent by a GPU application domain, and determine whether there are resources corresponding to the application data packet based on the GPU application data packet and the GPU control description file; if so, allocate idle GPU hardware resources to the GPU application domain, return a GPU hardware resource allocation data packet to the GPU application domain, and update and maintain the GPU control description information chain and the GPU control description file based on the GPU application data packet; receive a GPU setting data packet sent by the GPU application domain, set the allocated GPU hardware resources based on the GPU setting data packet, send a setting success data packet to the GPU application domain after the setting is successful, and send a setting failure command packet to the GPU application domain after the setting fails.
[0012] Furthermore, the GPU application domain includes:
[0013] A GPU application description file, wherein the GPU application description file is used to describe the allocated GPU hardware resource information;
[0014] A GPU application description information linked list, wherein the GPU application description information linked list is used to describe the GPU hardware resource application information of the GPU application domain;
[0015] A GPU application module, wherein the GPU application module is used to send a GPU hardware resource application data packet to a GPU control module of a GPU control domain, and update a GPU application description information linked list according to a GPU hardware resource allocation data packet returned by the GPU control module, so that the GPU application domain has the corresponding GPU hardware resource usage authority and directly uses the corresponding GPU hardware resources using VFIO; and
[0016] A GPU setting data packet is sent to the GPU control module of the GPU control domain, requesting the GPU control module to set the allocated GPU hardware resources according to the setting information; after receiving the setting success data packet sent by the GPU control module, the GPU hardware resources set by the GPU control domain are used according to the setting information; after receiving the setting failure data packet, the GPU application module throws a setting error message.
[0017] Furthermore, the GPU control description information linked list includes: linked list nodes, each linked list node corresponding to a description of a GPU application domain applying for the use of GPU hardware resources;
[0018] The linked list nodes include:
[0019] Information about the system domain corresponding to the allocated GPU hardware resources;
[0020] The permissions of the allocated GPU hardware resources relative to the allocated system domain;
[0021] A system domain structure of allocated GPU hardware resources, the structure comprising: GPU computing resources divided and managed by the GPU control module using GPU pooling technology, and a GPU display interface;
[0022] And a pointer to the system domain structure corresponding to the next allocated GPU hardware resource.
[0023] Furthermore, the GPU application description information linked list includes:
[0024] At least one node, each node represents information of a GPU control domain that can use GPU hardware resources;
[0025] The nodes include:
[0026] Information about the GPU control domain where the allocated GPU hardware resources are located;
[0027] Permissions for allocated GPU hardware resources; System domain structure for allocated GPU hardware resources;
[0028] And a pointer to a GPU control domain structure corresponding to the next allocated GPU hardware resource, wherein the pointer points to another GPU control domain.
[0029] Furthermore, the GPU control module is also used for:
[0030] When the GPU application domain actively releases GPU hardware resources, the GPU control module receives and parses the GPU hardware resource release data packet, recycles the released GPU hardware resources according to the parsing result, and updates the GPU control description information linked list and the GPU control description file according to the recycled and released information.
[0031] Furthermore, the simulation module also includes:
[0032] The simulation unit is used to call the driver interface of the slave system domain to process the USB device packet when it is determined to be a USB interface peripheral through the simulation device chain list, so as to obtain the peripheral driver device stream from the slave system domain.
[0033] Furthermore, the GPU application module is also used for:
[0034] When it is determined that the application domain has completed the allocated GPU hardware resources, a hardware resource release data packet is sent to the GPU control module, and a hardware resource recovery data packet is received and parsed, and the GPU application description information linked list and the GPU application description file are updated according to the parsing result.
[0035] Furthermore, the GPU control module is also used for:
[0036] When there is no corresponding resource, the occupied application domain corresponding to the corresponding resource in the GPU application description information linked list is searched, and a GPU hardware resource release request data packet is sent to the occupied application domain.
[0037] Furthermore, the GPU control module of the GPU control domain and the GPU application module of the GPU application domain communicate through a shared memory, and a corresponding interrupt will be triggered after data is written into the shared memory.
[0038] Furthermore, the GPU application domain is also used for:
[0039] Actively send GPU hardware resource usage data packets to obtain the GPU hardware resource information and corresponding permissions of the corresponding GPU control domain.
[0040] Furthermore, when its own resources do not meet the requirements, the GPU control domain can apply for GPU hardware resources from other GPU control domains that have GPU hardware resources;
[0041] Correspondingly, when the GPU application domain has GPU hardware resources, the GPU application domain can be used as a GPU control domain that provides services to other GPU application domains. The GPU virtual sharing system based on multi-system isolation provided by the embodiment of the present invention divides multiple isolated systems into a GPU control domain and a GPU application domain, wherein the GPU control domain is used to manage the usage of GPU hardware resources; a GPU application domain, wherein the GPU application domain is used to request GPU hardware resources for temporary use by the domain; the GPU control domain includes: a GPU control description file, wherein the GPU control description file is used to describe the hardware information of the GPU hardware resources and the result of allocating GPU hardware resources; a GPU control description information chain table, wherein the GPU control description information chain table is used to describe the GPU hardware resource information used by each GPU application domain; a GPU control module, wherein the GPU control module is used to receive a GPU application data packet sent by the GPU application domain, and determine whether there are resources corresponding to the application data packet according to the GPU application data packet and the GPU control description file, and if there are resources corresponding to the application data packet, allocate idle GPU hardware resources to the GPU application domain, return a GPU hardware resource allocation data packet to the GPU application domain, and update and maintain the GPU control description information chain and the GPU control description file according to the GPU application data packet. When the GPU resources of the GPU control domain meet the GPU application domain GPU's request, the GPU control domain can transparently transmit the corresponding GPU hardware resources to the GPU application domain through VFIO, avoiding large amounts of data transmission and massive interruptions during use. And because the GPU resources are uniformly managed by the GPU control domain according to the GPU use request, the error rate and difficulty of use are reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0043] Figure 1 It is a structural diagram of a GPU virtual sharing system based on multi-system isolation provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0045] Figure 1 is a schematic diagram of the structure of a GPU virtual sharing system based on multi-system isolation provided by an embodiment of the present invention, see Figure 1, the GPU virtual sharing system based on multi-system isolation may include: a GPU control domain, the GPU control domain is used to manage the use of GPU hardware resources; a GPU application domain, the GPU application domain is used to request GPU hardware resources for temporary use in this domain; the GPU control domain includes: a GPU control description file, the GPU control description file is used to describe the hardware information of GPU hardware resources and the result of allocating GPU hardware resources; a GPU control description information chain table, which is used to describe the GPU hardware resource information used by each GPU application domain; a GPU control module, the GPU control module is used to receive a GPU application data packet sent by the GPU application domain, and determine whether there are resources corresponding to the application data packet based on the GPU application data packet and the GPU control description file. If there are resources, allocate idle GPU hardware resources to the GPU application domain, return a GPU hardware resource allocation data packet to the GPU application domain, and update and maintain the GPU control description information chain and the GPU control description file based on the GPU application data packet. And
[0046] Receive a GPU setting data packet sent by the GPU application domain, set the allocated GPU hardware resources according to the GPU setting data packet, send a setting success data packet to the GPU application domain after the setting is successful, and send a setting failure command packet to the GPU application domain after the setting fails.
[0047] In this embodiment, the isolation system may be a system that isolates different hardware resources on the same multi-core CPU to run multiple different operating systems. This includes: a master system and a slave system, and the slave system may be multiple. In this embodiment, the GPU control domain may be a master system or a slave system that has GPU hardware resources, and the GPU application domain may be a master system or a slave system that needs to apply for the use of GPU hardware resources. Furthermore, there may be multiple GPU control domains, and accordingly, there may also be multiple GPU application domains.
[0048] The GPU control domain is used to manage the use of GPU hardware resources. For example, GPU hardware resources can be allocated to the GPU control domain. Therefore, the GPU control domain can directly use the GPU hardware resources. Correspondingly, other domains that apply for GPU hardware resources from the GPU control domain are GPU application domains, which send requests to the corresponding GPU control domain and use the GPU hardware resources allocated by the GPU control domain from the GPU control domain using the VFIO transparent transmission method.
[0049] The GPU control module is the core component of the GPU control domain. It has the ability to manage GPU hardware. For example, the GPU control module can realize the hardware resources of the GPU device segmentation and share the segmented GPU hardware resources to different system domains; and can set permissions for the segmented GPU hardware resources to control whether other system domains can use the corresponding GPU hardware resources. The corresponding permissions include read-only permissions, read-write permissions, control permissions, etc. With read-only permissions, other system domains can only read the corresponding GPU hardware resource data; with read-write permissions, other system domains can read and write the corresponding GPU hardware resource data; with control permissions, other system domains can control the corresponding GPU hardware resources to complete more complex tasks.
[0050] The CPU control module can load and initialize the GPU device according to the GPU control description file. Among them, one of the functions of the GPU control description file is used to describe the GPU hardware resource information, for example: describing which GPU devices the GPU control module can load. After completing the initialization of the GPU device, the GPU control domain can use the GPU hardware resources. And the CPU control module can be used to provide the GPU application domain with the corresponding GPU hardware resources. Create and maintain a GPU control description information linked list. The GPU application description information linked list is used to describe the GPU hardware resource application information of the GPU application domain.
[0051] Exemplarily, the GPU control description information linked list is a linked list structure, wherein each linked list node corresponds to a description of a GPU application domain applying for the use of GPU hardware resources. Among them, it may include: hardware resource information for describing GPU allocation, which may include: GPU computing resources divided and managed by the GPU control module using GPU pooling technology, and GPU display interface description of the hardware display interface resources provided by the GPU device, such as HDMI, VGA, DP and other hardware display interfaces. And a pointer to the system domain structure corresponding to the next allocated GPU hardware resource, so as to facilitate the search for the next system domain of the CPU control module, so as to fully understand the allocation results and remaining resources of the GPU hardware resources.
[0052] Exemplarily, the GPU control description information linked list example is as follows:
[0053] typedef struct control_domain_g{
[0054] uint_32_t os; / / Corresponding to the system domain
[0055] uint_8_t limit; / / Corresponding GPU hardware resource permissions
[0056] struct computing_unit *gpu_unit; / / GPU computing unit structure
[0057] struct display_dev *gpu_dev; / / GPU hardware display interface
[0058] struct control_domain_g *next; / / Pointer to the next system domain GPU resource structure
[0059] } control_domain_t;
[0060] The GPU control module can receive the GPU application data packet sent by the GPU application domain, parse the GPU application data packet, obtain the corresponding GPU hardware resources, and determine whether the idle GPU hardware resources meet the request of the GPU application domain. If satisfied, the GPU control module allocates the corresponding GPU hardware resources to the GPU application domain, and sends a GPU hardware resource allocation data packet to the GPU application domain. So that the GPU application domain can use the allocated GPU hardware resources. And based on the above allocation information as a new linked list node, write it into the GPU control description information linked list. And the corresponding allocation information, that is, the corresponding relationship between the allocated GPU hardware resources and the GPU application domain, and describe the GPU hardware resource partitioning method and the GPU application domain's use rights of the allocated GPU hardware resources.
[0061] When the requirements cannot be met, the GPU control module sends a GPU hardware resource recovery packet to the GPU application domain that occupies the resource, receives and parses the GPU hardware resource release packet returned by the GPU application domain, and then recovers the corresponding GPU hardware resources and updates the GPU control description information linked list. For example, the corresponding node can be deleted and the pointer related to it can be modified.
[0062] If no GPU hardware resource release data packet is received, it will not be recycled temporarily. In addition, when the GPU application domain has completed the use of the allocated GPU hardware resources, it needs to actively release the GPU hardware resources and actively send a GPU hardware resource release data packet. The GPU control module receives the GPU hardware resource release data packet and parses it, then recycles the corresponding GPU hardware resources and updates the GPU control description information linked list. During this process, the corresponding GPU application domain of the relevant GPU hardware resources cannot access the above resources. The above processed information is synchronously updated to the GPU control description file. This is convenient for the initialization of the GPU control module after starting or restarting.
[0063] In addition, the GPU control module can also receive a GPU setting data packet sent by the GPU application domain, set the allocated GPU hardware resources according to the GPU setting data packet, send a setting success data packet to the GPU application domain after the setting is successful, and send a setting failure command packet to the GPU application domain after the setting fails. In this embodiment, the GPU application domain can select the corresponding library according to the needs of its own tasks to perform various calculations with the help of the GPU's computing power. Exemplarily, when the GPU application domain needs to use the GPU with the help of the OpenGL library to complete image drawing and rendering, a setting data packet can be issued according to the function characteristics of the OpenGL library, and after the GPU control module is successfully set, a setting success data packet is returned to it, so that the GPU application domain can better use the allocated GPU resources for calculation according to the hardware settings. Exemplarily, the GPU control module can use GPU hardware resources by calling OpenGl, OpenCL, FFmpeg, GStreamer, Mesa and other libraries.
[0064] Correspondingly, the GPU application domain includes: a GPU application description file, which is used to describe GPU hardware resource information; a GPU application description information linked list, which is used to describe the GPU hardware resource application information of the GPU application domain; a GPU application module, which is used to send a GPU hardware resource application data packet to the GPU control module of the GPU control domain, and update the GPU application description information linked list according to the GPU hardware resource allocation data packet returned by the GPU control module, so that the GPU application domain has the corresponding GPU hardware resource usage rights, and uses VFIO to directly use the corresponding GPU hardware resources. Corresponding permissions include read-only permissions, read-write permissions, control permissions, etc. A GPU application domain with read-only permissions can only read the corresponding GPU hardware resource data; a GPU application domain with read-write permissions can read and write the corresponding GPU hardware resource data; a GPU application domain with control permissions can control the corresponding GPU hardware resources to complete more complex tasks.
[0065] In this embodiment, the GPU application module is the core component of the GPU application domain. Specifically, the GPU application module is used to generate a GPU application data packet according to the computing requirements of the system domain, and send the GPU application data packet to the GPU control module of the corresponding GPU control domain, wherein the corresponding GPU control domain can be single or multiple, determined according to the computing requirements and multi-system settings. After receiving the GPU application data packet, the GPU control module of the GPU control domain can determine whether its requirements can be met according to the current hardware resource information, and when it is determined that it can be met, allocate idle GPU hardware resources to the GPU application domain. And return a GPU application confirmation data packet to the GPU application module according to the allocation information. The GPU application module receives and parses the GPU application confirmation data packet, and writes the allocated GPU hardware resources into the GPU application description file according to the parsing result of the GPU application confirmation data packet. The GPU application module is initialized according to the GPU application description file, and a corresponding GPU application description information linked list is created. Initialization is equivalent to mounting the corresponding GPU hardware for the GPU application domain, so as to facilitate the direct use of the allocated GPU hardware resources using the transparent transmission technology in the later stage. Furthermore, the GPU application module can also send a GPU setting data packet to request the GPU control module of the GPU control domain to set the GPU hardware resources allocated to the GPU application domain. After the GPU application module receives the setting success data packet sent by the GPU control domain, it uses the GPU hardware resources allocated and set by the GPU control domain according to the setting information. After receiving the setting failure data packet, the GPU application module throws a setting error message. The setting data packet may include: information for directly configuring the allocated GPU hardware resources, or providing corresponding configuration description information, so that the GPU control module can configure the allocated GPU hardware resources according to the configuration description information using the corresponding configuration information provided by itself, so as to reduce the transmission of data.
[0066] In this embodiment, the GPU application description information linked list is also a linked list structure, including at least one node, each node represents the information of a GPU control domain that can use GPU hardware resources. Exemplarily, each node may include: information about the GPU control domain where the allocated GPU hardware resources are located, permissions for the allocated GPU hardware resources, and a system domain structure of the allocated GPU hardware resources, which is used to describe the hardware resource information allocated by the GPU. It may include: GPU computing resources that are divided and managed by the GPU control module using GPU pooling technology; and hardware display interface resources provided by the GPU hardware device, as well as a pointer to the GPU control domain structure corresponding to the next allocated GPU hardware resource, so as to facilitate the use of multiple divided GPU resources for calculation, wherein the divided GPU resources may be in one or more GPU control domains.
[0067] Exemplarily, the GPU application description information chain is shown as follows:
[0068] typedef struct apply_domain_g{
[0069] uint_32_t os; / / Corresponding to the system domain
[0070] uint_8_t limit; / / Corresponding GPU hardware resource permissions
[0071] struct computing_unit *gpu_unit; / / GPU computing unit structure
[0072] struct display_dev *gpu_dev; / / GPU hardware display interface
[0073] struct apply_domain_g *next; / / Pointer to the next system domain GPU resource structure
[0074] } apply_domain_t;
[0075] In addition, the GPU application description file may be updated and maintained according to the applied GPU hardware resources, so as to facilitate initialization using the updated GPU application description file after the GPU application domain is restarted.
[0076] When the GPU application domain completes the use of the allocated GPU hardware resources, the GPU application module can send a GPU hardware resource release data packet to the GPU control module of the allocated GPU hardware resources. The GPU control module receives and parses the GPU hardware resource release data packet, and then reclaims the corresponding GPU hardware resources. The GPU application module updates the GPU application description information linked list accordingly, and illustratively, the corresponding node can be deleted. When there are GPU hardware resources using multiple GPU control modules, the corresponding pointer is modified according to the completion of the use.
[0077] In addition, the GPU application module can also receive a GPU hardware resource release request data packet, parse the GPU hardware resource release request data packet, determine whether the GPU hardware resources in the GPU hardware resource release data packet have been used up, and return the GPU hardware resource release data packet to the GPU control module when the use is completed, so that the GPU control module can release and recycle the corresponding GPU hardware resources. Otherwise, no action is required.
[0078] In this embodiment, the GPU control domain and the GPU application domain can communicate through shared memory, and when data is written in the shared memory, the receiver generates a soft interrupt to process it. Compared with the traditional method, the number of interrupts is significantly reduced, and the real-time performance of GPU data processing will not be affected.
[0079] In addition, in this embodiment, the roles of the GPU control domain and the GPU application domain are not fixed. For example, the GPU control domain may also be provided with a GPU application module, a GPU application description file, and a GPU application description information linked list. GPU hardware resources of other system domains may be used. Correspondingly, the GPU application domain may also be provided with a GPU control module, a GPU control description file, and a GPU control description information linked list to provide GPU hardware resources for other system domains.
[0080] The following further describes the working process of the GPU virtual sharing system based on multi-system isolation provided in this embodiment.
[0081] First, jailhouse can be used to isolate the Soc system into multiple systems, and according to the settings of GPU hardware resources, GPU application domain and GPU control domain can be set. Among them, GPU control domain, the GPU control domain is used to manage the use of GPU hardware resources; GPU application domain, the GPU application domain is used to request GPU hardware resources for temporary use of this domain. Each system domain runs the corresponding operating system such as Linux, rtos (Real Time Operate System) and other operating systems separately, and the GPU device is transparently transmitted from the GPU control domain to the GPU application domain through the hardware transparent transmission method, so that the GPU control domain and the GPU application domain can share and directly access the GPU physical device resources.
[0082] After setting the GPU control domain and GPU application domain, the GPU control module in the GPU control domain is initialized using the GPU hardware information described in the GPU control description file, so that the GPU control module determines which GPU hardware devices can be loaded and the various characteristics of the hardware devices. The GPU control module can also be generated according to the description of the GPU control description file and maintained in real time. The GPU hardware resources corresponding to each system domain are described separately by the GPU control description information linked list.
[0083] Correspondingly, in the GPU application domain, the GPU application module is initialized according to the GPU application description file, wherein the GPU application description file first describes the current system domain as the GPU application domain.
[0084] After the GPU application domain and the GPU control domain are initialized, the GPU application domain sends a GPU hardware resource application data packet to the GPU control module of the GPU control domain according to the hardware resources required by the system. The GPU control module receives the GPU application data packet from the GPU application module of the GPU application domain. If there are idle GPU hardware resources, the corresponding GPU hardware resources are allocated to the GPU application domain, and a GPU hardware resource allocation data packet is sent to the GPU application domain, so that the GPU application domain can directly use the relevant GPU hardware resources using the transparent transmission technology. The GPU control module updates the GPU control description file, which can specifically describe the mapping relationship between the allocated GPU hardware resources and the application domain. It also describes the GPU hardware resource partitioning method, the corresponding GPU hardware resource usage permissions for different system domains, and GPU hardware resource sharing related information. At the same time, the GPU control description information linked list is updated and maintained based on the above allocation information.
[0085] If the GPU application domain successfully applies for GPU hardware resources and receives the GPU hardware resource allocation data packet, it will update the GPU application description information list, obtain the corresponding GPU hardware resource usage rights, and generate a GPU application description file. The GPU application domain can use the VFIO transparent transmission technology to directly use the allocated GPU hardware resources to achieve a similar effect of using its own GPU resources. The GPU application module can actively send GPU hardware resource usage data packets to obtain the GPU hardware resource information and corresponding permissions of the corresponding GPU control domain.
[0086] When it is necessary to reclaim the GPU hardware resources allocated to the GPU application domain, the GPU control module sends a GPU hardware resource reclaiming data packet to the GPU application module of the GPU application domain, and the GPU application module detects whether the corresponding GPU hardware resources can be released; when the corresponding GPU hardware resources are idle and can be released by the GPU application domain, the GPU control module successfully reclaims the hardware resources, and the GPU control module adds the relevant GPU hardware information to the GPU control description information linked list; when the corresponding GPU hardware resources cannot be released when being used by the GPU application domain, the GPU control module fails to reclaim the hardware resources and does not process the GPU hardware resources.
[0087] When the GPU application domain actively releases GPU hardware resources, the GPU control module receives and parses the GPU hardware resource release data packet, then reclaims the corresponding GPU hardware resources and adds the relevant GPU hardware information to the GPU control description information linked list. The results of GPU hardware resource allocation and recycling are synchronously updated to the GPU control description file and the GPU application description file.
[0088] When the GPU application domain lacks GPU-related software libraries, the GPU application module of the GPU application domain can send a GPU setting data packet to the GPU control domain to request the GPU control module of the GPU control domain to set the GPU hardware resources allocated to the GPU application domain; the GPU control module of the GPU control domain receives the GPU setting data packet sent by the GPU application domain, sets the GPU hardware resources allocated to the GPU application domain according to the GPU setting data packet, sends a setting success data packet containing setting success information to the GPU application module of the GPU application domain after the GPU control module successfully sets the GPU hardware resources, and sends a setting failure command packet containing error information to the GPU application module of the GPU application domain after the setting fails; after the GPU application module receives the setting success data packet sent by the GPU control domain, uses the GPU hardware resources allocated and set by the GPU control domain according to the setting information, and throws out a setting error message after receiving the setting failure data packet.
[0089] By using the above method, GPU hardware resources can be effectively managed and reasonably allocated, so that each application domain can use GPU hardware resources.
[0090] The GPU virtual sharing system based on multi-system isolation provided in this embodiment divides multiple isolated systems into a GPU control domain and a GPU application domain, wherein the GPU control domain is used to manage the usage of GPU hardware resources; a GPU application domain, wherein the GPU application domain is used to request GPU hardware resources for temporary use in this domain; the GPU control domain includes: a GPU control description file, wherein the GPU control description file is used to describe the hardware information of the GPU hardware resources and the result of allocating the GPU hardware resources; a GPU control description information chain table, wherein the GPU control description information chain table is used to describe the GPU hardware resource information used by each GPU application domain; a GPU control module, wherein the GPU control module is used to receive a GPU application data packet sent by the GPU application domain, and to determine whether there are resources corresponding to the application data packet according to the GPU application data packet and the GPU control description file, and when there are resources corresponding to the application data packet, to allocate idle GPU hardware resources to the GPU application domain, to return a GPU hardware resource allocation data packet to the GPU application domain, and to update and maintain the GPU control description information chain and the GPU control description file according to the GPU application data packet. When the GPU resources meet the request of the GPU in the GPU application domain, the GPU control domain can transparently transmit the corresponding GPU hardware resources to the GPU application domain through VFIO to avoid large amounts of data transmission and massive interruptions during use. Furthermore, since GPU resources are uniformly managed by the GPU control domain according to GPU usage requests, the error rate and usage difficulty are reduced.
[0091] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A GPU virtual sharing system based on multi-system isolation, characterized in that: include: A GPU control domain, wherein the GPU control domain is used to manage the usage of GPU hardware resources; A GPU application domain, wherein the GPU application domain is used to request GPU hardware resources for temporary use by the domain; The GPU control domain includes: A GPU control description file, wherein the GPU control description file is used to describe hardware information of GPU hardware resources and a result of allocating GPU hardware resources; GPU control description information linked list, used to describe the GPU hardware resource information used by each GPU application domain; a GPU control module, the GPU control module being used to receive a GPU application data packet sent by a GPU application domain, and determine whether there are resources corresponding to the application data packet according to the GPU application data packet and the GPU control description file, and if so, allocate idle GPU hardware resources to the GPU application domain, return a GPU hardware resource allocation data packet to the GPU application domain, and update and maintain the GPU control description information chain and the GPU control description file according to the GPU application data packet; and Receive a GPU setting data packet sent by the GPU application domain, set the allocated GPU hardware resources according to the GPU setting data packet, send a setting success data packet to the GPU application domain after the setting is successful, and send a setting failure command packet to the GPU application domain after the setting fails; The GPU application domain includes: A GPU application description file, wherein the GPU application description file is used to describe the allocated GPU hardware resource information; A GPU application description information linked list, wherein the GPU application description information linked list is used to describe the GPU hardware resource application information of the GPU application domain; A GPU application module, wherein the GPU application module is used to send a GPU hardware resource application data packet to a GPU control module of a GPU control domain, and update a GPU application description information linked list according to a GPU hardware resource allocation data packet returned by the GPU control module, so that the GPU application domain has the corresponding GPU hardware resource usage authority and directly uses the corresponding GPU hardware resources using VFIO; and A GPU setting data packet is sent to the GPU control module of the GPU control domain, requesting the GPU control module to set the allocated GPU hardware resources according to the setting information; after receiving the setting success data packet sent by the GPU control module, the GPU hardware resources set by the GPU control domain are used according to the setting information; after receiving the setting failure data packet, the GPU application module throws a setting error message.
2. The system according to claim 1, characterized in that The GPU control description information linked list includes: linked list nodes, each linked list node corresponding to a description of a GPU application domain applying for the use of GPU hardware resources; The linked list nodes include: Information about the system domain corresponding to the allocated GPU hardware resources; The permissions of the allocated GPU hardware resources relative to the allocated system domain; A system domain structure of allocated GPU hardware resources, the structure comprising: GPU computing resources divided and managed by the GPU control module using GPU pooling technology, and a GPU display interface; And a pointer to the system domain structure corresponding to the next allocated GPU hardware resource.
3. The system according to claim 2, characterized in that The GPU application description information linked list includes: At least one node, each node represents information of a GPU control domain that can use GPU hardware resources; The nodes include: Information about the GPU control domain where the allocated GPU hardware resources are located; Permissions for allocated GPU hardware resources; System domain structure for allocated GPU hardware resources; And a pointer to a GPU control domain structure corresponding to the next allocated GPU hardware resource, wherein the pointer points to another GPU control domain.
4. The system according to claim 1, characterized in that The GPU control module is also used for: When the GPU application domain actively releases GPU hardware resources, the GPU control module receives and parses the GPU hardware resource release data packet, recycles the released GPU hardware resources according to the parsing result, and updates the GPU control description information linked list and the GPU control description file according to the recycled and released information.
5. The system according to claim 4, characterized in that The GPU application module is also used for: When it is determined that the application domain has completed the allocated GPU hardware resources, a hardware resource release data packet is sent to the GPU control module, and a hardware resource recovery data packet is received and parsed, and the GPU application description information linked list and the GPU application description file are updated according to the parsing result.
6. The system according to claim 5, characterized in that The GPU control module is also used for: When there is no corresponding resource, the occupied application domain corresponding to the corresponding resource in the GPU application description information linked list is searched, and a GPU hardware resource release request data packet is sent to the occupied application domain.
7. The system according to claim 1, characterized in that The GPU control module of the GPU control domain and the GPU application module of the GPU application domain communicate through a shared memory, and a corresponding interrupt will be triggered after data is written into the shared memory.
8. The system according to claim 3, characterized in that The GPU application domain is also used for: Actively send GPU hardware resource usage data packets to obtain the GPU hardware resource information and corresponding permissions of the corresponding GPU control domain.
9. The system according to claim 1, characterized in that When its own resources do not meet the requirements, the GPU control domain can apply for GPU hardware resources from other GPU control domains that have GPU hardware resources; Correspondingly, when the GPU application domain has GPU hardware resources, the GPU application domain can serve as a GPU control domain that provides services to other GPU application domains.
Citation Information
Patent Citations
GPU resource pool scheduling system and method
CN112286645A