Resource allocation method and device applied to virtual machine system
Through static resource allocation and scheduling mapping, the resource occupation problem caused by frequent triggering of virtual machines into simulation mechanisms in virtual machine systems is solved, and the real-time response and resource configuration accuracy of virtual machine systems are improved.
Patent Information
- Application Number
- CN202411182176.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-31
AI Technical Summary
In virtual machine applications, virtual machines frequently trigger into simulation mechanisms, occupying a large amount of hardware computing resources, resulting in a reduction in system response real-time and affecting normal use.
By determining the total resource and resource configuration parameters of the hardware configuration of the hardware terminal device, static resource allocation is performed to ensure that the virtual processor in the working domain corresponds one by one with the hardware processor, establish a static scheduling mapping, reduce dynamic resource allocation, and improve resource configuration accuracy sex.
Reduce the hardware computing resources occupied during the virtual machine system operation, and improve the real-time response and operation efficiency of the virtual machine system.
Smart Images

Figure CN119225954A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer virtualization, and in particular to a resource configuration method and device applied to a virtual machine system. Background Art
[0002] In virtual machine applications, when the operating system or application tries to execute privileged instructions, the execution of these instructions will trigger a simulation mechanism because the virtual machine itself has no actual privilege level. Specifically, the Virtual Machine Manager (VMM) in virtualization technology intercepts these privileged instructions and simulates them as needed to ensure that the virtual machine can run in a virtual environment with the same effect as the actual hardware. This mechanism requires the virtual machine to access and operate hardware resources.
[0003] Practice has found that in some embedded virtual machine application scenarios such as industrial SoC (System on Chip) and automotive SoC, because the virtual machine frequently triggers the simulation mechanism, it occupies a large amount of hardware computing resources, which significantly reduces the real-time response of the overall system during operation, seriously affecting normal use.
[0004] Therefore, how to improve the accuracy of resource configuration of the virtual machine system to improve the real-time response of the overall runtime of the virtual machine system is a technical problem that needs to be solved urgently. Summary of the invention
[0005] The present invention provides a resource configuration method and device applied to a virtual machine system, which can improve the accuracy of resource configuration of the virtual machine system, so as to improve the real-time response of the overall runtime of the virtual machine system.
[0006] In order to solve the above technical problems, the first aspect of the present invention discloses a resource configuration method applied to a virtual machine system, wherein the virtual machine system is mounted on a hardware terminal device, the virtual machine system has at least one working domain, and each working domain is used to store resources corresponding to the working domain, the method comprising:
[0007] Determine the total hardware configuration resources and at least one resource configuration parameter of the hardware terminal device; wherein each of the resource configuration parameters includes a configuration identifier, and each of the resource configuration parameters has a working domain that uniquely corresponds to the resource configuration parameter;
[0008] Static resource allocation is performed on the total hardware configuration resources according to any of the resource configuration parameters, so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain.
[0009] As an optional implementation, in the first aspect of the present invention, the working domain includes at least one virtual processor, and the hardware terminal device includes at least one hardware processor;
[0010] Performing static resource allocation on the total hardware configuration resources according to any of the resource configuration parameters so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain, including:
[0011] Parsing the total hardware configuration resources to obtain processor configuration resources;
[0012] The processor configuration resources are allocated according to any of the resource configuration parameters, so that the virtual processors in the working domain corresponding to the resource configuration parameter and the hardware processors corresponding to the resource configuration parameter correspond statically one to one.
[0013] As an optional implementation, in the first aspect of the present invention, the resource configuration parameters further include processor attribute parameters;
[0014] Allocating resources to the processor configuration resources according to any of the resource configuration parameters so that the virtual processors in the working domain corresponding to the resource configuration parameter correspond to the hardware processors corresponding to the resource configuration parameter in a one-to-one static manner, including:
[0015] Determine the attributes corresponding to each hardware processor according to the processor configuration resources, and analyze the attributes corresponding to each hardware processor and the processor attribute parameters to obtain at least one processor group; wherein each processor group consists of a hardware processor and a virtual processor with the same attributes as the hardware processor;
[0016] For any of the processor groups, a static scheduling mapping is established between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors; wherein the static scheduling mapping corresponding to each of the processor groups is used to characterize the static scheduling routing between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors.
[0017] As an optional implementation, in the first aspect of the present invention, the virtual machine system further includes a resource scheduler;
[0018] For any of the processor groups, establishing a static scheduling mapping between hardware processors in the processor group and virtual processors corresponding to the hardware processors includes:
[0019] For any of the processor groups, the resource scheduler is called to construct a dynamic scheduling mapping between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors, and the dynamic scheduling mapping is locked to obtain a static scheduling mapping; wherein the dynamic scheduling mapping corresponding to each of the processor groups is used to characterize the dynamic scheduling routing between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors;
[0020] or,
[0021] For any of the processor groups, pre-configured processor scheduling parameters are obtained, and a static scheduling mapping is constructed between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors according to the processor scheduling parameters.
[0022] As an optional implementation, in the first aspect of the present invention, static resource allocation is performed on the total hardware configuration resources according to any of the resource configuration parameters so that the working domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the working domain, including:
[0023] Parsing the total hardware configuration resources to obtain hardware interrupt configuration resources; wherein the hardware interrupt configuration resources include at least one hardware interrupt request number;
[0024] The hardware interrupt configuration resource is allocated according to any of the resource configuration parameters, so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter are statically corresponding one by one.
[0025] As an optional implementation, in the first aspect of the present invention, the virtual machine system further includes a virtual interrupt controller;
[0026] Allocating the hardware interrupt configuration resource according to any of the resource configuration parameters so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter correspond to each other in a one-to-one static manner, including:
[0027] For any of the resource configuration parameters, obtaining an interrupt scheduling parameter that is pre-configured and corresponds to the resource configuration parameter, and constructing a static interrupt mapping between a working domain corresponding to the resource configuration parameter and a hardware interrupt request number corresponding to the resource configuration parameter according to the interrupt scheduling parameter;
[0028] or,
[0029] For any of the resource configuration parameters, calling the virtual interrupt controller to construct a dynamic interrupt mapping between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter, and performing a locking operation on the dynamic interrupt mapping to obtain a static interrupt mapping;
[0030] The dynamic interrupt mapping corresponding to each resource configuration parameter is used to represent the dynamic allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter;
[0031] The static interrupt mapping corresponding to each resource configuration parameter is used to represent the static allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter.
[0032] As an optional embodiment, in the first aspect of the present invention, the method further comprises:
[0033] Get the device tree properties of the hardware terminal device;
[0034] Attribute parsing is performed on the device tree attributes to obtain the total hardware configuration resources.
[0035] As an optional embodiment, in the first aspect of the present invention, the method further comprises:
[0036] Parsing the processor configuration resource to obtain at least one piece of hardware identification information representing a hardware processor identification;
[0037] For any of the hardware processors, an identification reconstruction operation is performed on the virtual processor statically corresponding to the hardware processor according to the hardware identification information corresponding to the hardware processor, so that the identification of the hardware processor corresponds to the identification of the virtual processor statically corresponding to the hardware processor.
[0038] A second aspect of the present invention discloses a resource configuration device applied to a virtual machine system, the device is applied to the virtual machine system, the virtual machine system is mounted on a hardware terminal device, the virtual machine system has at least one working domain, and each working domain is used to store resources corresponding to the working domain, the device includes:
[0039] A parameter determination module, used to determine the total hardware configuration resources and at least one resource configuration parameter of the hardware terminal device; wherein each of the resource configuration parameters includes a configuration identifier, and each of the resource configuration parameters has a working domain that uniquely corresponds to the resource configuration parameter;
[0040] The resource allocation module is used to perform static resource allocation on the total hardware configuration resources according to any of the resource configuration parameters, so that the working domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the working domain.
[0041] As an optional implementation, in the second aspect of the present invention, the working domain includes at least one virtual processor, and the hardware terminal device includes at least one hardware processor;
[0042] The specific manner in which the resource allocation module performs static resource allocation on the total hardware configuration resources according to any of the resource configuration parameters so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain includes:
[0043] Parsing the total hardware configuration resources to obtain processor configuration resources;
[0044] The processor configuration resources are allocated according to any of the resource configuration parameters, so that the virtual processors in the working domain corresponding to the resource configuration parameter and the hardware processors corresponding to the resource configuration parameter correspond statically one to one.
[0045] As an optional implementation, in the second aspect of the present invention, the resource configuration parameters further include processor attribute parameters;
[0046] The specific manner in which the resource allocation module allocates resources to the processor configuration resources according to any of the resource configuration parameters so that the virtual processors in the working domain corresponding to the resource configuration parameter and the hardware processors corresponding to the resource configuration parameter correspond to each other statically includes:
[0047] Determine the attributes corresponding to each hardware processor according to the processor configuration resources, and analyze the attributes corresponding to each hardware processor and the processor attribute parameters to obtain at least one processor group; wherein each processor group consists of a hardware processor and a virtual processor with the same attributes as the hardware processor;
[0048] For any of the processor groups, a static scheduling mapping is established between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors; wherein the static scheduling mapping corresponding to each of the processor groups is used to characterize the static scheduling routing between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors.
[0049] As an optional implementation, in the second aspect of the present invention, the virtual machine system further includes a resource scheduler;
[0050] The specific manner in which the resource allocation module establishes, for any of the processor groups, a static scheduling mapping between a hardware processor in the processor group and a virtual processor corresponding to the hardware processor includes:
[0051] For any of the processor groups, the resource scheduler is called to construct a dynamic scheduling mapping between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors, and the dynamic scheduling mapping is locked to obtain a static scheduling mapping; wherein the dynamic scheduling mapping corresponding to each of the processor groups is used to characterize the dynamic scheduling routing between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors;
[0052] or,
[0053] For any of the processor groups, pre-configured processor scheduling parameters are obtained, and a static scheduling mapping is constructed between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors according to the processor scheduling parameters.
[0054] As an optional implementation, in the second aspect of the present invention, the resource allocation module performs static resource allocation on the total hardware configuration resources according to any of the resource configuration parameters, so that the specific manner in which the working domain corresponding to the resource configuration parameter is allocated to the hardware configuration resource corresponding to the working domain includes:
[0055] Parsing the total hardware configuration resources to obtain hardware interrupt configuration resources; wherein the hardware interrupt configuration resources include at least one hardware interrupt request number;
[0056] The hardware interrupt configuration resource is allocated according to any of the resource configuration parameters, so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter are statically corresponding one by one.
[0057] As an optional implementation, in the second aspect of the present invention, the virtual machine system further includes a virtual interrupt controller;
[0058] The resource allocation module allocates the hardware interrupt configuration resource according to any of the resource configuration parameters so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter correspond to each other in a one-to-one static manner, including:
[0059] For any of the resource configuration parameters, obtaining an interrupt scheduling parameter that is pre-configured and corresponds to the resource configuration parameter, and constructing a static interrupt mapping between a working domain corresponding to the resource configuration parameter and a hardware interrupt request number corresponding to the resource configuration parameter according to the interrupt scheduling parameter;
[0060] or,
[0061] For any of the resource configuration parameters, calling the virtual interrupt controller to construct a dynamic interrupt mapping between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter, and performing a locking operation on the dynamic interrupt mapping to obtain a static interrupt mapping;
[0062] The dynamic interrupt mapping corresponding to each resource configuration parameter is used to represent the dynamic allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter;
[0063] The static interrupt mapping corresponding to each resource configuration parameter is used to represent the static allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter.
[0064] As an optional implementation, in the second aspect of the present invention, the device further includes:
[0065] The attribute acquisition module is used to obtain the device tree attributes of the hardware terminal device;
[0066] The attribute parsing module is used to perform attribute parsing processing on the device tree attributes to obtain the total hardware configuration resources.
[0067] As an optional implementation, in the second aspect of the present invention, the device further includes:
[0068] A resource parsing module, used to parse the processor configuration resources to obtain at least one hardware identification information representing a hardware processor identification;
[0069] The identification reconstruction module is used to perform an identification reconstruction operation on the virtual processor statically corresponding to any of the hardware processors according to the hardware identification information corresponding to the hardware processor, so that the identification of the hardware processor corresponds to the identification of the virtual processor statically corresponding to the hardware processor.
[0070] The third aspect of the present invention discloses another resource configuration device applied to a virtual machine system, wherein the virtual machine system is mounted on a hardware terminal device, the virtual machine system has at least one working domain, and each working domain is used to store resources corresponding to the working domain, and the device includes:
[0071] A memory storing executable program code;
[0072] a processor coupled to the memory;
[0073] The processor calls the executable program code stored in the memory to execute the resource configuration method applied to a virtual machine system disclosed in the first aspect of the present invention.
[0074] The fourth aspect of the present invention discloses a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are called by a processor, they are used to execute the resource configuration method for a virtual machine system disclosed in the first aspect of the present invention.
[0075] Compared with the prior art, the present invention has the following beneficial effects:
[0076] In the present invention, the total hardware configuration resources of the hardware terminal device and the resource configuration parameters uniquely corresponding to each working domain in the virtual machine system are first obtained, and the resource configuration parameters include a configuration identifier; then, static resource allocation is performed on the total hardware configuration resources according to any resource configuration parameter, so that the working domain corresponding to the resource configuration parameter is allocated to the corresponding hardware configuration resources required by the working domain. It can be seen that the present invention can statically allocate hardware configuration resources to the corresponding working domain according to the resource configuration parameters, reduce the hardware computing resources occupied by the virtual machine system during operation, and improve the accuracy of the resource configuration of the virtual machine system, so as to improve the real-time response of the overall system during operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0078] Figure 1 It is a flow chart of a resource configuration method applied to a virtual machine system disclosed in an embodiment of the present invention;
[0079] Figure 2 It is a schematic diagram of hardware processor resource allocation applied to a virtual machine system disclosed in the prior art;
[0080] Figure 3 It is a schematic diagram of processor configuration resource allocation corresponding to the resource configuration method disclosed in the embodiment of the present invention;
[0081] Figure 4 It is a schematic diagram of hardware interrupt resource allocation applied to a virtual machine system disclosed in the prior art;
[0082] Figure 5 It is a schematic diagram of hardware interrupt configuration resource allocation corresponding to the resource configuration method disclosed in the embodiment of the present invention;
[0083] Figure 6 It is a structural schematic diagram of a resource configuration device applied to a virtual machine system disclosed in an embodiment of the present invention;
[0084] Figure 7 is a structural schematic diagram of a resource configuration device applied to a virtual machine system disclosed in another embodiment of the present invention;
[0085] Figure 8 is a structural schematic diagram of a resource configuration device applied to a virtual machine system disclosed in another embodiment of the present invention;
[0086] Fig. 9 It is a structural schematic diagram of another resource configuration device applied to a virtual machine system disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0087] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0088] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or end including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or ends.
[0089] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0090] In virtual machine applications, when the operating system or application attempts to execute privileged instructions, the execution of these instructions will trigger the trap simulation mechanism because the virtual machine itself has no actual privilege level. Specifically, the Virtual Machine Manager (VMM) in virtualization technology intercepts these privileged instructions and simulates them as needed to ensure that the virtual machine can run in a virtual environment with the same effect as the actual hardware. This mechanism requires the virtual machine to access and operate hardware resources. Practice has found that in some embedded virtual machine application scenarios such as industrial SoC (System on Chip) and automotive SoC, because the virtual machine frequently triggers the trap simulation mechanism, it occupies a large amount of hardware computing resources, which significantly reduces the real-time response of the overall system during operation, seriously affecting normal use. Therefore, how to configure the resources of the virtual machine system to improve the real-time response is a technical problem that needs to be solved urgently.
[0091] In order to solve the above technical problems, the present invention discloses a resource configuration method and device applied to a virtual machine system, aiming to reduce the hardware computing resources occupied by the virtual machine system when it is running and improve the real-time response of the overall system when it is running. The following are detailed descriptions.
[0092] In order to better understand the resource configuration method and device applied to the virtual machine system of the present invention, the virtual machine system applied by the present invention is first described. The virtual machine system applied by the present invention is mounted on a hardware terminal device, which is a device configured with at least one hardware processor capable of data processing and executable instructions, such as a computer host, an industrial SoC terminal, a vehicle-mounted SoC terminal, etc. And there is at least one working domain in the virtual machine system, each working domain is used to store the resources corresponding to the working domain, and each working domain includes at least one virtual processor, and the virtual processor corresponds to the hardware processor one by one, so as to simulate and implement the function of the corresponding hardware processor in the virtual machine system. The virtual machine system also includes a virtual machine manager, a resource scheduler, a virtual interrupt controller, etc. In this field, the resource scheduler and the virtual interrupt controller are usually integrated in the virtual machine manager. The virtual machine software corresponding to the virtual machine system applied by the present invention includes KVM, Citrix Hypervisor, Xen, etc.
[0093] Embodiment 1
[0094] See also Figure 1 , Figure 1 1 is a flow chart of a resource configuration method applied to a virtual machine system disclosed in an embodiment of the present invention. Figure 1The method shown can be applied to a resource configuration device, which can allocate the total hardware configuration resources of the hardware terminal device to the internal working domain of the virtual machine system carried by the hardware terminal device. Further, the resource configuration device can be integrated into the hardware terminal device or the virtual machine system, or can exist independently of the hardware terminal device and the virtual machine system, which is not limited in the embodiments of the present invention. Figure 1 As shown, a resource configuration method applied to a virtual machine system disclosed in an embodiment of the present invention includes but is not limited to the following operations:
[0095] 101. Determine total hardware configuration resources and at least one resource configuration parameter of a hardware terminal device.
[0096] Each resource configuration parameter includes a configuration identifier, and each resource configuration parameter has a working domain that uniquely corresponds to the resource configuration parameter.
[0097] In an embodiment of the present invention, the total hardware configuration resources of the hardware terminal device include categories such as the number of hardware processors, hardware processor models and corresponding attributes, memory address resources, IIC interface external devices, SPI interface external devices, etc. It should be noted that the resources corresponding to these categories included in the total hardware configuration resources usually do not need to be allocated to the working domain of the virtual machine system in full, and only need to be partially allocated according to the actual application scenario requirements. The configuration identifier represents the hardware configuration resources that need to be configured to the corresponding working domain, such as the hardware processor model that needs to be configured in the working domain. Furthermore, the resource configuration parameters can also include a location identifier that represents the order in which the working domains are created, a level identifier that represents the importance of the working domains, etc. When allocating resources according to the location identifier, they can be allocated in sequence according to the order in which the working domains are created. When allocating resources according to the level identifier, they can be allocated first to working domains with higher levels.
[0098] 102. Perform static resource allocation on the total hardware configuration resources according to any resource configuration parameter, so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain.
[0099] It can be seen that the embodiment of the present invention can statically allocate hardware configuration resources to corresponding work domains according to resource configuration parameters, reduce the hardware computing resources occupied during the operation of the virtual machine system, and improve the resource configuration accuracy of the virtual machine system to improve the real-time response of the overall system during operation.
[0100] It should be noted that, according to the application scenario, other types of identification data may be set in the resource configuration parameters, and the resource configuration parameters may include multiple identification parameter types at the same time.
[0101] In another optional embodiment, the virtual machine system has three working domains: working domain 1, working domain 2, and working domain 3. The resource configuration parameters corresponding to working domain 1 include location identifier 1, level identifier 1, and configuration identifier 1. The resource configuration parameters corresponding to working domain 2 include location identifier 2, level identifier 2, and configuration identifier 2. The resource configuration parameters corresponding to working domain 3 include location identifier 3, level identifier 3, and configuration identifier 3. Moreover, working domain 1 is created first, and working domain 3 is created last. The level of working domain 2 is higher than that of working domain 1 and working domain 3, and the levels of working domain 1 and working domain 3 are the same. When the resource configuration method of the present invention is used to allocate resources, resources are first allocated according to level identifier 1, level identifier 2, and level identifier 3. Because the level of working domain 2 is higher than that of working domain 1 and working domain 3, resources are allocated to working domain 2 according to configuration identifier 2 corresponding to working domain 2 at this time; then resources are allocated according to location identifier 1 and location identifier 3. Because working domain 1 is created earlier than working domain 3, resources are allocated to working domain 1 according to configuration identifier 1 corresponding to working domain 1 at this time; finally, resources are allocated to working domain 3 according to configuration identifier 3 corresponding to working domain 3.
[0102] In an optional embodiment, performing static resource allocation on the total hardware configuration resources according to any resource configuration parameter so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain may include:
[0103] The total hardware configuration resources are parsed to obtain processor configuration resources; and the processor configuration resources are allocated according to any resource configuration parameter, so that the virtual processors in the working domain corresponding to the resource configuration parameter and the hardware processors corresponding to the resource configuration parameter are statically corresponding one by one.
[0104] For details, please refer to Figure 2 , Figure 2This is a schematic diagram of hardware processor resource allocation for a virtual machine system disclosed in the prior art. The hardware terminal device is configured with four hardware processors (hardware processor 1, hardware processor 2, hardware processor 3 and hardware processor 4), and the virtual machine system is provided with two working domains (working domain 1 and working domain 2), and each working domain has two virtual processors (virtual processor 1 and virtual processor 2 of working domain 1, virtual processor 3 and virtual processor 4 of working domain 2). After the virtual machine manager obtains the hardware processor resources, it dynamically allocates the hardware processor resources to each working domain through the resource scheduler according to the real-time running state of the virtual machine system, so that the four hardware processors of the hardware terminal device dynamically correspond to the four virtual processors in the virtual machine system. The trap simulation mechanism of the virtual machine system needs to occupy a certain amount of computing power resources, and because the virtual machine frequently triggers the trap simulation mechanism, this part of the computing power resources is difficult to be released for other uses. Therefore, in order to ensure the operating efficiency of the virtual machine system, the hardware terminal device is usually required to have a higher computing power performance. The higher the computing power performance requirements of the device, the more processors need to be equipped, and the larger the size of the hardware terminal device. In some embedded virtual machine application scenarios such as industrial SoC (System on Chip) and automotive SoC, the size of hardware terminal devices is limited, which also makes their computing performance low. The resource allocation method of traditional virtual machine systems occupies too high a proportion of computing resources, thus affecting the overall operation efficiency and real-time response of the virtual machine system.
[0105] In the embodiments of the present invention, please refer to Figure 3 , Figure 3 This is a schematic diagram of processor configuration resource allocation corresponding to the resource configuration method disclosed in the embodiment of the present invention. The hardware terminal device is configured with four hardware processors (hardware processor 1, hardware processor 2, hardware processor 3 and hardware processor 4), and the virtual machine system is provided with two working domains (working domain 1 and working domain 2), and each working domain has two virtual processors (virtual processor 1 and virtual processor 2 of working domain 1, virtual processor 3 and virtual processor 4 of working domain 2). After processor resource allocation is performed by the resource configuration method of the present invention, one hardware processor is statically corresponding to one virtual processor. Figure 3 As shown, hardware processor 1 statically corresponds to virtual processor 1 of work domain 1, hardware processor 2 statically corresponds to virtual processor 2 of work domain 1, hardware processor 3 statically corresponds to virtual processor 3 of work domain 2, and hardware processor 4 statically corresponds to virtual processor 4 of work domain 2. It should be noted that Figure 3 The illustrated correspondence is merely used to illustrate the solution of the present invention. In another optional embodiment, the static correspondence between the hardware processor and the virtual processor is in other forms.
[0106] It can be seen that this optional embodiment statically allocates hardware processor resources so that the virtual processors in the working domain correspond to the allocated hardware processors one by one. There is no need to dynamically allocate hardware processor resources in real time according to the operating status of the virtual machine system through the resource scheduler, which reduces the computing power resource occupation and can improve the accuracy of resource configuration of the virtual machine system, thereby improving the overall operating efficiency and real-time response of the virtual machine system.
[0107] In an optional embodiment, the resource configuration parameters also include processor attribute parameters.
[0108] Allocating processor configuration resources according to any resource configuration parameter so that the virtual processors in the work domain corresponding to the resource configuration parameter correspond to the hardware processors corresponding to the resource configuration parameter in a one-to-one static manner may include:
[0109] Determine the attributes corresponding to each hardware processor according to the processor configuration resources, and analyze the attributes corresponding to each hardware processor and the processor attribute parameters to obtain at least one processor group; for any processor group, establish a static scheduling mapping between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors.
[0110] In this optional embodiment, each processor group consists of a hardware processor and a virtual processor with the same attributes as the hardware processor; the static scheduling map corresponding to each processor group is used to characterize the static scheduling route between the hardware processor in the processor group and the virtual processor corresponding to the hardware processor. The hardware processor resources are allocated to the corresponding work domain by first grouping, then constructing the static scheduling route and generating the corresponding static scheduling map. When the virtual machine system needs to enable a certain work domain, it only needs to call the static scheduling map of each virtual processor in the work domain, and then the performance of the hardware processor corresponding to the static scheduling map can be created or run a simulation task.
[0111] In an optional embodiment, for any processor group, establishing a static scheduling mapping between a hardware processor in the processor group and a virtual processor corresponding to the hardware processor may include:
[0112] For any processor group, the resource scheduler is called to build a dynamic scheduling mapping between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors, and the dynamic scheduling mapping is locked to obtain a static scheduling mapping; specifically, the dynamic scheduling mapping corresponding to each processor group is used to characterize the dynamic scheduling routing between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors.
[0113] Alternatively, for any processor group, a pre-configured processor scheduling parameter is obtained, and a static scheduling mapping is constructed between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors according to the processor scheduling parameter.
[0114] In this optional embodiment, a dynamic scheduling mapping between the hardware processors and the corresponding virtual processors in the processor group is constructed by calling the resource scheduler once, and then the dynamic scheduling mapping is locked to obtain a static scheduling mapping. The resource scheduler is no longer called to dynamically allocate resources when the virtual machine system is running. Alternatively, a static scheduling mapping between the hardware processors and the corresponding virtual processors in the processor group is directly constructed according to the pre-configured processor scheduling parameters. Specifically, the processor scheduling parameters can be configured when the virtual machine system is created, or they can be temporarily configured by the staff when the virtual machine system performs a new simulation task.
[0115] In an optional embodiment, performing static resource allocation on the total hardware configuration resources according to any resource configuration parameter so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain may include:
[0116] The total hardware configuration resources are parsed to obtain hardware interrupt configuration resources, specifically, the hardware interrupt configuration resources include at least one hardware interrupt request number; the hardware interrupt configuration resources are allocated according to any resource configuration parameter, so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter correspond to each other statically.
[0117] See also Figure 4 , Figure 4 It is a schematic diagram of hardware interrupt resource allocation applied to a virtual machine system disclosed in the prior art. The hardware terminal device is configured with four hardware interrupt request numbers (hardware interrupt request number 1, hardware interrupt request number 2, hardware interrupt request number 3 and hardware interrupt request number 4), and the virtual machine system is provided with two working domains (working domain 1 and working domain 2). After the virtual machine manager obtains the hardware interrupt resources, it first creates virtual interrupt resources (such as virtual interrupt request numbers) according to the hardware interrupt resources through the virtual interrupt controller, and then dynamically allocates the virtual interrupt resources to each working domain according to the real-time running status of the virtual machine system. This method of first creating virtual interrupt resources and then dynamically allocating them requires additional computing resources, thereby affecting the overall operating efficiency and real-time response of the virtual machine system.
[0118] In the embodiments of the present invention, please refer to Figure 5 , Figure 5This is a schematic diagram of hardware interrupt configuration resource allocation corresponding to the resource configuration method disclosed in the embodiment of the present invention. The hardware terminal device is configured with four hardware interrupt request numbers (hardware interrupt request number 1, hardware interrupt request number 2, hardware interrupt request number 3 and hardware interrupt request number 4), and the virtual machine system is provided with two working domains (working domain 1 and working domain 2). After the hardware interrupt resource allocation is performed by the resource configuration method of the present invention, one working domain is statically corresponding to one hardware interrupt request number. Figure 5 As shown, work domain 1 statically corresponds to hardware interrupt request number 1, and work domain 2 corresponds to hardware interrupt request number 3. It should be noted that Figure 5 The shown correspondence is only used to illustrate the solution of the present invention. In another optional embodiment, the static correspondence between the working domain and the hardware interrupt request number is in other forms.
[0119] It can be seen that this optional embodiment statically allocates hardware interrupt configuration resources so that the work domains corresponding to the same resource configuration parameters correspond to the hardware interrupt request number in a one-to-one static manner. There is no need to first create virtual interrupt resources according to the hardware interrupt resources through the virtual interrupt controller, and then dynamically allocate the virtual interrupt resources to each work domain according to the real-time running status of the virtual machine system, which reduces the computing power resource occupation and can improve the accuracy of the resource configuration of the virtual machine system, thereby improving the overall operating efficiency and real-time response of the virtual machine system.
[0120] In an optional embodiment, allocating resources to the hardware interrupt configuration resource according to any resource configuration parameter so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter correspond to each other in a one-to-one static manner may include:
[0121] For any resource configuration parameter, an interrupt scheduling parameter pre-configured and corresponding to the resource configuration parameter is obtained, and a static interrupt mapping is constructed between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter according to the interrupt scheduling parameter.
[0122] Alternatively, for any resource configuration parameter, the virtual interrupt controller is called to construct a dynamic interrupt mapping between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter, and the dynamic interrupt mapping is locked to obtain a static interrupt mapping.
[0123] Specifically, the dynamic interrupt mapping corresponding to each resource configuration parameter is used to characterize the dynamic allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter, and the static interrupt mapping corresponding to each resource configuration parameter is used to characterize the static allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter.
[0124] In this optional embodiment, a static interrupt mapping between a working domain corresponding to the same resource configuration parameter and a hardware interrupt request number is directly constructed according to the pre-configured interrupt scheduling parameters. Specifically, the interrupt scheduling parameters can be configured when the virtual machine system is created, or they can be temporarily configured by the staff when the virtual machine system performs a new simulation task. Alternatively, a dynamic interrupt mapping between a working domain corresponding to the same resource configuration parameter and a hardware interrupt request number is constructed by calling a virtual interrupt controller once, and then the dynamic interrupt mapping is locked to obtain a static interrupt mapping, and the virtual interrupt controller is no longer called to dynamically allocate resources when the virtual machine system is running.
[0125] In an optional embodiment, the resource configuration method applied to a virtual machine system of the present invention may further include:
[0126] Obtain the device tree properties of the hardware terminal device; perform property parsing on the device tree properties to obtain the total hardware configuration resources.
[0127] Specifically, the device tree is a data structure that describes hardware, and the device tree attributes represent and organize all hardware resource configuration information of the hardware terminal device. The hardware resource configuration information of the hardware terminal device, that is, the total hardware configuration resources, is obtained by obtaining and parsing the device tree attributes to facilitate subsequent resource allocation.
[0128] In some other optional embodiments, the hardware configuration resources allocated to the virtual machine system working domain may also be configured by the staff inputting instructions from the outside. In this case, the hardware configuration resources that are adjusted and allowed to be allocated to the virtual machine system working domain are essentially the "total hardware configuration resources" in the embodiment of the present invention. For example, the hardware terminal device is configured with 100 hardware processors, but the staff sets that only 60 of them can be allocated to the virtual machine system, then only these 60 hardware processors belong to the "total hardware configuration resources" in the embodiment of the present invention.
[0129] In an optional embodiment, the resource configuration method applied to a virtual machine system of the present invention may further include:
[0130] The processor configuration resources are parsed to obtain at least one piece of hardware identification information representing the hardware processor identification; for any hardware processor, an identification reconstruction operation is performed on the virtual processor statically corresponding to the hardware processor according to the hardware identification information corresponding to the hardware processor, so that the identification of the hardware processor corresponds to the identification of the virtual processor statically corresponding to the hardware processor.
[0131] In this optional embodiment, by reconstructing the identifier so that the identifier of the virtual processor in the working domain corresponds to the identifier of the corresponding hardware processor, it is beneficial for the staff to locate the target data more clearly when viewing the relevant data (such as log data) of the virtual machine system, thereby improving the readability of the relevant data records.
[0132] Specifically, the hardware identification information may be an ID code of a hardware processor. After the identification reconstruction, the ID code of the virtual processor in the working domain is consistent with the ID code of the corresponding hardware processor. It should be noted that the hardware identification information may also be a combination of one or more of the processor number, processor model, memory base address, etc. of the hardware processor, and the embodiment of the present invention does not impose any specific limitation thereto.
[0133] In another optional embodiment, the resource configuration method of the present invention is applied to a Xen virtual machine system, and the corresponding resource configuration is completed through a virtual machine controller. The optional resource configuration process is as follows:
[0134] The first step is to load and start the virtual machine operating system through the system boot program (such as uboot program, a boot loader mainly used in embedded systems);
[0135] The second step is to parse the device tree properties of the hardware terminal device to obtain hardware resource configurations such as hardware processors and interrupt request numbers;
[0136] The third step is to enable all processors and put some processors into standby mode as needed;
[0137] The fourth step is to create a corresponding work domain based on the number and attributes of virtual processors required by the task;
[0138] The fifth step is to configure static resources for the work domain, including the following items:
[0139] (1) Modify the ID of the virtual processor to be consistent with the ID of the corresponding hardware processor;
[0140] (2) Modify the interrupt routing register and statically allocate interrupt resources;
[0141] (3) Disable the interrupt virtualization feature and do not use the virtual interrupt request number;
[0142] (4) Modify the relevant code of the resource scheduler to statically allocate hardware processor resources instead of dynamically scheduling.
[0143] After completing resource configuration, guide the virtual processor of each document object node to call the core opening instruction in the startup phase, set the corresponding flag bit, and perform context switching of the document object of the virtual processor during scheduling, thereby waking up the virtual processor for subsequent simulation tasks.
[0144] Embodiment 2
[0145] See also Figure 6 , Figure 6 Schematic diagram of a resource configuration device for a virtual machine system disclosed in an embodiment of the present invention. Figure 6 The device shown is used to implement the resource configuration method for a virtual machine system described in the first embodiment. Further, the device can be integrated into a hardware terminal device or a virtual machine system, or can exist independently of the hardware terminal device and the virtual machine system, which is not limited in the embodiment of the present invention. Figure 6 As shown, a resource configuration device applied to a virtual machine system disclosed in an embodiment of the present invention includes but is not limited to the following modules:
[0146] The parameter determination module 201 is used to determine the total hardware configuration resources and at least one resource configuration parameter of the hardware terminal device; wherein each resource configuration parameter includes a configuration identifier, and each resource configuration parameter has a working domain that uniquely corresponds to the resource configuration parameter;
[0147] The resource allocation module 202 is used to perform static resource allocation on the total hardware configuration resources according to any resource configuration parameter, so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain.
[0148] In an embodiment of the present invention, the total hardware configuration resources of the hardware terminal device include the number of hardware processors, the hardware processor model and corresponding attributes, memory address resources, IIC interface external devices, SPI interface external devices and other categories. It should be noted that the resources corresponding to these categories included in the total hardware configuration resources are usually not required to be allocated to the working domain of the virtual machine system in full, and only need to be partially allocated according to the actual application scenario requirements. The configuration identifier represents the hardware configuration resources that need to be configured to the corresponding working domain, such as the hardware processor model that needs to be configured in the working domain. Further, the resource configuration parameters may also include a position identifier representing the order of creation of the working domain, a level identifier representing the importance of the working domain, etc. When allocating resources according to the position identifier, they can be allocated in sequence according to the order of creation of the working domain, and when allocating resources according to the level identifier, they can be allocated to the working domain with a higher level first. It should be noted that other types of identification data can also be set in the resource configuration parameters according to the application scenario requirements, and the resource configuration parameters can include multiple identification parameter types at the same time.
[0149] It can be seen that the embodiment of the present invention can statically allocate hardware configuration resources to corresponding work domains according to resource configuration parameters, reduce the hardware computing resources occupied during the operation of the virtual machine system, and improve the resource configuration accuracy of the virtual machine system to improve the real-time response of the overall system during operation.
[0150] In an optional embodiment, the resource allocation module 202 performs static resource allocation on the total hardware configuration resources according to any resource configuration parameter so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resource corresponding to the work domain. The specific manner includes:
[0151] The total hardware configuration resources are parsed to obtain processor configuration resources; and the processor configuration resources are allocated according to any resource configuration parameter, so that the virtual processors in the working domain corresponding to the resource configuration parameter and the hardware processors corresponding to the resource configuration parameter are statically corresponding one by one.
[0152] In this optional embodiment, by statically allocating hardware processor resources, the virtual processors in the working domain are statically corresponding to the allocated hardware processors. There is no need to dynamically allocate hardware processor resources, which reduces the computing power resource usage and can improve the accuracy of resource configuration of the virtual machine system, thereby improving the overall operating efficiency and real-time response of the virtual machine system.
[0153] In an optional embodiment, the resource configuration parameters also include processor attribute parameters;
[0154] The resource allocation module 202 allocates processor configuration resources according to any resource configuration parameter so that the virtual processors in the working domain corresponding to the resource configuration parameter and the hardware processors corresponding to the resource configuration parameter correspond to each other statically one by one, including:
[0155] Determine the attributes corresponding to each hardware processor according to the processor configuration resources, and analyze the attributes corresponding to each hardware processor and the processor attribute parameters to obtain at least one processor group; for any processor group, establish a static scheduling mapping between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors.
[0156] In an embodiment of the present invention, each processor group is composed of a hardware processor and a virtual processor with the same attributes as the hardware processor. The static scheduling mapping corresponding to each processor group is used to characterize the static scheduling route between the hardware processor in the processor group and the virtual processor corresponding to the hardware processor. The hardware processor resources are allocated to the corresponding working domain by first grouping, then constructing the static scheduling route and generating the corresponding static scheduling mapping. When the virtual machine system needs to enable a certain working domain, it only needs to call the static scheduling mapping of each virtual processor in the working domain, and the performance of the hardware processor corresponding to the static scheduling mapping can be created or run a simulation task.
[0157] In an optional embodiment, the resource allocation module 202 establishes, for any processor group, a static scheduling mapping between a hardware processor in the processor group and a virtual processor corresponding to the hardware processor, in a specific manner including:
[0158] For any processor group, the resource scheduler is called to build a dynamic scheduling mapping between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors, and the dynamic scheduling mapping is locked to obtain a static scheduling mapping; specifically, the dynamic scheduling mapping corresponding to each processor group is used to characterize the dynamic scheduling routing between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors.
[0159] Alternatively, for any processor group, a pre-configured processor scheduling parameter is obtained, and a static scheduling mapping is constructed between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors according to the processor scheduling parameter.
[0160] In the embodiment of the present invention, a dynamic scheduling mapping between the hardware processors and the corresponding virtual processors in the processor group is constructed by calling the resource scheduler once, and then the dynamic scheduling mapping is locked to obtain a static scheduling mapping, and the resource scheduler is no longer called to dynamically allocate resources when the virtual machine system is running. Alternatively, a static scheduling mapping between the hardware processors and the corresponding virtual processors in the processor group is directly constructed according to the pre-configured processor scheduling parameters.
[0161] In an optional embodiment, the resource allocation module 202 performs static resource allocation on the total hardware configuration resources according to any resource configuration parameter so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resource corresponding to the work domain. The specific manner includes:
[0162] The total hardware configuration resources are parsed to obtain hardware interrupt configuration resources; specifically, the hardware interrupt configuration resources include at least one hardware interrupt request number; and the hardware interrupt configuration resources are allocated according to any resource configuration parameter so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter correspond to each other statically.
[0163] In the embodiment of the present invention, by statically allocating hardware interrupt configuration resources, the work domains corresponding to the same resource configuration parameters are statically corresponding to the hardware interrupt request numbers. It is not necessary to dynamically allocate virtual interrupt resources to each work domain, which reduces the computing power resource occupation, can improve the accuracy of resource configuration of the virtual machine system, and thus improve the overall operating efficiency and real-time response of the virtual machine system.
[0164] In an optional embodiment, the resource allocation module 202 allocates the hardware interrupt configuration resource according to any resource configuration parameter so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter correspond to each other in a one-to-one static manner, including:
[0165] For any resource configuration parameter, an interrupt scheduling parameter pre-configured and corresponding to the resource configuration parameter is obtained, and a static interrupt mapping is constructed between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter according to the interrupt scheduling parameter.
[0166] Alternatively, for any resource configuration parameter, the virtual interrupt controller is called to construct a dynamic interrupt mapping between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter, and the dynamic interrupt mapping is locked to obtain a static interrupt mapping.
[0167] Specifically, the dynamic interrupt mapping corresponding to each resource configuration parameter is used to characterize the dynamic allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter. The static interrupt mapping corresponding to each resource configuration parameter is used to characterize the static allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter.
[0168] In this optional embodiment, a static interrupt mapping between a working domain corresponding to the same resource configuration parameter and a hardware interrupt request number is directly constructed according to the pre-configured interrupt scheduling parameters. Alternatively, a dynamic interrupt mapping between a working domain corresponding to the same resource configuration parameter and a hardware interrupt request number is constructed by calling a virtual interrupt controller once, and then the dynamic interrupt mapping is locked to obtain a static interrupt mapping, and the virtual interrupt controller is no longer called to dynamically allocate resources when the virtual machine system is running.
[0169] In another optional embodiment, Figure 7 As shown, the device may also include but is not limited to the following modules:
[0170] The attribute acquisition module 203 is used to acquire the device tree attributes of the hardware terminal device;
[0171] The attribute parsing module 204 is used to perform attribute parsing processing on the device tree attributes to obtain the total hardware configuration resources.
[0172] Specifically, the device tree is a data structure that describes hardware, and the device tree attributes represent and organize all hardware resource configuration information of the hardware terminal device. The hardware resource configuration information of the hardware terminal device, that is, the total hardware configuration resources, is obtained by obtaining and parsing the device tree attributes to facilitate subsequent resource allocation.
[0173] In this optional embodiment, after the attribute parsing module 204 completes the attribute parsing process on the device tree attributes and obtains the total hardware configuration resources, the parameter determination module 201 can be triggered to perform the above-mentioned operation of determining the total hardware configuration resources and at least one resource configuration parameter of the hardware terminal device.
[0174] In another optional embodiment, Figure 8 As shown, the device may also include but is not limited to the following modules:
[0175] A resource parsing module 205, configured to parse processor configuration resources to obtain at least one piece of hardware identification information representing a hardware processor identification;
[0176] The identification reconstruction module 206 is used to perform an identification reconstruction operation on the virtual processor statically corresponding to any hardware processor according to the hardware identification information corresponding to the hardware processor, so that the identification of the hardware processor corresponds to the identification of the virtual processor statically corresponding to the hardware processor.
[0177] In this optional embodiment, after the resource allocation module 202 completes the above-mentioned operation of parsing the total hardware configuration resources to obtain the processor configuration resources, the resource parsing module 205 can be triggered to perform the operation of parsing the processor configuration resources to obtain at least one hardware identification information representing the hardware processor identifier.
[0178] Specifically, by reconstructing the identifier so that the identifier of the virtual processor in the working domain corresponds to the identifier of the corresponding hardware processor, it is beneficial for the staff to locate the target data more clearly when viewing the relevant data (such as log data) of the virtual machine system, thereby improving the readability of the relevant data records. Specifically, the hardware identification information can be the ID code of the hardware processor. After the identifier reconstruction, the ID code of the virtual processor in the working domain is consistent with the ID code of the corresponding hardware processor. It should be noted that the hardware identification information can also be a combination of one or more of the processor number, processor model, memory base address, etc. of the hardware processor, and the embodiment of the present invention does not make specific restrictions.
[0179] Embodiment 3
[0180] See also Fig. 9 , Fig. 9 1 is a schematic diagram of a structure of another resource configuration device applied to a virtual machine system disclosed in an embodiment of the present invention. Fig. 9 The device shown is used to implement the resource configuration method for a virtual machine system described in the first embodiment. Further, the device can be integrated into a hardware terminal device or a virtual machine system, or can exist independently of the hardware terminal device and the virtual machine system, which is not limited in the embodiment of the present invention. Fig. 9 As shown, a resource configuration device applied to a virtual machine system disclosed in an embodiment of the present invention includes but is not limited to:
[0181] A memory 301 storing executable program codes;
[0182] a processor 302 coupled to the memory 301;
[0183] The processor 302 calls the executable program code stored in the memory 301 to execute part or all of the steps in the resource configuration method applied to the virtual machine system described in the first embodiment of the present invention.
[0184] Embodiment 4
[0185] An embodiment of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called by a processor, they are used to execute some or all steps of the resource configuration method applied to a virtual machine system described in the first embodiment of the present invention.
[0186] The device embodiments described above are only illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, and may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.
[0187] Through the specific description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution can be essentially or partly contributed to the prior art in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0188] Finally, it should be noted that the resource configuration method and device applied to a virtual machine system disclosed in the embodiment of the present invention discloses only the preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A resource configuration method applied to a virtual machine system, wherein the virtual machine system is mounted on a hardware terminal device, characterized in that: The virtual machine system has at least one working domain, and each working domain is used to store resources corresponding to the working domain. The method includes: Determine the total hardware configuration resources and at least one resource configuration parameter of the hardware terminal device; wherein each of the resource configuration parameters includes a configuration identifier, and each of the resource configuration parameters has a working domain that uniquely corresponds to the resource configuration parameter; Static resource allocation is performed on the total hardware configuration resources according to any of the resource configuration parameters, so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain.
2. The resource configuration method applied to a virtual machine system according to claim 1, characterized in that: The working domain includes at least one virtual processor, and the hardware terminal device includes at least one hardware processor; Performing static resource allocation on the total hardware configuration resources according to any of the resource configuration parameters so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain, including: Parsing the total hardware configuration resources to obtain processor configuration resources; The processor configuration resources are allocated according to any of the resource configuration parameters, so that the virtual processors in the working domain corresponding to the resource configuration parameter and the hardware processors corresponding to the resource configuration parameter correspond statically one to one.
3. The resource configuration method applied to a virtual machine system according to claim 2, characterized in that: The resource configuration parameters also include processor attribute parameters; Allocating resources to the processor configuration resources according to any of the resource configuration parameters so that the virtual processors in the working domain corresponding to the resource configuration parameter correspond to the hardware processors corresponding to the resource configuration parameter in a one-to-one static manner, including: Determine the attributes corresponding to each hardware processor according to the processor configuration resources, and analyze the attributes corresponding to each hardware processor and the processor attribute parameters to obtain at least one processor group; wherein each processor group consists of a hardware processor and a virtual processor with the same attributes as the hardware processor; For any of the processor groups, a static scheduling mapping is established between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors; wherein the static scheduling mapping corresponding to each of the processor groups is used to characterize the static scheduling routing between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors.
4. The resource configuration method applied to a virtual machine system according to claim 3, characterized in that: The virtual machine system also includes a resource scheduler; For any of the processor groups, establishing a static scheduling mapping between hardware processors in the processor group and virtual processors corresponding to the hardware processors includes: For any of the processor groups, the resource scheduler is called to construct a dynamic scheduling mapping between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors, and the dynamic scheduling mapping is locked to obtain a static scheduling mapping; wherein the dynamic scheduling mapping corresponding to each of the processor groups is used to characterize the dynamic scheduling routing between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors; or, For any of the processor groups, pre-configured processor scheduling parameters are obtained, and a static scheduling mapping is constructed between the hardware processors in the processor group and the virtual processors corresponding to the hardware processors according to the processor scheduling parameters.
5. The resource configuration method applied to a virtual machine system according to claim 1, characterized in that: Performing static resource allocation on the total hardware configuration resources according to any of the resource configuration parameters so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain, including: Parsing the total hardware configuration resources to obtain hardware interrupt configuration resources; wherein the hardware interrupt configuration resources include at least one hardware interrupt request number; The hardware interrupt configuration resource is allocated according to any of the resource configuration parameters, so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter are statically corresponding one by one.
6. The resource configuration method applied to a virtual machine system according to claim 5, characterized in that: The virtual machine system also includes a virtual interrupt controller; Allocating resources for the hardware interrupt configuration resource according to any of the resource configuration parameters so that the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter correspond to each other statically, including: For any of the resource configuration parameters, obtaining an interrupt scheduling parameter that is pre-configured and corresponds to the resource configuration parameter, and constructing a static interrupt mapping between a working domain corresponding to the resource configuration parameter and a hardware interrupt request number corresponding to the resource configuration parameter according to the interrupt scheduling parameter; or, For any of the resource configuration parameters, calling the virtual interrupt controller to construct a dynamic interrupt mapping between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter, and locking the dynamic interrupt mapping to obtain a static interrupt mapping; The dynamic interrupt mapping corresponding to each resource configuration parameter is used to represent the dynamic allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter; The static interrupt mapping corresponding to each resource configuration parameter is used to represent the static allocation route between the working domain corresponding to the resource configuration parameter and the hardware interrupt request number corresponding to the resource configuration parameter.
7. The resource configuration method applied to a virtual machine system according to any one of claims 1 to 6, characterized in that: The method further comprises: Get the device tree properties of the hardware terminal device; Attribute parsing is performed on the device tree attributes to obtain the total hardware configuration resources.
8. The resource configuration method applied to a virtual machine system according to any one of claims 2 to 4, characterized in that: The method further comprises: Parsing the processor configuration resource to obtain at least one piece of hardware identification information representing a hardware processor identification; For any of the hardware processors, an identification reconstruction operation is performed on the virtual processor statically corresponding to the hardware processor according to the hardware identification information corresponding to the hardware processor, so that the identification of the hardware processor corresponds to the identification of the virtual processor statically corresponding to the hardware processor.
9. A resource configuration device applied to a virtual machine system, wherein the virtual machine system is mounted on a hardware terminal device, characterized in that: The virtual machine system has at least one working domain, and each working domain is used to store resources corresponding to the working domain, and the device includes: A parameter determination module, used to determine the total hardware configuration resources and at least one resource configuration parameter of the hardware terminal device; wherein each of the resource configuration parameters includes a configuration identifier, and each of the resource configuration parameters has a working domain that uniquely corresponds to the resource configuration parameter; The resource allocation module is used to perform static resource allocation on the total hardware configuration resources according to any of the resource configuration parameters, so that the work domain corresponding to the resource configuration parameter is allocated to the hardware configuration resources corresponding to the work domain.
10. A resource configuration device applied to a virtual machine system, wherein the virtual machine system is mounted on a hardware terminal device, characterized in that: The virtual machine system has at least one working domain, and each working domain is used to store resources corresponding to the working domain, and the device includes: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the resource configuration method applied to a virtual machine system according to any one of claims 1 to 8.
