Resource allocation method and computing device
By dynamically determining the resource amount of DPU and PCIE slots during the system startup of the computing device, the problem of poor resource allocation flexibility in computing device is solved, and more flexible resource allocation is achieved.
Patent Information
- Application Number
- CN202411888085.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-15
AI Technical Summary
When computing devices allocate resources, different resource allocation tables need to be pre-set when configurations are not provided, resulting in poor resource allocation flexibility.
During the system startup of the computing device, the resource amount is dynamically determined based on the DPU's in-place situation, and the resource amount required for the integrated input and output IIO stack of different PCIE slots is flexibly allocated.
By dynamically determining the amount of resources required by the DPU and the amount of resources required by the PCIE slot, the flexibility of resource allocation is improved and the limitation of presetting the resource allocation table is avoided.
Smart Images

Figure CN119829280A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the technical field of computing devices, and in particular, to a resource allocation method and a computing device. Background Art
[0002] The computing device needs to allocate resources to the connected data processing unit (DPU).
[0003] At present, the computing device can allocate resources to the connected DPU according to the pre-configured resource allocation table. The resource allocation table may include: the amount of resources required by the DPU connected to the computing device. However, when the configuration of the computing device is different, the amount of resources required by the DPU connected to the computing device is different. Therefore, it is necessary to pre-set a corresponding resource allocation table for each configuration of the computing device, resulting in poor flexibility in resource allocation. Summary of the invention
[0004] The embodiments of the present application provide a resource allocation method and a computing device for solving the technical problem of poor resource allocation flexibility.
[0005] In a first aspect, an embodiment of the present application provides a resource allocation method, which is applied to a computing device, wherein the computing device includes a plurality of peripheral component interconnection fast PCIE slots, and the method includes:
[0006] During the system startup process of the computing device, based on the presence of the DPU in the computing device, determining a first resource amount, the first resource amount being the sum of resource amounts required by at least one DPU in the computing device, the DPU in the computing device being inserted in the PCIE slot;
[0007] Determine, according to the first resource amount, a second resource amount corresponding to each PCIE slot of the plurality of PCIE slots, wherein the second resource amount is a resource amount required for an integrated input and output IIO stack of the PCIE slot;
[0008] Based on the first resource amount and the second resource amount, resources are allocated to the multiple PCIE slots.
[0009] In the above scheme, the computing device can determine the first amount of resources based on the presence of the DPU in the computing device during the system startup of the computing device; can determine the second amount of resources corresponding to each of the multiple PCIE slots based on the first amount of resources; and can allocate resources to the multiple PCIE slots based on the first amount of resources and the second amount of resources. In the above method, the computing device can determine the amount of resources required by the DPU based on the presence of the DPU in the computing device. When the DPUs in place in the computing device are different, the amount of resources required by the DPU determined by the computing device is also different. Through the above scheme, the computing device can flexibly determine the amount of resources required by the DPU, and can flexibly allocate the amount of resources to multiple PCIE slots, thereby improving the flexibility of resource allocation.
[0010] In a possible implementation manner, determining the first resource amount based on the presence of the DPU in the computing device includes:
[0011] Obtaining a first signal, where the first signal is used to indicate the number of DPUs in the computing device;
[0012] The first resource amount is determined according to the first signal.
[0013] In the above solution, the computing device can determine the first resource amount according to the first signal, thereby achieving the purpose of determining the first resource amount.
[0014] In a possible implementation, the computing device further includes a first complex programmable logic device (CPLD); and the obtaining of the first signal includes:
[0015] A first signal is obtained from a register of the first CPLD, where the first signal is data stored in M bits in the register of the first CPLD, where the M bits are used to indicate the number of DPUs in place in the computing device, and M is an integer greater than or equal to 1.
[0016] In the above solution, the computing device can determine the first signal according to the data stored in the M bits, thereby achieving the purpose of obtaining the first signal.
[0017] In a possible implementation manner, determining the first resource amount according to the first signal includes:
[0018] If the first signal indicates that the number of DPUs in the computing device is zero, determining that the first amount of resources is zero;
[0019] If the first signal indicates that the number of DPUs in place in the computing device is greater than zero, determine the amount of resources required by each DPU in at least one DPU in place in the computing device, and determine the sum of the amount of resources required by each DPU as the first amount of resources.
[0020] In the above solution, the first resource amount can be determined according to the first signal, thereby achieving the purpose of determining the first resource amount.
[0021] In a possible implementation, for any existing DPU, determining the amount of resources required by the DPU includes:
[0022] Determine whether there is an update resource amount in the configuration space of the DPU;
[0023] If the updated resource amount exists in the configuration space of the DPU, determining the updated resource amount as the resource amount required by the DPU;
[0024] If there is no update resource amount in the configuration space of the DPU, the resource amount required by the DPU is determined according to the model of the DPU.
[0025] In the above solution, the update resource amount can be determined as the resource amount required by the DPU, or the resource amount required by the DPU can be determined according to the model of the DPU, thereby achieving the purpose of determining the resource amount required by the DPU.
[0026] In a possible implementation, determining, according to the first resource amount, a second resource amount corresponding to each PCIE slot in the plurality of PCIE slots includes:
[0027] Determine a difference between a third resource amount and the first resource amount, the third resource amount being the total amount of resources in the computing device;
[0028] The ratio of the difference to the number of the plurality of PCIE slots is determined as the second resource amount.
[0029] In the above solution, the second resource amount can be determined based on the first resource amount, thereby achieving the purpose of determining the second resource amount.
[0030] In a possible implementation manner, allocating resources to the multiple PCIE slots based on the first resource amount and the second resource amount includes:
[0031] If the first resource amount is zero, allocating resources of the second resource amount to each PCIE slot of the plurality of PCIE slots;
[0032] If the first resource amount is greater than zero, determine the slot number corresponding to each DPU in the at least one in-place DPU, and allocate resources to the multiple PCIE slots based on the slot number, where the slot number is used to indicate the PCIE slot in which the DPU is inserted.
[0033] In the above solution, resources can be allocated to multiple PCIE slots according to the first resource amount, thereby achieving the purpose of allocating resources to the PCIE slots.
[0034] In a possible implementation, the computing device further includes a second CPLD; and the determining a slot number corresponding to each DPU in the at least one in-place DPU includes:
[0035] Acquire a second signal from a register of the second CPLD, where the second signal is data stored in N bits in the register of the second CPLD, where the N bits are used to indicate a slot number of a target slot, where the target slot is a PCIE slot in which the DPU is inserted, and N is an integer greater than or equal to 1;
[0036] According to the second signal, a slot number corresponding to each DPU in at least one in-place DPU is determined.
[0037] In the above solution, the slot number corresponding to each in-place DPU can be determined according to the second signal, thereby achieving the purpose of determining the slot number of the in-place DPU.
[0038] In a possible implementation manner, the number of the target slots is greater than or equal to 1; and the allocating resources to the multiple PCIE slots based on the slot numbers includes:
[0039] Determine the amount of resources required by the DPU installed in each target slot;
[0040] Allocate resources to each target slot according to the amount of resources required by the DPU inserted in each target slot and the second amount of resources;
[0041] Allocate a second amount of resources to each PCIE slot among the plurality of PCIE slots except the target slot.
[0042] In the above scheme, resources can be allocated to the target slot according to the resource amount required by the DPU inserted in the target slot and the second resource amount, and the second resource amount can be allocated to PCIE slots other than the target slot, thereby achieving the purpose of allocating resources to multiple PCIE slots.
[0043] In a possible implementation, for any target slot, determining the amount of resources required by the DPU inserted in the target slot includes:
[0044] Determine whether there is an update resource amount in the configuration space corresponding to the target slot;
[0045] If the updated resource amount exists in the configuration space corresponding to the target slot, the updated resource amount is determined as the resource amount required by the DPU inserted in the target slot;
[0046] If the configuration space corresponding to the target slot does not have an updated resource amount, the resource amount required by the DPU inserted in the target slot is determined according to the model of the DPU inserted in the target slot.
[0047] In the above scheme, the amount of resources required by the DPU inserted in the target slot can be determined according to the updated resource amount or the DPU model, thereby achieving the purpose of determining the amount of resources required by the DPU inserted in the target slot.
[0048] In a possible implementation, the resource is any one of the following:
[0049] Bus number, memory address space, input / output I / O address space or interrupt resource.
[0050] In the above scheme, the resources may be a bus number, a memory address space, an I / O address space or an interrupt resource, etc. The computing device may allocate a bus number, a memory address space, an I / O address space or an interrupt resource, etc. to multiple PCIE slots through any of the methods described above, thereby achieving the purpose of flexibly allocating resources to the PCIE slots.
[0051] In a second aspect, an embodiment of the present application provides a resource allocation device, which is applied to a computing device, wherein the computing device includes a plurality of peripheral component interconnection fast PCIE slots, and the device includes: a determination module and an allocation module, wherein:
[0052] The determination module is used to determine, during a system startup process of the computing device, a first resource amount based on the presence of a DPU in the computing device, where the first resource amount is the sum of resource amounts required by at least one DPU in the computing device, where the DPU in the computing device is a DPU inserted in the PCIE slot;
[0053] The determining module is used to determine, according to the first resource amount, a second resource amount corresponding to each PCIE slot of the plurality of PCIE slots, wherein the second resource amount is a resource amount required by an integrated input and output IIO stack of the PCIE slot;
[0054] The allocation module is used to allocate resources to the multiple PCIE slots based on the first resource amount and the second resource amount.
[0055] In the above scheme, the computing device can determine the first amount of resources based on the presence of the DPU in the computing device during the system startup of the computing device; can determine the second amount of resources corresponding to each of the multiple PCIE slots based on the first amount of resources; and can allocate resources to the multiple PCIE slots based on the first amount of resources and the second amount of resources. In the above method, the computing device can determine the amount of resources required by the DPU based on the presence of the DPU in the computing device. When the DPUs in place in the computing device are different, the amount of resources required by the DPU determined by the computing device is also different. Through the above scheme, the computing device can flexibly determine the amount of resources required by the DPU, and can flexibly allocate the amount of resources to multiple PCIE slots, thereby improving the flexibility of resource allocation.
[0056] In a possible implementation, the determining module is specifically configured to:
[0057] Obtaining a first signal, where the first signal is used to indicate the number of DPUs in the computing device;
[0058] The first resource amount is determined according to the first signal.
[0059] In the above solution, the computing device can determine the first resource amount according to the first signal, thereby achieving the purpose of determining the first resource amount.
[0060] In a possible implementation, the computing device further includes a first complex programmable logic device (CPLD); the determining module is specifically configured to:
[0061] A first signal is obtained from a register of the first CPLD, where the first signal is data stored in M bits in the register of the first CPLD, where the M bits are used to indicate the number of DPUs in place in the computing device, and M is an integer greater than or equal to 1.
[0062] In the above solution, the computing device can determine the first signal according to the data stored in the M bits, thereby achieving the purpose of obtaining the first signal.
[0063] In a possible implementation, the determining module is specifically configured to:
[0064] If the first signal indicates that the number of DPUs in the computing device is zero, determining that the first amount of resources is zero;
[0065] If the first signal indicates that the number of DPUs in place in the computing device is greater than zero, determine the amount of resources required by each DPU in at least one DPU in place in the computing device, and determine the sum of the amount of resources required by each DPU as the first amount of resources.
[0066] In the above solution, the first resource amount can be determined according to the first signal, thereby achieving the purpose of determining the first resource amount.
[0067] In a possible implementation, for any in-place DPU, the determination module is specifically configured to:
[0068] Determine whether there is an update resource amount in the configuration space of the DPU;
[0069] If the updated resource amount exists in the configuration space of the DPU, determining the updated resource amount as the resource amount required by the DPU;
[0070] If there is no update resource amount in the configuration space of the DPU, the resource amount required by the DPU is determined according to the model of the DPU.
[0071] In the above solution, the update resource amount can be determined as the resource amount required by the DPU, or the resource amount required by the DPU can be determined according to the model of the DPU, thereby achieving the purpose of determining the resource amount required by the DPU.
[0072] In a possible implementation, the determining module is specifically configured to:
[0073] Determine a difference between a third resource amount and the first resource amount, the third resource amount being the total amount of resources in the computing device;
[0074] The ratio of the difference to the number of the plurality of PCIE slots is determined as the second resource amount.
[0075] In the above solution, the second resource amount can be determined based on the first resource amount, thereby achieving the purpose of determining the second resource amount.
[0076] In a possible implementation, the allocation module is specifically configured to:
[0077] If the first resource amount is zero, allocating resources of the second resource amount to each PCIE slot of the plurality of PCIE slots;
[0078] If the first resource amount is greater than zero, determine the slot number corresponding to each DPU in the at least one in-place DPU, and allocate resources to the multiple PCIE slots based on the slot number, where the slot number is used to indicate the PCIE slot in which the DPU is inserted.
[0079] In the above solution, resources can be allocated to multiple PCIE slots according to the first resource amount, thereby achieving the purpose of allocating resources to the PCIE slots.
[0080] In a possible implementation, the computing device further includes a second CPLD; the allocation module is specifically configured to:
[0081] Acquire a second signal from a register of the second CPLD, where the second signal is data stored in N bits in the register of the second CPLD, where the N bits are used to indicate a slot number of a target slot, where the target slot is a PCIE slot in which the DPU is inserted, and N is an integer greater than or equal to 1;
[0082] According to the second signal, a slot number corresponding to each DPU in at least one in-place DPU is determined.
[0083] In the above solution, the slot number corresponding to each in-place DPU can be determined according to the second signal, thereby achieving the purpose of determining the slot number of the in-place DPU.
[0084] In a possible implementation, the number of the target slots is greater than or equal to 1; and the allocation module is specifically configured to:
[0085] Determine the amount of resources required by the DPU installed in each target slot;
[0086] Allocate resources to each target slot according to the amount of resources required by the DPU inserted in each target slot and the second amount of resources;
[0087] Allocate a second amount of resources to each PCIE slot among the plurality of PCIE slots except the target slot.
[0088] In the above scheme, resources can be allocated to the target slot according to the resource amount required by the DPU inserted in the target slot and the second resource amount, and the second resource amount can be allocated to PCIE slots other than the target slot, thereby achieving the purpose of allocating resources to multiple PCIE slots.
[0089] In a possible implementation, for any target slot, the allocation module is specifically configured to:
[0090] Determine whether there is an update resource amount in the configuration space corresponding to the target slot;
[0091] If the updated resource amount exists in the configuration space corresponding to the target slot, the updated resource amount is determined as the resource amount required by the DPU inserted in the target slot;
[0092] If the configuration space corresponding to the target slot does not have an updated resource amount, the resource amount required by the DPU inserted in the target slot is determined according to the model of the DPU inserted in the target slot.
[0093] In the above scheme, the amount of resources required by the DPU inserted in the target slot can be determined according to the updated resource amount or the DPU model, thereby achieving the purpose of determining the amount of resources required by the DPU inserted in the target slot.
[0094] In a possible implementation, the resource is any one of the following:
[0095] Bus number, memory address space, input / output I / O address space or interrupt resource.
[0096] In the above scheme, the resources may be a bus number, a memory address space, an I / O address space or an interrupt resource, etc. The computing device may allocate a bus number, a memory address space, an I / O address space or an interrupt resource, etc. to multiple PCIE slots through any of the methods described above, thereby achieving the purpose of flexibly allocating resources to the PCIE slots.
[0097] In a third aspect, an embodiment of the present application provides a computing device, including: a memory, a processor;
[0098] The memory stores computer-executable instructions;
[0099] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0100] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.
[0101] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0102] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0103] Figure 1 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0104] Figure 2 A schematic diagram of a resource allocation method provided in an embodiment of the present application;
[0105] Figure 3 A flowchart of another resource allocation method provided in an embodiment of the present application;
[0106] Figure 4 A schematic diagram of the structure of a resource allocation device provided in an embodiment of the present application;
[0107] Figure 5 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0108] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.
[0109] To facilitate understanding, the technical terms involved in the embodiments of the present application are first explained.
[0110] DPU: refers to a processor used to handle data-intensive tasks. DPU is usually used in data center high-performance computing environments.
[0111] Configuration space: In the Peripheral Component Interconnect Express (PCIE) standard, the configuration space is a standardized address space used to manage and configure PCIE devices. The configuration space allows the operating system and device drivers to access the device's configuration information in order to identify the device, allocate resources, enable functions, and handle interrupts.
[0112] Integrated Input / Output Stack (IIO Stack): refers to the architecture and software stack used to handle the integrated input / output functions of PCIE devices in a processor or chipset. The IIO stack is mainly responsible for managing and coordinating data transmission and communication between PCIE devices.
[0113] For ease of understanding, the following Figure 1 , the computing device involved in the embodiments of the present application is described.
[0114] Figure 1 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. Figure 1The computing device may include a central processing unit (CPU) and a plurality of PCIE slots. For example, the plurality of PCIE slots may be PCIE slot 1, PCIE slot 2, ... and PCIE slot W, where W may be an integer greater than or equal to 2.
[0115] The PCIE slot can be used to plug in PCIE devices, including but not limited to DPU, graphics card, solid-state drive, and wireless network card.
[0116] When a DPU is plugged into a PCIE slot, the CPU usually needs to allocate resources to the DPU. For example, the CPU can allocate resources to the DPU through a basic input / output system (BIOS).
[0117] Currently, the CPU can allocate resources to the DPU plugged into the PCIE slot according to the configuration of the computing device, wherein the configuration of the computing device can be used to indicate the CPU model included in the computing device, the plugged DPU model, and the PCIE slot where the DPU is located.
[0118] Specifically, a resource allocation table may be pre-set for each configuration of the computing device, and the resource allocation table may include the amount of resources allocated to each DPU plugged into the computing device under the configuration. During the startup phase of the computing device, the CPU may allocate resources to the DPU according to the resource allocation table.
[0119] However, in the above method, different resource allocation tables need to be pre-set for different configurations. If a new computing device configuration appears, the resource allocation table corresponding to the new configuration needs to be re-set, resulting in poor resource allocation flexibility.
[0120] In view of this, an embodiment of the present application proposes a resource allocation method for improving the flexibility of resource allocation.
[0121] The technical solutions of the embodiments of the present application are described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0122] Figure 2 A flowchart of a resource allocation method provided in an embodiment of the present application. The execution subject of the method may be a computing device or a processor set in a computing device. The computing device may be, for example, a server. The processor in the computing device may be, for example, a CPU in a server. For ease of understanding, the following description is made by taking the execution subject as a computing device as an example. Figure 2 , the method may include:
[0123] S201. During a system startup process of a computing device, determine a first resource amount based on the presence of a DPU in the computing device.
[0124] The computing device may include multiple PCIE slots.
[0125] The first resource amount is the sum of resource amounts required by at least one DPU in place in the computing device, wherein the DPU in place is inserted in a PCIE slot.
[0126] For example, if one DPU is inserted into multiple PCIE slots, the first resource amount is the resource amount required by the one DPU; if two DPUs are inserted into multiple PCIE slots, the first resource amount is the sum of the resource amounts required by the two DPUs.
[0127] In this embodiment, the computing device may obtain the first signal and determine the first resource amount according to the first signal, wherein the first signal may be used to indicate the number of DPUs in the computing device.
[0128] The first signal may be data stored in M bits in a specific register in the computing device, where M is an integer greater than or equal to 1.
[0129] For example, assuming that M is equal to 5, and the absence of a set bit among the 5 bits indicates that the number of DPUs in the computing device is zero, and the presence of 2 bits set among the 5 bits indicates that the number of DPUs in the computing device is 2. Then, when the first signal indicates that there are 2 bits set, the computing device may determine that the number of DPUs in the computing device is 2.
[0130] Specifically, if the first signal indicates that the number of DPUs in the computing device is zero, the computing device may determine that the first resource amount is zero. If the first signal indicates that the number of DPUs in the computing device is greater than zero, the computing device may determine the amount of resources required for each DPU in place according to the DPU model of the DPU in place, and may determine the sum of the resource amounts of each DPU as the first resource amount.
[0131] It should be noted that if the first signal indicates that the number of PCIE slots of the DPU in the computing device is greater than zero, the computing device can obtain the model of the DPU in place from the configuration space corresponding to the multiple PCIE slots.
[0132] Specifically, the configuration space corresponding to the multiple PCIE slots includes the vendor ID and device ID of each DPU in place. The combination of each vendor ID and device ID can uniquely indicate a DPU model. The computing device can determine the DPU model of the corresponding DPU based on the vendor ID and device ID. There is a corresponding relationship between the DPU model and the resource demand.
[0133] For any in-place DPU, the computing device may determine the resource requirement of the DPU based on the DPU model of the DPU and the correspondence between the DPU model and the resource requirement, and may determine the resource requirement of the DPU as the resource amount required by the DPU.
[0134] In this embodiment, the resource may be any of the following: bus number (i.e., Bus number), memory address space, input / output (I / O) address space, or interrupt resource, etc. It should be noted that the above resources are not exhaustive and do not constitute a limitation on the technical solution provided in the embodiment of the present application.
[0135] S202: Determine a second resource amount corresponding to each PCIE slot in a plurality of PCIE slots according to the first resource amount.
[0136] The second resource amount is the resource amount required by the IIO stack of the PCIE slot.
[0137] In this embodiment, the computing device can determine the difference between the third resource amount and the first resource amount, where the third resource amount is the total amount of resources in the computing device; and determine the ratio of the difference to the number of multiple PCIE slots as the second resource amount.
[0138] For example, assuming that the number of the plurality of PCIE slots is 5 and the first resource amount is not zero, then:
[0139] Second resource amount = (third resource amount - first resource amount) / 5
[0140] For another example, assuming that the number of the plurality of PCIE slots is 5 and the first resource amount is zero, then:
[0141] Second resource amount = third resource amount / 5
[0142] S203: Allocate resources to multiple PCIE slots based on the first resource amount and the second resource amount.
[0143] In this embodiment, the plurality of PCIE slots may be divided into PCIE slots in which the DPU is inserted and PCIE slots in which the DPU is not inserted.
[0144] For any PCIE slot that is not equipped with a DPU, the computing device may allocate a second resource line resource to the PCIE slot.
[0145] For any PCIE slot in which a DPU is inserted, the computing device can determine the first sum of the second resource amount and the resource amount required by the corresponding DPU, and can allocate the first sum of resources to the PCIE slot. The corresponding DPU can be the DPU inserted in the PCIE slot.
[0146] In the resource allocation method provided in this embodiment, the computing device can determine the first resource amount based on the presence of the DPU in the computing device during the system startup process of the computing device; can determine the second resource amount corresponding to each PCIE slot in multiple PCIE slots based on the first resource amount; and can allocate resources to multiple PCIE slots based on the first resource amount and the second resource amount. In the above method, the computing device can determine the amount of resources required by the DPU based on the presence of the DPU in the computing device. When the DPUs in place in the computing device are different, the amount of resources required by the DPU determined by the computing device is also different. Through the above method, the computing device can flexibly determine the amount of resources required by the DPU, and can flexibly allocate resources to multiple PCIE slots, thereby improving the flexibility of resource allocation.
[0147] Based on the above embodiments, Figure 3 , the resource allocation method provided in the embodiment of the present application is further explained.
[0148] Figure 3 A flowchart of another resource allocation method provided in an embodiment of the present application. The execution subject of the method may be a computing device or a processor set in a computing device. The computing device may be, for example, a server. The processor in the computing device may be, for example, a CPU in a server. For ease of understanding, the following description is made by taking the execution subject as a computing device as an example. Figure 3 , the method may include:
[0149] S301. Acquire a first signal.
[0150] The first signal is used to indicate the number of DPUs present in the computing device.
[0151] In this embodiment, the computing device further includes a first complex programmable logic device (CPLD), and the register of the first CPLD can be used to store the first signal. The computing device can obtain the first signal from the register of the first CPLD, and the first signal is data stored in M bits in the register of the first CPLD, and the M bits are used to indicate the number of DPUs in the computing device, and M is an integer greater than or equal to 1.
[0152] In this embodiment, if the first signal indicates that the number of DPUs in the computing device is zero, S302 is executed; if the first signal indicates that the number of DPUs in the computing device is greater than zero, S303 is executed.
[0153] S302: Determine that the first resource amount is zero.
[0154] It should be understood that if the first signal indicates that the number of DPUs in the computing device is zero, it means that the computing device is not currently equipped with a DPU, and the amount of resources required by the DPU is zero. In other words, the first amount of resources is zero.
[0155] S303: Determine the amount of resources required by each DPU in at least one in-place DPU in the computing device, and determine the sum of the amount of resources required by each DPU as the first amount of resources.
[0156] It should be noted that the method for determining the amount of resources required by each DPU is the same. In this embodiment, any DPU is taken as an example to illustrate the method for determining the amount of resources required by the DPU.
[0157] In this embodiment, the computing device can determine whether there is an updated resource amount in the configuration space of the DPU; if there is an updated resource amount in the configuration space of the DPU, the updated resource amount is determined as the resource amount required by the DPU; if there is no updated resource amount in the configuration space of the DPU, the resource amount required by the DPU is determined according to the model of the DPU.
[0158] Specifically, the computing device may determine the update resource amount as the resource amount required by the DPU; or, the computing device may determine the resource amount required by the DPU based on the DPU model.
[0159] The updated resource amount may be the amount of resources that should be allocated to the DPU, determined during the previous operation of the computing device according to the DPU load or the tasks performed by the DPU, etc. The updated resource amount may be greater than the amount of resources required by the DPU determined according to the DPU model, or the updated resource amount may be less than the amount of resources required by the DPU determined according to the DPU model.
[0160] For example, during the previous operation of the computing device, if the amount of resources allocated to the DPU cannot meet the computing needs of the DPU, the computing device can determine the amount of updated resources corresponding to the DPU according to actual needs to improve the computing efficiency of the DPU; or the computing device can determine the amount of updated resources corresponding to each DPU according to the load balancing principle to avoid overloading or idleness of some DPUs; or the computing device can adaptively determine the amount of updated resources corresponding to the DPU according to data processing requirements (such as real-time data processing requirements, or large-volume data processing requirements, etc.) to improve data processing accuracy or rate. The computing device can also store the amount of updated resources corresponding to the DPU in the corresponding configuration space so that the amount of updated resources corresponding to the DPU can be obtained from the corresponding configuration space when it is started next time.
[0161] For another example, in a data center scenario, during the previous operation of the computing device, if multiple virtual machines shared the DPU in the computing device, the computing device can determine the update resource amount corresponding to the DPU according to the actual needs of the virtual machines to improve the performance and stability of the virtual environment; or the computing device can determine the update resource amount corresponding to each DPU for the purpose of energy conservation to reduce the overall power consumption of the data center. The computing device can also store the update resource amount corresponding to the DPU in the corresponding configuration space so that the update resource amount corresponding to the DPU can be obtained from the corresponding configuration space at the next startup.
[0162] For another example, during the previous operation of the computing device, the computing device can determine the amount of update resources corresponding to the corresponding DPU based on the traffic of the network device (such as a router or switch, etc.) to improve the data packet processing speed and network throughput and reduce latency; or, for the DPU corresponding to a high-security network application, the computing device can determine the amount of update resources corresponding to the DPU to improve the security of data transmission; or, in systems such as Network Attached Storage (NAS) or Storage Area Network (SAN), the computing device can adaptively determine the amount of update resources corresponding to the DPU based on the storage access mode to improve data reading, writing and storage efficiency; or, for the DPU corresponding to a high-reliability data storage application, the computing device can determine the amount of update resources corresponding to the DPU to improve data integrity.
[0163] It should be noted that the method for determining the amount of resources required by the DPU according to the DPU model can be found in S201 and will not be described in detail here.
[0164] During the specific implementation process, for any in-place DPU, when there is an updated amount of resources in the configuration space of the DPU, the computing device can determine the updated amount of resources as the amount of resources required by the DPU; when there is no updated amount of resources in the configuration space of the DPU, the computing device can determine the amount of resources required by the DPU based on the model of the DPU.
[0165] In this embodiment, the computing device can adjust the amount of resources allocated to the DPU according to the updated amount of resources of the DPU. In this way, the resources in the computing device can be better allocated and scheduled, so that the DPU can run efficiently, the overall performance of the computing device is better, and the user experience can be better.
[0166] S304: Determine a second resource amount corresponding to each PCIE slot in the plurality of PCIE slots according to the first resource amount.
[0167] It should be noted that the specific implementation method of S304 can refer to S202 and will not be repeated here.
[0168] In addition, if the first resource amount is zero, execute S305; if the first resource amount is not zero, execute S306.
[0169] S305: Allocate a second amount of resources to each PCIE slot in the plurality of PCIE slots.
[0170] It should be understood that if the first resource amount is zero, it means that each PCIE slot is not equipped with a DPU, and only the resource amount required by the IIO stack of the PCIE slot needs to be allocated to each PCIE slot. In other words, only the second resource amount needs to be allocated to each PCIE slot.
[0171] S306: Determine a slot number corresponding to each DPU in at least one in-place DPU.
[0172] In this embodiment, the computing device further includes a second CPLD. The computing device can obtain a second signal from a register of the second CPLD, the second signal being data stored in N bits in the register of the second CPLD, the N bits being used to indicate the slot number of the target slot, the target slot being a PCIE slot in which the DPU is inserted, and N being an integer greater than or equal to 1; according to the second signal, the slot number corresponding to each DPU in at least one in-place DPU is determined.
[0173] It should be noted that the second register and the first register may be the same register, or the second register and the first register may be two different registers. If the second register and the first register are the same register, the N bits may be other bits independent of the M bits.
[0174] Specifically, there may be a corresponding relationship between the N bits and the multiple PCIE slots. For any bit, if the bit is set, it indicates that the slot corresponding to the bit is the target slot. In other words, if the bit is set, the slot number corresponding to the bit is the slot number corresponding to the in-place DPU.
[0175] S307: Allocate resources to multiple PCIE slots based on the slot numbers.
[0176] It should be understood that the number of target slots is greater than or equal to one.
[0177] The computing device can determine the amount of resources required by the DPU inserted in each target slot; allocate resources to each target slot according to the amount of resources required by the DPU inserted in each target slot and the second amount of resources; and allocate the second amount of resources to each PCIE slot among multiple PCIE slots except the target slot.
[0178] Specifically, the second resource amount may be allocated to a PCIE slot in which no DPU is inserted; and resources may be allocated to each target slot according to the resource amount required by the DPU connected to each target slot and the second resource amount.
[0179] When allocating resources to each target slot, for any target slot, a first sum of the amount of resources required by the DPU connected to the target slot and the second amount of resources can be determined, and the amount of resources of the first sum can be allocated to the target slot.
[0180] In this embodiment, when determining the amount of resources required by the DPU inserted in the target slot, the computing device can determine whether there is an updated amount of resources in the configuration space corresponding to the target slot; if there is an updated amount of resources in the configuration space corresponding to the target slot, the updated amount of resources is determined as the amount of resources required by the DPU inserted in the target slot; if there is no updated amount of resources in the configuration space corresponding to the target slot, the amount of resources required by the DPU inserted in the target slot is determined according to the model of the DPU inserted in the target slot.
[0181] The configuration space corresponding to the target slot may be the configuration space of the DPU inserted in the target slot.
[0182] Specifically, for each target slot, the configuration space corresponding to the target slot may store the vendor identifier and device identifier of the DPU connected to the target slot. If the DPU connected to the target slot has an updated resource amount, the configuration space corresponding to the target slot may also store the corresponding updated resource amount. In the case where the updated resource amount is stored in the configuration space corresponding to the target slot, the computing device may determine the updated resource amount as the resource amount required by the DPU plugged in the target slot. In the case where the updated resource amount is not stored in the configuration space corresponding to the target slot, the computing device may determine the resource amount required by the DPU plugged in the target slot based on the model of the DPU plugged in the target slot.
[0183] When determining the amount of resources required by the DPU inserted in the target slot according to the model of the DPU inserted in the target slot, the computing device can determine the model of the DPU inserted in the target slot according to the vendor identifier and device identifier in the configuration space corresponding to the target slot; and can determine the amount of resources required by the DPU according to the model of the DPU.
[0184] It should be noted that the specific method of determining the model of the DPU according to the vendor identifier and the device identifier, and determining the amount of resources required by the DPU according to the model of the DPU can be found in S201 and will not be repeated here.
[0185] In the service management method provided in this embodiment, the computing device can obtain a first signal; if the first signal indicates that the number of DPUs in place in the computing device is zero, the first resource amount can be determined to be zero; if the first signal indicates that the number of DPUs in place in the computing device is greater than zero, the resource amount required by each DPU in at least one DPU in place in the computing device can be determined, and the sum of the resource amounts required by each DPU can be determined as the first resource amount; the second resource amount corresponding to each PCIE slot in multiple PCIE slots can be determined according to the first resource amount; if the first resource amount is zero, the second resource amount can be allocated to each PCIE slot in multiple PCIE slots; if the first resource amount is not zero, the slot number corresponding to each DPU in at least one DPU in place can be determined, and resources can be allocated to multiple PCIE slots based on the slot number. In the above method, the computing device can flexibly adjust the amount of resources allocated to each DPU, thereby improving the flexibility of resource allocation. Through the above method, the allocation of resources can be made more reasonable, thereby making the system performance of the computing device better and the resource utilization higher. In addition, in the above method, there is no need to manually configure the resource allocation table in advance, which reduces the error rate of manual configuration. In addition, after allocating resources through the above method, the performance of computing equipment is better and the probability of failure is lower, which makes the operation and maintenance cost lower.
[0186] Figure 4The resource allocation device 10 is applied to a computing device, and the computing device includes a plurality of peripheral components interconnected with fast PCIE slots, such as Figure 4 As shown, the resource allocation device 10 includes: a determination module 11 and an allocation module 12, wherein:
[0187] The determination module is used to determine, during a system startup process of the computing device, a first resource amount based on the presence of a DPU in the computing device, where the first resource amount is the sum of resource amounts required by at least one DPU in the computing device, where the DPU in the computing device is a DPU inserted in the PCIE slot;
[0188] The determining module is used to determine, according to the first resource amount, a second resource amount corresponding to each PCIE slot of the plurality of PCIE slots, wherein the second resource amount is a resource amount required by an integrated input and output IIO stack of the PCIE slot;
[0189] The allocation module is used to allocate resources to the multiple PCIE slots based on the first resource amount and the second resource amount.
[0190] The resource allocation device provided in this embodiment can execute the method shown in any of the above method embodiments, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.
[0191] In a possible implementation, the determining module 11 is specifically configured to:
[0192] Obtaining a first signal, where the first signal is used to indicate the number of DPUs in the computing device;
[0193] The first resource amount is determined according to the first signal.
[0194] In a possible implementation, the computing device further includes a first complex programmable logic device (CPLD); the determining module 11 is specifically configured to:
[0195] A first signal is obtained from a register of the first CPLD, where the first signal is data stored in M bits in the register of the first CPLD, where the M bits are used to indicate the number of DPUs in place in the computing device, and M is an integer greater than or equal to 1.
[0196] In a possible implementation, the determining module 11 is specifically configured to:
[0197] If the first signal indicates that the number of DPUs in the computing device is zero, determining that the first amount of resources is zero;
[0198] If the first signal indicates that the number of DPUs in place in the computing device is greater than zero, determine the amount of resources required by each DPU in at least one DPU in place in the computing device, and determine the sum of the amount of resources required by each DPU as the first amount of resources.
[0199] In a possible implementation, for any DPU in place, the determining module 11 is specifically configured to:
[0200] Determine whether there is an update resource amount in the configuration space of the DPU;
[0201] If the updated resource amount exists in the configuration space of the DPU, determining the updated resource amount as the resource amount required by the DPU;
[0202] If there is no update resource amount in the configuration space of the DPU, the resource amount required by the DPU is determined according to the model of the DPU.
[0203] In a possible implementation, the determining module 11 is specifically configured to:
[0204] Determine a difference between a third resource amount and the first resource amount, the third resource amount being the total amount of resources in the computing device;
[0205] The ratio of the difference to the number of the plurality of PCIE slots is determined as the second resource amount.
[0206] In a possible implementation, the allocation module 12 is specifically configured to:
[0207] If the first resource amount is zero, allocating resources of the second resource amount to each PCIE slot of the plurality of PCIE slots;
[0208] If the first resource amount is greater than zero, determine the slot number corresponding to each DPU in the at least one in-place DPU, and allocate resources to the multiple PCIE slots based on the slot number, where the slot number is used to indicate the PCIE slot in which the DPU is inserted.
[0209] In a possible implementation, the computing device further includes a second CPLD; the allocation module 12 is specifically configured to:
[0210] Acquire a second signal from a register of the second CPLD, where the second signal is data stored in N bits in the register of the second CPLD, where the N bits are used to indicate a slot number of a target slot, where the target slot is a PCIE slot in which the DPU is inserted, and N is an integer greater than or equal to 1;
[0211] According to the second signal, a slot number corresponding to each DPU in at least one in-place DPU is determined.
[0212] In a possible implementation, the number of the target slots is greater than or equal to 1; the allocation module 12 is specifically configured to:
[0213] Determine the amount of resources required by the DPU installed in each target slot;
[0214] Allocate resources to each target slot according to the amount of resources required by the DPU inserted in each target slot and the second amount of resources;
[0215] Allocate a second amount of resources to each PCIE slot among the plurality of PCIE slots except the target slot.
[0216] In a possible implementation, for any target slot, the allocation module 12 is specifically configured to:
[0217] Determine whether there is an update resource amount in the configuration space corresponding to the target slot;
[0218] If the updated resource amount exists in the configuration space corresponding to the target slot, the updated resource amount is determined as the resource amount required by the DPU inserted in the target slot;
[0219] If the configuration space corresponding to the target slot does not have an updated resource amount, the resource amount required by the DPU inserted in the target slot is determined according to the model of the DPU inserted in the target slot.
[0220] In a possible implementation, the resource is any one of the following:
[0221] Bus number, memory address space, input / output I / O address space or interrupt resource.
[0222] The resource allocation device provided in this embodiment can execute the method shown in any of the above method embodiments, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.
[0223] Figure 5 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. Figure 5 As shown, the computing device 20 may include: a processor 21 and a memory 22, wherein the processor 21 and the memory 22 can communicate; exemplarily, the processor 21 and the memory 22 communicate via a communication bus 23, the memory 22 is used to store computer execution instructions, and the processor 21 is used to call the computer execution instructions in the memory to execute the resource allocation method shown in any of the above method embodiments.
[0224] Optionally, the computing device 20 may further include a communication interface, which may include a transmitter and / or a receiver.
[0225] The computing device 20 may be the computing device shown in any of the above method embodiments, and may execute the resource allocation method shown in any of the above method embodiments.
[0226] Optionally, the processor may be a CPU, a GPU, a baseboard management controller (BMC), other general-purpose processors, a digital signal processor (DSP), or an application-specific integrated circuit (ASIC). A general-purpose processor may be a microprocessor or the processor may be any conventional processor. The steps of the method disclosed in the embodiments of the present application may be directly implemented as a hardware processor, or may be implemented as a combination of hardware and software modules in the processor.
[0227] An embodiment of the present application provides a computer-readable storage medium, on which computer-executable instructions are stored; the computer-executable instructions are used to implement the resource allocation method as described in any of the above embodiments.
[0228] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above-mentioned resource allocation method.
[0229] All or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned memory (storage medium) includes: read-only memory (English: read-only memory, abbreviated: ROM), RAM, flash memory, hard disk, solid state drive, magnetic tape (English: magnetic tape), floppy disk (English: floppy disk), optical disc (English: optical disc) and any combination thereof.
[0230] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable terminal device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0231] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0232] These computer program instructions can also be loaded onto a computer or other programmable terminal device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0233] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the embodiments of the present application are also intended to include these modifications and variations.
[0234] In the embodiments of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the existence of other identical elements in the process, method, article or device including the element. The term "or" and its variations may refer to "and / or". In the embodiments of the present application, the terms "first", "second", etc. are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. In the embodiments of the present application, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, A and / or B, which may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0235] After considering the invention disclosed in the specification and practice, those skilled in the art will easily think of other embodiments of the present application. The embodiments of the present application are intended to cover any variation, use or adaptive change of the embodiments of the present application, which follows the general principles of the embodiments of the present application and includes common knowledge or conventional technical means in the technical field that are not disclosed in the embodiments of the present application.
Claims
1. A resource allocation method, characterized in that: Applied to a computing device, the computing device includes a plurality of peripheral component interconnection fast PCIE slots, the method includes: During the system startup process of the computing device, based on the presence of the DPU in the computing device, determining a first resource amount, the first resource amount being the sum of resource amounts required by at least one DPU in the computing device, the DPU in the computing device being inserted in the PCIE slot; Determine, according to the first resource amount, a second resource amount corresponding to each PCIE slot of the plurality of PCIE slots, wherein the second resource amount is a resource amount required for an integrated input and output IIO stack of the PCIE slot; Based on the first resource amount and the second resource amount, resources are allocated to the multiple PCIE slots.
2. The method according to claim 1, characterized in that: The determining the first resource amount based on the presence of the DPU in the computing device includes: Obtaining a first signal, where the first signal is used to indicate the number of DPUs in the computing device; The first resource amount is determined according to the first signal.
3. The method according to claim 2, characterized in that The computing device further includes a first complex programmable logic device (CPLD); and obtaining the first signal includes: A first signal is obtained from a register of the first CPLD, where the first signal is data stored in M bits in the register of the first CPLD, where the M bits are used to indicate the number of DPUs in place in the computing device, and M is an integer greater than or equal to 1.
4. The method according to claim 2 or 3, characterized in that: The determining the first resource amount according to the first signal includes: If the first signal indicates that the number of DPUs in the computing device is zero, determining that the first amount of resources is zero; If the first signal indicates that the number of DPUs in place in the computing device is greater than zero, determine the amount of resources required by each DPU in at least one DPU in place in the computing device, and determine the sum of the amount of resources required by each DPU as the first amount of resources.
5. The method according to claim 4, characterized in that For any existing DPU, the amount of resources required by the DPU is determined, including: Determine whether there is an update resource amount in the configuration space of the DPU; If the updated resource amount exists in the configuration space of the DPU, determining the updated resource amount as the resource amount required by the DPU; If there is no update resource amount in the configuration space of the DPU, the resource amount required by the DPU is determined according to the model of the DPU.
6. The method according to any one of claims 1 to 5, characterized in that: The determining, according to the first resource amount, a second resource amount corresponding to each PCIE slot in the plurality of PCIE slots includes: Determine a difference between a third resource amount and the first resource amount, the third resource amount being the total amount of resources in the computing device; The ratio of the difference to the number of the plurality of PCIE slots is determined as the second resource amount.
7. The method according to any one of claims 1 to 6, characterized in that: The allocating resources to the plurality of PCIE slots based on the first resource amount and the second resource amount includes: If the first resource amount is zero, allocating resources of the second resource amount to each PCIE slot of the plurality of PCIE slots; If the first resource amount is greater than zero, determine the slot number corresponding to each DPU in the at least one in-place DPU, and allocate resources to the multiple PCIE slots based on the slot number, where the slot number is used to indicate the PCIE slot in which the DPU is inserted.
8. The method according to claim 7, characterized in that The computing device further includes a second CPLD; and the determining of the slot number corresponding to each DPU in the at least one in-place DPU includes: Acquire a second signal from a register of the second CPLD, where the second signal is data stored in N bits in the register of the second CPLD, where the N bits are used to indicate a slot number of a target slot, where the target slot is a PCIE slot in which the DPU is inserted, and N is an integer greater than or equal to 1; According to the second signal, a slot number corresponding to each DPU in at least one in-place DPU is determined.
9. The method according to claim 7 or 8, characterized in that: The number of target slots is greater than or equal to 1; and the allocating resources to the multiple PCIE slots based on the slot numbers includes: Determine the amount of resources required by the DPU installed in each target slot; Allocate resources to each target slot according to the amount of resources required by the DPU inserted in each target slot and the second amount of resources; Allocate a second amount of resources to each PCIE slot among the plurality of PCIE slots except the target slot.
10. The method according to claim 9, characterized in that For any target slot, determine the amount of resources required by the DPU installed in the target slot, including: Determine whether there is an update resource amount in the configuration space corresponding to the target slot; If the updated resource amount exists in the configuration space corresponding to the target slot, the updated resource amount is determined as the resource amount required by the DPU inserted in the target slot; If the configuration space corresponding to the target slot does not have an updated resource amount, the resource amount required by the DPU inserted in the target slot is determined according to the model of the DPU inserted in the target slot.
11. A computing device, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 10.