Memory resource management method and device, electronic equipment and storage medium
By reading and allocating memory resources from the firmware of the switching module during the driver execution environment stage, the problem of server startup time caused by the BIOS including switching chips on multiple PCI links from the CPU to the PCI device is solved, and faster server startup is achieved.
Patent Information
- Application Number
- CN202510928002.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-08-05
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the case where the CPU to PCI device includes switching chips on multiple PCI links, the BIOS needs to reserve and allocate memory resources for each PCI device and PCI port when the server starts, resulting in a long server startup time.
In the driver execution environment stage, by reading the reserved memory resources of the target device and the target port from the firmware of the switching module, allocating the target memory resources to the switching module, and enabling the hot-swap function of its uplink and downlink ports, the memory resource allocation is directly read from the firmware of the switching module.
Shortens the server startup time and avoids duplicate memory resource reservation and hot-swap feature enable settings for each PCI device and PCI port.
Smart Images

Figure CN120429128A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of resource allocation technology, and in particular to a memory resource management method, device, electronic device, and storage medium. Background Art
[0002] Smart NICs play a crucial role in data center servers, improving server efficiency by offloading tasks from the Central Processing Unit (CPU). However, these Smart NICs contain a variety of devices, such as network ports, virtual network cards, and storage devices. Each of these devices requires memory resources, particularly 32-bit memory resources, to ensure proper operation. In addition to Smart NICs, other Peripheral Component Interconnect (PCI) devices in servers also require 32-bit memory resources. Related technologies use the Basic Input / Output System (BIOS) to reserve and allocate memory resources for PCI devices and ports during server startup.
[0003] However, when multiple PCI links from the CPU to PCI devices include switch chips, when the BIOS reserves and allocates memory resources for PCI devices and PCI ports when the server starts, it is necessary to reserve and allocate memory resources for each PCI device and PCI port connected to the switch chip, and to enable the hot-swap function of the upstream and downstream ports of the switch chip. This is rather cumbersome and results in a longer server startup time. Summary of the Invention
[0004] The present application provides a memory resource management method, apparatus, electronic device and storage medium to at least solve the problem in the related art that the server startup time is long when multiple PCI links from the CPU to the PCI device include switching chips.
[0005] This application provides a memory resource management method, including: During the target device enumeration phase of the driver execution environment phase, for any target link, if a switching module exists on the target link, the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port are read from the firmware of the switching module. The firmware of the switching module determines the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, and enables the hot-swap function of the uplink port and the downlink port of the switching module. Allocate target memory resources to the switch module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switch module and the reserved memory resources of the target port, and enable the hot-swap function of the target link; After completing the processing of all target links, start and enter the operating system.
[0006] The present application also provides a memory resource management device, comprising: a reading module configured to, during a target device enumeration phase of a driving execution environment phase, read, for any target link, if a switching module exists on the target link, the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port from the firmware of the switching module, the firmware of the switching module determining the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, and enabling the hot-swap function of the uplink port and the downlink port of the switching module; an allocation module for allocating target memory resources to the switching module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port, and enabling the hot-swap function of the target link; The startup module is used to start and enter the operating system after completing the processing of all target links.
[0007] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any one of the above-mentioned memory resource management methods when executing the computer program.
[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned memory resource management methods are implemented.
[0009] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned memory resource management methods when executed by a processor.
[0010] Through the present application, in the target device enumeration stage of the driving execution environment stage, for any target link, when there is a switching module on the target link, the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port are read from the firmware of the switching module; based on the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, the target memory resources are allocated to the switching module, and the hot plug function of the target link is enabled; after completing the processing of all target links, the operating system is started and entered. The firmware of the switching module is used to determine the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port, and the hot-swap function of the upstream and downstream ports of the switching module is enabled. The basic input and output system directly reads information from the firmware of the switching module and allocates memory resources to the switching module based on the read information. Therefore, it can solve the technical problem that when multiple PCI links from the CPU to the PCI device include switching chips, the BIOS reserves and allocates memory resources for the PCI devices and PCI ports when the server starts, and it is necessary to reserve and allocate memory resources for each PCI device and PCI port connected to the switching chip, and it is necessary to enable the hot-swap function of the upstream and downstream ports of the switching chip, resulting in a long startup time of the server. The technical effect of shortening the startup time of the server is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0012] Figure 1 A schematic diagram of the structure of a memory resource management system provided in an embodiment of the present application; Figure 2 A schematic diagram of the structure of a DPU card provided in an embodiment of the present application; Figure 3 A flowchart of a memory resource management method provided in an embodiment of the present application; Figure 4 A connection diagram of a PCI Switch chip provided in an embodiment of the present application; Figure 5 A schematic diagram of a process for performing memory resource management during the target device enumeration phase of the driver execution environment phase provided by an embodiment of the present application; Figure 6A flowchart of another memory resource management method provided in an embodiment of the present application; Figure 7 A schematic diagram of the first process provided in an embodiment of the present application; Figure 8 A schematic diagram of a process for memory resource management after entering an operating system according to an embodiment of the present application; Figure 9 A schematic diagram of the structure of a memory resource management device provided in an embodiment of the present application; Figure 10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0013] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0014] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0015] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0016] A Smart NIC is a highly programmable network interface card (NIC) that works with servers. Compared to traditional NICs, it not only provides basic data transmission capabilities but also possesses additional computing power, allowing it to take on some tasks previously performed by the CPU. By offloading network, security, and storage-related data processing functions to hardware acceleration chips, Smart NICs significantly reduce the CPU workload, allowing servers to focus more on running critical applications and operating systems, thereby improving overall business efficiency. The development of Smart NICs has gone through three stages: the first stage was the basic function NIC, the second stage was the hardware-based NIC, and the third stage was the Data Processing Unit (DPU) Smart NIC. The DPU Smart NIC not only offloads functions on the data plane but also completely offloads functions on the control plane. Specifically in the security area, it can handle all security-related tasks.
[0017] In the third phase, the DPU becomes the core component of the SmartNIC. A DPU is a processor designed specifically for data centers, primarily used to provide infrastructure virtualization services such as networking, storage, security, and management. Its architecture typically combines a general-purpose CPU (such as an ARM or X86 architecture) with a dedicated acceleration engine to achieve high-performance data processing. The dedicated acceleration engine can be an application-specific integrated circuit (ASIC), a network processor (NP), or a field-programmable gate array (FPGA). The general-purpose CPU can be an Advanced RISC Machine (ARM) or X86 architecture. This combination enables the DPU to efficiently complete complex computing tasks without affecting the performance of the main CPU.
[0018] Currently, DPU smart network cards have been widely used in servers of various architectures, including but not limited to servers based on the X86 architecture and the ARM architecture. However, regardless of the architecture, when using smart network cards, resources for the smart network cards must be reserved in advance. This is because the smart network card contains many devices, such as network card devices, virtual network cards, storage devices, and other physical or virtual devices. These devices all require memory resources, and some memory resources are prioritized. For example, 32-bit memory resources need to be highly prioritized. In addition to smart network cards, other PCI devices in the server also require 32-bit memory resources. In related technologies, memory resources are reserved and allocated for PCI devices and PCI ports based on the BIOS when the server starts. It is understandable that the DPU smart network card is also a PCI device.
[0019] However, when multiple PCI links from the CPU to the PCI device include switching chips, when the BIOS reserves and allocates memory resources for the PCI devices and PCI ports when the server starts, it is necessary to reserve and allocate memory resources for each PCI device and PCI port connected to the switching chip, and the hot-swap function of the upstream and downstream ports of the switching chip needs to be enabled and set, which is rather cumbersome and results in a longer startup time for the server.
[0020] In response to the above problems, an embodiment of the present application provides a memory resource management method, device, electronic device and storage medium, which method includes: in the target device enumeration stage of the driving execution environment stage, for any target link, when there is a switching module on the target link, the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port are read from the firmware of the switching module, the firmware of the switching module determines the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, and enables the hot plug function of the upstream port and the downstream port of the switching module; based on the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, the target memory resources are allocated to the switching module, and the hot plug function of the target link is enabled; after completing the processing of all target links, the operating system is started and entered. The method provided by the above scheme uses the firmware of the switching module to determine the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port, and enables the hot-swap function of the upstream and downstream ports of the switching module. The basic input and output system directly reads information from the firmware of the switching module and allocates memory resources to the switching module based on the read information. Therefore, it can solve the technical problem that when multiple PCI links from the CPU to the PCI device include switching chips, the BIOS reserves and allocates memory resources for the PCI devices and PCI ports when the server starts, and it is necessary to reserve and allocate memory resources for each PCI device and PCI port connected to the switching chip, and it is necessary to enable the hot-swap function of the upstream and downstream ports of the switching chip, resulting in a long startup time of the server. The technical effect of shortening the startup time of the server is achieved.
[0021] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the memory resource management method depends, the specific application environment architecture or specific hardware architecture is described herein.
[0022] The memory resource management method, device, electronic device and storage medium provided in the embodiments of the present application are suitable for managing memory resources. Figure 1 As shown, it is a structural diagram of the memory resource management system provided in an embodiment of the present application. The memory resource management system is a server, which includes two CPUs, namely CPU0 and CPU1. The two CPUs are interconnected through the Cache Coherent Interconnect for Accelerators (CCIX) or Ultra Path Interconnect (UPI) or General Management Interface (GMI).
[0023] CPU0 expands PCI lanes through multiple root complexes (RCs): RC0, RC1, RC2, and RC3. Each root complex corresponds to a set of PCI lanes for connecting peripherals. The bandwidth of each PCI lane can be flexibly configured to meet the needs of different devices.
[0024] The server also includes PCI Switch 0. PCI Switch 0 connects upstream to RC0 of CPU 0 via a PCI x16 or PCI x8 link. Downstream, it splits into multiple lanes to connect to multiple PCI endpoint devices (EPs), such as PCI EP0, PCI EP1, and PCI EP2. A PCI x16 link indicates that it consists of 16 lanes; more lanes means higher bandwidth. The hotplug feature of PCI Switch 0 is enabled, indicating that PCI Switch 0 allows PCI endpoint devices to be inserted and removed online. Understandably, because the CPU's PCI link has a limited number of root ports (root ports) and cannot accommodate more PCI devices, a PCI switch chip is introduced to expand the number of PCI interfaces.
[0025] The server also includes PCI interface Redundant Array of Independent Disks (RAID) card 1. PCI interface RAID card 1 is connected to the server motherboard via a PCI slot. PCI interface RAID card 1 is connected to RC1 of CPU 0 via a PCI x16 or PCI x8 link. The hot-swap function of PCI interface RAID card 1 is enabled, allowing the hard drives managed by RAID card 1 to be inserted or removed online.
[0026] The server also includes a PCI interface non-volatile memory express (NVMe) 0 operating system, and the PCI interface NVMe0 operating system is connected to RC2 of CPU0 through a PCI×8 or PCI×4 link.
[0027] The server also includes a PCI interface DPU card 1, which is connected to RC3 of CPU0 via a PCI×8 or PCI×16 link. The hot-swap function of the PCI interface DPU card 1 is enabled, indicating that the DPU card 1 can be inserted or removed online. The DPU card is a DPU intelligent network card. Figure 2 This is a structural diagram of a DPU card provided in an embodiment of the present application. Figure 2 As shown in the figure, the DPU card can be connected to the server's CPU via a PCI×16 link. The DPU card includes CPU2, which is connected to a USB interface, a personal computer (PC) hard disk 0, and PCI Switch2. PCI Switch2 is connected to PCI network card 0, PCI network card 1, and PC hard disk 1. It is understandable that the DPU card can be not only Figure 2 The DPU card shown includes a PCI switch chip, but may also be a DPU card that does not include a PCI switch chip. The PCI switch chip is a switching module.
[0028] The server also includes a baseboard management controller (BMC) and BIOS. The BMC communicates with the BIOS through the Intelligent Platform Management Interface (IPMI). The BMC connects to CPU0 through a low-pin-count interface (LPC) or PCI. The BIOS connects to CPU0 through the LPC, a serial peripheral interface (SPI), or a quad serial peripheral interface (QSPI). The BMC can also connect to CPU0 through the Universal Serial Bus over LAN (USB over LAN).
[0029] CPU1 expands PCI lanes through multiple root complexes: RC4, RC5, RC6, and RC7. Each root complex corresponds to a set of PCI lanes for connecting peripherals. The bandwidth of each PCI lane can be flexibly configured to meet the needs of different devices.
[0030] The server also includes PCI Switch 1. PCI Switch 1 is connected upstream to RC7 of CPU 1 via a PCI x8 or PCI x4 link. Downstream, it splits into multiple channels to connect to multiple PCI endpoint devices, such as PCI EP3, PCI EP4, and PCI EP5. The hot-swap function of PCI Switch 1 is enabled, indicating that PCI endpoint devices can be inserted or removed online.
[0031] The server also includes a PCI interface RAID card 2, which is connected to RC6 of CPU1 via a PCI×16 or PCI×8 link. The hot-swap function of the PCI interface RAID card 2 is enabled, indicating that the hard disk managed by the RAID card 2 can be inserted or removed online.
[0032] The server further includes a PCI interface NVMe1 operating system, which is connected to RC5 of CPU 1 via a PCI×8 or PCI×4 link. The hot-swap function of the PCI interface NVMe1 operating system is disabled.
[0033] The server also includes a PCI interface DPU card 2, which is connected to RC4 of CPU1 via a PCI×8 or PCI×16 link. The hot-swap function of the PCI interface DPU card 2 is enabled, indicating that the DPU card 2 is allowed to be inserted or removed online.
[0034] The server also includes a Platform Controller Hub (PCH). CPU1 communicates with the PCH via the Direct Media Interface (DMI). The PCH connects to a USB flash drive and USB keyboard hotkeys via a USB port and to a Serial Advanced Technology Attachment (SATA) hard drive 0 via a SATA port.
[0035] During the target device enumeration phase of the driver execution environment phase, the basic input / output system in the server reads the reserved memory resources or unallocated memory resources of the target device connected to the switch module and the reserved memory resources of the target port from the switch module's firmware for any target link, if a switch module exists on the target link. The switch module's firmware determines the reserved memory resources or unallocated memory resources of the target device connected to the switch module and the reserved memory resources of the target port, and enables the hot-swap function of the switch module's upstream and downstream ports. Based on the reserved memory resources or unallocated memory resources of the target device connected to the switch module and the reserved memory resources of the target port, the switch module allocates target memory resources to the switch module and enables the hot-swap function of the target link. After completing processing for all target links, the server boots and enters the operating system. The target link is a PCI link, and the switch module is a PCISwitch chip.
[0036] The embodiment of the present application provides a memory resource management method, which is applied to a server. Figure 3 A flowchart of the memory resource management method provided in the embodiment of the present application is shown in FIG. Figure 3 As shown, the process includes the following steps: Step S301, in the target device enumeration stage of the driving execution environment stage, for any target link, if there is a switching module on the target link, the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port are read from the firmware of the switching module. The firmware of the switching module determines the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, and enables the hot-swap function of the upstream port and the downstream port of the switching module.
[0037] The target device is a PCI device, and the switching module is a PCI switch chip. Figure 4 A connection diagram of a PCI Switch chip provided in an embodiment of the present application is shown in FIG. Figure 4As shown, the upstream side of the PCI switch chip is connected to the CPU via a PCI x16 or x8 link. The PCI switch chip includes multiple downstream ports, namely DP0, DP1, DP2, and DP3. DP0 is connected to PCI device 0 via PCI slot 0. PCI slot 0 has hot-swap functionality enabled. PCISlot0 x16 indicates that PCI slot 0 has 16 data transmission channels. DP1 is connected to PCI device 1 via PCI slot 1. PCI slot 1 has hot-swap functionality enabled and 16 data transmission channels. DP2 is connected to PCI device 2 via PCI slot 2. PCI slot 2 has hot-swap functionality enabled and 16 data transmission channels. DP3 is connected to PCI slot 3. PCI slot 3 is not connected to a PCI device, and its hot-swap functionality is disabled, meaning it is not enabled.
[0038] The PCI Switch chip is connected to the Switch firmware (Firmware, abbreviated as: FW) or the switch module firmware via SPI. The Switch firmware is used to determine the reserved memory resources or to-be-allocated memory resources of the PCI device connected to the PCI Switch chip and the reserved memory resources of the target port, and enable the hot-swap function of the upstream and downstream ports of the switch module. The target port is a PCI port that is not connected to a PCI device and needs to support hot-swap. Figure 4 As shown, SwitchFW determines that the reserved memory resources or memory resources to be allocated of the PCI device connected to DP0 are 16M 32-bit memory resources, and determines that the hot-plug function of PCI Slot0 connected to DP0 is enabled. Switch FW determines that the reserved memory resources or memory resources to be allocated of the PCI device connected to DP1 are 8M 32-bit memory resources, and determines that the hot-plug function of PCI Slot1 connected to DP1 is enabled. Switch FW determines that the reserved memory resources or memory resources to be allocated of the PCI device connected to DP2 are 32M 32-bit memory resources, and determines that the hot-plug function of PCI Slot2 connected to DP2 is enabled. Switch FW determines that the reserved memory resources or memory resources to be allocated of DP3 are 0M 32-bit memory resources, and determines that the hot-plug function of PCI Slot3 connected to DP3 is disabled.
[0039] During the target device enumeration phase of the Driver Execution Environment (DXE) stage, the BIOS reads the reserved memory resources or unallocated memory resources of the target device connected to the switch module, as well as the reserved memory resources of the target port, from the switch module firmware for any target link, if a switch module is present on the target link. The target link is the link between the CPU and the PCI device.
[0040] It should be noted that if the target device connected to the switching module is a smart network card or a preset target device, the firmware of the switching module determines the reserved memory resources of the smart network card or the preset target device connected to the switching module based on the memory resources required by the smart network card or the preset target device. If the target device connected to the switching module is not a smart network card and is not a preset target device, the firmware of the switching module determines the memory resources to be allocated for the target device based on the memory resources required by the target device. The firmware of the switching module determines the preset value as the reserved memory resource of the target port, and the preset value can be 2M 32-bit memory resource. It can be understood that the memory resources described in this application are 32-bit memory resources, that is, 32-bit memory mapped input / output (Memory-Mapped Input / Output, abbreviated as: MMIO) resources. The smart network card is a DPU smart network card.
[0041] It is understandable that if the smart network card is a DPU card that includes a PCI Switch chip, the firmware in the PCI Switch chip in the smart network card can determine the reserved memory resources of the target device connected to the PCI Switch chip. The CPU of the smart network card reads the reserved memory resources of the target device connected to the PCI Switch chip from the firmware in the PCI Switch chip, and obtains the to-be-allocated memory resources or reserved memory resources of the target devices and target ports on other target links to determine the memory resources required by the smart network card. If the smart network card is a DPU card that does not include a PCI Switch chip, the CPU of the smart network card obtains the to-be-allocated memory resources or reserved memory resources of the target devices and target ports on all target links in the smart network card to determine the memory resources required by the smart network card.
[0042] Step S302: Allocate target memory resources to the switch module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switch module and the reserved memory resources of the target port, and enable the hot-swap function of the target link.
[0043] It is understandable that after the switching module obtains the target memory resources, the switching module firmware reserves and allocates memory resources for the target device connected to the switching module based on the target memory resources, and reserves memory resources for the target port connected to the switching module.
[0044] The enabling setting of the hot-plug function of the target link is to enable the hot-plug function of the PCI configuration space of the target link where the switch module is located.
[0045] Step S303: After completing the processing of all target links, start and enter the operating system.
[0046] Completing the processing of all target links means completing the memory resource reservation or memory resource allocation for the target devices or target ports on all target links.
[0047] Figure 5 A flow chart of memory resource management in the target device enumeration phase of the driver execution environment phase provided by the embodiment of the present application is shown as follows: Figure 5 As shown, after the server is powered on, the BIOS determines whether the current PCI link includes a switch module during the PCI device enumeration phase of the DXE phase.
[0048] If the current PCI link includes a switching module, the BIOS reads the information in the firmware of the switching module of the current PCI link. The information includes the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port. It can be understood that it also includes the status of the hot-plug function of the PCI slot corresponding to the target device.
[0049] The BIOS allocates target memory resources to the switch module of the current PCI link based on the read information, and enables the hot-swap function of the PCI configuration space of the PCI link where the switch module is located.
[0050] Determine whether the current PCI link is the last PCI link. If not, continue to poll the next PCI link and return to the step of determining whether the current PCI link includes a switch module. If so, the server boots into the operating system.
[0051] If the current PCI link does not include a switch module, a first process is executed, wherein the first process is described below.
[0052] The memory resource management method provided in the embodiment of the present application determines the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port by utilizing the firmware of the switching module, and enables the hot-swap function of the upstream port and the downstream port of the switching module. The basic input / output system directly reads information from the firmware of the switching module and allocates memory resources to the switching module based on the read information. There is no need for the BIOS to enable the hot-swap function of the upstream port and the downstream port of the switching module, and the BIOS does not need to reserve or allocate memory resources for each target device and target port under the switching module. Therefore, it can solve the technical problem that when multiple PCI links from the CPU to the PCI device include a switching chip, the BIOS reserves and allocates memory resources for the PCI device and PCI port when the server starts, and it is necessary to reserve and allocate memory resources for each PCI device and PCI port connected to the switching chip, and it is necessary to enable the hot-swap function of the upstream port and the downstream port of the switching chip, resulting in a long server startup time. The technical effect of shortening the server startup time is achieved.
[0053] The embodiment of the present application provides a memory resource management method, which is applied to a server. Figure 6 A flowchart of the memory resource management method provided in the embodiment of the present application is shown in FIG. Figure 6 As shown, the process includes the following steps: Step S601: During the target device enumeration phase of the driver execution environment phase, for any target link, if a switch module exists on the target link, the reserved memory resources or memory resources to be allocated of the target device connected to the switch module and the reserved memory resources of the target port are read from the switch module firmware. The switch module firmware determines the reserved memory resources or memory resources to be allocated of the target device connected to the switch module and the reserved memory resources of the target port, and enables the hot-swap function of the uplink and downlink ports of the switch module. For details, see Figure 3 Step S301 of the illustrated embodiment will not be described in detail here.
[0054] Step S602: Allocate target memory resources to the switch module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switch module and the reserved memory resources of the target port, and enable the hot-swap function of the target link.
[0055] Specifically, the above step S602 includes: Step S6021: Determine the total memory resources required by the target device and the target port connected to the switch module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switch module and the reserved memory resources of the target port.
[0056] The reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port are accumulated to obtain the total memory resources required by the target device and the target port connected to the switching module.
[0057] Step S6022, allocates target memory resources equal to the total memory resources to the switching module, so that the firmware of the switching module reserves memory resources or allocates memory resources to be allocated for the target device connected to the switching module based on the target memory resources, and reserves memory resources for the target port connected to it.
[0058] It can be understood that the firmware of the switching module reserves memory resources or allocates memory resources to be allocated for the target device connected to the switching module, and reserves memory resources for the target port connected to it based on the reserved memory resources or memory resources to be allocated for the target device connected to the switching module and the reserved memory resources of the target port.
[0059] Step S603: After completing the processing of all target links, start and enter the operating system. Figure 3 Step S303 of the illustrated embodiment will not be described in detail here.
[0060] The memory resource management method provided in the embodiment of the present application calculates the total memory resources required by the target device and the target port, and allocates matching target memory resources to the switching module, thereby ensuring the accuracy of the memory resources allocated to the switching module and avoiding waste or shortage of memory resources.
[0061] In some optional implementations, the memory resource management method further includes: Step a1: for any target link, when the target link does not include a switch module, if a target device exists on the target link, read the manufacturer identification code and device identification code of the target device.
[0062] Reading the manufacturer identification code and the device identification code of the target device means reading the manufacturer identification code and the device identification code of the target device existing on the target link.
[0063] Step a2: Determine whether the target device is a smart network card or a preset target device based on the manufacturer identification code and the device identification code of the target device.
[0064] The preset target device is a PCI device other than the smart network card that requires reserved memory resources, and can be set specifically according to actual conditions.
[0065] Step a3: If the target device is a smart network card or a preset target device, memory resources are reserved for the target device based on the memory resources required by the smart network card or the preset target device, and the hot plug function of the target link where the target device is located is enabled.
[0066] Step a4: If the target device is not a smart network card and is not a preset target device, memory resources are allocated to the target device based on the memory resources required by the target device, and the hot plug function of the target link where the target device is located is disabled.
[0067] Figure 7 The flowchart of the first process provided in the embodiment of the present application is as follows: Figure 7 As shown, if the current PCI link does not include a switch module, it is determined whether the BIOS can read the vendor identification code (VID) and device identification code (DID) of the PCI device on the current PCI link. If the BIOS can read the VID and DID of the PCI device on the current PCI link, the DID and VID of the PCI device are obtained to determine whether the PCI device is a DPU card or a PCI device that requires reserved memory resources, that is, the preset target device.
[0068] If the PCI device is a DPU card or a PCI device that requires reserved memory resources, then reserve 32 bits of memory resources of the DPU card or the preset target device, and enable the hot-plug function of the PCI link where the PCI device is located. This corresponds to the aforementioned step a3 and will not be repeated here.
[0069] If the PCI device is not a DPU card and does not require reserved memory resources, allocate the memory resources required by the PCI device normally and disable the hot-plug function of the PCI link where the PCI device is located. That is, disable the hot-plug function of the PCI configuration space of the PCI link where the PCI device is located. This corresponds to the above step a4 and is not repeated here.
[0070] Determine whether the current PCI link is the last PCI link. If not, continue to poll the next PCI link and return to the step of determining whether the current PCI link includes a switch module. If so, the server boots into the operating system.
[0071] It should be noted that enabling or disabling the hot-plug function of the target link is to enable or disable the hot-plug function of the PCI configuration space of the target link.
[0072] The memory resource management method provided in the embodiment of the present application can accurately determine whether the target device is a smart network card or a preset target device by reading the manufacturer identification code and device identification code of the target device. This helps the system adopt different memory resource management strategies according to the characteristics of the device. For smart network cards or preset target devices, memory resource reservation is adopted; while for other ordinary devices, memory resources are allocated. This method can reasonably configure resources according to the actual needs of the device, improve resource utilization and reduce waste. The hot-swap function is enabled for the target link where the smart network card or the preset target device is located to facilitate the dynamic insertion and removal of the device; and the hot-swap function is turned off for the target link where the non-smart network card or the non-preset target device is located to avoid unnecessary operational interference and improve the stability and security of the system.
[0073] In some optional implementations, the memory resource management method further includes: Step b1: If the target link does not include a switching module and there is no target device on the target link, it is determined whether there is a target port on the target link that needs to support a hot-swap function.
[0074] Step b2: If there is a target port on the target link that needs to support hot plug functionality, memory resources are reserved for the target port, and the hot plug functionality of the target link where the target port is located is enabled. The target port in the memory resource reservation is the target port on the target link that needs to support hot plug functionality.
[0075] Step b3: If there is no target port on the target link that needs to support the hot plug function, the hot plug function of the target link is disabled.
[0076] like Figure 7 As shown, if the BIOS cannot read the VID and DID of the PCI device on the current PCI link, it is determined that there is no PCI device on the current PCI link.
[0077] When there is no PCI device on the current PCI link, it is determined whether the current PCI link needs to reserve memory resources to facilitate the insertion of the PCI device in the system, that is, whether there is a target port on the target link that needs to support hot plugging.
[0078] If the current PCI link needs to reserve memory resources to facilitate the use of PCI devices inserted into the system, the memory resources are reserved for the target port, and the hot plug function of the current PCI link, that is, the target link where the target port is located, is enabled.
[0079] If the current PCI link does not need to reserve memory resources to facilitate the insertion of PCI devices in the system, that is, there is no target port on the target link that needs to support the hot plug function, then the current PCI link does not reserve any memory resources and there is no need to set the hot plug function of the current PCI link to be enabled, that is, the hot plug function of the target link is disabled.
[0080] The memory resource management method provided in the embodiment of the present application reserves memory resources for target ports that need to support the hot-swap function; and for target links that do not have target ports, the hot-swap function is directly turned off without the need for additional memory resource allocation. This method reasonably configures memory resources according to actual needs, improves resource utilization and reduces the burden on the system.
[0081] It should be noted that the execution subject of the above steps S601 to S603, steps a1 to a4, and steps b1 to b3 is the BIOS of the server.
[0082] In some optional implementations, the memory resource management method further includes: Step c1, after entering the operating system, if the operating system startup file includes reallocation resource parameters, then for any target link, if the hot-swap function of the target link is enabled, then if there is a switching module on the target link, determine whether the hot-swap function of the uplink port and the downlink port of the switching module is enabled.
[0083] It can be understood that after entering the operating system, the server operating system executes steps c1 to c4, steps d1 to d2, and steps e1 to e4.
[0084] If the operating system startup file includes resource reallocation parameters, 32-bit memory resources need to be reallocated.
[0085] Step c2: If the hot-swap function of the upstream port and the downstream port of the switching module is enabled, the target memory resources allocated to the switching module in the target device enumeration stage of the driver execution environment stage are kept unchanged, so that the firmware of the switching module allocates memory resources to the target device based on the reserved memory resources or to-be-allocated memory resources of the target device to which the switching module is connected, and allocates memory resources to the target port based on the reserved memory resources of the target port to which the switching module is connected.
[0086] Step c3: If the hot-swap function of the target link is enabled, then if there is no switch module on the target link, it is determined whether there is a target device on the target link.
[0087] Step c4: when there is a target device on the target link, if the target device is a smart network card or a preset target device, memory resources are allocated to the target device according to the reserved memory resources of the target device in the target device enumeration phase in the driving execution environment phase.
[0088] Figure 8 A flowchart of memory resource management after entering the operating system is provided in the embodiment of the present application, such as Figure 8 As shown in the figure, after the server boots and enters the operating system, the user determines whether the operating system needs to reallocate memory resources. If so, the reallocation parameter is added to the operating system startup file in the operating system's boot loader (GNU GRandUnified Bootloader, or Grub). The reallocation parameter is the PCI=realloc parameter, and the operating system startup file is Grub. It should be noted that the PCI=realloc parameter is added to Grub by default, allowing the operating system to reallocate 32-bit memory resources for PCI devices.
[0089] If the user is certain that the operating system does not need to reallocate memory resources, simply remove the PCI=realloc parameter in Grub. In this case, the operating system uses PCI devices according to the memory resources allocated by the BIOS during server startup. Specifically, the operating system allocates memory resources to target devices according to the memory resources reserved or allocated for each target device during target device enumeration in the driver execution environment phase, and allocates memory resources to target ports according to the memory resources reserved for each target port during target device enumeration in the driver execution environment phase.
[0090] When the operating system needs to reallocate 32-bit memory resources for the PCI device, it is determined whether the hot plug function of the PCI configuration space of the current PCI link is turned on, that is, whether the hot plug function of the current PCI link is enabled.
[0091] If the hot-plug function of the PCI configuration space of the current PCI link is enabled, it is determined whether there is a switch module on the current PCI link.
[0092] If a switch module exists on the current PCI link, it is determined whether the hot-swap function of the upstream port and the downstream port of the switch module is enabled, that is, whether the hot-swap function of the upstream port and the downstream port of the switch module is enabled.
[0093] If the hot-swap function is enabled for the uplink and downlink ports of the switching module, the resources allocated by default by the BIOS will be used and the operating system will no longer reallocate memory resources. That is, the target memory resources allocated to the switching module during the target device enumeration phase of the driver execution environment phase remain unchanged, so that the firmware of the switching module allocates memory resources to the target device based on the reserved memory resources or to-be-allocated memory resources of the target device to which the switching module is connected, and allocates memory resources to the target port based on the reserved memory resources of the target port to which the switching module is connected. If the hot-swap function is not enabled for the uplink and downlink ports of the switching module, the steps of determining whether there is a PCI device on the current PCI link and reallocating 32-bit memory resources are executed.
[0094] If there is no switching module on the current PCI link, determine whether there is a target device on the current PCI link. If there is a target device on the current PCI link, it can be allocated according to the resources reserved by the BIOS, because the hot-swap function of the PCI link where the DPU card is located is turned on, so there is no need to reallocate 32-bit memory resources. That is, if the target device is an intelligent network card or a preset target device, memory resources are allocated to the target device according to the reserved memory resources of the target device in the target device enumeration stage in the driver execution environment stage. It can be understood that the target device that is not an intelligent network card or a preset target device has completed the memory resource allocation in the target device enumeration stage in the driver execution environment stage, and it can remain unchanged.
[0095] It should be noted that 32-bit memory resources are limited and the maximum is 4GB. If the allocated 32-bit memory resources exceed 4GB, some PCI devices will become unusable, such as the display interface will not be displayed. In order to ensure the normal use of the DPU card, preset target device, target port on the target link where no switching module exists, and the target device and target port connected to the switching module on the target link where a switching module exists, the present application reserves memory resources or allocates memory resources for the DPU card, preset target device, target port on the target link where no switching module exists, and the target device and target port connected to the switching module on the target link where a switching module exists in the target device enumeration stage of the driving execution environment stage. After the server enters the operating system, regardless of whether the operating system needs to reallocate memory resources, the hot plug function is enabled to enable the setting to notify the operating system to ensure that the DPU card, preset target device, target port on the target link where no switching module exists, and the target device and target port connected to the switching module on the target link where a switching module exists are allocated according to the reserved memory resources or the memory resources to be allocated, without the need for reallocation, thereby ensuring the normal use of the DPU card, preset target device, target port on the target link where no switching module exists, and the target device and target port connected to the switching module on the target link where a switching module exists. And when the operating system needs to reallocate memory resources, the PCI devices that can reallocate memory resources are actually allocated according to the remaining amount of 32-bit memory resources. If the remaining amount of 32-bit memory resources meets the memory resources required by the PCI devices that can reallocate memory resources, all of them are allocated. If not, after identifying the PCI devices that do not meet the requirements, no more memory resource allocation is performed and memory resources are isolated, ensuring the rational use of memory resources.
[0096] The memory resource management method provided in the embodiments of the present application allows the operating system to dynamically adjust the memory resource configuration of the target link and its related devices and ports according to actual needs by reallocating resource parameters. This makes resource allocation more flexible and efficient, and can adapt to different operating environments and load conditions. By determining whether the hot-swap function of the target link and the hot-swap function of the uplink and downlink ports of the switching module are enabled, the normal use of the DPU card, preset target device, target port on the target link without a switching module, and the target device and target port connected to the switching module on the target link with a switching module is ensured, and the problem of unusability caused by insufficient memory resources will not occur.
[0097] In some optional implementations, the memory resource management method further includes: Step d1: If the target device does not exist on the target link, determine whether there is a target port on the target link that needs to support the hot plug function.
[0098] If the hot-swap function of the target link is enabled, then if there is no switch module on the target link, and if there is no target device on the target link, it is determined whether there is a target port on the target link that needs to support the hot-swap function.
[0099] Step d2: If there is a target port on the target link that needs to support hot plugging, memory resources are allocated to the target port according to the reserved memory resources of the target port in the target device enumeration phase of the driver execution environment phase.
[0100] In some optional implementations, the memory resource management method further includes: Step e1: After entering the operating system, if the operating system startup file includes a resource reallocation parameter, for any target link, if the hot plug function of the target link is disabled, it is determined whether the target link has a target device.
[0101] Step e2: If a target device exists on the target link, determine whether the remaining memory resources meet the memory resources required by the target device.
[0102] It should be noted that the remaining memory resources are determined by subtracting the fixedly allocated memory resources from the total 32-bit memory resources. The fixedly allocated memory resources include the DPU card, preset target device, and target port reserved memory resources or unallocated memory resources on the target link without a switch module, as well as the target device and target port reserved memory resources or unallocated memory resources connected to the switch module on the target link with a switch module, and also include other allocated memory resources in addition to the above.
[0103] Step e3: If the remaining memory resources meet the memory resources required by the target device, the required memory resources are allocated to the target device.
[0104] Step e4: If the remaining memory resources do not meet the memory resources required by the target device, no memory resources are allocated to the target device.
[0105] like Figure 8 As shown, if the operating system needs to reallocate resources, then when the hot-plug function of the current PCI link is disabled, it is determined whether there is a PCI device on the current PCI link and the 32-bit memory resources are reallocated.
[0106] If a PCI device exists on the current PCI link, it is determined whether the 32-bit memory resources meet the 32-bit memory resources required by the current PCI device, that is, whether the remaining memory resources meet the memory resources required by the target device.
[0107] If the 32-bit memory resources meet the 32-bit memory resources required by the current PCI device, 32-bit memory resources are allocated to the existing PCI device, that is, memory resources are allocated to the PCI device existing on the current PCI link according to the memory resources required by the device.
[0108] If the 32-bit memory resources do not meet the 32-bit memory resources required by the current PCI device, the allocation of 32-bit memory resources to the current PCI device is stopped, that is, for the PCI device existing on the current PCI link, no memory resources are allocated to the PCI device.
[0109] If no PCI device exists on the current PCI link, the current PCI link does not perform 32-bit memory resource allocation and performs memory resource isolation.
[0110] After the memory resource allocation is completed, each target device or target port uses the allocated 32-bit memory resource normally.
[0111] It should be noted that the memory resource management method provided in the embodiment of the present application can meet the actual business needs of the customer data center and supports servers of any architecture. It is highly versatile and applicable.
[0112] The memory resource management method provided in the embodiment of the present application determines whether the remaining memory resources meet the needs of the target device, ensuring that memory is allocated to the target device only when there are sufficient resources, thereby ensuring the rational use of memory resources and avoiding the problem of system performance degradation or device failure to operate normally due to insufficient resources.
[0113] In some optional implementations, the memory resource management method further includes: In step f1, if allocating target memory resources to the switching module fails, re-execute the step of allocating target memory resources to the switching module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port.
[0114] In step f2, if the number of times the target memory resources are allocated to the switch module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switch module and the reserved memory resources of the target port exceeds a preset threshold, and allocation of the target memory resources to the switch module still fails, an alarm is reported. The preset threshold is set by technical personnel and is not described in detail here.
[0115] The memory resource management method provided in the embodiments of the present application provides a mechanism for re-executing the allocation steps when the target memory resource allocation for a switch module fails. This allows the system to attempt to resolve the problem multiple times, thereby increasing the probability of successful resource allocation and enhancing the robustness and reliability of the system. If the number of re-executions exceeds a preset threshold and still fails, the system triggers an alarm, allowing technicians to promptly identify and address potential issues, preventing more serious system failures or service interruptions caused by resource allocation failures.
[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0117] The embodiment of the present application also provides a memory resource management device, such as Figure 9 As shown, the memory resource management device includes: The reading module 901 is used to read the reserved memory resources or memory resources to be allocated and the reserved memory resources of the target device connected to the switching module and the reserved memory resources of the target port from the firmware of the switching module during the target device enumeration stage of the driving execution environment stage for any target link when a switching module exists on the target link. The firmware of the switching module determines the reserved memory resources or memory resources to be allocated and the reserved memory resources of the target device connected to the switching module and enables the hot-swap function of the upstream port and the downstream port of the switching module.
[0118] The allocation module 902 is configured to allocate target memory resources to the switching module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port, and enable the hot-swap function of the target link.
[0119] The startup module 903 is used to start and enter the operating system after completing the processing of all target links.
[0120] In some optional implementations, the allocation module 902 includes: The first determining unit is configured to determine the total memory resources required by the target device and the target port connected to the switching module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port.
[0121] The first allocation unit is used to allocate target memory resources that are the same as the total memory resources to the switching module, so that the firmware of the switching module reserves memory resources or allocates memory resources to be allocated for the target device connected to the switching module based on the target memory resources, and reserves memory resources for the target port connected to it.
[0122] In some optional implementations, the memory resource management device further includes: The first reading unit is configured to read the manufacturer identification code and the device identification code of any target link if there is a target device on the target link when the target link does not include a switching module.
[0123] The second determining unit is configured to determine whether the target device is a smart network card or a preset target device based on the manufacturer identification code and the device identification code of the target device.
[0124] The first setting unit is used to reserve memory resources for the target device based on the memory resources required by the smart network card or the preset target device if the target device is a smart network card or a preset target device, and enable the hot plug function of the target link where the target device is located.
[0125] The second setting unit is used to allocate memory resources to the target device based on the memory resources required by the target device if the target device is not a smart network card and is not a preset target device, and to turn off the hot plug function of the target link where the target device is located.
[0126] In some optional implementations, the memory resource management device further includes: The first judgment unit is configured to judge whether there is a target port on the target link that needs to support the hot plug function if the target link does not include a switching module and if there is no target device on the target link.
[0127] The third setting unit is configured to reserve memory resources for a target port that needs to support hot plugging if there is a target port on the target link that needs to support hot plugging, and enable the hot plugging function of the target link where the target port is located.
[0128] The fourth setting unit is configured to disable the hot plug function of the target link if there is no target port on the target link that needs to support the hot plug function.
[0129] In some optional implementations, the memory resource management device further includes: The second judgment unit is used to, after entering the operating system, if the operating system startup file includes a reallocation resource parameter, then for any target link, if the hot plug function of the target link is enabled, then if there is a switching module on the target link, determine whether the hot plug function of the uplink port and the downlink port of the switching module is enabled.
[0130] The second allocation unit is used to keep the target memory resources allocated to the switching module in the target device enumeration stage of the driver execution environment stage unchanged if the hot-swap function of the upstream port and the downstream port of the switching module is enabled, so that the firmware of the switching module allocates memory resources to the target device based on the reserved memory resources or to-be-allocated memory resources of the target device to which the switching module is connected, and allocates memory resources to the target port based on the reserved memory resources of the target port to which the switching module is connected.
[0131] The third judgment unit is configured to, if the hot-swap function of the target link is enabled, determine whether a target device exists on the target link when no switching module exists on the target link.
[0132] The third allocation unit is used to allocate memory resources to the target device according to the reserved memory resources of the target device in the target device enumeration stage in the driving execution environment stage when there is a target device on the target link, if the target device is a smart network card or a preset target device.
[0133] In some optional implementations, the memory resource management device further includes: The fourth determining unit is configured to determine whether there is a target port on the target link that needs to support the hot plug function if the target device does not exist on the target link.
[0134] The fourth allocation unit is configured to allocate memory resources to a target port that needs to support hot plugging function if there is a target port on the target link according to the reserved memory resources of the target port in the target device enumeration phase of the driver execution environment phase.
[0135] In some optional implementations, the memory resource management device further includes: The fifth judgment unit is used to, after entering the operating system, if the operating system startup file includes a resource reallocation parameter, then for any target link, if the hot plug function of the target link is closed, determine whether there is a target device on the target link.
[0136] The sixth judgment unit is configured to judge whether the remaining memory resources meet the memory resources required by the target device if a target device exists on the target link.
[0137] The fifth allocating unit is configured to allocate the required memory resources to the target device if the remaining memory resources satisfy the memory resources required by the target device.
[0138] The third determining unit is configured to not allocate memory resources to the target device if the remaining memory resources do not meet the memory resources required by the target device.
[0139] For the description of the features in the embodiment corresponding to the memory resource management device, please refer to the relevant description of the embodiment corresponding to the memory resource management method, and no further details will be given here.
[0140] The embodiment of the present application also provides an electronic device, such as Figure 10 As shown, it includes a processor 1001 and a memory 1002, wherein the memory 1002 stores a computer program, and the processor 1001 is configured to run the computer program to execute the steps in any of the above-mentioned memory resource management method embodiments.
[0141] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned memory resource management method embodiments when running.
[0142] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0143] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned memory resource management method embodiments are implemented.
[0144] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above-mentioned memory resource management method embodiments are implemented.
[0145] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0146] The above is a detailed introduction to a memory resource management method, device, electronic device and storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A memory resource management method, characterized in that: include: In the target device enumeration phase of the driving execution environment phase, for any target link, if a switching module exists on the target link, the reserved memory resources or the memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port are read from the firmware of the switching module, the firmware of the switching module determines the reserved memory resources or the memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, and enables the hot-swap function of the uplink port and the downlink port of the switching module; Allocate target memory resources to the switching module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port, and enable the hot-swap function of the target link; After completing the processing of all target links, start and enter the operating system.
2. The method according to claim 1, characterized in that Allocating target memory resources to the switching module based on reserved memory resources or to-be-allocated memory resources of a target device connected to the switching module and reserved memory resources of a target port includes: Determining the total memory resources required by the target device and the target port connected to the switching module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port; Allocate target memory resources that are equal to the total memory resources to the switching module, so that the firmware of the switching module reserves memory resources or allocates memory resources to be allocated for the target device connected to the switching module based on the target memory resources, and reserves memory resources for the target port connected to it.
3. The method according to claim 1, characterized in that The method further comprises: For any target link, if the target link does not include a switch module, if there is a target device on the target link, read the manufacturer identification code and device identification code of the target device; Determining whether the target device is a smart network card or a preset target device based on the manufacturer identification code and the device identification code of the target device; If the target device is a smart network card or a preset target device, memory resources are reserved for the target device based on the memory resources required by the smart network card or the preset target device, and the hot plug function of the target link where the target device is located is enabled; If the target device is not a smart network card and is not a preset target device, memory resources are allocated to the target device based on the memory resources required by the target device, and the hot plug function of the target link where the target device is located is disabled.
4. The method according to claim 3, characterized in that The method further comprises: In the case that the target link does not include a switching module, if there is no target device on the target link, determining whether there is a target port on the target link that needs to support a hot-swap function; If there is a target port on the target link that needs to support the hot-swap function, memory resources are reserved for the target port, and the hot-swap function of the target link where the target port is located is enabled; If there is no target port on the target link that needs to support the hot plug function, the hot plug function of the target link is disabled.
5. The method according to claim 1, wherein The method further comprises: After entering the operating system, if the operating system startup file includes a resource reallocation parameter, then for any target link, if the hot-swap function of the target link is enabled, if a switch module exists on the target link, determine whether the hot-swap function of the uplink port and the downlink port of the switch module is enabled; If the hot-swap function of the uplink port and the downlink port of the switching module is enabled, the target memory resources allocated to the switching module in the target device enumeration phase of the driver execution environment phase are kept unchanged, so that the firmware of the switching module allocates memory resources to the target device based on the reserved memory resources or to-be-allocated memory resources of the target device to which the switching module is connected, and allocates memory resources to the target port based on the reserved memory resources of the target port to which the switching module is connected; If the hot-swap function of the target link is enabled, then if there is no switch module on the target link, determining whether there is a target device on the target link; When a target device exists on the target link, if the target device is a smart network card or a preset target device, memory resources are allocated to the target device according to the reserved memory resources of the target device in the target device enumeration phase of the driver execution environment phase.
6. The method according to claim 5, characterized in that The method further comprises: If the target device does not exist on the target link, determining whether there is a target port on the target link that needs to support the hot plug function; If there is a target port that needs to support hot plug function on the target link, memory resources are allocated to the target port according to the reserved memory resources of the target port in the target device enumeration phase in the driver execution environment phase.
7. The method according to claim 1, characterized in that The method further comprises: After entering the operating system, if the operating system startup file includes a resource reallocation parameter, then for any target link, if the hot plug function of the target link is disabled, it is determined whether there is a target device on the target link; If a target device exists on the target link, determining whether the remaining memory resources meet the memory resources required by the target device; If the remaining memory resources meet the memory resources required by the target device, the required memory resources are allocated to the target device; If the remaining memory resources do not meet the memory resources required by the target device, no memory resources are allocated to the target device.
8. A memory resource management device, characterized in that: include: a reading module configured to, during a target device enumeration phase of a driving execution environment phase, read, for any target link, from the firmware of the switching module, the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, if a switching module exists on the target link; the firmware of the switching module determines the reserved memory resources or memory resources to be allocated of the target device connected to the switching module and the reserved memory resources of the target port, and enables the hot-swap function of the uplink port and the downlink port of the switching module; an allocation module for allocating target memory resources to the switching module based on the reserved memory resources or to-be-allocated memory resources of the target device connected to the switching module and the reserved memory resources of the target port, and enabling the hot-swap function of the target link; The startup module is used to start and enter the operating system after completing the processing of all target links.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the memory resource management method according to any one of claims 1 to 7 when executing the computer program.
10. 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 management method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Memory resource processing method, device and system and electronic equipment
CN120144324A
System and method for multi-level switch firmware combination memory resource allocation
CN120238511A
Resource allocation method and apparatus, and base station, readable storage medium and program product
WO2025016187A1