Resource allocation method, storage medium, electronic equipment and program product
By identifying and reserving the memory resources of the smart network card device when the server is started and turning on the hot-swap function, the problem of unbalanced device resource allocation in the smart network card is solved, ensuring the normal use of the device and improving the user experience.
Patent Information
- Application Number
- CN202510725421.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-05-30
AI Technical Summary
When smart network cards contain more devices, the existing technology needs to reserve resources in advance, resulting in uneven resource allocation and some devices cannot be used, affecting the user experience.
By reading device identification information when the server starts, identifying the data processing device and reserving memory resources, turning on the hot-swap function of the external interconnection link, the operating system redistributes memory resources according to the hot-swap function after entering.
Ensure that data processing equipment can be used normally at any time, avoid the inability to use the equipment caused by resource problems, and improve the user experience.
Smart Images

Figure CN120234159A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular, to a resource allocation method, a storage medium, an electronic device, and a program product. Background Art
[0002] A Data Processing Unit Smart Network Interface Card is an advanced network interface card integrated with the functions of a Data Processing Unit (DPU). It not only has the basic functions of a traditional network card but also adds powerful data processing capabilities, which can reduce the burden on the Central Processing Unit (CPU) and improve the overall efficiency and performance of the data center.
[0003] Currently, in the related art, resource reservation needs to be made for the smart network card in advance when applying the smart network card, and then all devices in the server are allocated resources according to the reserved resources when the server starts. However, when there are many devices in the smart network card, it will lead to ineffective resource allocation, and then some devices cannot be used, affecting the user experience. Summary of the Invention
[0004] The present disclosure provides a resource allocation method, a storage medium, an electronic device, and a program product. Its main purpose is to solve the problem that in the related art, resource reservation needs to be made for the smart network card in advance when applying the smart network card, and then all devices in the server are allocated resources according to the reserved resources when the server starts. However, when there are many devices in the smart network card, it will lead to ineffective resource allocation, and then some devices cannot be used, affecting the user experience.
[0005] In a first aspect, the present application provides a resource allocation method, including: In response to the processor entering the Basic Input / Output System, sequentially read the identification information of a plurality of devices connected to the processor, where the identification information is used to determine the device types of the plurality of devices; Based on the identification information, in the case of determining that there is a data processing device among the plurality of devices, determine the first memory resources required for the operation of the data processing device; Reserve memory resources for the data processing device according to the first memory resources, and enable the hot-plug function of the first external interconnect link connecting the data processing device; In response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, configure the memory resources for the data processing device according to the memory resources reserved by the Basic Input / Output System.
[0006] In a second aspect, the present application provides a resource allocation apparatus, including: A reading module, configured to sequentially read identification information of a plurality of devices connected to a processor in response to the processor entering the basic input / output system, where the identification information is used to determine the device types of the plurality of devices; A determination module, configured to determine a first memory resource required for a data processing device to operate based on the identification information in the case of determining that there is a data processing device among the plurality of devices; A reservation module, configured to reserve memory resources for the data processing device according to the first memory resource and turn on the hot plug function of a first external interconnect link connecting the data processing device; A configuration module, configured to, in response to the processor entering the operating system, if it is recognized that the hot plug function of the first external interconnect link is turned on, configure the memory resources for the data processing device according to the memory resources reserved by the basic input / output system.
[0007] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method of the first aspect is implemented.
[0008] In a fourth aspect, the present application provides an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, and when the processor executes the computer program, the method of the first aspect is implemented.
[0009] In a fifth aspect, the present application provides a computer program product, on which a computer program is stored, and when the computer program is executed by a processor, the method of the first aspect is implemented.
[0010] The resource allocation method, storage medium, electronic device, and program product provided by the present disclosure, wherein the method includes: in response to the processor entering the basic input / output system, sequentially reading the identification information of multiple devices connected to the processor, and the identification information is used to determine the device types of the multiple devices; based on the identification information, in the case of determining that there is a data processing device among the multiple devices, determining the first memory resources required for the operation of the data processing device; reserving memory resources for the data processing device according to the first memory resources, and enabling the hot-plug function of the first external interconnect link connected to the data processing device; in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, then configuring the memory resources for the data processing device according to the memory resources reserved by the basic input / output system. Compared with the related art, in the present application, in response to the processor entering the basic input / output system, the identification information of multiple devices connected to the processor is sequentially read; based on the identification information, in the case of determining that there is a data processing device among the multiple devices, the first memory resources required for the operation of the data processing device are determined; memory resources are reserved for the data processing device according to the first memory resources, and the hot-plug function of the first external interconnect link connected to the data processing device is enabled; in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, then the memory resources of the data processing device are configured according to the memory resources reserved by the basic input / output system. By using the basic input / output system to actively identify devices when the server starts up and enabling the hot-plug function of the external interconnect link where the device is located, when the server enters the operating system, the operating system will reallocate the memory resources under the system. Even if the basic input / output system has completed the memory resource allocation, the system will still reallocate the memory resources. Because the memory resources are limited and the location information of the data processing device cannot be fixed, according to the function of the parameters, since the data processing device recognized later has no resources available because the memory resources have been allocated, but the external interconnect link with the hot-plug function enabled does not need to reallocate the memory resources. Therefore, it is necessary for the basic input / output system to default to enable the hot-plug function of the external interconnect link where the data processing device is located, to avoid the data processing device being unable to be used normally due to the system reallocating again, ensuring that the data processing device can be used normally at any time, without worrying about the problem that the data processing device cannot be used due to resource issues, and improving the user experience.
[0011] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become easily understood through the following description. Brief Description of the Drawings
[0012] To more clearly illustrate the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0013] Figure 1 It shows a schematic flowchart of a resource allocation method provided by an embodiment of the present application; Figure 2 It shows a schematic flowchart of another resource allocation method provided by an embodiment of the present application; Figure 3 It shows a schematic structural diagram of an example provided by an embodiment of the present application; Figure 4 It shows a schematic structural diagram of an example provided by an embodiment of the present application; Figure 5 It shows a schematic flowchart of an example provided by an embodiment of the present application; Figure 6 It shows a schematic structural diagram of a resource allocation device provided by an embodiment of the present application. Detailed implementation manners
[0014] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present application.
[0015] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0016] A smart network interface card (SmartNIC) is a flexible and programmable network card that works in conjunction with a server. Since a SmartNIC has computing capabilities, to free up the CPU computing power, it offloads data processing functions related to networking, security, and storage that are not suitable for the CPU to a programmable hardware chip for execution, reducing CPU consumption and enabling the server to run critical applications and operating systems more effectively, and optimizing the overall efficiency of business data processing. The development of SmartNICs can be divided into three stages. The first stage: basic function network cards; the second stage: hardware offloading network cards (the first-generation SmartNIC, SNIC); the third stage: data processor (DPU) SmartNICs, which can achieve full offloading of security-related functions (data plane + control plane). The DPU in the third stage is a dedicated processor that provides virtualization services for data center infrastructure such as networking, storage, security, and management around data processing. It consists of a computing architecture formed by a CPU based on architectures such as ARM (Advanced RISC Machine) / X86 and a dedicated hardware acceleration engine such as an Application Specific Integrated Circuit (ASIC) Network Processor (NP) / Field Programmable Gate Array (FPGA), forming an entity that provides virtualization functions. Based on the above basic concept, currently DPU products have been widely used in various architecture servers in data centers, including but not limited to X86 architecture and ARM architecture, etc. However, regardless of the architecture of the server, resource reservation for the SmartNIC needs to be done in advance when applying the SmartNIC because there are many devices inside the SmartNIC, such as network interface devices, virtual network cards, physical or virtual devices such as solid-state drives (SSDs) for storage devices, etc. These devices all need to use memory resources and some memory resources are prioritized. For example, the maximum capacity limit of 32-bit memory resources is 4G. What if the 32-bit system resources are insufficient? Since the SmartNIC has a large demand for 32-bit resources, when the resources are insufficient, the system will go black during the process of starting the devices equipped with the SmartNIC and entering the operating system. We will also encounter the problem that the system goes black and we cannot view the system when checking through the management interface of the remote board management controller (BMC) based on the Kernel-based Virtual Machine (KVM), but the display must output normally to meet our normal use.
[0017] To address the technical problem in related technologies where resource reservation for an intelligent network card needs to be performed in advance when applying the intelligent network card, and then all devices in the server are allocated resources according to the reserved resources when the server starts. However, when there are many devices in the intelligent network card, it will lead to ineffective resource allocation, resulting in some devices being unable to be used and affecting the user experience. This embodiment provides a resource configuration method, as Figure 1 shown, the method includes the following steps: Step 101, in response to the processor entering the Basic Input / Output System, sequentially read the identification information of multiple devices connected to the processor.
[0018] Among them, the identification information is used to determine the device types of the multiple devices.
[0019] In the embodiments of the present application, the Basic Input / Output System (BIOS) is a firmware interface in a computer. It runs first when the computer starts, is responsible for initializing and testing hardware components, and loading the operating system. Specifically, when the computer is powered on, the CPU starts executing the BIOS code from a predefined address (usually 0xFFFF0). The BIOS performs hardware detection and initialization operations, searches for bootable devices according to the set boot order, and after finding a suitable bootable device, the BIOS loads the boot loader in its Master Boot Record (MBR). The boot loader further loads the operating system kernel, and then the control is transferred to the operating system.
[0020] In some examples, the identification information of multiple devices connected to the processor can specifically be the Device ID (DID) and the Vendor ID (VID). Specifically, the Basic Input / Output System reads the DID and VID of each PCI device during the Peripheral Component Interconnect (PCI) enumeration phase in the Driver Execution Environment (DXE) phase.
[0021] For this embodiment, in the Unified Extensible Firmware Interface (UEFI) framework, the DXE phase is a key part of system initialization, which involves the identification and initialization of hardware components, including the enumeration of PCI devices. This process does involve reading the DID and VID of each PCI device to correctly identify and configure these devices.
[0022] It should be noted that the device type of a device can be determined by identifying the identification information of the device. Specifically, it can be determined whether the device is a data processing device or an external interconnection device. Among them, the data processing device can specifically be a data processor (DPU) device, and the external interconnection device can be a PCI device.
[0023] Step 102: Based on the identification information, in the case where it is determined that there is a data processing device among multiple devices, determine the first memory resource required for the operation of the data processing device.
[0024] In the embodiment of the present application, a data processing unit (DPU) device is a new type of processor unit designed specifically for data centers, aiming to optimize data processing tasks within the data center. The DPU not only has powerful computing capabilities but also integrates network, storage, and security functions, which can significantly reduce the burden on the CPU and improve the overall efficiency and performance of the data center.
[0025] In some examples, the first memory resource can be the memory resource required for the operation of the data processing device.
[0026] Step 103: Reserve the memory resource for the data processing device according to the first memory resource, and enable the hot-plug function of the first external interconnection link connecting the data processing device.
[0027] For this embodiment, the hot-plug function (Hot Swapping or Hot Plugging) refers to the ability to add or remove hardware components without shutting down the power supply during the operation of a computer system or device. This technology greatly improves the availability and flexibility of the system, especially applicable to server and storage environments that require high availability. Specifically, hot swapping means that a device can be safely inserted or removed while the system is running without causing the system to crash or other negative impacts.
[0028] It should be noted that the intelligent network card device requires 32-bit memory addresses, and the 32-bit memory address resources of the server are limited with a maximum capacity of 4GB. Therefore, it is necessary to reserve resources for the intelligent network card in advance. At the same time, when the server starts, the system will also allocate resources to all devices of the server. The resource allocation includes both resource reservation allocation and the allocation of resources for currently recognized devices. If there are too many devices when the current device starts, it will lead to ineffective allocation of some device resources, that is, the 32-bit resources of 4G cannot meet the total device demand exceeding the 4G limit, which will cause some devices to be unusable. If the 32-bit resources occupied by all devices on the PCI link of the current server do not exceed the 4G capacity limit, there is no need to worry about DPU or display problems in the system. However, when the 32-bit resource requirements of all devices in the system are greater than 4GB and the resource reservation is insufficient, it will cause the devices in the system to fail to work properly, especially devices such as DPU. To solve the problem that the DPU device cannot be used in the system due to excessive resource reservation and in the system, we add the pci=realloc parameter to the bootloader configuration (Grand Unified Bootloader, Grub) file when the system starts to achieve the problem of reallocating resources in the system. At the same time, the BIOS needs to enable the hotplug function in the PCI configuration space of the PCI link. In this way, when the server starts and enters the operating system, the system will reallocate the 32-bit memory resources of the MMIO of the entire PCI link of the server according to the enabling situation of the hotplug function attribute of the PCI link and the setting of the Grub parameter.
[0029] Step 104, in response to the processor entering the operating system, if it is recognized that the hotplug function of the first external interconnection link is enabled, the memory resources of the data processing device are configured according to the memory resources reserved by the basic input / output system.
[0030] In the embodiment of the present application, the process of the processor entering the operating system is a key step in the computer startup process, involving the transition from hardware initialization to the operating system taking over system control. This process generally includes BIOS or UEFI firmware initialization, the execution of the bootloader, and the loading and initialization of the operating system.
[0031] In some examples, when the server starts and enters the operating system, the system will reallocate the 32-bit memory resources of the MMIO of the entire PCI link of the server according to the enabling situation of the hotplug function attribute of the PCI link and the setting of the Grub parameter.
[0032] Compared with the related art, in this embodiment, in response to the processor entering the basic input / output system, the identification information of multiple devices connected to the processor is read sequentially; based on the identification information, when it is determined that there is a data processing device among the multiple devices, the first memory resource required for the operation of the data processing device is determined; the memory resource of the data processing device is reserved according to the first memory resource, and the hot-plug function of the first external interconnect link connecting the data processing device is enabled; in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, the memory resource of the data processing device is configured according to the memory resource reserved by the basic input / output system. By using the basic input / output system to actively identify devices when the server starts up and enabling the hot-plug function of the external interconnect link where the device is located, when the server enters the operating system, the operating system will reallocate the memory resources under the system. Even if the basic input / output system has completed the memory resource allocation, the system will still reallocate the memory resources. Because the memory resources are limited and the location information of the data processing device cannot be fixed, according to the function of the parameter, since the later-identified data processing device has completed the memory resource allocation, there is no resource available for allocation. However, for the external interconnect link with the hot-plug function enabled, there is no need to reallocate the memory resources. Therefore, it is necessary for the basic input / output system to default to enable the hot-plug function of the external interconnect link where the data processing device is located, to avoid the data processing device being unable to be used normally due to the system reallocating again, which can ensure that the data processing device can be used normally at any time, without worrying about the problem that the data processing device cannot be used due to resource issues, and improve the user experience.
[0033] Further, as a refinement and extension of the above embodiment, the following method can be adopted but is not limited to, such as Figure 2 shown, the method includes: Step 201, in response to the processor entering the basic input / output system, sequentially read the identification information of multiple devices connected to the processor.
[0034] Among them, the identification information is used to determine the device types of the multiple devices.
[0035] In the embodiment of the present application, as Figure 3 shown, it can be a physical connection schematic diagram of the devices in the processor. Specifically, the processor may include a CPU, a BIOS, a BMC, a DPU card, etc. Among them, as Figure 4 shown, it can be a physical schematic diagram of the DPU.
[0036] Exemplarily, when the server starts up, during the PCI enumeration stage of the Driver Execution Environment (DXE) phase of the BIOS, by reading the device identification code and vendor identification code of each PCI device, it is determined whether the processor contains a DPU device (i.e., the data processing device in the embodiments of the present application) by identifying the device identification code and vendor identification code.
[0037] Step 202: Based on the identification information, in the case of determining that there is a data processing device among multiple devices, determine the first memory resource required for the operation of the data processing device.
[0038] In some examples, the first memory resource may be the memory resource required for the operation of the data processing device.
[0039] Exemplarily, if it is determined in the basic input / output system that device 1 is a data processing device, then it is necessary to determine the memory resource required for the operation of device 1 in the operating system.
[0040] Step 203: Determine whether an external interconnect device is connected to the first external interconnect link.
[0041] For this embodiment, the first external interconnect link may be the link where the data processing device is located.
[0042] Exemplarily, in the case of determining that there is a data processing device in the first external interconnect link, continue to determine whether an external interconnect device, i.e., a PCI device, is connected to the first external interconnect link.
[0043] Step 204: Reserve memory resources for the data processing device according to the first memory resource, and enable the hot-plug function of the first external interconnect link connected to the data processing device.
[0044] Optionally, step 204 may specifically include: in the case of determining that the first external interconnect link is not connected to an external interconnect device, determine the first memory resource as the total memory resource corresponding to the first external interconnect link; reserve memory resources for the first external interconnect link based on the total memory resource, and enable the hot-plug function of the first external interconnect link.
[0045] As an alternative, in the case of determining that the first external interconnect link is not connected to an external interconnect device, i.e., only connected to the data processing device, determine the first memory resource required for the operation of the data processing device as the total memory resource required for the operation of the first external interconnect link, and enable the hot-plug function of the first external interconnect link.
[0046] Optionally, step 204 specifically further includes: when it is determined that an external interconnection device is connected to the first external interconnection link, determining the second memory resource required for the operation of the first external interconnection device connected to the first external interconnection link; adding the first memory resource and the second memory resource, and determining the sum as the total memory resource; reserving the memory resource for the first external interconnection link based on the total memory resource, and enabling the hot plug function of the first external interconnection link.
[0047] Exemplarily, when it is determined that an external interconnection device is also connected to the first external interconnection link, it is necessary to determine the second memory resource required for the operation of the first external interconnection device connected to the first external interconnection link, determine the sum of the first memory resource required for the operation of the data processing device and the second memory resource required for the operation of the external interconnection link as the total memory resource of the first external interconnection link, and enable the hot plug function of the first external interconnection link.
[0048] As an optional method, when the server starts, the BIOS reads the DID and VID of each PCI device during the PCI enumeration stage of the DXE phase; confirms whether the current device is a DPU device, and if not, there is no need to reserve 32-bit memory resources; if it is a DPU device, reserve 32-bit resources according to the known 32-bit resource size of the DPU; at the same time, when the PCI link physically connected to the current DPU accumulates the MMIO 32-bit resources reserved by the DPU when counting the 32-bit resources required by other PCI devices, at the same time, the BIOS enables the hot plug function, that is, the hotplug function, of the PCI configuration space of the bridge of the PCI link physically connected to the DPU.
[0049] Step 205, in response to the processor entering the operating system, if it is recognized that the hot plug function of the first external interconnection link is enabled, configure the memory resource of the data processing device according to the memory resource reserved by the basic input / output system.
[0050] Optionally, step 205 may specifically include: based on the identification information, when it is determined that there is no data processing device among multiple devices, determining whether there is an external interconnection device among the multiple devices; when it is determined that there is an external interconnection device among the multiple devices, determining the third memory resource required for the operation of the second external interconnection device existing among the multiple devices; reserving the memory resource for the second external interconnection device according to the third memory resource, and enabling the hot plug function of the second external interconnection link connected to the second external interconnection device.
[0051] For this embodiment, if it is determined based on the identification information that there is no data processing device, it is necessary to continue to determine whether there is an external interconnection device among multiple devices. If there is an external interconnection device, it is necessary to determine the memory resources required for the operation of the existing external interconnection device, that is, the third memory resources required for the operation of the second external interconnection device in the embodiments of the present application. Memory resources are reserved for the second external interconnection device according to the third memory resources, and the hot-plug function of the second external interconnection link connecting the second external interconnection device is enabled.
[0052] Optionally, step 205 specifically further includes: in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnection link is enabled, memory resources are configured for the data processing device according to the total memory resources.
[0053] Exemplarily, in response to the completion of resource reservation in the basic input / output system, the processor enters the operating system, and the operating system defaults to adding the PCI=realloc parameter to the boot loader configuration (Grub) parameters; at this time, the operating system will re-allocate all PCI resources of the server.
[0054] In some examples, pci=realloc is a Linux kernel startup parameter mainly used to affect the allocation behavior of PCI device resources. When the system detects overlapping or conflicting PCI device resources, using this parameter can instruct the kernel to attempt to re-allocate these resources to avoid conflicts and ensure that all devices can work properly.
[0055] Exemplarily, after the processor enters the operating system, it is necessary to determine whether the hot-plug functions of multiple external interconnection links are enabled. If it is determined that the hot-plug function of the first external interconnection link is enabled, memory resources need to be configured for the data processing device according to the total memory resources reserved by the basic input / output system.
[0056] Optionally, step 205 specifically further includes: in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnection link is enabled, memory resources are configured for the data processing device according to the first memory resources in the total memory resources, and memory resources are configured for the first external interconnection device according to the second memory resources in the total memory resources.
[0057] For this embodiment, after the processor enters the operating system, it is necessary to determine whether the hot-plug functions of multiple external interconnection links are enabled. If it is determined that the hot-plug function of the first external interconnection link is enabled, memory resources can also be configured for the data processing device according to the first memory resources in the total memory resources reserved by the basic input / output system, and memory resources are configured for the first external interconnection device according to the second memory resources in the total memory resources reserved by the basic input / output system.
[0058] Optionally, step 205 specifically further includes: in response to the processor entering the operating system, if it is recognized that the hot plug function of the second external interconnect link is enabled, then configure the memory resources for the second external interconnect device according to the third memory resource.
[0059] Exemplarily, after the processor enters the operating system, it is necessary to determine whether the hot plug functions of multiple external interconnect links are enabled. When it is recognized that the hot plug function of the second external interconnect link is enabled, the memory resources of the second external interconnect device can be configured according to the third memory resource reserved by the basic input / output system.
[0060] Optionally, step 205 specifically further includes: in response to the processor entering the operating system, if it is recognized that the hot plug function of the third external interconnect link is enabled and no data processing device or external interconnect device is connected to the third external interconnect link, then configure the memory resources for the third external interconnect link according to a predetermined link resource configuration threshold.
[0061] In some examples, after the processor enters the operating system, it is necessary to determine whether the hot plug functions of multiple external interconnect links are enabled. When it is recognized that the hot plug function of the third external interconnect link is enabled and no data processing device or external interconnect device is connected to the third external interconnect link, it is necessary to configure the memory resources for the third external interconnect link according to a predetermined link resource configuration threshold.
[0062] Optionally, step 205 specifically further includes: in response to the processor entering the operating system, if it is recognized that the hot plug function of the fourth external interconnect link is not enabled, then determine whether a data processing device and / or an external interconnect device is connected to the fourth external interconnect link; in the case where it is determined that a data processing device and / or an external interconnect device is connected to the fourth external interconnect link, determine the fourth memory resource required for the operation of the data processing device and / or the external interconnect device connected to the fourth external interconnect link.
[0063] In some examples, after the processor enters the operating system, it is necessary to determine whether the hot plug functions of multiple external interconnect links are enabled. If it is recognized that the hot plug function of the fourth external interconnect link is not enabled, then it is necessary to further determine whether a data processing device and / or an external interconnect device is connected to the fourth external interconnect link; in the case where it is determined that a data processing device and / or an external interconnect device is connected to the fourth external interconnect link, determine the fourth memory resource required for the operation of the data processing device and / or the external interconnect device connected to the fourth external interconnect link.
[0064] Optionally, step 205 specifically further includes: if it is determined that the fourth memory resource is less than or equal to a predetermined resource to be allocated, then configure the resources for the data processing device and / or the external interconnect device connected to the fourth external interconnect link based on the predetermined resource to be allocated.
[0065] Optionally, step 205 specifically further includes: if it is determined that the fourth memory resource is greater than the predetermined resource to be allocated, no resource configuration is performed on the data processing device and / or external interconnection device connected by the fourth external interconnection link.
[0066] Exemplarily, when reallocating resources in the system, it is necessary to scan the PCI bridge devices of each PCI link. Here, only one PCI link is taken as an example for illustration; first, scan the devices under the current PCI link bridge and determine whether the Hotplug function of the current bridge is enabled. If the Hotplug function of the current PCI link bridge is enabled and there is no device, 2M of 32-bit memory resources also need to be allocated. If the Hotplug function of the current PCI link bridge is disabled and there is no device, no actual memory resources need to be allocated. If the Hotplug function of the current PCI link bridge is disabled and there are PCI devices and the 32-bit 4G memory resources meet the actual requirements, 32-bit memory resources are allocated. If the remaining memory resources of the 32-bit 4G memory resources cannot meet the actual requirements of the current device, no resource allocation is performed and this device is isolated from the memory resources, that is, the memory resources are turned off; in this way, the above steps are sequentially performed on all PCI links in the system until all PCI bridges and devices have completed memory resource allocation. At this time, the DPU device and its functions can be normally used in the server operating system.
[0067] Optionally, the present application also provides the following example, as Figure 5 shown, including: When the server starts, the BIOS reads the DID and VID of each PCI device during the PCI enumeration stage in the DXE stage; confirms whether the current device is a DPU device. If not, no 32-bit memory resources need to be reserved; if it is a DPU device, 32-bit resource reservation is performed according to the known 32-bit resource size of the DPU; at the same time, when the PCI link physically connected to the current DPU counts the 32-bit resources required by other PCI devices, the MMIO 32-bit resources reserved by the DPU are accumulated. At the same time, the BIOS enables the PCI configuration space hotplug function, that is, the hotplug function, of the bridge of the PCI link physically connected to the DPU.
[0068] The server continues to boot and enter the operating system, and the operating system will default to adding the PCI=realloc parameter to the Grub parameters; at this time, the operating system will reallocate all PCI resources of the server; when the system driver scans that the hotplug function of the PCI configuration space of the PCI bridge is enabled, the resources reserved by this device at BIOS startup will be reserved. If the hotplug function of the PCI configuration space of the PCI bridge is disabled, the operating system will reallocate the devices that reserved and allocated 32-bit memory resources by the BIOS in the DXE stage. If there is no device on the downstream port of the PCI bridge of the current PCI link, there is no need to allocate 32-bit memory resources, and only the 32-bit memory resources required by the PCI bridge need to be allocated.
[0069] When reallocating resources under the system, it is necessary to scan the PCI bridge devices of each PCI link. Here, only one PCI link is used as an example for illustration; first, scan the devices under the current PCI link bridge and determine whether the Hotplug function of the current bridge is enabled. If the hotplug function of the current PCI link bridge is enabled and there is no device, 2M of 32-bit memory resources also need to be allocated. If the hotplug function of the current PCI link bridge is disabled and there is no device, there is no need to allocate actual memory resources. If the hotplug function of the current PCI link bridge is disabled and there is a PCI device and the 32-bit 4G memory resources meet the actual requirements, 32-bit memory resources will be allocated. If the remaining memory resources of the 32-bit 4G memory resources cannot meet the actual requirements of the current device, resource allocation will not be performed and this device will be isolated from memory resources, that is, the memory resources will be turned off. In this way, the above steps are sequentially executed for all PCI links under the system until all PCI bridges and devices have completed memory resource allocation. At this time, the DPU device and its functions can be normally used in the server operating system.
[0070] It should be noted that in the embodiment of the present application, when the server is started, in the DXE stage, the DID and VID of the PCI device are judged, and after it is confirmed that it is a DPU, 32-bit memory resources are reserved. At the same time, the hotplug function of the PCI link bridge where it is located is enabled. For non-DPU devices, whether to allocate memory resources is confirmed according to whether there is a PCI device on the PCI link. When the server is started, because the system default enables and turns on the PCI=realloc parameter, the system will reallocate resources for all PCI devices. However, the 32-bit memory resources in the system are limited, so some devices must be allocated resources. Therefore, the hotplug enable setting is used to notify the operating system not to reallocate the DPU device. Therefore, the system can skip the resource reallocation of the DPU device, but other devices are actually allocated according to the remaining amount of 32-bit memory resources. If all PCI device resources are satisfied, they are all allocated. If not, the PCI devices that do not meet the identification of 32-bit 4G memory resources and those after them will not be allocated memory resources and the memory resources will be isolated.
[0071] Compared with the related technology, in this embodiment, in response to the processor entering the basic input / output system, the identification information of multiple devices connected to the processor is sequentially read; based on the identification information, when it is determined that there is a data processing device among the multiple devices, the first memory resources required for the operation of the data processing device are determined; the memory resources of the data processing device are reserved according to the first memory resources, and the hotplug function of the first external interconnection link connecting the data processing device is enabled; in response to the processor entering the operating system, if it is recognized that the hotplug function of the first external interconnection link is enabled, the memory resources of the data processing device are configured according to the memory resources reserved by the basic input / output system. By actively identifying devices using the basic input / output system when the server is started and enabling the hotplug function of the external interconnection link where the device is located, when the server enters the operating system, the operating system will reallocate the memory resources in the system. Even if the basic input / output system has completed the memory resource allocation, the system will still perform a new memory resource allocation. Because the memory resources are limited and the location information of the data processing device cannot be fixed, according to the function of the parameter, because the data processing device recognized later has no resources available because the memory resources have been allocated, but the external interconnection link with the hotplug function enabled does not need to reallocate the memory resources. Therefore, it is necessary for the basic input / output system to default to enable the hotplug function of the external interconnection link where the data processing device is located to avoid the data processing device being unable to be used normally due to the system reallocating again, which can ensure that the data processing device can be used normally at any time without worrying about the problem that the data processing device cannot be used in the resource problem, thus improving the user experience.
[0072] The embodiment of the present application also provides a resource configuration device, such asFigure 6 As shown in the figure, the device includes: a reading module 31, a determination module 32, a reservation module 33, and a configuration module 34.
[0073] The reading module 31 is configured to sequentially read the identification information of a plurality of devices connected to the processor in response to the processor entering the basic input / output system, and the identification information is used to determine the device types of the plurality of devices; The determination module 32 is configured to determine the first memory resource required for the operation of the data processing device based on the identification information when it is determined that there is a data processing device among the plurality of devices; The reservation module 33 is configured to reserve memory resources for the data processing device according to the first memory resource, and turn on the hot-plug function of the first external interconnection link connected to the data processing device; The configuration module 34 is configured to, in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnection link is turned on, configure the memory resources of the data processing device according to the memory resources reserved by the basic input / output system.
[0074] In some examples of this embodiment, the determination module 32 is further configured to determine whether an external interconnection device is connected to the first external interconnection link.
[0075] In some examples of this embodiment, the reservation module 33 is specifically further configured to, when it is determined that the first external interconnection link is not connected to an external interconnection device, determine the first memory resource as the total memory resource corresponding to the first external interconnection link; reserve memory resources for the first external interconnection link based on the total memory resource, and turn on the hot-plug function of the first external interconnection link.
[0076] In some examples of this embodiment, the reservation module 33 is specifically further configured to, when it is determined that the first external interconnection link is connected to an external interconnection device, determine the second memory resource required for the operation of the first external interconnection device connected to the first external interconnection link; perform an accumulation process on the first memory resource and the second memory resource, and determine the result of the accumulation process as the total memory resource; reserve memory resources for the first external interconnection link based on the total memory resource, and turn on the hot-plug function of the first external interconnection link.
[0077] In some examples of this embodiment, the configuration module 34 is further configured to, based on the identification information, when it is determined that there is no data processing device among the plurality of devices, determine whether there is an external interconnection device among the plurality of devices; when it is determined that there is an external interconnection device among the plurality of devices, determine the third memory resource required for the operation of the second external interconnection device existing among the plurality of devices; reserve memory resources for the second external interconnection device according to the third memory resource, and turn on the hot-plug function of the second external interconnection link connected to the second external interconnection device.
[0078] In some examples of this embodiment, the configuration module 34 is specifically configured to, in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnection link is enabled, configure the memory resources of the data processing device according to the total memory resources.
[0079] In some examples of this embodiment, the configuration module 34 is further specifically configured to, in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnection link is enabled, configure the memory resources of the data processing device according to the first memory resource in the total memory resources, and configure the memory resources of the first external interconnection device according to the second memory resource in the total memory resources.
[0080] In some examples of this embodiment, the configuration module 34 is further specifically configured to, in response to the processor entering the operating system, if it is recognized that the hot-plug function of the second external interconnection link is enabled, configure the memory resources of the second external interconnection device according to the third memory resource.
[0081] In some examples of this embodiment, the configuration module 34 is specifically configured to, in response to the processor entering the operating system, if it is recognized that the hot-plug function of the third external interconnection link is enabled and no data processing device or external interconnection device is connected to the third external interconnection link, configure the memory resources of the third external interconnection link according to a predetermined link resource configuration threshold.
[0082] In some examples of this embodiment, the configuration module 34 is specifically configured to, in response to the processor entering the operating system, if it is recognized that the hot-plug function of the fourth external interconnection link is not enabled, determine whether a data processing device and / or an external interconnection device is connected to the fourth external interconnection link; in the case where it is determined that a data processing device and / or an external interconnection device is connected to the fourth external interconnection link, determine the fourth memory resource required for the operation of the data processing device and / or the external interconnection device connected to the fourth external interconnection link.
[0083] In some examples of this embodiment, the configuration module 34 is specifically configured to, if it is determined that the fourth memory resource is less than or equal to a predetermined resource to be allocated, configure the resources of the data processing device and / or the external interconnection device connected to the fourth external interconnection link based on the predetermined resource to be allocated.
[0084] In some examples of this embodiment, the configuration module 34 is specifically configured to, if it is determined that the fourth memory resource is greater than the predetermined resource to be allocated, not configure the resources of the data processing device and / or the external interconnection device connected to the fourth external interconnection link.
[0085] It should be noted that for other corresponding descriptions of each functional unit involved in a resource configuration device provided in this embodiment, reference can be made toFigure 1 The corresponding description in [it] will not be elaborated here.
[0086] Based on the above method as Figure 1 shown, correspondingly, this embodiment also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above method as Figure 1 shown is implemented.
[0087] Based on the above method as Figure 1 shown, correspondingly, this embodiment also provides a computer program product, on which a computer program is stored, and when the computer program is executed by a processor, the above method as Figure 1 shown is implemented.
[0088] Based on such understanding, the technical solution of this application can be embodied in the form of a software product, and this software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each implementation scenario of this application.
[0089] Based on the above method as Figure 1 shown, and Figure 6 the virtual device embodiment shown, in order to achieve the above object, this embodiment of this application also provides an electronic device, such as a personal computer, a server, and this device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to implement the above method as Figure 1 shown.
[0090] In some embodiments, the above entity device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, sensors, an audio circuit, a WI-FI module, and so on. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), etc., and optionally the user interface may further include a USB interface, a card reader interface, etc. The network interface may include a standard wired interface, a wireless interface (such as a WI-FI interface), etc. in some embodiments.
[0091] Those skilled in the art can understand that the above structure of the entity device provided in this embodiment does not constitute a limitation on the entity device, and it may include more or fewer components, or combine some components, or have different component arrangements.
[0092] The storage medium may further include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned physical devices, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to implement communication between components inside the storage medium, as well as communication with other hardware and software in the information processing physical device.
[0093] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or can also be implemented by hardware. By applying the solution of this embodiment, compared with the related art, this embodiment, in response to the processor entering the basic input / output system, sequentially reads the identification information of multiple devices connected to the processor; based on the identification information, in the case of determining that there is a data processing device among the multiple devices, determines the first memory resource required for the operation of the data processing device; reserves the memory resource for the data processing device according to the first memory resource, and enables the hot-plug function of the first external interconnect link connecting the data processing device; in response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, configures the memory resource for the data processing device according to the memory resource reserved by the basic input / output system. By using the basic input / output system to actively identify devices when the server starts up and enabling the hot-plug function of the external interconnect link where the device is located, when the server enters the operating system, the operating system will re-allocate the memory resources under the system. Even if the basic input / output system has completed the memory resource allocation, the system will still perform a re-memory resource allocation. Because the memory resources are limited and the location information of the data processing device cannot be fixed, according to the function of the parameter, because the data processing device recognized later has no resources available for allocation since the memory resources have been allocated, but the external interconnect link with the hot-plug function enabled does not need to re-allocate the memory resources. Therefore, it is necessary for the basic input / output system to default to enable the hot-plug function of the external interconnect link where the data processing device is located, to avoid the data processing device being unable to be used normally due to the system re-allocation again, which can ensure that the data processing device can be used normally at any time, without worrying about the problem that the data processing device cannot be used due to resource problems, and improves the user experience.
[0094] It should be noted that, in this text, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.
[0095] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments herein, but rather to the broadest scope consistent with the principles and novel features claimed herein.
Claims
1. A resource allocation method, characterized in that, Including: In response to the processor entering the Basic Input / Output System (BIOS), sequentially read the identification information of multiple devices connected to the processor, where the identification information is used to determine the device types of the multiple devices; Based on the identification information, when it is determined that there is a data processing device among the multiple devices, determine the first memory resource required for the operation of the data processing device; Reserve memory resources for the data processing device according to the first memory resource, and enable the hot-plug function of the first external interconnect link connecting the data processing device; In response to the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, configure the memory resources for the data processing device according to the memory resources reserved by the Basic Input / Output System; 2. The method according to claim 1, wherein After determining the first memory resource required for the operation of the data processing device when it is determined that there is a data processing device among the multiple devices based on the identification information, the method further includes: Determine whether an external interconnect device is connected to the first external interconnect link.
3. The method according to claim 2, wherein The step of reserving memory resources for the data processing device according to the first memory resource and enabling the hot-plug function of the first external interconnect link connecting the data processing device includes: When it is determined that no external interconnect device is connected to the first external interconnect link, determine the first memory resource as the total memory resource corresponding to the first external interconnect link; Reserve memory resources for the first external interconnect link based on the total memory resource, and enable the hot-plug function of the first external interconnect link.
4. The method according to claim 3, wherein The step of reserving memory resources for the data processing device according to the first memory resource and enabling the hot-plug function of the first external interconnect link connecting the data processing device further includes: When it is determined that an external interconnect device is connected to the first external interconnect link, determine the second memory resource required for the operation of the first external interconnect device connected to the first external interconnect link; Perform an accumulation process on the first memory resource and the second memory resource, and determine the result of the accumulation process as the total memory resource; Reserve memory resources for the first external interconnect link based on the total memory resource, and enable the hot-plug function of the first external interconnect link.
5. The method according to claim 4, wherein After reading the identification information of multiple devices connected to the processor in response to the processor entering the Basic Input / Output System, the method further includes: Based on the identification information, when it is determined that there is no data processing device among the multiple devices, determine whether there is an external interconnect device among the multiple devices; When it is determined that there is an external interconnect device among the multiple devices, determine the third memory resource required for the operation of the second external interconnect device existing among the multiple devices; Reserve memory resources for the second external interconnect device according to the third memory resource, and enable the hot-plug function of the second external interconnect link connecting the second external interconnect device.
6. The method according to claim 5, characterized in that, Upon the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, memory resource configuration for the data processing device is performed according to the memory resources reserved by the basic input / output system, including: Upon the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, memory resource configuration for the data processing device is performed according to the total memory resources.
7. The method according to claim 6, wherein Upon the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, memory resource configuration for the data processing device is performed according to the memory resources reserved by the basic input / output system, and further includes: Upon the processor entering the operating system, if it is recognized that the hot-plug function of the first external interconnect link is enabled, memory resource configuration for the data processing device is performed according to the first memory resource in the total memory resources, and memory resource configuration for the first external interconnect device is performed according to the second memory resource in the total memory resources.
8. The method according to claim 7, wherein The method further includes: Upon the processor entering the operating system, if it is recognized that the hot-plug function of the second external interconnect link is enabled, memory resource configuration for the second external interconnect device is performed according to the third memory resource.
9. The method according to claim 8, wherein The method further includes: Upon the processor entering the operating system, if it is recognized that the hot-plug function of the third external interconnect link is enabled and no data processing device or external interconnect device is connected to the third external interconnect link, memory resource configuration for the third external interconnect link is performed according to a predetermined link resource configuration threshold.
10. The method according to claim 7, wherein The method further includes: Upon the processor entering the operating system, if it is recognized that the hot-plug function of the fourth external interconnect link is not enabled, it is determined whether a data processing device and / or an external interconnect device is connected to the fourth external interconnect link; In the case where it is determined that a data processing device and / or an external interconnect device is connected to the fourth external interconnect link, the fourth memory resources required for the operation of the data processing device and / or the external interconnect device connected to the fourth external interconnect link are determined.
11. The method according to claim 9, characterized in that, After determining the fourth memory resources required for the operation of the data processing device and / or the external interconnect device, the method further includes: If it is determined that the fourth memory resources are less than or equal to the predetermined resources to be allocated, resource configuration for the data processing device and / or the external interconnect device connected to the fourth external interconnect link is performed based on the predetermined resources to be allocated.
12. The method according to claim 11, wherein The method further includes: If it is determined that the fourth memory resources are greater than the predetermined resources to be allocated, no resource configuration is performed for the data processing device and / or the external interconnect device connected to the fourth external interconnect link.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
14. An electronic device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, the method according to any one of claims 1 to 12 is implemented.
15. A computer program product, on which a computer program is stored, characterized in that, When the computer program product is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Method and apparatus for distributing resource of hot-plug bus interface
CN101226515A
Resource allocation method and system
CN103455379A
Hot plug system, method, equipment and cluster for peripheral device interconnection expansion equipment
CN118035150A
Firmware upgrade effective method and device of PCIe device, storage medium and program product
CN119201187A
Resource allocation method and device for data processing unit, electronic equipment and storage medium
CN119781844A
Cited By
Configuration method and device for starting system database
CN120723340A