Memory resource processing method, device and system and electronic equipment
By obtaining the topology information of the internal link of the hardware device and determining the memory resource reservation strategy based on the extended device configuration information, the problem of unreasonable allocation of memory resources of the hardware device is solved, and the effect of improving the performance and stability of computing devices is achieved.
Patent Information
- Application Number
- CN202510624112.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-05-15
AI Technical Summary
In the prior art, the memory resource allocation of hardware devices is unreasonable, which may cause the extended equipment connected to the downlink port of the Switch switching device to be unable to be used normally due to insufficient memory resources.
By obtaining the topology information of the internal link of the computing device during the driver execution stage, we can determine whether there are switching devices and extension devices connections, and determine the memory resource reservation strategy based on the configuration information of the extension device, and finally reserve memory resources for each hardware device.
It solves the problem of unreasonable allocation of memory resources for hardware devices, and avoids the expansion devices connected to the downlink port of the Switch switch device being unable to be used normally due to insufficient memory resources, thereby improving the performance and stability of computing devices.
Smart Images

Figure CN120144324A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and in particular, to a method, apparatus, system, and electronic device for processing memory resources. Background Art
[0002] Currently, hardware devices such as smart network cards are widely used in computing device products such as servers. Taking a smart network card as an example, when a computing device applies a smart network card, it is necessary to allocate memory resources for the smart network card in advance. Therefore, how to allocate memory resources for a smart network card has become a key research content.
[0003] In related technologies, memory resources are usually allocated to a smart network card according to the memory requirement information provided by the smart network card manufacturer. However, in actual applications, a hardware device such as a smart network card may be provided with a Switch switching device, and other peripherals may be connected to the downstream ports of the Switch switching device. If memory resources are allocated only according to the memory requirements of the smart network card itself, it may cause the expansion devices connected to the downstream ports of the Switch switching device to be unable to be used normally due to insufficient memory resources. Summary of the Invention
[0004] This application provides a method, apparatus, system, and electronic device for processing memory resources, so as to at least solve the problem in related technologies that the allocation of memory resources for hardware devices is unreasonable, which may cause the expansion devices connected to the downstream ports of the internal Switch switching device to be unable to be used normally due to insufficient memory resources.
[0005] This application provides a method for processing memory resources, including: Obtaining topology information of an internal link of any hardware device during the driver execution stage of a computing device; Judging whether the internal link of the hardware device includes a switching device according to the topology information of the internal link of the hardware device; When it is determined that the internal link of the hardware device includes at least one switching device, for any switching device, judging whether an expansion device is connected to the downstream port of the switching device; When it is determined that an expansion device is connected to the downstream port of the switching device, determining a target memory resource reservation policy for the internal link of the hardware device according to the configuration information of the expansion device; Reserving memory resources for each hardware device in each computing device according to the target memory resource reservation policies corresponding to the hardware devices in the computing device.
[0006] This application also provides a device for processing memory resources, including: An obtaining module, configured to obtain topology information of an internal link of any hardware device during the driver execution stage of a computing device; The first judgment module is used to judge whether the internal link of the hardware device includes a switching device according to the topology information of the internal link of the hardware device; The second judgment module is used to judge whether the downstream port of any switching device is connected to an expansion device for any switching 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 policy of the internal link of the hardware device according to the configuration information of the expansion device when it is determined that the downstream 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 policy corresponding to each hardware device in the computing device.
[0007] This application also provides a memory resource processing system, including: a plurality of hardware devices and a memory resource processing device, and the memory resource processing device at least includes a basic input / output system; The memory resource processing device processes the memory resources of each hardware device based on any of the above memory resource processing methods.
[0008] This application also provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of any of the above memory resource processing methods when executing the computer program.
[0009] This application also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above memory resource processing methods are implemented.
[0010] This application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of any of the above memory resource processing methods are implemented.
[0011] Through this application, since the topology information of the internal link of the hardware device in the driver execution stage of the computing device is obtained, and based on this, it is judged whether there is a switching device and the connection situation of the expansion device, then the memory resource reservation policy is determined according to the configuration information of the expansion device, and finally the memory resources are reserved according to the policies corresponding to each hardware device. Therefore, the technical problem of unreasonable allocation of memory resources for hardware devices in the prior art can be solved, so as to avoid that the expansion device connected to the downstream port of the Switch switching device inside the hardware device cannot be used normally due to insufficient memory resources, thereby achieving the technical effects of improving the performance and stability of the computing device. Description of the Drawings
[0012] To more clearly illustrate the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the embodiments. Obviously, the accompanying 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 accompanying drawings can also be obtained based on these drawings.
[0013] Figure 1 It is a schematic flowchart of the memory resource processing method provided by the embodiments of the present application; Figure 2 It is a schematic topological structure diagram of the switching device provided by the embodiments of the present application; Figure 3 It is a schematic flowchart of an exemplary memory resource processing method provided by the embodiments of the present application; Figure 4 It is a schematic structure diagram of the internal link provided by the embodiments of the present application; Figure 5 It is a schematic flowchart of another exemplary memory resource processing method provided by the embodiments of the present application; Figure 6 It is a schematic flowchart of yet another exemplary memory resource processing method provided by the embodiments of the present application; Figure 7 It is a schematic structure diagram of the memory resource processing device provided by the embodiments of the present application; Figure 8 It is a schematic structure diagram of the memory resource processing system provided by the embodiments of the present application; Figure 9 It is a schematic structure diagram of the electronic device provided by the embodiments of the present application. Detailed implementation manners
[0014] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all 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, rather than to describe a specific order or sequence.
[0016] Taking the smart network card as an example of the hardware device, the smart network card (Smart Network Interface Card, abbreviated as SmartNIC) is a flexible and programmable network card that is used in conjunction with computing devices such as servers. Since the smart network card has computing capabilities, in order to release 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 the CPU consumption, enabling the server to run critical applications and operating systems more effectively, and optimizing the overall efficiency of business data processing. The development of smart network cards can be divided into three stages. The first stage: basic function network cards; the second stage: hardware offloading network cards (the first-generation smart network card SNIC); the third stage: DPU smart network cards, which can achieve full offloading of security-related functions (data plane + control plane). The data processor (Data Processing Unit, abbreviated as 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 is a computing architecture composed of a CPU based on architectures such as ARM / X86 and dedicated hardware acceleration engines such as ASIC (Application Specific Integrated Circuit) / NP (Network Processor) / FPGA (Field Programmable Gate Array), forming an entity that provides virtualization functions. Based on the above basic concepts, 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, no matter what architecture the server is, when applying a smart network card, it is necessary to reserve resources for the smart network card in advance because there are many devices inside the smart network card, such as physical or virtual devices like network interface devices, virtual network cards, storage devices SSD, etc. These devices all need to use memory resources and some memory resources are prioritized. For example, 32-bit memory resources need to be highly prioritized to be satisfied. However, some DPU devices also contain Switch switching devices (Switch chips) inside, and other PCI devices (expansion devices) are also connected under the Switch chip. At this time, memory resources also need to be allocated. At the same time, in the server, in addition to the DPU device containing a Switch chip, the server's motherboard or PCI device card also contains a similar Switch chip. Similarly, the Switch chip and the PCI devices under it also need resources. However, the 32-bit memory resources are limited and the maximum is 4GB. If it exceeds 4GB, it will cause some devices to be unable to be used, such as the interface of the display function (DPU display interface or on-board VGA interface) not being able to display, or the devices that need to be used not being able to work properly under the system or the devices being lost, etc. The core of these problems is due to insufficient memory resource allocation.
[0017] In order to solve the above technical problems, embodiments of the present application provide a method, apparatus, system, and electronic device for processing memory resources. The method includes: obtaining topology information of an internal link of any hardware device of a computing device during a driver execution phase; determining, according to the topology information of the internal link of the hardware device, whether the internal link of the hardware device includes a switching device; in a case where it is determined that the internal link of the hardware device includes at least one switching device, for any switching device, determining whether a downstream port of the switching device is connected to an expansion device; in a case where it is determined that the downstream port of the switching device is connected to an expansion device, determining a target memory resource reservation policy for the internal link of the hardware device according to configuration information of the expansion device; and performing memory resource reservation for each hardware device in each computing device according to the target memory resource reservation policy corresponding to each hardware device in the computing device. In the method provided by the above solution, since the topology information of the internal link of the hardware device of the computing device during the driver execution phase is obtained, and based on this, it is determined whether there is a switching device and the connection situation of the expansion device, then the memory resource reservation policy is determined according to the configuration information of the expansion device, and finally the memory resource reservation is performed according to the policy corresponding to each hardware device, it is possible to solve the technical problem of unreasonable allocation of memory resources for hardware devices in the prior art, so as to avoid that the expansion device connected to the downstream port of the Switch switching device inside the hardware device cannot be used normally due to insufficient memory resources, thereby achieving the technical effect of improving the performance and stability of the computing device.
[0018] In order to enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0019] Embodiments of the present application provide a method for processing memory resources, which is used to reserve and allocate memory resources for hardware devices of computing devices such as servers. The execution subject of the embodiments of the present application is an electronic device, such as a server, a desktop computer, a laptop computer, a tablet computer, and other electronic devices that can be used for memory resource processing.
[0020] As Figure 1 shown, it is a schematic flowchart of the method for processing memory resources provided by the embodiments of the present application. The method includes: Step 101, obtaining topology information of an internal link of any hardware device of a computing device during a driver execution phase.
[0021] Among them, the computing device includes a server and a computer, etc., and the hardware device includes an intelligent network card, a graphics processor, and a central processing unit, etc.
[0022] Specifically, when the computing device starts up, it first enters the driver execution phase. The Basic Input Output System (BIOS) of the computing device enumerates the PCI devices of the computing device during the driver execution phase (DXE phase) to obtain the hardware topology information of the computing device and the topology information of the internal links of each hardware device in the hardware topology.
[0023] Step 102: According to the topology information of the internal link of the hardware device, determine whether the internal link of the hardware device includes a switching device.
[0024] Among them, the switching device is the Switch chip. The switching chip includes an uplink port and a downlink port. The uplink port is generally connected to a superior device, such as a controller in the hardware device, and the downlink port is generally connected to an expansion device. The expansion devices include network cards and hard disks, etc.
[0025] Step 103: When 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 an expansion device.
[0026] It should be noted that the expansion device connected to the downlink port of the switching device is used to expand the functions and performance of the hardware device. To ensure that the expansion device connected to the downlink port of the switching device can operate normally, the hardware device needs to reserve memory resources for the expansion device.
[0027] Step 104: When it is determined that the downlink port of the switching device is connected to an expansion device, determine the target memory resource reservation policy for the internal link of the hardware device according to the configuration information of the expansion device.
[0028] Among them, the configuration information of the expansion device at least includes memory capacity, model, working mode, data transfer rate, etc. The configuration information to a certain extent determines the performance and functions of the expansion device.
[0029] Specifically, if it is determined that the downlink port of the switching device is connected to an expansion device, it is necessary to determine how much memory resources should be reserved for the internal link of the hardware device according to the specific configuration information of the expansion device, that is, to determine the target memory resource reservation policy for the internal link to meet the normal operation requirements of the expansion device.
[0030] Step 105: Reserve memory resources for each hardware device in each computing device according to the target memory resource reservation policy corresponding to each hardware device in the computing device.
[0031] Specifically, after determining the target memory resource reservation policies corresponding to each hardware device, according to the memory resource reservation requirements characterized by the target memory resource reservation policies of each hardware device, reserve corresponding amounts of memory resources for each hardware device to ensure that the hardware device and the expansion devices connected to its internal switching device can operate normally and stably subsequently.
[0032] Based on the above embodiments, as an implementable manner, in one embodiment, determining the target memory resource reservation policy for the internal link of the hardware device according to the configuration information of the expansion device includes: Step 1041, for any expansion device, determine the memory resource requirements of the expansion device in various operating states according to the configuration information of the expansion device; Step 1042, determine the maximum memory resource requirements of the expansion device according to the memory resource requirements of the expansion device in various operating states; Step 1043, determine the memory resource reservation requirements for the downstream ports of the switching device according to the maximum memory resource requirements of the expansion device; Step 1044, determine the target memory resource reservation policy for the internal link according to the memory resource reservation requirements for each downstream port of each switching device in the internal link of the hardware device.
[0033] Among them, as Figure 2 shown, it is a schematic diagram of the topological structure of the switching device provided by the embodiments of the present application. In the figure, DP0, DP1, DP2, and DP3 represent the downstream ports of the switching device. Among them, the DP0 port is connected to a PCI device, and this device is directly connected to the switching device through a PCI link. The DP1 port is connected to a PCI Slot0 x16 slot, and a PCI device is connected to this slot, indicating that a PCI device can be connected through the slot expansion. The DP2 port is connected to two PCI Slot0 x16 slots, and a PCI device is connected to each slot, indicating that multiple devices can be connected simultaneously through this port. The DP3 port is connected to a PCI Slot0 x16 slot, and currently no device is connected to this slot, indicating that this slot is in an idle state.
[0034] It should be noted that the expansion device includes multiple operating states, and the operating state can also be referred to as the working mode. For example, the normal operating state, high-load operating state, standby state, etc. The memory resource requirements in different operating states will be different.
[0035] Specifically, after determining the memory resource requirements of the expansion device in various operating states, the maximum value can be found from them, and this maximum value is the maximum memory resource requirement of the expansion device. Considering the maximum memory resource requirement can ensure that the expansion device can obtain sufficient memory resources to work properly in any operating state, avoiding performance degradation or failures due to insufficient memory. Finally, based on the maximum memory resource requirement of the expansion device, the amount of memory resources to be reserved for the downstream port of the switching device is determined to ensure that the expansion device connected to this downstream port can work properly.
[0036] Among them, by accurately determining the memory requirements of the expansion device in various operating states and reserving memory resources based on the maximum memory requirement, it can be ensured that the expansion device has sufficient memory support for its normal operation in any case, reducing device failures and performance degradation caused by insufficient memory, thereby improving the operating stability of the entire hardware device.
[0037] Further, in an embodiment, after reserving memory resources for any internal link, the hot-plug function is enabled in the configuration space corresponding to the internal link to indicate that the internal link has reserved memory resources.
[0038] Among them, the configuration space is used to store the configuration information and status information of the hardware device. The configuration space includes the identifier and register information of the hardware device, etc. By accessing the configuration space of the hardware device, relevant information of the hardware device is obtained, and the hardware device is configured and managed. After reserving memory resources for any internal link, the hot-plug function is enabled in the configuration space corresponding to the internal link to indicate that the internal link has reserved memory resources, and after the expansion device on the internal link is unplugged, etc., the previously reserved memory resources will be automatically recycled.
[0039] Based on the above embodiments, as an implementable manner, in an embodiment, the method further includes: Step 201, when it is determined that the downstream port of the switching device is not currently connected to an expansion device, determine whether there is an expansion device planned to be connected to the downstream port of the switching device in the future; Step 202, when it is determined that there is an expansion device planned to be connected to the downstream port of the switching device in the future, determine the target memory resource reservation strategy for the internal link of the hardware device according to the configuration information of the expansion device planned to be connected in the future.
[0040] Among them, the expansion device planned to be connected in the future includes the expansion device that the computing device will add to connect during the operating system entry stage or during subsequent operation. For example, when the computing device needs to process more network traffic, it may add a connection to a data processor to specifically unload the computing tasks on the server host side.
[0041] Specifically, by determining whether there is a plan to connect an expansion device to the downstream port of the switching device in the future and determining the memory resource reservation strategy in advance according to the plan, it is possible to ensure that sufficient memory resources are allocated to the new device when the device is added, avoiding conflicts and shortages that may be caused by temporary resource allocation.
[0042] Correspondingly, in one embodiment, when it is determined that the downstream port of the switching device is not connected to an expansion device and there is no planned expansion device to be connected in the future, it is determined that the downstream port of the switching device does not need to reserve memory resources.
[0043] Specifically, when it is determined that the downstream port of the switching device is not connected to an expansion device and there is no planned expansion device to be connected in the future, it is determined that the downstream port of the switching device does not need to reserve memory resources, and thus no memory resources are reserved for this downstream port, so as to avoid unnecessary memory resource reservation and improve the utilization rate of memory resources.
[0044] Exemplarily, as Figure 3 shown, it is a schematic flowchart of an exemplary memory resource processing method provided by an embodiment of the present application. After the computing device is powered on, first, the BIOS determines whether the internal link of the hardware device includes a switching device during the driver execution phase. When 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 downstream port of the switching device is connected to an expansion device. If it is connected, corresponding memory resources are reserved for the expansion device. After the memory resources are reserved, the hot plug function is enabled in the configuration space of the downstream port of the switching device, and the hot plug function is enabled in the configuration space of the upstream port of the switching device to indicate that the memory resources of the expansion device connected to the downstream port of the switching device have been reserved. Then, the hot plug function is enabled in the configuration space of the internal link to indicate that the internal link has completed the memory resource reservation. Among them, if the downstream port of the switching device is not connected to an expansion device, it is further determined whether there is a planned expansion device to be connected to the downstream port of the switching device, that is, it is determined whether the downstream port of the switching device is a specific PCI port. If it is, further resource reservation is performed on the specific interface. If not, no resource reservation is performed, and the next switching device on the internal link is continued to be polled. After a series of hot plug function enabling operations are completed, it is determined whether the internal link is the last link of the hardware device. If it is, the computing device starts to run the operating system. If not, the next internal link is continued to be polled.
[0045] Based on the above embodiments, as an implementable manner, in one embodiment, the method further includes: Step 301, when 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; Step 302: Determine the target memory resource reservation policy for the internal link of the hardware device according to the attribute information of each physical device.
[0046] Among them, a physical device is a device directly connected to the internal link. As Figure 4 shown, it is a schematic diagram of the structure of the internal link provided by the embodiment of the present application. The internal link is the internal link of the hardware device DPU. The network cards 0, 1 and the hard disk 1 connected to the downstream ports of the switching device are expansion devices, and the CPU, USB interface and hard disk 0 are physical devices.
[0047] Specifically, after obtaining the attribute information of each physical device on the internal link, the target memory resource reservation policy for the internal link of the hardware device can be determined according to the working characteristics and resource requirements of different physical devices. For example, when the CPU performs complex calculations, it may require a large amount of memory resources to quickly read and store data, while the hard disk has relatively stable memory requirements during data reading and writing. Therefore, it is necessary to comprehensively consider the attribute information of each physical device to formulate a reasonable memory resource reservation policy for the entire internal link to ensure that each physical device can obtain sufficient memory resources to work properly.
[0048] Specifically, in one embodiment, for any physical device, it can be determined whether the physical device is used for data processing tasks according to the attribute information of the physical device; in the case of determining that the physical device is used for data processing tasks, obtain the configuration information of the physical device; according to the configuration information of the physical device, determine the memory resource requirements of the physical device in various operating states; according to the memory resource requirements of the physical device in various operating states, determine the maximum memory resource requirements of the physical device; according to the maximum memory resource requirements of the physical device, determine the memory resource reservation requirements of the physical device; according to the memory resource reservation requirements of each physical device on the internal link of the hardware device, determine the target memory resource reservation policy for the internal link of the hardware device.
[0049] Among them, the attribute information of the physical device at least includes device type, function description, vendor identification code (VID), device identification code (VID), and application scenario identifier, etc.
[0050] Specifically, for each physical device on the internal link of the hardware device, based on its attribute information, it is determined whether the device mainly undertakes data processing tasks. For example, CPUs, GPUs, and DPUs are used for data processing tasks such as data calculation, analysis, and graphics rendering, while some simple input / output devices, such as keyboards and mice, are not involved in data processing tasks. If it is determined that a physical device is 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 cores, memory capacity, model, working mode, and data transfer rate of the CPU. Based on the configuration information of the physical device, its memory resource requirements in different operating states (working modes) are analyzed. The maximum value is selected from the memory resource requirements of the physical device in various operating states, that is, its maximum memory resource requirement is determined. According to the maximum memory resource requirement of the physical device, and also in combination with the overall system resource status, the actual memory resource reservation requirement of the physical device is determined. The memory resource reservation requirements of all physical devices on the internal link of the hardware device are summarized, and factors such as the collaborative working relationship and resource dependence between devices can also be further considered to formulate the target memory resource reservation strategy for the entire internal link.
[0051] Correspondingly, in one embodiment, when it is determined that the physical device is not used for data processing tasks, the memory resource reservation requirement of the physical device is determined according to the preset memory resource reservation rule.
[0052] Among them, the preset memory resource reservation rule can be formulated according to the common characteristics and usage scenarios of the physical device, and the basic function requirements of the device and the balance of the overall system resource allocation can also be considered. The preset memory resource reservation rule at least includes the default memory resource reservation value of the physical device. For example, 1M of memory resources is reserved for the physical device that is not used for data processing tasks.
[0053] Specifically, by determining the memory resource reservation requirement for the physical device that is not used for data processing tasks according to the preset memory resource reservation rule, the memory resources are allocated efficiently and reasonably. While meeting the basic functions of the device, over-allocation of memory resources to such devices is avoided, thereby improving the overall utilization efficiency of the system memory resources.
[0054] Specifically, in one embodiment, when no physical device is currently connected to the internal link, it is determined whether there is a physical device planned to be connected to the internal link in the future; when it is determined that there is a physical device planned to be connected to the internal link in the future, according to the attribute information of the physical device planned to be connected in the future, the target memory resource reservation strategy for the internal link of the hardware device is determined.
[0055] Among them, the physical devices planned to be connected in the future include that when a computing device enters the operating system stage or during subsequent operation, physical devices to be connected will be added. For example, when a computing device needs to process more network traffic, a data processor may be added to be specifically used for the computing tasks of the CPU.
[0056] Furthermore, in one embodiment, the memory resource reservation results of all internal links can also be accumulated to obtain the total reserved memory resources; when the total reserved memory resources reach the preset memory resource upper limit value, a corresponding upper limit prompt message is generated.
[0057] It should be noted that since hardware devices such as intelligent network cards require 32-bit memory addresses and the 32-bit memory address resources of the server are limited with a maximum capacity of 4GB, it is necessary to reserve memory resources for hardware devices such as intelligent network cards in advance. Therefore, the preset memory resource upper limit value does not exceed 4GB. The memory resources allocated and reserved in the embodiments of the present application are the 32-bit memory resources of the computing device.
[0058] Specifically, the total reserved memory resources can be compared with the preset memory resource upper limit value in real time. If the total reserved memory resources reach the preset memory resource upper limit value, it means that the memory resource reservation of the system has approached or reached the maximum allocable amount. When the upper limit value is reached, a corresponding prompt message is generated. This prompt message can be presented in various forms, such as displaying a warning message on the system management interface or recording it through a log. The content of the prompt message may include the total reserved memory resources, the preset memory resource upper limit value, and possible solutions, etc.
[0059] Among them, the solutions include re-evaluating each device with reserved memory to check whether there is over-reservation. If so, the memory resource reservation value is readjusted.
[0060] Exemplarily, such as Figure 5As shown in the figure, it is a schematic flowchart of another exemplary memory resource processing method provided by an embodiment of the present application. When 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. When 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 reserved memory resources (such as DPU, etc.). If so, according to the configuration information of the physical device, memory resources are reserved for the physical device. If not, memory resources are reserved for the physical device according to the preset memory resource reservation rule (allocate the required memory resources normally). After the memory resources are reserved, the hot-plug function is enabled in the configuration space of the internal link, that is, the hot-plug function is enabled. Among them, 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 physical device to be inserted under the system, that is, the internal link has a physical device planned to be connected in the future. If so, corresponding memory resources are reserved, otherwise no memory resources are reserved.
[0061] Based on the above embodiments, as an implementable manner, in one embodiment, the method further includes: Step 401, when the computing device enters the operating system stage, if the user configuration parameter indicates that any hardware device needs to perform memory resource reallocation, traverse the internal link of the hardware device to filter out the expansion devices or physical devices that have not reserved memory resources before; Step 402, use the filtered expansion devices or physical devices as the expansion devices or physical devices to be allocated; Step 403, allocate corresponding memory resources to the expansion devices or physical devices to be allocated.
[0062] It should be noted that the memory resource reservation operation provided in the above embodiment 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 starts and enters the operating system stage, the Grub interface of the operating system defaults to add the PCI=realloc parameter to the Grub file. If it is not necessary to reallocate the memory resources allocated by the BIOS under the operating system at this time, this parameter is removed from the Grub file; if it is necessary to reallocate the memory resources allocated by the BIOS under the system at this time, this parameter is retained in the Grub file. Among them, whether to retain this parameter in the Grub file can actually be determined according to the user configuration parameter.
[0064] Specifically, the purpose of traversing the internal link is to identify those expansion devices or physical devices that have not been allocated memory resources during the previous memory resource reservation process. For example, at the initial startup of the system, some expansion devices may not be connected, resulting in these devices not having received memory reservation before. At this time, by traversing the internal link, these devices can be screened out and used as expansion devices or physical devices to be allocated. After determining the expansion devices or physical devices to be allocated, the operating system allocates corresponding memory resources according to the specific requirements of these devices.
[0065] Specifically, in one embodiment, the internal link of the hardware device can be traversed to determine whether the hot-plug function is enabled in the configuration space of each internal link; in the case where it is determined that the hot-plug function is enabled in the configuration space of the internal link, it is determined whether the internal link includes a switching device; in the case where 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 upstream port and the downstream port of the switching device have the hot-plug function enabled; in the case where it is determined that the upstream port and the downstream port do not have the hot-plug function enabled, it is determined that the expansion device connected to the switching device has not had memory resources reserved.
[0066] Specifically, first, the internal links of the hardware device are checked one by one to see whether the hot-plug function is enabled in the configuration space corresponding to each internal link. The enabled hot-plug function means that the link is designed to support dynamic plugging and unplugging of devices, and certain memory resource reservation operations have been performed on it before. When it is determined that the hot-plug function is enabled in the configuration space of a certain internal link, it is further determined whether the link includes a switching device. If there is a switching device in the link, for each switching device, it is checked whether the hot-plug function of its upstream port and downstream port is enabled. The hot-plug function status of the port reflects whether the switching device and the expansion device connected to the downstream port of the switching device have had memory resource reservation operations.
[0067] Among them, through multi-level judgments on the hot-plug function of the internal link configuration space, the switching device and its port hot-plug function, the expansion devices that have not had memory resources reserved can be accurately screened out, avoiding misjudgment and omission, and providing a precise target for subsequent memory resource allocation.
[0068] Among them, when it is found that neither the upstream port nor the downstream port of the switching device has the hot-plug function enabled, the expansion device connected to the switching device has not had memory resources reserved, that is, the expansion device connected to the switching device is the expansion device to be allocated.
[0069] Specifically, in one embodiment, in the case where it is determined that the hot-plug function is not enabled in the configuration space of the internal link, it is determined that the physical device connected to the internal link has not had memory resources reserved.
[0070] Specifically, when it is determined that the hot plug function is not enabled in the configuration space of a certain internal link, it indicates that memory resources have not been reserved for the physical devices connected to this link before, that is, all physical devices on this internal link are physical devices to be allocated. In this case, if this internal link includes a switching device, the switching device and its connected expansion devices also belong to the devices to be allocated.
[0071] Specifically, in an embodiment, when 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; when 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 hot plug function is enabled in the configuration space of this internal link and the internal link does not include a switching device, it is further determined whether a physical device is connected to this internal link. If no physical device is connected, it means that this link is currently in an idle state. However, in order to ensure quick response and normal operation when devices may be connected subsequently, a certain amount of memory resources can be allocated to it, that is, a preset amount of memory resources is allocated to the internal link, such as allocating 2M of memory resources, etc.
[0073] Further, in an embodiment, the memory resource allocation requirements of the expansion device to be allocated or the physical device to be allocated can be obtained; it is determined whether the current remaining memory resources meet the memory resource allocation requirements of the expansion device to be allocated or the physical device to be allocated; when it is determined that the current remaining memory resources meet the memory resource allocation requirements of the expansion device to be allocated or the physical device to be allocated, the corresponding memory resources are allocated to the expansion device to be allocated or the physical device to be allocated.
[0074] Specifically, after identifying the expansion device to be allocated or the physical device to be allocated, first obtain the memory resource allocation requirements of these devices. The determination of the memory resource allocation requirements of different devices can refer to the above embodiments. After obtaining the memory requirements of the devices to be allocated, further check the remaining available memory resources (current remaining memory resources) in the current system. 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 device to be allocated or the physical device to be allocated, according to the specific requirements of the devices, the corresponding amount of memory resources is allocated to these devices. Among them, when it is determined that the current remaining memory resources cannot meet the memory resource allocation requirements of the expansion device to be allocated or the physical device to be allocated, the memory resource allocation for the expansion device to be allocated or the physical device to be allocated is stopped.
[0075] Exemplarily, such as Figure 6As shown in the figure, it is a schematic flowchart of another exemplary memory resource processing method provided by an embodiment of the present application. After entering the operating system stage, first determine whether memory resource reallocation is required. If so, retain the PCI=realloc parameter in the Grub file; otherwise, remove the PCI=realloc parameter in the Grub file and use the hardware devices according to the memory resources reserved by the BIOS when the server starts under the system. If the operating system reallocates memory resources, first determine whether the configuration space of the internal link (current PCI bridge) has enabled the hot-plug function. If so, further determine whether the internal link includes a switching device. If so, further determine whether the upstream port and downstream port of the switching device have enabled the hot-plug function. If so, use the resources allocated by the BIOS default, and the operating system does not reallocate memory resources. If the internal link of the hardware device does not include a switching device, further determine whether a physical device is connected to the internal link. If so, since the hot-plug function of the internal link has been enabled, that is, the memory resources reserved for the physical device have been reserved before, so the memory resources are not reallocated. If no physical device is connected to the internal link, allocate a preset amount of memory resources to the internal link. Among them, if the upstream port and downstream port of the switching device do not enable the hot-plug function or the configuration space of the internal link does not enable the hot-plug function, further determine whether a physical device is connected to the internal link and whether an expansion device is connected to the downstream port of the switching device, that is, determine 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, further determine whether the current remaining memory resources meet the memory resource allocation requirements of the expansion device or physical device to be allocated. If so, allocate corresponding memory resources to the expansion device or physical device to be allocated; otherwise, stop allocating memory resources to the expansion device or physical device to be allocated.
[0076] The memory resource processing method provided by the embodiment of the present application includes: obtaining the topology information of the internal link of any hardware device during the driver execution stage of the computing device; judging whether the internal link of the hardware device includes a switching device according to the topology information of the internal link of the hardware device; in the case of determining that the internal link of the hardware device includes at least one switching device, for any switching device, judging whether the downstream port of the switching device is connected to an expansion device; in the case of determining that the downstream port of the switching device is connected to an expansion device, determining the target memory resource reservation policy of the internal link of the hardware device according to the configuration information of the expansion device; and performing memory resource reservation for each hardware device in each computing device according to the target memory resource reservation policy corresponding to each hardware device in the computing device. In the method provided by the above solution, since the topology information of the internal link of the hardware device during the driver execution stage of the computing device is obtained, and based on this, it is judged whether there is a switching device and the connection situation of the expansion device, and then the memory resource reservation policy is determined according to the configuration information of the expansion device, and finally the memory resource reservation is performed according to the policy corresponding to each hardware device, it is possible to solve the technical problem of unreasonable allocation of memory resources for hardware devices in the prior art, so as to avoid the expansion device connected to the downstream port of the Switch switching device inside 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. Moreover, after the computing device enters the operating system, further memory resource reallocation can be performed, which further ensures the reliability of the memory resource allocation result, so as to further ensure that the hardware devices on the computing device can operate normally and stably.
[0077] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.
[0078] The embodiment of the present application also provides a memory resource processing device for executing the memory resource processing method provided by the above embodiment.
[0079] As Figure 7 shown, it is a schematic structural diagram of the memory resource processing device provided by the embodiment of the present application. The memory resource processing device 70 includes: an obtaining module 701, a first judging module 702, a second judging module 703, a determining module 704, and a reserving module 705.
[0080] Among them, an acquisition module is configured to acquire the topology information of the internal link of any hardware device during the driver execution stage of the computing device; a first determination module is configured to determine whether the internal link of the hardware device includes a switching device according to the topology information of the internal link of the hardware device; a second determination module is configured to, when it is determined that the internal link of the hardware device includes at least one switching device, determine whether the downstream port of any switching device is connected to an expansion device; a determination module is configured to, when it is determined that the downstream port of the switching device is connected to an expansion device, determine the target memory resource reservation policy of the internal link of the hardware device according to the configuration information of the expansion device; a reservation module is configured to perform memory resource reservation for each hardware device in each computing device according to the target memory resource reservation policy corresponding to each hardware device in the computing device.
[0081] For the description of the features in the corresponding embodiments of the memory resource processing apparatus, reference may be made to the relevant descriptions in the corresponding embodiments of the memory resource processing method, which will not be elaborated here one by one.
[0082] An embodiment of the present application further provides a memory resource processing system for executing the memory resource processing method provided in the above embodiment.
[0083] As Figure 8 shown, it is a schematic structural diagram of the memory resource processing system provided by the embodiment of the present application. The memory resource processing apparatus includes: a plurality of hardware devices and a memory resource processing device, and the memory resource processing device 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 embodiment.
[0085] Among them, the memory resource processing device further includes an operating system. The basic input / output system is used for memory resource reservation, and the operating system is used for memory resource reallocation.
[0086] An embodiment of the present application further provides an electronic device, as Figure 9 shown, it is a schematic structural diagram of the electronic device provided by the embodiment of the present application, including a processor 10 and a memory 20. A computer program is stored in the memory 20, and the processor 10 is configured to run the computer program to execute the steps in any of the above embodiments of the memory resource processing method.
[0087] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any of the above embodiments of the memory resource processing method when running.
[0088] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), mobile hard disks, magnetic disks, or optical discs.
[0089] The embodiments of the present application further provide a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the embodiments of the above-mentioned memory resource processing method.
[0090] The embodiments of the present application further provide another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any of the embodiments of the above-mentioned memory resource processing method.
[0091] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner 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 to exceed the scope of the present application.
[0092] The above has introduced in detail a memory resource processing method, device, system, and electronic device provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A memory resource processing method, characterized in that: include: Obtaining topology information of internal links of any hardware device of the computing device during the driver execution phase; Determining, based on topology information of an internal link of the hardware device, whether the internal link of the hardware device includes a switching device; In the case where it is determined that the internal link of the hardware device includes at least one switching device, for any of the switching devices, determining whether a downlink port of the switching device is connected to an expansion device; In the case where 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 an internal link of the hardware device according to configuration information of the expansion device; Memory resources are reserved for each of the hardware devices in the computing devices according to the target memory resource reservation policy corresponding to each of the hardware devices in the computing devices.
2. The memory resource processing method according to claim 1, characterized in that: Determining the target memory resource reservation strategy for the internal link of the hardware device according to the configuration information of the extension device includes: For any of the expansion devices, determining the memory resource requirements of the expansion device in various operating states according to the configuration information of the expansion device; Determining the maximum memory resource requirement of the expansion device according to the memory resource requirement of the expansion device in various operating states; Determining the memory resource reservation requirement of the downlink port of the switching device according to the maximum memory resource requirement of the expansion device; According to the memory resource reservation requirement of each downlink port of each switching device in the internal link of the hardware device, a target memory resource reservation strategy of the internal link is determined.
3. The memory resource processing method according to claim 1, characterized in that: The method further comprises: After reserving memory resources for any of the internal links, a hot-swap function is enabled in the configuration space corresponding to the internal link to indicate that memory resources have been reserved for the internal link.
4. The memory resource processing method according to claim 1, characterized in that: The method further comprises: In the case where it is determined that the downlink port of the switching device is not currently connected to an expansion device, determining whether the downlink port of the switching device has an expansion device that is planned to be connected in the future; When it is determined that the downlink port of the switching device has an expansion device that is planned to be connected in the future, a target memory resource reservation strategy for the internal link of the hardware device is determined according to configuration information of the expansion device that is planned to be connected in the future.
5. The memory resource processing method according to claim 4, characterized in that: The method further comprises: When it is determined that the downlink port of the switching device is not connected to an expansion device and no expansion device is planned to be connected in the future, it is determined that the downlink port of the switching device does not need to reserve memory resources.
6. The memory resource processing method according to claim 1, characterized in that: The method further comprises: When it is determined that the internal link of the hardware device does not include a switching device, acquiring attribute information of each physical device on the internal link; A target memory resource reservation strategy for an internal link of the hardware device is determined according to the attribute information of each of the physical devices.
7. The memory resource processing method according to claim 6, characterized in that: Determining the target memory resource reservation strategy for the internal link of the hardware device according to the attribute information of each of the physical devices includes: For any of the physical devices, judging whether the physical device is used for performing a data processing task according to the attribute information of the physical device; In the case where it is determined that the physical device is used to perform the data processing task, obtaining configuration information of the physical device; Determining memory resource requirements of the physical device in various operating states according to the configuration information of the physical device; Determining the maximum memory resource requirement of the physical device according to the memory resource requirements of the physical device in various operating states; Determining a memory resource reservation requirement of the physical device according to a maximum memory resource requirement of the physical device; According to the memory resource reservation requirements of each of the physical devices on the internal link of the hardware device, a target memory resource reservation strategy for the internal link of the hardware device is determined.
8. The memory resource processing method according to claim 7, characterized in that: The method further comprises: When it is determined that the physical device is not used for performing data processing tasks, a memory resource reservation requirement of the physical device is determined according to a preset memory resource reservation rule.
9. The memory resource processing method according to claim 6, characterized in that: The method further comprises: In the case that the internal link is not currently connected to any physical device, determining whether the internal link has a physical device that is planned to be connected in the future; In the case where it is determined that the internal link has a physical device that is planned to be connected in the future, a target memory resource reservation strategy for the internal link of the hardware device is determined according to attribute information of the physical device that is planned to be connected in the future.
10. The memory resource processing method according to claim 1, characterized in that: The method further comprises: The memory resource reservation results of all internal links are accumulated to obtain the total amount of reserved memory resources; When the total amount of reserved memory resources reaches a preset upper limit value of memory resources, corresponding upper limit prompt information is generated.
11. The memory resource processing method according to claim 1, characterized in that: The method further comprises: When the computing device enters the operating system stage, if the user configuration parameter indicates that any of the hardware devices needs to reallocate memory resources, the internal links of the hardware device are traversed to screen expansion devices or physical devices for which memory resources have not been reserved before; The screened expansion device or physical device is used as an expansion device to be allocated or a physical device to be allocated; Corresponding memory resources are allocated to the expansion device to be allocated or the physical device to be allocated.
12. The memory resource processing method according to claim 11, characterized in that: The traversing of the internal links of the hardware device to screen the expansion devices or physical devices for which memory resources have not been reserved before includes: Traversing the internal links of the hardware device to determine whether the configuration space of each internal link has enabled the hot-swap function; In the case where it is determined that the configuration space of the internal link has enabled the hot-swap function, determining whether the internal link includes a switching device; In the case where it is determined that the internal link of the hardware device includes at least one switching device, for any of the switching devices, determining whether the uplink port and the downlink port of the switching device have enabled the hot-swap function; When it is determined that the hot-swap function of the uplink port and the downlink port is not enabled, it is determined that the expansion device connected to the switching device does not reserve memory resources.
13. The memory resource processing method according to claim 12, characterized in that: The method further comprises: When it is determined that the hot-plug function is not enabled in the configuration space of the internal link, it is determined that the physical device connected to the internal link does not reserve memory resources.
14. The memory resource processing method according to claim 12, characterized in that: The method further comprises: In the case where it is determined that the internal link of the hardware device does not include a switching device, determining whether a physical device is connected to the internal link; When it is determined that no physical device is connected to the internal link, a preset quota of memory resources is allocated to the internal link.
15. The memory resource processing method according to claim 11, characterized in that: The allocating corresponding memory resources to the extension device to be allocated or the physical device to be allocated includes: Obtaining memory resource allocation requirements of the expansion device to be allocated or the physical device to be allocated; Determine whether the current remaining memory resources meet the memory resource allocation requirements of the expansion device to be allocated or the physical device to be allocated; In the case where it is determined that the current remaining memory resources meet the memory resource allocation requirements of the expansion device to be allocated or the physical device to be allocated, corresponding memory resources are allocated to the expansion device to be allocated or the physical device to be allocated.
16. A memory resource processing device, characterized in that: include: An acquisition module, used to acquire topology information of an internal link of any hardware device of the computing device during the driver execution phase; A first judgment module, used to judge whether the internal link of the hardware device includes a switching device according to the topology information of the internal link of the hardware device; A second judgment module is used to judge, for any of the switching devices, whether a downlink port of the 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; A determination module, configured to determine a target memory resource reservation strategy for an internal link of the hardware device according to 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 of the hardware devices in each of the computing devices according to the target memory resource reservation policy corresponding to each of the hardware devices in the computing device.
17. A memory resource processing system, characterized in that: include: A plurality of hardware devices and a memory resource processing device, wherein the memory resource processing device comprises at least a basic input and output system; The memory resource processing device performs memory resource processing on each of the hardware devices based on the memory resource processing method according to any one of claims 1 to 15.
18. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the memory resource processing method as claimed in any one of claims 1 to 15 when executing the computer program.
19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the memory resource processing method according to any one of claims 1 to 15.
20. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the memory resource processing method according to any one of claims 1 to 15 are implemented.
Citation Information
Patent Citations
Memory resource allocation method, device and equipment
CN110399217A
Server PCIe resource allocation method, system and device and storage medium
CN116541083A
PCIe equipment hot insertion method and device, electronic equipment and medium
CN117873937A
Heterogeneous acceleration pooling server system, pooling resource allocation method and medium
CN119883590A
Method, device and medium for allocating resource based on type of PCI device
US20210357258A1
Cited By
Memory resource management method and device, electronic equipment and storage medium
CN120429128A
Configuration method and device for starting system database
CN120723340A
Abnormality detection method for server memory and electronic equipment
CN120892275A
Method for detecting abnormality of server memory and electronic device
CN120892275B