Server device resource allocation method, server, storage medium and program product

CN120492174AInactive Publication Date: 2025-08-15INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510969566.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-14
Publication Date
2025-08-15
Estimated Expiration
Not applicable · inactive patent

Smart Images

  • Figure CN120492174A_ABST
    Figure CN120492174A_ABST
Patent Text Reader

Abstract

The invention discloses a server device resource allocation method, a server, a storage medium and a program product, and relates to the technical field of server resource allocation. Each stack unit is traversed through a processor, whether a target port of each stack unit is a root port or not is judged, and if yes, the server device resource allocation is completed; the target resource quantity of the stack unit is determined according to the port type and the corresponding resource demand quantity, and finally the device resources of the server are allocated according to the target resource quantity of the stack unit, so that automatic identification and allocation of the resources are realized, the defects of a server device resource allocation mode in related technologies are overcome, and the resource allocation efficiency is improved. And the technical effects that the resources are efficiently utilized, the resource waste amount is reduced and the like are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of server resource allocation, and in particular to a server device resource allocation method, a server, a storage medium, and a program product. Background Art

[0002] Peripheral Component Interconnect Express (PCIe) devices require a certain amount of MMIO (Memory-Mapped Input / Output) resources to operate in the system. The requirements for 32-bit, 64-bit, and prefetchable MMIO resources vary depending on the device type. Generally speaking, the IIO Integrated Input / Output (IIO) module of the CPU (Central Processing Unit) is divided into multiple stacks. Traditional BIOS (Basic Input / Output System) implementations allocate a fixed MMIO High Granularity Size (HGS) to each stack, and limit the MMIO High Granularity Size to a certain value. Otherwise, errors or even system crashes may occur.

[0003] However, actual hardware support capabilities can now break through this limitation. Although traditional technologies have alleviated the resource shortage problem by increasing GranularitySize or allocating more resources to specific stacks, they still have obvious flaws: First, the use of a unified granularity allocation method can easily lead to resource waste; second, some stacks are not used to connect to PCIe devices or only connect to a small number of low-demand devices, but are still allocated a large amount of MMIO resources; third, current methods rely on manual prediction of certain stacks' high resource requirements, making it difficult to maximize the system's support capabilities for PCIe devices when resources are limited. Summary of the Invention

[0004] The present application provides a server device resource allocation method, a server, a storage medium and a program product to at least solve the technical problem that the server device resource allocation method in the related art has defects and causes resource waste.

[0005] The present application provides a server device resource allocation method, wherein the server includes at least one processor, which is provided with multiple stack units, and the processor is configured to perform the following steps, including: traversing each stack unit and identifying whether a target port of the stack unit is a root port, wherein the target port of the stack unit is the stack port of the stack unit or the integrated input / output module port corresponding to the stack unit; if the target port of the stack unit is not the root port, determining the target resource amount of the stack unit according to the resource demand of the stack unit; if the target port of the stack unit is the root port, determining the target resource amount of the stack unit according to the resource demand of each terminal device connected to the target port; and allocating the device resources of the server according to the target resource amount of each stack unit.

[0006] The present application also provides a server, comprising: a memory for storing a computer program; and at least one processor, wherein the processor is configured to implement the steps of the above-mentioned server device resource allocation method when executing the computer program.

[0007] The present application also provides a non-volatile computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned server device resource allocation method are implemented.

[0008] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned server device resource allocation method when executed by a processor.

[0009] Through this application, since the processor can traverse each stack unit, determine whether the target port of the stack unit is the root port, and determine the target resource amount of the stack unit according to the port type and the corresponding resource demand, and finally allocate the device resources of the server through the target resource amount of the stack unit, automatic identification and allocation of resources is achieved. Therefore, it can solve the technical problem that the related technology cannot dynamically allocate resources and cause resource waste, and achieve technical effects such as high-efficiency utilization of resources and reduction of resource waste. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0011] Figure 1 A flow chart of a method for allocating server device resources provided in an embodiment of the present application; Figure 2 A structural diagram of a processor and a stack unit provided in accordance with an embodiment of the present application; Figure 3 A schematic diagram showing the connection between a root port and a terminal device or switch according to an embodiment of the present application; Figure 4 A sequential MMIOH resource allocation diagram provided in one embodiment of the present application; Figure 5 A block diagram of a server device resource allocation apparatus provided in an embodiment of the present application; Figure 6 A schematic diagram of the structure of the server provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0013] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

[0014] Currently, although the code mentions a maximum MMIO High Granularity Size setting of 1024GB, and the code checks whether this setting exceeds 1024GB and reports an error and crashes the machine if it does, in reality, this value can exceed 1024GB; and the amount of MMIO resources allocated to each stack unit can be different. Therefore, in related technologies, the following solution can be used to achieve different resource allocations exceeding 1024GB: Add settings for MMIO High Granularity Size as needed. The existing code handles this by assuming that each setting is four times the size of its previous neighbor. For example, the next setting after 1024GB is 4096GB. Each setting is assigned a unique ID. The code handles the MMIO High Granularity Size setting in two ways: maintaining the four-fold relationship in the existing code logic, or performing special processing based on the unique ID of each setting to obtain settings that are not four times the size of their previous neighbor.

[0015] When a machine has too many PCIe devices, such as GPUs (Graphics Processing Units), connected, especially when many of these devices are connected to a single CPU Stack / IIO Port (Stack / Integrated Input-Output Port), the previous maximum MMIO capacity of 1024GB may be insufficient, leading to resource shortages. In this case, set the MMIO High Granularity Size setting to the larger amount customized in step 1 / 2. This will allocate more MMIO resources to all CPU Stacks / IIO Ports, based on the code's functional implementation. The specific amount is equal to this newly added setting, which can resolve the resource shortage issue.

[0016] In view of the situation where the current code allocates the same capacity of MMIO to each CPU stack unit, the above method is improved. When too many PCIe devices such as GPUs are connected to the machine, especially when many of these devices come from one CPUStack / IIO Port, the previous maximum MMIO capacity of 1024G is not enough, resulting in resource shortage. In this way, more resources are dynamically allocated to the one or several stack units that lack resources, and the corresponding statistics of the Base (stack base address) and Limit (stack limit) data of each stack unit's resources are updated according to the changed configuration. In addition, the Base and Limit registers in the PCIe configuration space of the Root port bridge corresponding to each stack unit, which record the resources under the bridge, are updated to the above registers with the current improved setting values according to the method defined in the PCIe specification.

[0017] However, the above approach also requires consideration of the CPU's maximum supported MMIO address limit, as well as the fact that some PCIe devices have their own MMIO resource range requirements, such as a maximum limit. Furthermore, this improvement increases the total MMIO allocation for PCI (Peripheral Component Interconnect) / PCIE devices, potentially challenging the upper limits in both cases.

[0018] In this case, you can adjust the MMIO High Base (the high-end (memory address space above 4GB) MMIO starting address) setting to a lower value. This will lower the MMIO addresses of all PCIE devices overall, ensuring they do not exceed the CPU's MMIO upper limit. At the same time, it's important to note that this value must meet relevant design and implementation requirements, including but not limited to ensuring it is not less than the total amount of memory connected to the machine. If there's no suitable MMIO High Base setting, add a new setting with the required value based on the current implementation logic. Furthermore, hardware can adjust the CPU stack unit connected to PCIE devices with special requirements. For example, if a device has a resource upper limit, prioritize connecting the device to the low stack unit port of CPU0. Alternatively, software can break the traditional sequential resource allocation process for each CPU stack unit and instead allocate resources to stack units connected to devices requiring lower MMIO bandwidth, followed by those connected to devices requiring higher MMIO bandwidth. Variables and registers that maintain statistics on the upper and lower resource limits for each stack unit, CPU, and related bridges can be used to meet device MMIO upper and lower limits.

[0019] After resolving the resource allocation issue, the existing resource check and processing mechanism in the code that was inconsistent with the actual design was deleted or adjusted to make it consistent with the actual design, including but not limited to removing the error and crash handling for the 1024GB upper limit on the MMIO allocation for each stack unit in the code.

[0020] The above-mentioned related technology solutions still have defects: increasing the MMIO High Granularity Size will actually lead to waste of resource utilization, and the larger the general MMIO High Granularity Size, the greater the waste; each CPU stack unit / IIO Port will be allocated a resource amount as large as the MMIO High Granularity Size, or a special port will be given a larger resource amount, but in fact not every CPU stack unit is used as a PCIE Port. In this case, this stack unit actually does not need or requires relatively few MMIOH (Memory Mapped I / O High) resources. Its resource demand is not on the same order of magnitude as that of the PCIE Port. Allocating the same two levels of resources to it is a waste of resources and results in low utilization; the related technology is a static or semi-static optimization solution that requires pre-determining the resource requirements of the CPU stack unit and performing special processing on the resource allocation of the CPU stack unit to meet its requirements, and cannot achieve the dynamic solution effect of automatic identification and allocation.

[0021] In response to the defects of the above-mentioned related technologies, the embodiments of the present application propose a server device resource allocation method, server, storage medium and program product to realize automatic identification and allocation of resources, solve the technical problem that the related technologies cannot dynamically allocate resources and cause resource waste, and achieve technical effects such as high-efficiency utilization of resources and reduction of resource waste, which will be described in detail below.

[0022] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0023] Figure 1 FIG. 1 is a flow chart of a method for allocating server device resources according to an embodiment of the present invention. The server includes at least one processor, and the processor is provided with multiple stack units, such as Figure 1 As shown, the processor is configured to perform the following steps: In step S101 , each stack unit is traversed to identify whether a target port of the stack unit is a root port, wherein the target port of the stack unit is a stack port of the stack unit or an integrated input / output module port corresponding to the stack unit.

[0024] Among them, the stack unit is the multiple units into which the integrated I / O (Input / Ouput) module of the processor is divided. Each such unit is called a stack unit. The root port is the port directly connected to the processor and serves as the starting point of the PCIe device tree.

[0025] It can be understood that the embodiment of the present application first traverses each stack unit in the processor and checks whether the target port of the stack unit is the root port in the PCIe architecture. The target port here refers to the stack port inside the stack unit or the corresponding integrated input and output module port. In this way, it can be determined whether the stack unit is directly connected to the external PCIe device, thereby deciding whether corresponding resources need to be allocated to it.

[0026] In step S102 , if the target port of the stack unit is not a root port, the target resource amount of the stack unit is determined according to the resource requirement of the stack unit.

[0027] It can be understood that if the embodiment of the present application determines that the target port of the stack unit is not a root port for directly connecting to an external PCIe device, the target resource amount to be allocated is determined based on the actual resource requirements of the stack unit. That is, when the stack unit does not serve as a root port for directly connecting to an external device, its specific resource requirements are evaluated and an appropriate amount of resources are allocated to it accordingly, rather than allocating them according to a preset fixed value. This can make more efficient use of resources and avoid unnecessary waste.

[0028] In an embodiment of the present application, before determining the target resource amount of the stack unit based on the resource demand of the stack unit, it includes: initiating resource demand interaction for the stack unit; when it is determined according to the interaction result that the stack unit does not need resources, skipping the stack unit; when it is determined according to the interaction result that the stack unit needs resources, determining the target resource amount of the stack unit based on the resource demand of the stack unit.

[0029] The resource requirement interaction is a process of communicating with a stack unit to determine whether the stack unit needs resources and how much resources it needs. The details will be described in detail below and will not be repeated here.

[0030] It can be understood that the embodiment of the present application determines the target resource amount of the stack unit by initiating resource demand interaction with the stack unit. Specifically, if it is determined through the resource demand interaction that the stack unit does not need additional resources, the stack unit is directly skipped and no resources are allocated to it; conversely, if the interaction result shows that the stack unit does need resources, the amount of resources to be allocated to the target stack unit is determined based on its specific resource demand, thereby ensuring that resources can match actual needs more accurately, improving the efficiency of resource utilization, and reducing waste.

[0031] In an embodiment of the present application, initiating resource demand interaction for the stack unit includes: sending a read / write request to the corresponding register or memory address space of the stack unit; and determining the interaction result for the stack unit based on the read / write result.

[0032] Among them, read and write requests refer to commands sent to specific hardware components for communicating with registers or memory address spaces related to the stack unit; registers or memory address spaces refer to special locations within or associated with the stack unit that can be used to store status information, configuration parameters or data exchange. By accessing these locations, information about the current status or requirements of the stack unit can be obtained.

[0033] It can be understood that the embodiment of the present application initiates the interaction process of the stack unit resource demand, including sending read and write requests to the corresponding register or memory address space of the stack unit. By analyzing the data returned by these read and write operations, the interaction result obtained by interacting with the stack unit can be determined, that is, whether the stack unit needs resources and its specific resource demand can be confirmed, thereby realizing the determination of subsequent resource allocation strategies based on the actual detected resource demand of the stack unit, ensuring that resources can be used efficiently and reducing waste.

[0034] In step S103 , if the target port of the stack unit is a root port, the target resource amount of the stack unit is determined according to the resource demand amount of each terminal device connected to the target port.

[0035] The terminal device refers to a device that is directly or indirectly connected to the root port through the PCIe bus, such as a GPU.

[0036] It is understandable that in the embodiment of the present application, if the target port of the stack unit is identified as a root port, it is necessary to determine the target amount of resources to be allocated to the stack unit based on the specific resource requirements of the terminal device connected to this root port. That is, it is necessary to evaluate the total amount of MMIO resources required by the terminal device connected to the root port, and allocate sufficient resources to the target stack unit accordingly to support the normal operation of these devices, thereby ensuring that the resources can accurately meet the needs of the actual connected devices, thereby improving the effectiveness and rationality of resource allocation.

[0037] In an embodiment of the present application, before determining the target resource amount of the stack unit based on the resource requirement of each terminal device connected to the target port, it includes: traversing each terminal device connected to the target port, obtaining the type and size of resources required by each terminal device, and determining the resource requirement of each terminal device based on the type and size of resources required by each terminal device.

[0038] The resource types may include 32-bit MMIO, 64-bit MMIO, 32-bit prefetchable MMIO, 64-bit prefetchable MMIO, etc.

[0039] It can be understood that, before confirming that the target port of the stack unit is the root port and determining the target resource amount of the stack unit based on the resource requirement of each terminal device connected to the target port, the embodiment of the present application needs to first traverse all terminal devices connected to the root port, obtain the type of resources required and their corresponding size for each terminal device, and calculate the exact resource requirement of each terminal device based on this information, thereby ensuring that the resources subsequently allocated to the stack unit can accurately match the requirements of all terminal devices actually connected, thereby achieving effective utilization and reasonable allocation of resources.

[0040] It should be noted that after obtaining the resource requirements of each terminal device under the root port, each terminal device reports the required resource requirements to its upper-level PCIe Bridge; the Bridge collects and summarizes the types and sizes of resources required by all the terminal devices connected below, as well as the starting and ending addresses of the resources allocated to them, and then reports to its upper-level Bridge (if any). After the above-mentioned reporting, when it reaches the processor root port level, it can know the total size of the resource requirements required by all terminal devices connected to the root port.

[0041] In step S104 , the device resources of the server are allocated according to the target resource amount of each stack unit.

[0042] It can be understood that the embodiment of the present application can allocate corresponding device resources in the server to each stack unit based on the target resource amount determined by each stack unit obtained in the above steps, that is, allocate resources based on the actual needs of each stack unit, or the type and size of resources required by all terminal devices directly or indirectly connected to the stack unit. In this way, it can be ensured that each stack unit and its associated devices can obtain the exact amount of resources required, thereby achieving effective utilization of resources while avoiding waste of resources, which is crucial for optimizing the internal hardware configuration of the server and improving overall performance.

[0043] In an embodiment of the present application, the device resources of the server are allocated according to the target resource amount of each stack unit, including: reading the first allocation order pre-configured by the current processor, wherein the first allocation order is the resource allocation order of the stack units of at least one processor; starting from the starting allocation address of the current processor, allocating the device resources of the target resources to each stack unit according to the first allocation order.

[0044] Among them, the first allocation order defines the order of stack units in at least one processor when allocating device resources. The first allocation order can define the resource allocation order of the stack units independently without following the order of the stack unit numbers in the processor. It is worth mentioning that the first allocation order can also be used to allocate resources for stack units across processors, that is, except for the dimension of processor number, all stack units of all processors are put together, and these stack units are logically re-sorted as needed to obtain the first allocation order, and then resource allocation processing is performed according to the first allocation order. The first allocation order is adjusted according to actual needs and is not specifically limited here.

[0045] It can be understood that when allocating server device resources to each stack unit according to its target resource quantity, the embodiment of the present application reads the first allocation order pre-configured by the current processor, which determines the order of the stack units in the processor in the resource allocation process. Starting from the starting allocation address of the stack unit specified by the current processor, the required device resources are allocated to each stack unit in this order until the target resource quantity requirements are met. For example, the stack units are numbered in the order of 0 / 1 / 2..., and the first allocation order is 0 / 2 / 1 / 3..., then the required device resources are allocated to each stack unit in turn according to the first allocation order, rather than only in the order of stack unit numbers. In this way, the allocation order of the stack units can be customized according to actual needs, which improves the efficiency and flexibility of resource utilization, reduces resource waste and improves overall performance.

[0046] In an embodiment of the present application, before allocating the device resources of the server according to the target resource amount of each stack unit, it also includes: reading the second allocation order pre-configured for the current processor, wherein the second allocation order is the resource allocation order for each processor; if the current processor is the first processor in the second allocation order, the starting allocation address of the current processor is the pre-configured address; if the current processor is not the first processor in the second allocation order, the starting allocation address of the current processor is the resource end address of the last processor that completed resource allocation.

[0047] Among them, the second allocation order defines the order in which device resources are allocated between each processor, which is generally the order of processor numbering. If necessary, the second allocation order can be customized and adjusted according to actual needs. The second allocation order is not specifically limited here; the starting allocation address refers to the memory address used when allocating resources to the first stack unit of the processor, and the initial value is the MMIO High Base value; the resource end address refers to the end address of the resources of all stack units of a processor after the resource allocation of a processor or stack unit is completed.

[0048] It can be understood that before allocating the server's device resources to each stack unit according to its target resource amount, the embodiment of the present application needs to read the second allocation order pre-configured by the current processor, which specifies the resource allocation order between each processor, wherein the second allocation order can be the default processor number 0 / 1 / 2 / ..., or it can be a custom order such as 0 / 2 / 1 / 3..., if the current processor is at the first place in the second allocation order, then its starting allocation address will be a pre-set fixed address, namely the MMIO High Base value; however, if the current processor is not the first processor in the second allocation order, then its starting allocation address will be the resource end address of the last processor that completed resource allocation. The above-mentioned resource allocation order ensures the continuity and orderliness of the resource allocation process, so that each processor and its related stack unit can obtain corresponding device resources according to actual needs and the predetermined order, thereby optimizing the resource allocation efficiency of the entire system.

[0049] In an embodiment of the present application, before traversing each stack unit, it also includes: reading the second allocation order pre-configured by the current processor, wherein the second allocation order is the resource allocation order of each processor; if the current processor is the first processor in the second allocation order, then starting to execute the device resource allocation action; if the current processor is not the first processor in the second allocation order, then based on the last processor that completed resource allocation and the second allocation order, determining that the current processor is the next processor to execute the device resource allocation action, then starting to execute the device resource allocation action.

[0050] It can be understood that before traversing each stack unit, the embodiment of the present application needs to read the second allocation order pre-configured by the current processor to understand the resource allocation order between the processors. If the current processor is the first processor in the second allocation order, the device resource allocation action is started immediately; if the current processor is not the first processor in the second allocation order, it is necessary to wait until the current processor is confirmed to be the next processor that should perform the resource allocation action based on the second allocation order and the information of the last processor that completed resource allocation, and then the device resource allocation action is started, thereby ensuring that all processors and their related stack units can obtain and allocate resources in an orderly manner according to a predetermined logical order, realizing efficient and conflict-free resource management, which not only ensures the continuity and orderliness of resource allocation, but also improves the resource allocation efficiency of the entire system.

[0051] In an embodiment of the present application, in the process of allocating device resources of a server according to the target resource amount of each stack unit, it also includes: identifying the address alignment requirements of the stack unit or processor; when allocating device resources of the server, aligning at least one of the resource start address and resource end address of the stack unit based on the alignment granularity of the address alignment requirements.

[0052] Among them, the address alignment requirement means that when allocating resources, certain hardware components or design specifications may require the starting address or ending address of the resource to be aligned according to a specific granularity (such as 1MB, 4MB, etc.), so as to improve access efficiency or meet the design requirements of specific hardware; the alignment granularity refers to the minimum unit set to meet the address alignment requirement. For example, if a device requires its resource address to be aligned at 4MB, it means that the resource starting address and / or ending address of the device should be an integer multiple of 4MB.

[0053] It can be understood that in the process of allocating device resources of the server according to the target resource amount of each stack unit in the embodiment of the present application, it is also necessary to identify whether there are address alignment requirements for the stack unit or processor. When these requirements and their corresponding alignment granularity are determined, when actually allocating resources, it is necessary to adjust the resource start address and / or resource end address of the stack unit based on the required alignment granularity to ensure that at least one of the addresses meets the alignment requirements, optimize hardware performance, avoid inefficient access or other potential problems caused by address misalignment, and ensure that all devices can operate in their optimal state, thereby achieving efficient use of resources while meeting the design specifications and performance requirements of specific hardware.

[0054] According to the server device resource allocation method of the embodiment of the present application, the processor can traverse each stack unit, determine whether the target port of the stack unit is the root port, and determine the target resource amount of the stack unit based on the port type and the corresponding resource demand. Finally, the server's device resources are allocated based on the target resource amount of the stack unit, thereby realizing automatic identification and allocation of resources, achieving technical effects such as efficient utilization of resources and reducing resource waste.

[0055] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0056] The server device resource allocation method is further described below through a specific embodiment.

[0057] Compared to related technologies, this embodiment no longer sets the MMIO High Granularity Size parameter, including its optional value configuration in the BIOS settings and its processing in the function code. Furthermore, the same amount of MMIOH is no longer pre-allocated to each stack unit of each processor. Instead, it is processed on demand. Specifically, the following steps are taken: Traverse each processor in order, where the processor and stack unit structure diagram is as follows Figure 2 As shown, the following processing is performed for each processor: For each processor, the target port (Stack / IIO Port) of each stack unit is traversed sequentially. When the target port is not a root port (PCIe Root Port), only a resource of a value that meets its own needs is allocated to it on demand. For stack units that do not require resources, they are skipped and no resources are allocated.

[0058] Among them, the amount of resources required for the stack unit, or whether resources are needed, can be obtained by interacting with the stack unit according to the design, such as reading, writing and parsing related registers or memory address space; or by studying the technical documents of the chip manufacturer, etc.

[0059] When the target port is a root port, its connection diagram is as follows: Figure 3 As shown, it should be noted that Figure 3 This only shows the situation where a root node is connected to multiple terminal devices. In actual situations, there may be two or more root nodes that jointly support one or more PCIe terminal devices or switching devices. According to the PCIe specification, it traverses all the PCIe terminal devices connected to it, collects the types and sizes of resources required by each PCIe terminal device, and allocates the required types and sizes of resources to the terminal device as needed. At the same time, according to the PCIe specification, it reports the required types and sizes of resources, as well as the starting and ending addresses of the allocated resources, to its upper-level PCIe Bridge. After collecting and summarizing the types and sizes of resources required by all the terminal devices connected to it, as well as the starting and ending addresses of the allocated resources, the Bridge reports to its upper-level Bridge (if any).

[0060] After reporting through the above layers, when it reaches the processor root port level, it can know the resource types and total size required by all PCIe terminal devices connected to it, as well as the starting address and ending address of the allocated resources (the starting address plus the total resource demand).

[0061] The following is a detailed description of the resource allocation order: For processor numbered 1 (referring to the first processor on the machine, or numbered 0, numbering can start from 0 or 1), the starting address of its stack unit resource allocation is the MMIO High Base value. Generally speaking, after all the stack unit resource allocations of a processor are processed in the order of processor number, the next processor is processed in sequence. The starting address of the starting stack unit resource allocation of the next processor is the ending address of the resources of all the stack units of the previous processor. The sequential MMIOH resource allocation is as follows: Figure 4 shown.

[0062] When special designs or business scenarios require it, during resource allocation, you can design optimization solutions including but not limited to the following: breaking the original processor order (not following the order of processor numbers 0 / 1 / 2...) or stack unit order (not following the order of stack unit numbers 0 / 1 / 2...), and defining the processor resource allocation order and / or stack unit resource allocation order by yourself; you can even allocate stack unit resources across processors, that is, excluding the dimension of processor number, putting all stack units of all processors together, re-logically sorting these stack units as needed, and then aligning them according to this new logical order for resource allocation.

[0063] It should be noted that when there are alignment requirements for the starting or ending addresses of resources between stack units or processors, such as but not limited to alignment at granularity of 1M, 4M, etc., the starting and / or ending addresses of resources shall be aligned as needed during resource allocation.

[0064] Through the above solution, after all stack units of all processors on the machine are allocated resources on demand, high-efficiency utilization of MMIOH resources is achieved, and resource waste is significantly reduced. Except for possible resource address alignment requirements, there is no other resource waste, thereby maximizing the number of devices supported by the machine in terms of MMIOH resources.

[0065] The embodiment of the present application also provides a server device resource allocation device, Figure 5 A schematic block diagram of a server device resource allocation device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the server device resource allocation apparatus 10 includes: an identification module 201 , a first determination module 202 , a second determination module 203 and an allocation module 204 .

[0066] Among them, the identification module 201 is used to traverse each stack unit and identify whether the target port of the stack unit is a root port, wherein the target port of the stack unit is the stack port of the stack unit or the integrated input and output module port corresponding to the stack unit; the first determination module 202 is used to determine the target resource amount of the stack unit according to the resource demand of the stack unit if the target port of the stack unit is not a root port; the second determination module 203 is used to determine the target resource amount of the stack unit according to the resource demand of each terminal device connected to the target port if the target port of the stack unit is a root port; the allocation module 204 is used to allocate the device resources of the server according to the target resource amount of each stack unit.

[0067] In an embodiment of the present application, the first determination module 202 is further used to: initiate resource requirement interaction for the stack unit before determining the target resource amount of the stack unit based on the resource requirement of the stack unit; skip the stack unit when it is determined according to the interaction result that the stack unit does not need resources; and determine the target resource amount of the stack unit based on the resource requirement of the stack unit when it is determined according to the interaction result that the stack unit needs resources.

[0068] In the embodiment of the present application, the first determination module 202 is further used to: send a read / write request to a register or memory address space corresponding to the stack unit; and determine an interaction result for the stack unit according to the read / write result.

[0069] In an embodiment of the present application, the second determination module 203 is further used to: before determining the target resource amount of the stack unit based on the resource requirement of each terminal device connected to the target port, traverse each terminal device connected to the target port, obtain the type and size of resources required by each terminal device, and determine the resource requirement of each terminal device based on the type and size of resources required by each terminal device.

[0070] In an embodiment of the present application, the allocation module 204 is further used to: allocate device resources of the server according to the target resource amount of each stack unit, read the first allocation order pre-configured by the current processor, wherein the first allocation order is the resource allocation order of the stack units of at least one processor; starting from the starting allocation address of the current processor, allocate device resources of the target resources to each stack unit according to the first allocation order.

[0071] In an embodiment of the present application, the allocation module 204 is further used to: before allocating the device resources of the server according to the target resource amount of each stack unit, read the second allocation order pre-configured by the current processor, wherein the second allocation order is the resource allocation order of each processor; if the current processor is the first processor in the second allocation order, the starting allocation address of the current processor is the pre-configured address; if the current processor is not the first processor in the second allocation order, the starting allocation address of the current processor is the resource end address of the last processor that completed resource allocation.

[0072] In an embodiment of the present application, a reading module is also included, wherein the reading module is further used to: before traversing each stack unit, read the second allocation order pre-configured by the current processor, wherein the second allocation order is the resource allocation order of each processor; if the current processor is the first processor in the second allocation order, the device resource allocation action is started; if the current processor is not the first processor in the second allocation order, based on the last processor that completed resource allocation and the second allocation order, it is determined that the current processor is the next processor to execute the device resource allocation action, and the device resource allocation action is started.

[0073] For the description of the features in the embodiment corresponding to the server device resource allocation apparatus, reference can be made to the relevant description of the embodiment corresponding to the server device resource allocation method, which will not be repeated here.

[0074] According to the server device resource allocation device of the embodiment of the present application, the processor can traverse each stack unit, determine whether the target port of the stack unit is the root port, and determine the target resource amount of the stack unit according to the port type and the corresponding resource demand. Finally, the device resources of the server are allocated according to the target resource amount of the stack unit, thereby realizing automatic identification and allocation of resources, achieving technical effects such as high-efficiency utilization of resources and reducing resource waste.

[0075] The embodiment of the present application also provides a server, such as Figure 6 As shown, the server includes: a memory 301 for storing computer programs; and at least one processor 302, where the processor 302 is configured to implement the steps of the above-mentioned server device resource allocation method when executing the computer program.

[0076] An embodiment of the present application further provides a non-volatile computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of the above-mentioned server device resource allocation method embodiment when running.

[0077] In an exemplary embodiment, the non-volatile computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0078] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in the embodiment of the server device resource allocation method are implemented.

[0079] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned server device resource allocation method embodiment are implemented.

[0080] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0081] The above is a detailed introduction to a server device resource allocation method, server, storage medium, and program product provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only intended to help understand the method and core ideas of the present application. It should be pointed out that, for those skilled in the art, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A server device resource allocation method, characterized in that: The server includes at least one processor, the processor is provided with a plurality of stack units, and the processor is configured to perform the following steps: Traversing each of the stack units, identifying whether a target port of the stack unit is a root port, wherein the target port of the stack unit is a stack port of the stack unit or an integrated input / output module port corresponding to the stack unit; If the target port of the stack unit is not the root port, determining the target resource amount of the stack unit according to the resource requirement of the stack unit; If the target port of the stack unit is the root port, determining the target resource amount of the stack unit according to the resource demand of each terminal device connected to the target port; The device resources of the server are allocated according to the target resource amount of each stack unit.

2. The server device resource allocation method according to claim 1, characterized in that: Before determining the target resource amount of the stack unit according to the resource demand amount of the stack unit, the method includes: Initiating resource demand interaction for the stack unit; When it is determined according to the interaction result that the stack unit does not need resources, skipping the stack unit; When it is determined according to the interaction result that the stack unit needs resources, the target resource amount of the stack unit is determined according to the resource demand of the stack unit.

3. The server device resource allocation method according to claim 2, characterized in that: The initiating resource demand interaction for the stack unit includes: Sending a read / write request to a corresponding register or memory address space of the stack unit; The interaction result of the stack unit is determined according to the read and write results.

4. The server device resource allocation method according to claim 1, wherein: Before determining the target resource amount of the stack unit according to the resource demand of each terminal device connected to the target port, the method includes: Traverse each terminal device connected to the target port, obtain the resource type and size required by each terminal device, and determine the resource demand of each terminal device according to the resource type and size required by each terminal device.

5. The server device resource allocation method according to claim 1, wherein: Allocating the device resources of the server according to the target resource amount of each stack unit includes: Reading a first allocation order pre-configured by the current processor, wherein the first allocation order is a resource allocation order of a stack unit of at least one processor; Starting from the start allocation address of the current processor, device resources of the target resource are allocated to each of the stack units according to the first allocation order.

6. The server device resource allocation method according to claim 5, characterized in that: Before allocating the device resources of the server according to the target resource amount of each stack unit, the method further includes: Reading a second allocation order pre-configured for the current processor, wherein the second allocation order is a resource allocation order for each processor; If the current processor is the first processor in the second allocation order, the starting allocation address of the current processor is a pre-configured address; If the current processor is not the first processor in the second allocation sequence, the starting allocation address of the current processor is the resource ending address of the last processor that completed resource allocation.

7. The server device resource allocation method according to claim 1, characterized in that: Before traversing each of the stack cells, the method further includes: Reading a second allocation order pre-configured for the current processor, wherein the second allocation order is a resource allocation order for each processor; If the current processor is the first processor in the second allocation order, then starting to execute the device resource allocation action; If the current processor is not the first processor in the second allocation order, the device resource allocation action is started when the current processor is determined to be the next processor to perform the device resource allocation action based on the last processor that completed resource allocation and the second allocation order.

8. A server, characterized in that: include: memory for storing computer programs; At least one processor, wherein the processor is configured to implement the steps of the server device resource allocation method according to any one of claims 1 to 7 when executing the computer program.

9. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the server device resource allocation method according to any one of claims 1 to 7 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the server device resource allocation method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method for dynamically adjusting computer system resources

    CN105630602A

  • MMIO resource setting method and related device

    CN113032148A

  • Method and device for unified scheduling of PCI (Peripheral Component Interconnect) equipment resources and medium

    CN115080242A

  • PCIe resource allocation method and device, electronic equipment and storage medium

    CN118034917A

  • Resource allocation method and device of PCIe equipment, storage medium and equipment

    CN119938321A

Cited By

  • Method and device for allocating memory mapping input and output resources of interface equipment

    CN120872626A

  • Access control service setting method and electronic equipment

    CN120874096A