A method, apparatus, system and electronic device for processing memory resources
By acquiring the internal link topology information of hardware devices such as smart network interface cards (NICs), the connection status of switching devices and expansion devices is determined. Based on the configuration information, a memory resource reservation strategy is determined, which solves the problem of unreasonable memory resource allocation, ensures the normal operation of expansion devices, and improves the performance and stability of computing devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2025-05-15
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, the unreasonable allocation of memory resources in hardware devices such as smart network cards causes expansion devices connected to the downlink ports of the Switch to malfunction due to insufficient memory resources.
By obtaining the internal link topology information of the computing device during the driver execution phase, it is determined whether switching devices and expansion devices are included, and a memory resource reservation strategy is determined based on the configuration information of the expansion devices to make reasonable memory resource reservations.
This solves the problem of unreasonable memory resource allocation, prevents expansion devices from failing to function properly due to insufficient resources, and improves the performance and stability of computing devices.
Smart Images

Figure CN120144324B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, system and electronic device for processing memory resources. Background Technology
[0002] Currently, hardware devices such as smart network interface cards (NICs) are widely used in computing devices such as servers. Taking smart NICs as an example, when computing devices use smart NICs, memory resources need to be allocated to the smart NICs in advance. Therefore, how to allocate memory resources to smart NICs has become a key research topic.
[0003] In related technologies, memory resources are typically allocated to smart network interface cards (NICs) based on the memory requirements provided by the NIC manufacturer. However, in practical applications, hardware devices such as smart NICs may have switch devices, and the downlink ports of these switch devices may connect to other peripherals. If memory resources are allocated solely based on the smart NIC's own memory requirements, the extended devices connected to the downlink ports of the switch device may malfunction due to insufficient memory resources. Summary of the Invention
[0004] This application provides a memory resource processing method, apparatus, system, and electronic device to at least solve the problem in the related art where unreasonable allocation of memory resources in hardware devices may cause the expansion devices connected to the downlink ports of the internal switch devices to malfunction due to insufficient memory resources.
[0005] This application provides a method for processing memory resources, including: Obtain the topology information of the internal links of any hardware device in the driver execution phase of the computing device; Based on the topology information of the internal links of the hardware device, determine whether the internal links of the hardware device include switching devices; If it is determined that the internal link of the hardware device includes at least one switching device, for any switching device, determine whether the downlink port of the switching device is connected to the expansion device; When it is determined that the downlink port of the switching device is connected to the expansion device, the target memory resource reservation strategy for the internal link of the hardware device is determined based on the configuration information of the expansion device. Based on the target memory resource reservation strategy corresponding to each hardware device in the computing device, memory resources are reserved for each hardware device in each computing device.
[0006] This application also provides a memory resource processing apparatus, including: The acquisition module is used to acquire the topology information of the internal links of any hardware device in the computing device during the driver execution phase; The first judgment module is used to determine whether the internal links of the hardware device include switching devices based on the topology information of the internal links of the hardware device. The second judgment module is used to determine whether the downlink port of any switching device is connected to an expansion device when it is determined that the internal link of the hardware device includes at least one switching device. The determination module is used to determine the target memory resource reservation strategy for the internal link of the hardware device based on the configuration information of the expansion device when it is determined that the downlink port of the switching device is connected to the expansion device. The reservation module is used to reserve memory resources for each hardware device in each computing device according to the target memory resource reservation strategy corresponding to each hardware device in the computing device.
[0007] This application also provides a memory resource processing system, including: multiple hardware devices and a memory resource processing device, wherein the memory resource processing device includes at least a basic input / output system; The memory resource processing device performs memory resource processing on each hardware device based on any of the above-mentioned memory resource processing methods.
[0008] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the above-described memory resource processing methods when executing the computer program.
[0009] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described memory resource processing methods.
[0010] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described memory resource processing methods.
[0011] By obtaining the internal link topology information of the computing device during the driver execution phase and determining whether there are switching devices and expansion devices connected, and then determining the memory resource reservation strategy based on the configuration information of the expansion devices, and finally reserving memory resources according to the strategy corresponding to each hardware device, the technical problem of unreasonable memory resource allocation of hardware devices in the prior art can be solved. This avoids the expansion devices connected to the downlink port of the internal switch device of the hardware device from being unable to be used normally due to insufficient memory resources, thereby achieving the technical effect of improving the performance and stability of the computing device. Attached Figure Description
[0012] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 A flowchart illustrating the memory resource processing method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the topology of the switching device provided in the embodiments of this application; Figure 3 A flowchart illustrating an exemplary memory resource processing method provided in this application embodiment; Figure 4 This is a schematic diagram of the internal link structure provided in an embodiment of this application; Figure 5 A flowchart illustrating another exemplary memory resource processing method provided in this application embodiment; Figure 6 A flowchart illustrating another exemplary memory resource processing method provided in this application embodiment; Figure 7 This is a schematic diagram of the structure of the memory resource processing device provided in the embodiments of this application; Figure 8 This is a schematic diagram of the structure of the memory resource processing system provided in the embodiments of this application; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0015] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0016] Taking smart network interface cards (NICs) as an example, a smart NIC is a flexible, programmable network card used in conjunction with computing devices such as servers. Because smart NICs possess computing capabilities, they offload CPU-unsuitable data processing functions related to networking, security, and storage to a programmable hardware chip to free up CPU resources. This reduces CPU consumption, allowing servers to run critical applications and operating systems more efficiently, thus optimizing the overall efficiency of business data processing. The development of smart NICs has gone through three stages: the first stage was basic function NICs; the second stage was hardware-offloaded NICs (first-generation smart NICs, SNICs); and the third stage is DPU smart NICs, which can achieve complete offloading of security-related functions (data plane + control plane). The third-stage data processing unit (DPU) is a dedicated processor that provides virtualization services for data center infrastructure, including networking, storage, security, and management, around data processing. It's a computing architecture composed of CPUs based on ARM / x86 architectures and dedicated hardware acceleration engines such as ASICs (Application Specific Integrated Circuits), NPs (Network Processors), and FPGAs (Field Programmable Gate Arrays), forming the entity that provides virtualization capabilities. Based on the above basic concepts, DPU products are now widely used in various server architectures in data centers, including but not limited to x86 and ARM architectures. However, regardless of the server architecture, when using smart network interface cards (NICs), resources need to be reserved in advance for the NICs. This is because smart NICs contain many devices, such as network port devices, virtual NICs, and physical or virtual storage devices like SSDs. These devices all require memory resources, with some memory resources being prioritized. For example, 32-bit memory resources need to be highly prioritized. However, some DPU devices also contain switch devices (switch chips), which may connect to other PCI devices (expansion devices), also requiring memory allocation. Meanwhile, in addition to the DPU device containing the Switch chip, the server's motherboard or PCI device card also contains a similar Switch chip. The same Switch chip and the PCI devices below it also require resources, but 32-bit memory resources are limited and have a maximum of 4GB. If it exceeds 4GB, some devices will become unusable, such as the display function (DPU display interface or onboard VGA interface) interface will not display, or the required devices will not be used normally under the system or the devices will be lost. The core of these problems is insufficient memory resource allocation.
[0017] To address the aforementioned technical problems, this application provides a memory resource processing method, apparatus, system, and electronic device. The method includes: acquiring topology information of the internal links of any hardware device during the driver execution phase of a computing device; determining, based on the topology information of the internal links of the hardware device, whether the internal links of the hardware device include a switching device; if it is determined that the internal links of the hardware device include at least one switching device, determining, for any switching device, whether the downlink port of the switching device is connected to an expansion device; if it is determined that the downlink port of the switching device is connected to an expansion device, determining a target memory resource reservation strategy for the internal links of the hardware device based on the configuration information of the expansion device; and reserving memory resources for each hardware device in each computing device according to the target memory resource reservation strategy corresponding to each hardware device in the computing device. The method provided by the above solution obtains the internal link topology information of the computing device during the driver execution phase, and determines whether there are switching devices and expansion devices connected. Then, it determines the memory resource reservation strategy based on the configuration information of the expansion devices, and finally reserves memory resources according to the strategy corresponding to each hardware device. Therefore, it can solve the technical problem of unreasonable memory resource allocation of hardware devices in the prior art, so as to avoid the expansion devices connected to the downlink port of the internal switch device of the hardware device from being unable to be used normally due to insufficient memory resources, thereby achieving the technical effect of improving the performance and stability of the computing device.
[0018] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0019] This application provides a memory resource processing method for reserving and allocating memory resources for hardware devices such as servers. The execution subject of this application is an electronic device, such as a server, desktop computer, laptop computer, tablet computer, or other electronic devices capable of memory resource processing.
[0020] like Figure 1 The diagram shown is a flowchart illustrating a memory resource processing method provided in an embodiment of this application. The method includes: Step 101: Obtain the topology information of the internal links of any hardware device in the driver execution phase of the computing device.
[0021] The computing devices include servers and computers, while the hardware devices include smart network cards, graphics processors, and central processing units.
[0022] Specifically, when a computing device starts up, it first enters the driver execution phase. During the driver execution phase (DXE phase), the Basic Input Output System (BIOS) of the computing device enumerates the PCI devices of the computing device to obtain the hardware topology information of the computing device, as well as the topology information of the internal links of each hardware device in the hardware topology.
[0023] Step 102: Based on the topology information of the internal links of the hardware device, determine whether the internal links of the hardware device include switching devices.
[0024] The switching device is the switch chip, which includes uplink and downlink ports. The uplink port is generally connected to the upstream device, such as the controller in the hardware device, while the downlink port is generally connected to the expansion device, such as the network card and hard drive.
[0025] Step 103: If it is determined that the internal link of the hardware device includes at least one switching device, for any switching device, determine whether the downlink port of the switching device is connected to the expansion device.
[0026] It should be noted that the expansion devices connected to the downlink ports of the switching equipment are used to expand the functionality and performance of the hardware. In order to ensure that the expansion devices connected to the downlink ports of the switching equipment can operate normally, the hardware equipment needs to reserve memory resources for the expansion devices.
[0027] Step 104: If it is determined that the downlink port of the switching device is connected to the expansion device, determine the target memory resource reservation strategy for the internal link of the hardware device based on the configuration information of the expansion device.
[0028] The configuration information of the expansion device includes at least memory capacity, model, working mode, and data transfer rate. The configuration information determines the performance and function of the expansion device to a certain extent.
[0029] Specifically, if it is determined that the downlink port of the switching device is connected to the expansion device, it is necessary to determine how much memory resources should be reserved in the internal link of the hardware device based on the specific configuration information of the expansion device. That is, to determine the target memory resource reservation strategy for the internal link in order to meet the normal operation requirements of the expansion device.
[0030] Step 105: Based on the target memory resource reservation strategy corresponding to each hardware device in the computing device, reserve memory resources for each hardware device in the computing device.
[0031] Specifically, after determining the target memory resource reservation strategy for each hardware device, a corresponding amount of memory resources is reserved for each hardware device based on the memory resource reservation requirements represented by the target memory resource reservation strategy of each hardware device, so as to ensure that the hardware device and the expansion device connected to its internal switching device can operate normally and stably in the future.
[0032] Based on the above embodiments, as an implementable approach, in one embodiment, the target memory resource reservation strategy for the internal links of the hardware device is determined according to the configuration information of the extended device, including: Step 1041: For any extended device, determine the memory resource requirements of the extended device under various operating states based on the configuration information of the extended device; Step 1042: Determine the maximum memory resource requirement of the expansion device based on its memory resource requirements under various operating states. Step 1043: Determine the memory resource reservation requirements for the downlink ports of the switching device based on the maximum memory resource requirements of the expansion device; Step 1044: Determine the target memory resource reservation strategy for the internal link based on the memory resource reservation requirements of each downlink port of each switching device in the internal link of the hardware device.
[0033] Among them, such as Figure 2 The diagram shows the topology of a switching device provided in an embodiment of this application. In the diagram, DP0, DP1, DP2, and DP3 represent the downlink ports of the switching device. Port DP0 connects to a PCI device, which is directly connected to the switching device via a PCI link. Port DP1 connects to a PCI Slot0 x16 slot, which in turn connects to another PCI device, indicating that PCI devices can be connected via slot expansion. Port DP2 connects to two PCI Slot0 x16 slots, each connected to a PCI device, indicating that multiple devices can be connected simultaneously via this port. Port DP3 connects to a PCI Slot0 x16 slot, which is currently empty, indicating that the slot is in an idle state.
[0034] It should be noted that the extended device includes multiple operating states, which can also be called working modes, such as normal operating state, high load operating state, and standby state. The memory resource requirements will be different in different operating states.
[0035] Specifically, after determining the memory resource requirements of the expansion device under various operating states, the maximum value can be identified; this maximum value is the maximum memory resource requirement of the expansion device. Considering the maximum memory resource requirement ensures that the expansion device has sufficient memory resources to operate normally under any operating state, avoiding performance degradation or failure due to insufficient memory. Finally, based on the maximum memory resource requirement of the expansion device, the amount of memory resources that need to be reserved for the downlink port of the switching device is determined to ensure that the expansion device connected to that downlink port can operate normally.
[0036] By accurately determining the memory requirements of the expansion device under various operating conditions and reserving memory resources based on the maximum memory requirement, it is possible to ensure that the expansion device has enough memory to support its normal operation under any circumstances, reduce device failures and performance degradation caused by insufficient memory, and thus improve the overall operational stability of the hardware device.
[0037] Furthermore, in one embodiment, after reserving memory resources for any internal link, hot-plugging functionality is enabled in the configuration space corresponding to the internal link to indicate that memory resources have been reserved for the internal link.
[0038] The configuration space stores configuration and status information for hardware devices, including device identifiers and register information. By accessing the configuration space, relevant hardware information can be obtained, and the hardware devices can be configured and managed. After reserving memory resources for any internal link, hot-plugging functionality is enabled in the corresponding configuration space of that internal link. This indicates that memory resources have been reserved for the internal link, and the previously reserved memory resources are automatically reclaimed when expansion devices or other devices on the internal link are removed.
[0039] Based on the above embodiments, as an implementable approach, in one embodiment, the method further includes: Step 201: If it is determined that the downlink port of the switching device is not currently connected to an expansion device, determine whether there is a planned expansion device to be connected to the downlink port of the switching device in the future; Step 202: If it is determined that there are planned future expansion devices connected to the downlink port of the switching device, determine the target memory resource reservation strategy for the internal link of the hardware device based on the configuration information of the planned future expansion devices.
[0040] Among them, the planned future expansion devices include computing devices that will add connectivity during the operating system stage or in subsequent operation. For example, when computing devices need to handle more network traffic, connection data processors may be added to offload computing tasks from the server host.
[0041] Specifically, by determining whether there are plans to connect expansion devices to the downlink ports of the switching equipment in the future, and by determining the memory resource reservation strategy in advance according to the plan, it is possible to ensure that there are enough memory resources allocated to the new devices when they are added, thus avoiding conflicts and insufficiencies that may be caused by temporary resource allocation.
[0042] Accordingly, in one embodiment, if it is determined that the downlink port of the switching device is not connected to an expansion device and there is no plan to connect an expansion device in the future, then it is determined that the downlink port of the switching device does not need to reserve memory resources.
[0043] Specifically, if it is determined that the downlink port of the switching device is not connected to any expansion device and there are no plans to connect any expansion device in the future, then it is determined that the downlink port of the switching device does not need to reserve memory resources, and therefore no memory resources are reserved for the downlink port, so as to avoid unnecessary memory resource reservation and improve the utilization rate of memory resources.
[0044] For example, such as Figure 3 The diagram illustrates an exemplary memory resource processing method provided in this application. After the computing device is powered on, the BIOS first determines during the driver execution phase whether the internal link of the hardware device includes a switching device. If it is determined that the internal link of the hardware device includes at least one switching device, for any switching device, it is determined whether the downlink port of the switching device is connected to an expansion device. If connected, memory resources are reserved for the expansion device. After memory resource reservation, hot-plugging functionality is enabled in the configuration space of the downlink port of the switching device and in the configuration space of the uplink port of the switching device, indicating that the expansion device connected to the downlink port of the switching device has completed memory resource reservation. Then, hot-plugging functionality is enabled in the configuration space of the internal link, indicating that the internal link has completed memory resource reservation. If the downlink port of the switching device is not connected to an expansion device, it is further determined whether the downlink port of the switching device is planned to be connected to an expansion device in the future, that is, whether the downlink port of the switching device is a specific PCI port. If so, resources are reserved for that specific interface; otherwise, no resource reservation is made, and the process continues to poll the next switching device on the internal link. After completing a series of hot-swap functionality activation operations, it determines whether the internal link is the last link of the hardware device. If it is, the computing device starts the operating system; otherwise, it continues to poll the next internal link.
[0045] Based on the above embodiments, as an implementable approach, in one embodiment, the method further includes: Step 301: If it is determined that the internal link of the hardware device does not include the switching device, obtain the attribute information of each physical device on the internal link; Step 302: Determine the target memory resource reservation strategy for the internal links of the hardware device based on the attribute information of each physical device.
[0046] Physical devices are those directly connected to the internal link, such as... Figure 4 The diagram shown is a structural schematic of the internal link provided in the embodiment of this application. The internal link is the internal link of the hardware device DPU. The network card 0, network card 1 and hard disk 1 that connect to the downlink port of the switching device are the expansion devices, and the CPU, USB interface and hard disk 0 are the physical devices.
[0047] Specifically, after obtaining the attribute information of each physical device on the internal link, the target memory resource reservation strategy for the internal link of the hardware device can be determined based on the working characteristics and resource requirements of different physical devices. For example, when the CPU performs complex calculations, it may need a large amount of memory resources to quickly read and store data, while the memory requirements of the hard drive are relatively stable when performing data read and write operations. Therefore, it is necessary to comprehensively consider the attribute information of each physical device and formulate a reasonable memory resource reservation strategy for the entire internal link to ensure that each physical device can obtain sufficient memory resources to work normally.
[0048] Specifically, in one embodiment, for any physical device, it can be determined whether the physical device is used for data processing tasks based on its attribute information; if it is determined that the physical device is used for data processing tasks, the configuration information of the physical device is obtained; based on the configuration information of the physical device, the memory resource requirements of the physical device under various operating states are determined; based on the memory resource requirements of the physical device under various operating states, the maximum memory resource requirements of the physical device are determined; based on the maximum memory resource requirements of the physical device, the memory resource reservation requirements of the physical device are determined; based on the memory resource reservation requirements of each physical device on the internal link of the hardware device, the target memory resource reservation strategy of the internal link of the hardware device is determined.
[0049] The attribute information of physical devices includes at least the device type, function description, manufacturer identification code (VID), device identification code (VID), and application scenario identifier.
[0050] Specifically, for each physical device in the internal hardware link, its attribute information is used to determine whether the device primarily undertakes data processing tasks. For example, CPUs, GPUs, and DPUs are used for data processing tasks such as calculation, analysis, and graphics rendering, while simple input / output devices, such as keyboards and mice, do not involve data processing tasks. If a physical device is determined to be used for data processing tasks, its configuration information is further obtained. The configuration information includes important parameters of the device, such as the number of CPU cores, memory capacity, model, operating mode, and data transfer rate. Based on the configuration information of the physical device, its memory resource requirements under different operating states (operating modes) are analyzed. The maximum value is selected from the memory resource requirements of the physical device under various operating states, thus determining its maximum memory resource requirement. Based on the maximum memory resource requirement of the physical device, and also considering the overall system resource status, the actual memory resource reservation requirement of the physical device can be determined. The memory resource reservation requirements of all physical devices in the internal hardware link are summarized, and factors such as the collaborative working relationship and resource dependencies between devices can be further considered to formulate a target memory resource reservation strategy for the entire internal link.
[0051] Accordingly, in one embodiment, when it is determined that the physical device is not used for data processing tasks, the memory resource reservation requirements of the physical device are determined according to a preset memory resource reservation rule.
[0052] The preset memory resource reservation rules can be formulated based on the common characteristics and usage scenarios of physical devices, and can also take into account the balance between the basic functional requirements of the devices and the overall resource allocation of the system. The preset memory resource reservation rules should at least include the default memory resource reservation value for the physical devices. For example, reserving 1MB of memory for physical devices not used for data processing tasks.
[0053] Specifically, by determining the memory resource reservation requirements for physical devices not used for data processing tasks according to preset memory resource reservation rules, memory resources can be allocated efficiently and reasonably. While meeting the basic functions of the devices, the excessive allocation of memory resources to such devices is avoided, thereby improving the overall utilization efficiency of system memory resources.
[0054] Specifically, in one embodiment, if the internal link is not currently connected to any physical device, it is determined whether the internal link has a physical device planned to be connected in the future; if it is determined that the internal link has a physical device planned to be connected in the future, the target memory resource reservation strategy of the internal link of the hardware device is determined based on the attribute information of the physical device planned to be connected in the future.
[0055] Among them, the physical devices that are planned to be connected in the future include computing devices that will be connected during the operating system stage or during subsequent operation. For example, when computing devices need to handle more network traffic, data processors may be added to be connected specifically for CPU computing tasks.
[0056] Furthermore, in one embodiment, the memory resource reservation results of all internal links can be accumulated to obtain the total amount of reserved memory resources; when the total amount of reserved memory resources reaches the preset memory resource upper limit, a corresponding upper limit prompt message is generated.
[0057] It should be noted that because hardware devices such as smart network cards require 32-bit memory addresses, and the 32-bit memory address resources of servers are limited with a maximum capacity of 4GB, memory resources need to be reserved in advance for hardware devices such as smart network cards. Therefore, the preset upper limit of memory resources does not exceed 4GB. The memory resources allocated and reserved in this embodiment are the 32-bit memory resources of the computing device.
[0058] Specifically, the total amount of reserved memory resources can be compared with the preset memory resource limit in real time. If the total amount of reserved memory resources reaches the preset memory resource limit, it means that the system's memory resource reservation has approached or reached the maximum allocatable amount. When the limit is reached, a corresponding prompt message is generated. This prompt message can be presented in various forms, such as displaying a warning message in the system management interface or logging it. The prompt message may include the total amount of reserved memory resources, the preset memory resource limit, and possible solutions.
[0059] The solution includes re-evaluating each device with reserved memory to check for over-reservation, and if so, readjusting the memory resource reservation value.
[0060] For example, such as Figure 5The diagram illustrates a flowchart of another exemplary memory resource processing method provided in this application embodiment. If it is determined that the internal link of the hardware device does not include a switching device, the attribute information of each physical device (PCI device) on the internal link (PCI link) is obtained. If it is determined that the internal link includes a physical device, it is further determined whether the physical device is used for data processing tasks or to reserve memory resources (such as a DPU). If so, memory resources are reserved for the physical device according to its configuration information. If not, memory resources (normally allocated memory resources) are reserved for the physical device according to a preset memory resource reservation rule. After reserving memory resources, hot-plugging functionality is enabled in the configuration space of the internal link, i.e., its hot-plugging function is enabled. Specifically, if it is determined that the internal link does not include a physical device, it is further determined whether the internal link needs to reserve memory resources for the insertion of physical devices into the system, i.e., if the internal link has planned future physical devices connected, then corresponding memory resources are reserved; otherwise, no memory resources are reserved.
[0061] Based on the above embodiments, as an implementable approach, in one embodiment, the method further includes: Step 401: When the computing device enters the operating system stage, if the user configuration parameters indicate that any hardware device needs to reallocate memory resources, the internal links of the hardware device are traversed to filter out the extended devices or physical devices that have not previously reserved memory resources. Step 402: Select the selected extended devices or physical devices as the extended devices or physical devices to be assigned. Step 403: Allocate corresponding memory resources for the expansion device or physical device to be allocated.
[0062] It should be noted that the memory resource reservation operation provided in the above embodiments is implemented by the BIOS of the computing device, and the memory resource reallocation operation is implemented by the operating system of the computing device.
[0063] Specifically, when the computing device boots up and enters the operating system stage, the operating system's Grub interface adds the PCI=realloc parameter to the Grub file by default. If it is not necessary to reallocate the memory resources allocated by the BIOS under the operating system, this parameter is removed from the Grub file; if it is necessary to reallocate the memory resources allocated by the BIOS under the system, this parameter is retained in the Grub file. Whether to retain this parameter in the Grub file can actually be determined according to the user's configuration parameters.
[0064] Specifically, the purpose of traversing the internal links is to identify extended devices or physical devices that have not been allocated memory resources in the previous memory resource reservation process. For example, during system initial startup, some extended devices may not have been connected yet, resulting in them not receiving memory reservations. Traversing the internal links allows these devices to be identified and designated as extended devices or physical devices awaiting allocation. After identifying these devices, the operating system allocates appropriate memory resources to them based on their specific needs.
[0065] Specifically, in one embodiment, the internal links of the hardware device can be traversed to determine whether the configuration space of each internal link has enabled hot-swapping functionality; if it is determined that the configuration space of the internal link has enabled hot-swapping functionality, it is determined whether the internal link includes a switching device; if it is determined that the internal links of the hardware device include at least one switching device, for any switching device, it is determined whether the uplink port and downlink port of the switching device have enabled hot-swapping functionality; if it is determined that the uplink port and downlink port have not enabled hot-swapping functionality, it is determined that the expansion device connected to the switching device has not reserved memory resources.
[0066] Specifically, the internal links of the hardware devices are first checked one by one to see if hot-plugging is enabled in the configuration space corresponding to each internal link. Enabled hot-plugging means that the link is designed to support dynamic device plugging and unplugging, and that certain memory resources have been reserved for it previously. Once it is determined that the configuration space of a certain internal link has enabled hot-plugging, it is further determined whether the link contains switching devices. If switching devices exist in the link, the hot-plugging functionality of the uplink and downlink ports of each switching device is checked. The hot-plugging status of the ports reflects whether memory resources have been reserved for the switching device and any extension devices connected to its downlink ports.
[0067] By performing multi-level judgments on the hot-swappable function of internal link configuration space and the hot-swappable function of switching devices and their ports, it is possible to accurately screen out expansion devices that have not reserved memory resources, avoid misjudgment and omission, and provide accurate targets for subsequent memory resource allocation.
[0068] If it is found that neither the uplink nor the downlink port of the switching device is hot-swappable, then the expansion device connected to the switching device has not reserved memory resources, meaning that the expansion device connected to the switching device is an expansion device to be allocated.
[0069] Specifically, in one embodiment, if it is determined that the configuration space of the internal link is not hot-swappable, it is determined that the physical devices connected to the internal link have not reserved memory resources.
[0070] Specifically, when it is determined that the configuration space of an internal link does not have the hot-plug function enabled, it indicates that no memory resources have been reserved for the physical devices connected to the link. In other words, all physical devices on the internal link are physical devices to be allocated. In this case, if the internal link includes a switching device, the switching device and its connected expansion devices are also devices to be allocated.
[0071] Specifically, in one embodiment, if it is determined that the internal link of the hardware device does not include a switching device, it is determined whether a physical device is connected to the internal link; if it is determined that no physical device is connected to the internal link, a preset amount of memory resources is allocated to the internal link.
[0072] Specifically, if the configuration space of the internal link is configured to enable hot-swapping and the internal link does not include a switching device, then it is further determined whether there is a physical device connected to the internal link. If no physical device is connected, it means that the link is currently in an idle state. However, in order to ensure that it can respond quickly and work normally when a device is connected in the future, a certain amount of memory resources can be allocated to it, that is, a pre-set amount of memory resources can be allocated to the internal link, such as allocating 2M of memory resources.
[0073] Furthermore, in one embodiment, the memory resource allocation requirements of the expansion device or physical device to be allocated can be obtained; it can be determined whether the current remaining memory resources meet the memory resource allocation requirements of the expansion device or physical device to be allocated; if it is determined that the current remaining memory resources meet the memory resource allocation requirements of the expansion device or physical device to be allocated, the corresponding memory resources can be allocated to the expansion device or physical device to be allocated.
[0074] Specifically, after identifying the expansion devices or physical devices to be allocated, the memory resource allocation requirements of these devices are first obtained. The determination of memory resource allocation requirements for different devices can be found in the above embodiments. After obtaining the memory requirements of the devices to be allocated, the remaining available memory resources in the current system (current remaining memory resources) are further checked. By comparing the current remaining memory amount with the memory requirements of the devices to be allocated, it is determined whether there is enough memory available for allocation. When it is determined that the current remaining memory resources can meet the memory resource allocation requirements of the expansion devices or physical devices to be allocated, the corresponding amount of memory resources is allocated to these devices according to their specific needs. Conversely, when it is determined that the current remaining memory resources cannot meet the memory resource allocation requirements of the expansion devices or physical devices to be allocated, memory resource allocation to the expansion devices or physical devices to be allocated is stopped.
[0075] For example, such as Figure 6The diagram illustrates a flowchart of another exemplary memory resource processing method provided in this application. Upon entering the operating system stage, it first determines whether memory resource reallocation is required. If so, the PCI=realloc parameter is retained in the Grub file; otherwise, the PCI=realloc parameter is removed from the Grub file, and the hardware devices are used according to the memory resources reserved by the BIOS during server startup. If the operating system reallocates memory resources, it first determines whether the configuration space of the internal link (current PCI bridge) has hot-swapping enabled. If so, it further determines whether the internal link includes a switching device. If so, it further determines whether the uplink and downlink ports of the switching device have hot-swapping enabled. If so, the resources are used according to the default BIOS allocation, and the operating system does not reallocate memory resources. If the internal link of the hardware device does not include a switching device, it further determines whether a physical device is connected to the internal link. If so, since the hot-swapping function of the internal link is enabled, i.e., memory resources have been reserved for the physical device, memory resources are not reallocated. If no physical device is connected to the internal link, a preset amount of memory resources is allocated to the internal link. If the uplink and downlink ports of the switching device are not hot-swappable or the configuration space of the internal link is not hot-swappable, then it is further determined whether there is a physical device connected to the internal link, and whether there is an expansion device connected to the downlink port of the switching device. That is, it is determined whether there is an expansion device or a physical device to be allocated. Physical devices and expansion devices can be collectively referred to as PCI devices. If so, it is further determined whether the current remaining memory resources meet the memory resource allocation requirements of the expansion device or the physical device to be allocated. If so, the corresponding memory resources are allocated to the expansion device or the physical device to be allocated. Otherwise, the memory resource allocation for the expansion device or the physical device to be allocated is stopped.
[0076] The memory resource processing method provided in this application embodiment obtains the topology information of the internal links of any hardware device in the driver execution phase of a computing device; determines whether the internal links of the hardware device include a switching device based on the topology information of the internal links of the hardware device; if it is determined that the internal links of the hardware device include at least one switching device, it determines whether the downlink port of the switching device is connected to an expansion device for any switching device; if it is determined that the downlink port of the switching device is connected to an expansion device, it determines the target memory resource reservation strategy of the internal links of the hardware device based on the configuration information of the expansion device; and reserves memory resources for each hardware device in each computing device according to the target memory resource reservation strategy corresponding to each hardware device in each computing device. The method described above obtains the internal link topology information of the computing device during the driver execution phase, determines the presence of switching and expansion device connections, then determines the memory resource reservation strategy based on the expansion device configuration information, and finally reserves memory resources according to the strategy corresponding to each hardware device. Therefore, it can solve the technical problem of unreasonable memory resource allocation for hardware devices in existing technologies, preventing expansion devices connected to the downlink ports of the internal switch device from failing to function properly due to insufficient memory resources. This improves the performance and stability of the computing device. Furthermore, after the computing device enters the operating system, further memory resource reallocation can be performed, further ensuring the reliability of the memory resource allocation results and guaranteeing the normal and stable operation of the hardware devices on the computing device.
[0077] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0078] The embodiments of this application also provide a memory resource processing apparatus for executing the memory resource processing method provided in the above embodiments.
[0079] like Figure 7 The diagram shown is a structural schematic of a memory resource processing device provided in an embodiment of this application. The memory resource processing device 70 includes: an acquisition module 701, a first judgment module 702, a second judgment module 703, a determination module 704, and a reservation module 705.
[0080] The system includes: an acquisition module for acquiring the topology information of the internal links of any hardware device during the driver execution phase of the computing device; a first judgment module for determining whether the internal links of the hardware device include a switching device based on the topology information of the internal links of the hardware device; a second judgment module for determining whether the downlink port of any switching device is connected to an expansion device if the internal links of the hardware device include at least one switching device; a determination module for determining the target memory resource reservation strategy of the internal links of the hardware device based on the configuration information of the expansion device if the downlink port of the switching device is connected to an expansion device; and a reservation module for reserving memory resources for each hardware device in each computing device according to the target memory resource reservation strategy corresponding to each hardware device in each computing device.
[0081] For a description of the features in the embodiment corresponding to the memory resource processing device, please refer to the relevant description in the embodiment corresponding to the memory resource processing method, which will not be repeated here.
[0082] Embodiments of this application also provide a memory resource processing system for executing the memory resource processing method provided in the above embodiments.
[0083] like Figure 8 The diagram shown is a structural schematic of a memory resource processing system provided in an embodiment of this application. The memory resource processing device includes: multiple hardware devices and a memory resource processing unit, which at least includes a basic input / output system.
[0084] The memory resource processing device performs memory resource processing on each hardware device based on the memory resource processing method provided in the above embodiments.
[0085] The memory resource processing device also includes an operating system, a basic input / output system for reserving memory resources, and an operating system for reallocating memory resources.
[0086] Embodiments of this application also provide an electronic device, such as... Figure 9 The diagram shown is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, including a processor 10 and a memory 20. The memory 20 stores a computer program, and the processor 10 is configured to run the computer program to execute the steps in any of the above-described memory resource processing method embodiments.
[0087] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described memory resource processing method embodiments at runtime.
[0088] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0089] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described memory resource processing method embodiments.
[0090] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described memory resource processing method embodiments.
[0091] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0092] The foregoing has provided a detailed description of a memory resource processing method, apparatus, system, and electronic device provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for processing memory resources, characterized in that, include: Obtain the topology information of the internal links of any hardware device in the driver execution phase of the computing device; Based on the topology information of the internal links of the hardware device, determine whether the internal links of the hardware device include switching devices; If it is determined that the internal link of the hardware device includes at least one switching device, for any one of the switching devices, it is determined whether the downlink port of the switching device is connected to an expansion device; If it is determined that the downlink port of the switching device is connected to an extension device, the target memory resource reservation strategy for the internal link of the hardware device is determined based on the configuration information of the extension device; wherein, the configuration information of the extension device includes at least memory capacity, model, working mode and data transmission rate; Memory resources are reserved for each hardware device in the computing device according to the target memory resource reservation strategy corresponding to each hardware device in the computing device. The method further includes: If it is determined that the downlink port of the switching device is not currently connected to an expansion device, it is determined whether the downlink port of the switching device is planned to be connected to an expansion device in the future; If it is determined that there are planned future expansion devices connected to the downlink port of the switching device, the target memory resource reservation strategy for the internal link of the hardware device is determined based on the configuration information of the planned future expansion devices. If it is determined that the downlink port of the switching device is not connected to any expansion device and there are no plans to connect any expansion device in the future, then it is determined that the downlink port of the switching device does not need to reserve memory resources. The step of determining the target memory resource reservation strategy for the internal links of the hardware device based on the configuration information of the extended device includes: For any of the aforementioned extended devices, the memory resource requirements of the extended device under various operating states are determined based on the configuration information of the extended device. Based on the memory resource requirements of the extended device under various operating states, determine the maximum memory resource requirements of the extended device; Based on the maximum memory resource requirements of the expansion device, determine the memory resource reservation requirements for the downlink ports of the switching device; Based on the memory resource reservation requirements of each downlink port of each switching device in the internal link of the hardware device, determine the target memory resource reservation strategy of the internal link; The method further includes: After reserving memory resources for any of the internal links, hot-swapping functionality is enabled in the configuration space corresponding to the internal link to indicate that memory resources have been reserved for the internal link; wherein, after an expansion device on an internal link is unplugged, the previously reserved memory resources will be automatically reclaimed.
2. The memory resource processing method of claim 1, wherein, The method further includes: If it is determined that the internal link of the hardware device does not include a switching device, obtain the attribute information of each physical device on the internal link; Based on the attribute information of each physical device, determine the target memory resource reservation strategy for the internal links of the hardware device.
3. The memory resource processing method according to claim 2, characterized in that, The step of determining the target memory resource reservation strategy for the internal links of the hardware device based on the attribute information of each physical device includes: For any of the physical devices, determine whether the physical device is used for data processing tasks based on the attribute information of the physical device; If it is determined that the physical device is used to perform data processing tasks, obtain the configuration information of the physical device; Based on the configuration information of the physical device, determine the memory resource requirements of the physical device under various operating states; Based on the memory resource requirements of the physical device under various operating states, determine the maximum memory resource requirements of the physical device; Based on the maximum memory resource requirement of the physical device, determine the memory resource reservation requirement of the physical device; Based on the memory resource reservation requirements of each physical device on the internal link of the hardware device, determine the target memory resource reservation strategy for the internal link of the hardware device.
4. The memory resource processing method according to claim 3, characterized in that, The method further includes: If it is determined that the physical device is not used for data processing tasks, the memory resource reservation requirements of the physical device are determined according to the preset memory resource reservation rules.
5. The method of claim 2, wherein, The method further includes: If the internal link is not currently connected to any physical device, determine whether there are any physical devices planned to be connected to the internal link in the future; If it is determined that there are physical devices planned to be connected to the internal link in the future, the target memory resource reservation strategy of the internal link of the hardware device is determined based on the attribute information of the physical devices planned to be connected in the future.
6. The method of claim 1, wherein, The method further includes: The memory resource reservation results of all internal links are summed to obtain the total amount of reserved memory resources; When the total amount of reserved memory resources reaches the preset memory resource limit, a corresponding limit prompt message is generated.
7. The method of claim 1, wherein, The method further includes: When the computing device enters the operating system stage, if the user configuration parameters indicate that any of the hardware devices needs to reallocate memory resources, the internal links of the hardware devices are traversed to filter out the extended devices or physical devices that have not previously reserved memory resources. The selected extended devices or physical devices are used as the extended devices or physical devices to be assigned. Allocate corresponding memory resources to the expansion device or physical device to be allocated.
8. The memory resource processing method of claim 7, wherein, The step of traversing the internal links of the hardware device to filter out expansion devices or physical devices for which memory resources have not been reserved before includes: The internal links of the hardware device are traversed to determine whether the configuration space of each internal link has enabled hot-swapping. If it is determined that the configuration space of the internal link has enabled hot-swapping, determine whether the internal link includes a switching device; If it is determined that the internal link of the hardware device includes at least one switching device, for any one of the switching devices, it is determined whether the uplink port and downlink port of the switching device have enabled hot-plugging function; If it is determined that the uplink and downlink ports are not hot-swappable, it is also determined that the expansion device connected to the switching device has not reserved memory resources.
9. The memory resource processing method of claim 8, wherein, The method further includes: If it is determined that the configuration space of the internal link is not hot-swappable, it is also determined that the physical devices connected to the internal link have not reserved memory resources.
10. The memory resource processing method of claim 8, wherein, The method further includes: If it is determined that the internal link of the hardware device does not include a switching device, it is determined whether a physical device is connected to the internal link; If it is determined that there are no physical devices connected to the internal link, a pre-set amount of memory resources are allocated to the internal link.
11. The memory resource processing method according to claim 7, characterized in that, The process of allocating corresponding memory resources for the unallocated extended device or the unallocated physical device includes: Obtain the memory resource allocation requirements of the expansion device or physical device to be allocated; Determine whether the current remaining memory resources meet the memory resource allocation requirements of the pending expansion device or the pending physical device; If it is determined that the current remaining memory resources meet the memory resource allocation requirements of the expansion device or physical device to be allocated, the corresponding memory resources are allocated to the expansion device or physical device to be allocated.
12. A memory resource handling apparatus, characterized by comprising: include: The acquisition module is used to acquire the topology information of the internal links of any hardware device in the computing device during the driver execution phase; The first judgment module is used to determine whether the internal links of the hardware device include switching devices based on the topology information of the internal links of the hardware device. The second determination module is used to determine, when it is determined that the internal link of the hardware device includes at least one switching device, whether the downlink port of the switching device is connected to an expansion device for any of the switching devices. The determination module is used to determine the target memory resource reservation strategy for the internal link of the hardware device based on the configuration information of the expansion device when it is determined that the downlink port of the switching device is connected to the expansion device; wherein the configuration information of the expansion device includes at least memory capacity, model, working mode and data transmission rate; The reservation module is used to reserve memory resources for each hardware device in the computing device according to the target memory resource reservation strategy corresponding to each hardware device in the computing device. The determining module is also used for: If it is determined that the downlink port of the switching device is not currently connected to an expansion device, it is determined whether the downlink port of the switching device is planned to be connected to an expansion device in the future; If it is determined that there are planned future expansion devices connected to the downlink port of the switching device, the target memory resource reservation strategy for the internal link of the hardware device is determined based on the configuration information of the planned future expansion devices. If it is determined that the downlink port of the switching device is not connected to any expansion device and there are no plans to connect any expansion device in the future, then it is determined that the downlink port of the switching device does not need to reserve memory resources. The determining module is specifically used for: For any of the aforementioned extended devices, the memory resource requirements of the extended device under various operating states are determined based on the configuration information of the extended device. Based on the memory resource requirements of the extended device under various operating states, determine the maximum memory resource requirements of the extended device; Based on the maximum memory resource requirements of the expansion device, determine the memory resource reservation requirements for the downlink ports of the switching device; Based on the memory resource reservation requirements of each downlink port of each switching device in the internal link of the hardware device, determine the target memory resource reservation strategy of the internal link; The reserved module is also used for: After reserving memory resources for any of the internal links, hot-swapping functionality is enabled in the configuration space corresponding to the internal link to indicate that memory resources have been reserved for the internal link; wherein, after an expansion device on an internal link is unplugged, the previously reserved memory resources will be automatically reclaimed.
13. A memory resource handling system, characterized by include: Multiple hardware devices and memory resource processing devices, wherein the memory resource processing devices include at least a basic input / output system; The memory resource processing device performs memory resource processing on each of the hardware devices based on the memory resource processing method as described in any one of claims 1 to 11.
14. An electronic device, comprising: include: Memory, used to store computer programs; A processor, configured to implement the steps of the memory resource processing method as described in any one of claims 1 to 11 when executing the computer program.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the memory resource processing method as described in any one of claims 1 to 11.
16. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the memory resource processing method as described in any one of claims 1 to 11.