Memory management method and related equipment
The processor core executes program code to manage memory data, which solves the limitations of existing ECC technology when identifying changes in DRAM data, and realizes the identification of memory changes without changing the hardware circuit, reducing memory management costs and abnormal restart risks.
Patent Information
- Application Number
- CN202311863931.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2025-07-01
AI Technical Summary
The existing ECC technology has limitations in identifying data changes in DRAM, especially in case of multi-bit errors, and requires changes in hardware circuit design, increasing memory costs and risk of equipment abnormal restart.
Through software, the processor core executes program code to manage memory data, and identify changes in the memory by comparing the reading of target data and verification data, avoid changes in hardware circuit design and expand the usage scenarios of memory management.
It realizes the identification of memory data changes without changing the hardware circuit, reduces the requirements for DDR hardware in memory management, reduces the risk of abnormal device restarts, and expands the application scenarios of memory management.
Smart Images

Figure CN120233939A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage technologies, and in particular, to a method for managing a memory and related devices. Background Art
[0002] In a computer system architecture, a dynamic random access memory (DRAM) is usually used as the memory. As a volatile storage medium, DRAM uses the amount of electric charge stored in a capacitor to represent data 0 and 1, and it is a volatile memory. Since the capacitor has a leakage phenomenon, it can only hold the charge for a very short time. The leakage of the capacitor causes charge drift, which may lead to errors in the stored data and faults such as bit flips. With the evolution of the manufacturing process, especially in the context of diversification and localization, the problem of data failure caused by bit flips is becoming increasingly serious. Therefore, it is particularly important to identify whether the data stored in the DRAM has changed. Summary of the Invention
[0003] This application provides a method for managing a memory and related devices, which is used to determine whether the data stored in the memory has changed.
[0004] In a first aspect, this application provides a method for managing a memory. The memory is connected to a processing unit through a storage controller. A first address and a second address in the memory are respectively used to store target data and check data of the target data. The processing unit runs an executable file to implement the method. The method may include: reading the data at the first address and the data at the second address from the memory respectively through the storage controller; using the data at the second address to determine the reliability information of the data at the first address, where the reliability information is used to indicate whether the data at the first address is consistent or inconsistent with the target data. In this way, it is beneficial to identify whether the data stored in the memory has changed due to memory reliability problems through software means. Compared with the ECC technology that requires the controller and / or the DDR chip to support the ECC feature, the memory management method provided in this application does not require modification of the hardware circuit design, which is beneficial to reducing the requirements for DDR hardware in memory management and expanding the usage scenarios of the memory management method.
[0005] Optionally, the reading the data at the first address and the data at the second address from the memory respectively through the storage controller includes: regularly reading the data at the first address and the data at the second address from the memory respectively through the storage controller.
[0006] Optionally, the target data is data in one or more other executable files other than the executable file. In this way, when the core runs the executable file, it is beneficial to check other executable files that have not been called, which is conducive to identifying errors in other executable files that have not been called in advance, so as to perform preprocessing (such as reloading, etc.) before they are called. Compared with the ECC method that only checks other executable files being called, it is beneficial to avoid abnormal restart of the device caused by multiple-bit errors in the executable file being called.
[0007] Optionally, the target data is a program code segment, a program static data segment, or a program dynamic data segment in the one or more other executable files. Since the countermeasures for errors in different types of segments in an executable file are generally different, by examining a certain type of segment in the executable file, when an error in this type of segment is identified, it is beneficial to execute more precise countermeasures.
[0008] Optionally, the target data includes data in a copy of the executable file. In this way, it is beneficial to ensure the data integrity of the executable file.
[0009] Optionally, the executable file is stored at a third address in the memory. The executable file run by the core when executing the management method of the present application and the data to be managed are stored in the same memory. In this way, it is beneficial to reduce the number of memories relied on by the core when executing the method of the present application and expand the applicable scenarios of the method of the present application.
[0010] Optionally, the verification data of the target data is the eigenvalue of the target data, which is beneficial to saving the storage resources of the memory. Optionally, the verification data of the target data is the target data. In this way, the verification data can be used as a backup of the target data, which is beneficial to improving the security of the target data.
[0011] Optionally, the method further includes: calculating the verification data of the target data; writing the verification data of the target data to the second address through the storage controller. In this way, even if the verification data of the target data is not stored in the memory, the core can generate the verification data of the target data by running the executable file and write it to the memory, which is beneficial to expanding the applicable scenarios of the method of the present application.
[0012] Optionally, the reliability information is used to indicate that the data at the first address is inconsistent with the target data. The method further includes: reloading the target data into the memory; and / or reporting the reliability information to the host computer connected to the processing unit. In this way, it is beneficial to repair the error of the target data before calling the target data, and it is beneficial to reduce or avoid major problems such as abnormal restart of the device.
[0013] Optionally, the memory is a memory or a flash memory or a hard disk.
[0014] In a second aspect, the present application provides a management device for a memory. The memory is connected to a processing unit through a storage controller. A first address and a second address in the memory are respectively used to store target data and check data of the target data. The processing unit generates the management device by running an executable file. The management device includes a reading module and a determining module. Among them, the reading module is used to respectively read the data at the first address and the data at the second address from the memory through the storage controller. The determining module is used to determine the reliability information of the data at the first address by using the data at the second address. The reliability information is used to indicate whether the data at the first address is consistent or inconsistent with the target data.
[0015] Optionally, the reading module can be used to respectively read the data at the first address and the data at the second address from the memory through the storage controller after the first data and the check data of the first data are written into the memory. Alternatively, the reading module can periodically read the data at the first address and the data at the second address from the memory through the storage controller. For example, manage the data in the executable file through a periodic task. Specifically, a core can add a memory management task in a timer and set the corresponding time slice size. When the time slice is exhausted, manage the data in the executable file stored in the DDR.
[0016] Optionally, the target data is data in one or more other executable files other than the executable file.
[0017] Optionally, the target data is a program code segment or a program static data segment or a program dynamic data segment in the one or more other executable files.
[0018] Optionally, the target data includes data in a copy of the executable file.
[0019] Optionally, the executable file is stored in the memory. For example, it is stored at a third address in the memory.
[0020] Optionally, the check data of the target data is the target data or a feature value of the target data.
[0021] Optionally, the management device further includes a calculation module and a writing module. Among them, the calculation module is used to calculate the check data of the target data, and the writing module is used to write the check data of the target data to the second address through the storage controller.
[0022] Optionally, the management device further includes an exception handling module, which is configured to reload the target data into the memory and / or report the reliability information to the host computer connected to the processing unit when the reliability information indicates that the data at the first address is inconsistent with the target data.
[0023] In a third aspect, the present application provides a computer device, which may include a processing unit and a storage controller. The processing unit is connected to the storage controller, and the storage controller is used to connect to a memory. The processing unit is configured to execute the method according to the first aspect or any possible implementation manner in the first aspect by running an executable file.
[0024] Optionally, the processing unit and the storage controller are integrated on the same chip. Alternatively, the processing unit and the storage controller are provided independently of each other.
[0025] Optionally, the processing unit may be a processor or one or more processor cores in a processor.
[0026] Optionally, the computer device further includes the memory.
[0027] Optionally, the computer device may further include a host computer, and the host computer is connected to the processing unit.
[0028] Optionally, the executable file is stored in a memory external to the computer device. When these instructions are decoded and executed by the processor of the computer device, part or all of the content of the above instructions is temporarily stored in the memory inside the computer device. Optionally, part of the content of these instructions is stored in the memory external to the computer device, and other parts of the content of these instructions are stored in the memory inside the computer device.
[0029] In a fourth aspect of the present application, there is provided a computer-readable storage medium storing instructions (or computer-readable instructions or computer program instructions or functional programs or program codes), which when running on a computer device, cause the computer device to execute the method according to the first aspect or any possible implementation manner in the first aspect of the embodiments of the present application.
[0030] In a fifth aspect of the present application, there is provided a computer program product, which when the instructions (or computer-readable instructions or computer program instructions or functional programs or program codes) included therein are executed by a computer device, is configured to implement the method according to the first aspect or any possible implementation manner in the first aspect of the embodiments of the present application.
[0031] Since each device provided in the embodiments of the present application can be used to execute the corresponding method in the foregoing embodiments, the technical effects that can be obtained by each device embodiment of the present application can refer to the technical effects obtained by the corresponding method embodiments described above, and will not be elaborated herein. Description of the Drawings
[0032] Figure 1 Schematic diagram of a computer device provided in an embodiment of the present application;
[0033] Figure 2-1 Schematic diagram showing the principle of sideband ECC;
[0034] Figure 2-2 Schematic diagram showing the principle of inline ECC;
[0035] Figure 2-3 Schematic diagram showing the principle of on-chip ECC;
[0036] Figure 2-4 Schematic diagram showing the principle of link ECC;
[0037] Figure 3 Schematic diagram showing a possible process of the method of the present application;
[0038] Figure 4 Schematic diagram showing a possible process of the core managing APP i by running the review APP;
[0039] Figure 5 Schematic diagram showing another process of the core managing APP i by running the review APP;
[0040] Figure 6 Schematic diagram showing another possible process of the method of the present application;
[0041] Figure 7 Schematic diagram showing a possible structure of the management device of the present application. Detailed Embodiments
[0042] Figure 1 Schematic diagram of a computer device provided in an embodiment of the present application. As Figure 1 shown, the computer device includes a processor and a DDR. The processor can be connected to the DDR through a DDR bus. Among them, DDR is the abbreviation of double data rate (DDR) synchronous dynamic random access memory (SDRAM). Figure 1Taking the DDR memory as an example, the DDR can be replaced by other types of memory. Correspondingly, different memories may use different data buses to communicate with the processor. Therefore, the DDR bus can also be replaced by other types of data buses. The embodiments of the present application do not limit the bus type. In addition, the computer device also includes various I / O devices, and the processor can access these I / O devices through the PCIe bus.
[0043] The processor is the computing core and control core of the computer device. One or more processor cores can be included in the processor. The processor can be a very large-scale integrated circuit. An operating system and other software programs are installed in the processor, so that the processor can access the memory and various PCIe devices. It can be understood that in the embodiments of the present invention, the Core in the processor can be, for example, a central processing unit (CPU), or it can be other specific integrated circuits (ASICs). The processor can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. In practical applications, the computer device can also include multiple processors.
[0044] The memory controller is a bus circuit controller that internally controls the memory of the computer device and is used to manage and plan the data transmission from the memory to the processor core (referred to as the core). Through the memory controller, data can be exchanged between the memory and the core. The memory controller used to control the DDR can also be called a DDR controller. As Figure 1 shown, the memory controller can be integrated into the processor. Those skilled in the art can know that the memory controller can be a separate chip, connected to the core through the system bus and connected to the memory through the DDR bus. Or, the memory controller can also be built into the processor. The embodiments of the present invention do not limit the specific location and form of existence of the memory controller. In practical applications, the memory controller can control the necessary logic to write data into the memory or read data from the memory. The memory controller can be a memory controller in a processor system such as a general-purpose processor, a dedicated accelerator, a GPU, an FPGA, or an embedded processor.
[0045] Memory is the main memory of a computer device. Memory is usually used to store various running software in the operating system, input and output data, and information exchanged with external memory, etc. To improve the access speed of the processor, memory needs to have the advantage of fast access speed. In the traditional computer system architecture, dynamic random access memory (DRAM) is usually used as memory. The processor can access the memory at high speed through the memory controller and perform read and write operations on any storage unit in the memory. In addition to DRAM, the memory can also be other random access memories, such as static random access memory (SRAM), etc. Additionally, the memory can also be read only memory (ROM). For read only memory, for example, it can be programmable read only memory (PROM), erasable programmable read only memory (EPROM), etc. The number and type of memory are not limited in this embodiment. Furthermore, the memory can be configured to have a power retention function. The power retention function means that when the system experiences a power failure and then powers on again, the data stored in the memory will not be lost. Memory with the power retention function is called non-volatile memory.
[0046] Input / output (I / O) devices refer to the hardware that can perform data transmission and can also be understood as devices connected to the I / O interface. Common I / O devices include network cards, printers, keyboards, mice, etc. The processor can access each I / O device through the PCIe bus. The processor can be not connected to I / O devices, or can be connected to a greater number of I / O devices.
[0047] Serial ATA (SATA) is a type of computer mechanical hard disk, where ATA stands for Advanced Technology Attachment Specification. The processor can be connected to SATA through a bus. SATA can also be used as an I / O device. The processor can access SATA through the PCIe bus. The type of external memory connected to the processor is not limited in this application. For example, the external memory can be a hard disk, a floppy disk, or an optical disc, etc. The processor can be not connected to external memory, or can be connected to a greater number and / or variety of external memories. The type of SATA is not limited in this application. For the following description, SATA is taken as an example of a solid-state disk (SSD).
[0048] It should be noted that the PCIe bus described above is only one example and can be replaced by other buses, such as the unified bus (UB) etc.
[0049] The host computer or the baseboard management controller (BMC) can perform firmware upgrades on the device, manage the operating state of the device, troubleshoot, etc. The processor can access the baseboard management controller through a management channel, which can be a PCIe bus or buses such as USB, I2C, etc. The baseboard management controller can maintain the program code in the memory, including upgrades or recoveries, etc. The baseboard management controller can also control the power circuit or clock circuit within the computer device, etc. In short, the baseboard management controller can manage the computer device in the above ways. However, the baseboard management controller is only an optional device. In some embodiments, the processor can communicate directly with the sensor to directly manage and maintain the computer device.
[0050] The memory can be the main memory of the computer device. The memory is connected to the memory through a double data rate (DDR) bus. The memory is usually used to store various running software in the operating system, input and output data, and information exchanged with the external memory, etc. In order to improve the access speed of the processor, the memory needs to have the advantage of fast access speed. In the traditional computer system architecture, dynamic random access memory (DRAM) is usually used as the memory. The processor can access the memory at high speed through the memory controller and perform read and write operations on any storage unit in the memory.
[0051] In practical applications, the memory can include one or more dual-inline-memory-modules (DIMMs). One DIMM can be regarded as a memory module entity, and memory particles (or memory chips) are arranged on the surface of the memory module. A memory rank refers to a group of memory particles that can meet the data bit width requirements of the CPU memory controller when paralleled. One or more ranks can be set on one DIMM.
[0052] Those skilled in the art will know that data is stored in memory. Specifically, data is stored in the storage units of a memory chip. In the embodiments of the present invention, a storage unit refers to the smallest storage unit (cell) for storing data. Usually, one storage unit can store 1 bit of data. Of course, some storage units can also achieve multi-value storage. When DRAM is used as memory, the storage units in DRAM (which can also be referred to as DRAM cells) are arranged and distributed in a matrix, and this matrix is called a memory bank or DRAM bank. According to this method, the storage units in a memory chip can be logically divided into multiple memory banks, and each memory bank can be regarded as a storage array composed of multiple storage units. Each storage unit (memory cell) in the memory bank is identified by its row address and column address, and the memory controller can locate any storage unit in the memory bank through the corresponding row and column decoders. In the embodiments of the present invention, a memory bank can also be simply referred to as a bank.
[0053] A memory chip may include a control and refresh circuit, multiple memory banks, a row address buffer, a column address buffer, a row decoder, and a column decoder. Among them, the control and refresh circuit is used to control the refresh operation of memory cells.
[0054] During the process of memory access, after the memory controller receives a memory access request from the core, the memory controller will generate an address signal and a control signal according to the received memory access request, and send the generated address signal and control signal to the memory to perform the memory access. Among them, the address signal may include a row address signal and a column address signal, and the control signal may include a chip select signal (CS), a write enable signal (WE), a column access strobe signal (CAS), a row access strobe signal (RAS), etc.
[0055] Those skilled in the art will know that DRAM uses the amount of charge stored in a capacitor to represent data 0 and 1, and it is a volatile memory. Due to the leakage phenomenon of the capacitor, the charge can only be maintained for a very short time. The leakage of the capacitor causes charge drift, which will lead to errors in the stored data and faults such as bit flips. Currently, it is generally improved by the ECC method.
[0056] Currently, there are four ways to implement error checking and correcting (ECC): side-band ECC, in-line ECC, On-die ECC, and link ECC. The following introduces these four types of ECC respectively.
[0057] Figure 2-1 A schematic diagram schematically showing side-band ECC is as follows Figure 2-1 As shown, side-band ECC is usually implemented using standard DDR (such as DDR4 and DDR5) in applications. For side-band ECC, the ECC data is sent to the memory as side-band data together with the actual data. Usually, the actual data generally occupies a 64-bit data width, and the side-band data additionally occupies an 8-bit data width for storing the ECC check code, with a total data width of 72 bits required. The controller uses the same write command (WR) / read command (RD) to write / read the actual data and the ECC check code simultaneously. Therefore, the side-band ECC scheme does not require additional WR / RD command overhead. However, side-band ECC requires the support of the memory controller and has no special requirements for the DDR particles themselves.
[0058] Figure 2-2 A schematic diagram schematically showing in-line ECC is as follows Figure 2-2 As shown, in-line ECC is usually used in low-power (LP) DDR DRAM (abbreviation: LPDDR) or small systems with only 1 to 2 standard DRAM particles attached. In these scenarios, using side-band ECC will waste bandwidth and increase the cost of DRAM. For example, LPDDR has a fixed channel width (for example, the channel width of LPDDR5 / 4 / 4X is 16 bits). If the "64 + 8" side-band ECC is adopted, it is necessary to use a 16-bit data width to provide a channel for the 8-bit ECC check code, resulting in bandwidth waste. For some scenarios with small DRAM capacity requirements, such as the scenario where the memory controller controls 1 DRAM particle, side-band ECC cannot be used. In-line ECC provides a suitable solution for these scenarios. In-line ECC is to specially allocate a storage space for the ECC check code inside the same DRAM particle, and both the data and the ECC check code are stored in this one DRAM particle. The ECC check code and the data go through the same channel. Therefore, usually, the WR / RD commands for the ECC check code and the data are separate. Therefore, this scheme will bring additional WR / RD command overhead. And, in-line ECC requires the support of the memory controller and has no special requirements for the DDR / LPDDR particles themselves.
[0059] Figure 2-3 A schematic diagram schematically showing On-die ECC is as follows Figure 2-3As shown, on-die ECC is currently mainly used in DDR5. On-die ECC is an advanced registration, admission and status (RAS) function supported by the DDR5 system. When writing, the core passes the data to be written to the DRAM through the memory controller. The DRAM calculates the ECC of the data internally and stores it. When reading, the DRAM performs error detection and correction internally and only sends the error-corrected data to the core through the memory controller. Therefore, on-die ECC can only correct single-bit errors in the memory array and cannot correct errors on the DDR channel. Usually, it needs to be used in combination with sideband ECC in applications. On-die ECC is implemented and closed-loop inside the DDR / LPDDR die and does not require support from the memory controller.
[0060] Figure 2-4 A schematic diagram of the link ECC is shown schematically. As Figure 2-4 shown, link ECC is currently mainly used in LPDDR5 to protect the LPDDR5 link or channel from faulty cells. When writing, the memory controller passes the data to be written and the generated ECC check code (denoted as check code 1) to the DRAM. The DRAM internally generates an ECC check code (denoted as check code 2) based on the received data and compares check code 1 and check code 2. When the two are the same, the DRAM writes the data. When the two are different, the DRAM corrects the data and then writes it (in this case, it is not required to write the ECC check code). When reading, the DRAM regenerates a new ECC check code (denoted as check code 3) based on the data to be read and passes the data and check code 3 to the memory controller. The memory controller generates an ECC check code (denoted as check code 4) based on the received data and compares check code 3 and check code 4. If the two are different, the memory controller can correct the data and then pass it to the core. Link ECC usually works in combination with inline ECC to provide more complete protection. Link ECC requires support from both the memory controller and the DDR / LPDDR to be implemented.
[0061] By analyzing the existing memory management methods, it is found that the above ECC has some limitations. For example, one limitation of the existing ECC (referred to as Limitation 1) is that ECC belongs to on-site error correction technology. After the memory controller receives a read request from the core, it checks the reliability of the corresponding data. When the data is incorrect, the memory controller needs to correct the error on-site. Moreover, due to the limited repair ability of ECC, it can only solve single-bit errors and cannot solve multi-bit errors. When the data indicated by the read request has multi-bit errors, the read will fail. For example, one limitation of the existing ECC (referred to as Limitation 2) is that sideband ECC requires an additional number of memory chips, increasing the memory cost and restricting the implementation of sideband ECC in some cost-sensitive devices. For example, one limitation of the existing ECC (referred to as Limitation 3) is that ECC technology requires the memory controller and / or memory chips to support the ECC feature.
[0062] To solve the above technical problems, this application proposes that the core manages the data in the memory by executing program code. In this way, it is beneficial to identify whether the data stored in the memory has changed due to memory reliability problems through software means. Compared with the ECC technology that requires the controller and / or DDR chips to support the ECC feature, the memory management method provided by this application does not require changes to the design of the hardware circuit, which is beneficial to reducing the requirements for DDR hardware in memory management and expanding the usage scenarios of the memory management method. In certain scenarios, the ECC particles of the CPU subsystem can be removed to achieve hardware cost reduction.
[0063] For ease of description, the program code will be referred to as an audit application (application, APP) hereinafter. The application can refer to an executable file. The executable file can also be referred to as an object file, which generally includes a code segment and a data segment. Among them, the code segment mainly contains the instructions of the program, which are generally readable and executable but generally not writable. The data segment mainly stores various global variable data (referred to as the program dynamic data segment) and / or static data (referred to as the program static data segment) used in the code segment. The data segment is generally readable, writable, and executable.
[0064] Figure 3 Schematically shows a possible process of the method of this application. As Figure 3 shown, the method may include:
[0065] S301. The compilation device generates a file package;
[0066] In the version building stage, the compilation device can compile the source code into n APPs, where n is a positive integer. Then, the compilation device can calculate the hash value of each APP to form a hash list. The compilation device can package the n APPs and the hash list into a file package.
[0067] It should be noted that the hash value of the APP is used as the baseline (or verification data) for verifying whether the APP has changed. The present application does not limit the type of verification data for the APP. For example, the hash value of the APP can be replaced with other types of characteristic values, such as cyclic redundancy check (CRC).
[0068] S302. The core writes the file package into the SSD;
[0069] The core can obtain the above file package and then write the file package into the SSD. For example, the core can receive the file package from the host computer and then write the file package into the SSD. Or, the SSD has stored the above file package before being inserted into the computer device. Correspondingly, this method may not include S302.
[0070] S303. The core writes the n APPs and the hash list in the file package into the DDR;
[0071] During the device startup phase or the device running phase, the core can read the file package in the SSD and write the n APPs and the hash list in the file package into the DDR.
[0072] S304. The core manages the n APPs in the DDR by running the review APP stored in the DDR;
[0073] After the n APPs and the hash list are written into the DDR, the core can manage the n APPs by running the review APP stored in the DDR. For example, use the hash value of the APP to determine whether the APP stored in the DDR is consistent with the original APP or whether there are differences.
[0074] Taking the core managing the n APPs in S304 as an example, optionally, the core can manage a part of the n APPs.
[0075] The following introduces the specific manner in which the core manages APP i by running the review APP stored in the DDR. Wherein, i is a positive integer less than or equal to n.
[0076] Figure 4 Schematically shows the possible process of the core managing APP i by running the review APP. In S304 introduced above, the manner in which the core manages the n APPs can be understood with reference to Figure 4 the process shown, and the core can execute the process shown for each of the n APPs in a serial or parallel manner Figure 4 shown.
[0077] Assume that the APP i and its hash value are stored at the first address and the second address in the DDR respectively, and the review APP is stored at the third address in the DDR. Since the data stored in the DDR may be changed due to DDR failures (such as bit flips), in order to identify whether the APP i stored at the first address in the DDR has changed, refer to Figure 4 , the core can execute S401 - S402 by running the review APP.
[0078] S401: Read the data at the first address and the data at the second address from the memory through the memory controller respectively;
[0079] During the process of the core running the review APP, the core can read the data at the first address and the data at the second address from the memory through the memory controller. The first address and the second address can be consecutive addresses or non - consecutive addresses.
[0080] This application does not limit the specific manner in which the core reads the data at the first address and the data at the second address from the memory through the memory controller. For example, the core can send a read request to the memory controller. The read request can carry the logical addresses of the first address and the second address respectively. The memory controller can perform address conversion on the logical addresses in the read request to determine the first address and the second address, and then read the data at the first address and the data at the second address from the DDR respectively.
[0081] This application does not limit the number of read requests sent by the core to the memory controller. For example, the core can send a single read request to the memory controller, and this read request is used to indicate reading the data at the first address and the second address in the DDR. Or, for example, the core can send multiple read requests to the memory controller, where at least one of the read requests is used to indicate reading the data at the first address in the DDR, and the other read requests are used to indicate reading the data at the second address in the DDR.
[0082] This application does not limit the manner in which the core determines the hash value of APP i from the hash list. For example, each hash value recorded in the hash list is associated with the file location and / or file name of the corresponding APP. Or, the core calculates the characteristic value of the identifier of the APP corresponding to each hash value in the hash list, and in the storage space allocated for the hash list, determines the storage location of the hash value in this storage space according to the characteristic value corresponding to the hash value. When it is necessary to review APP i, the characteristic value of the identifier of APP i can be calculated, and the hash value of APP i can be read from this storage space according to this characteristic value.
[0083] S402: Use the data at the second address to determine the reliability information of the data at the first address, and the reliability information is used to indicate whether the data at the first address is consistent or inconsistent with APP i;
[0084] After the core reads the data at the first address and the data at the second address, the data at the second address can be used to determine the reliability information of the data at the first address. The reliability information is used to indicate whether the data at the first address is consistent or inconsistent with APP i.
[0085] For example, the core can calculate the hash value of the data at the first address, then compare the hash value with the data at the second address, and determine the reliability information of the data at the first address according to the comparison result. Optionally, if the hash value is the same as the data at the second address, the reliability information can indicate that the data at the first address is consistent with APP i. If the hash value is different from the data at the second address, the reliability information can indicate that the data at the first address is inconsistent with APP i.
[0086] Optionally, after the core determines that the data at the first address is inconsistent with APP i using the data in the second address, the information of the first address can be recorded in the reliability information. For example, the information of the first address can be used to indicate at least one of the channel identifier, rank identifier, bank identifier, row identifier, and column identifier of the storage unit corresponding to the first address.
[0087] Optionally, when the reliability information indicates that the data at the first address is inconsistent with APP i, the core can also execute S403 - S404.
[0088] S403: Reload APP i into the memory;
[0089] When the reliability information indicates that the data at the first address is inconsistent with APP i, the core can reload APP i into the memory. For example, if APP i is stored in other memories outside the memory (such as SSD), the core can read APP i from the SSD and then write APP i into the memory. Since the inconsistency between the data at the first address and APP i may be due to a failure (such as bit flipping) in the first address and / or the second address, the core can write APP i to other addresses other than the first address and the second address. Optionally, the core can also reload the hash value of APP i into the memory.
[0090] S404: Report the reliability information to the host computer.
[0091] When the reliability information indicates that the data at the first address is inconsistent with APP i, the core can report the reliability information to the host computer. After receiving the reliability information, the host computer can alarm the user according to the reliability information to prompt DDR failure and / or APP i abnormality, etc. Optionally, after receiving the reliability information, the host computer can restart the computer device to reload each APP into the DDR.
[0092] The core may execute all or part of the steps in S403 to S404 by running an inspection APP or other APPs other than the inspection APP, or execute all or part of the steps in S403 to S404 through a hardware logic circuit.
[0093] In some examples, when the reliability information indicates that the data at the first address is inconsistent with APP i, the core may execute S403 without executing S404. In some examples, when the reliability information indicates that the data at the first address is inconsistent with APP i, the core may execute S404 without executing S403.
[0094] Above, taking the hash value of APP i calculated by other devices (such as a compilation device) other than the core as an example, optionally, the core may calculate the hash value of APP i, and then write the hash value of APP i to the second address through the storage controller.
[0095] Figure 5 Schematically show another process for the core to manage APP i by running the inspection APP. Refer to Figure 5 , this process may include S501 to S507.
[0096] S501. Generate a baseline value of APP i;
[0097] The core may calculate the eigenvalue of APP i stored in the DDR, and this eigenvalue may be used as the baseline value for later measuring whether a bit flip error occurs in the DDR. The method adopted by the core to calculate this eigenvalue is not limited in this application. For example, the core may select a hash algorithm or a CRC algorithm, etc., to calculate the eigenvalue of APP i. An algorithm with hardware acceleration capabilities (such as a hash algorithm) is beneficial to improving the calculation performance. Hereinafter, taking the core calculating the baseline value of APP i by using the hash algorithm as an example.
[0098] S502. Import the baseline value into the DDR;
[0099] After the core calculates the baseline value of APP i, it may write the baseline value into the DDR.
[0100] After both APP i and the baseline value of APP i are written into the DDR, the core may use the baseline value of APP i to manage APP i, such as executing S503 to S507. The specific timing for the core to manage APP i by running the inspection APP stored in the DDR is not limited in this application. The triggering mechanism of step S503 will be introduced later. By way of example, the core may trigger step S503 at regular intervals. For example, the core may add a timing task to the timer. After setting the duration of the time slice, when the time slice is exhausted, the core executes S503.
[0101] S503. Calculate the hash value of the data in the memory space where APP i is located;
[0102] After both APP i and its baseline value are written to the DDR, the core can read the data from the memory space where APP i is located and calculate the hash value of this data.
[0103] S504. Determine whether the calculated hash value is the same as the baseline value. If they are the same, execute S505; if not, execute S506;
[0104] The core can read the baseline value from the DDR and compare the calculated hash value with the baseline value. If the calculated hash value is the same as the baseline value, S505 can be executed; if not, the core can execute S506.
[0105] S505. Determine that the verification of APP i stored in the DDR is successful;
[0106] When the calculated hash value is the same as the baseline value, it can be considered that APP i stored in the DDR has not changed, it can be determined that there is no error in APP i stored in the DDR, and it can be considered that the verification of APP i is successful.
[0107] Optionally, the timing task can be a task with multiple loops. When the time slice is exhausted, the time slice can be set again. After the time slice is exhausted, the core can execute S503 again.
[0108] S506. Determine that the verification of APP i stored in the DDR fails;
[0109] When the calculated hash value is different from the baseline value, it can be considered that APP i stored in the DDR has changed, it can be determined that there is an error in APP i stored in the DDR, and it can be considered that the verification of APP i fails.
[0110] S507. Perform subsequent actions.
[0111] After S506, when the core recognizes that there is an error in the DDR, it can perform subsequent actions based on this recognition result. For example, it can perform at least one of the operations of alarm, program reloading, and restart. Step S507 can be understood with reference to S403 and / or S404.
[0112] Optionally, the core can calculate the hash value of APP i by examining other APPs or hardware logic circuits outside the APP.
[0113] As described above, taking the verification data for verifying the APP as the eigenvalue of the APP as an example, optionally, the verification data of the APP can be the APP itself. That is to say, in addition to writing the APP i to the first address of the DDR, the APP i is also written to the second address of the DDR, and the data at the second address is used as the verification data for the data at the first address. This application does not limit the method for the core to use the data at the second address to determine whether the data at the first address is consistent with the APP i. For example, the core can calculate the eigenvalues of the data at the first address and the data at the second address respectively, and determine whether the data at the first address is consistent with the APP i by comparing the two eigenvalues.
[0114] The core manages the APP in the memory by executing the review APP. In this way, it is beneficial to identify whether the data stored in the memory has changed due to memory reliability problems through software means. Compared with the ECC technology that requires the controller and / or the DDR chip to support the ECC feature, the memory management method provided in this application does not require modification of the hardware circuit design, which is beneficial to reducing the requirements of the memory management for the DDR hardware and expanding the usage scenarios of the memory management method. In some scenarios, the ECC particles of the CPU subsystem can be removed to reduce costs.
[0115] In the existing implementation of ECC, only when the core runs to the APP i, the memory controller and / or the DDR will verify the relevant data based on the corresponding read request. When multiple-bit errors occur in the APP i requested by the read request, it may cause a read failure and even cause the device to restart abnormally.
[0116] The APP i managed by the core during the execution of the review APP is an APP other than the review APP. In this way, it is beneficial for the core to check the code segments that have not been called when running the review APP, which is beneficial to identifying errors in the code segments that have not been called in advance, so as to facilitate preprocessing (such as reloading, etc.) before they are called. Compared with the ECC method that only checks the code segments being called, it is beneficial to avoid abnormal device restart caused by multiple-bit errors in the code segments being called.
[0117] Optionally, when the review APP is in the running state, the core can manage the APPs in the DDR that are not in the execution state by running the review APP. Correspondingly, when the core manages the APP i by running the review APP, the APP i is not in the execution state and can be in the ready state or the block state, etc.
[0118] This application does not limit the specific timing for the core to manage the APP i by running the review APP stored in the DDR.
[0119] Optionally, when the core writes n APPs and the hash list in the file package into the DDR, it can manage the APPs (such as APP i) that have been written into the DDR and perform a check on APP i that has been stored in the DDR.
[0120] Optionally, the core can manage the APPs stored in the DDR at regular intervals and check the APPs. For example, the core can manage the APPs through scheduled tasks. Specifically, the core can add a memory management task to the timer and set the corresponding time slice size. When the time slice is exhausted, it manages the APPs stored in the DDR.
[0121] The APP i stored in the DDR may change due to the reliability issues of the DDR. During the process of the core running to review the APP, by regularly / scheduled managing the APPs stored in the memory, it is beneficial to identify the changes of APP i due to the reliability issues of the DDR before calling APP i, giving the computer device a certain operation space to solve the DDR anomaly, and thus being beneficial to reducing or avoiding major problems such as abnormal restart of the device.
[0122] Optionally, the core can set different time slice sizes for different APPs. For example, for two APPs with different importance levels, the core can set a shorter time slice for the APP with higher importance and a longer time slice for the APP with lower importance. In this way, the core will check the APP with higher importance more frequently, which is beneficial to ensuring the reliability of the APP. The present application does not limit the size of the time slice, and the user can flexibly set the size of the time slice according to needs.
[0123] As mentioned above, the hash value in the hash list is taken as the hash value of all the data in the APP as an example. Optionally, the hash list can include the hash values of a part of the data in the APP. Correspondingly, in S304, the core can use the hash values of this part of the data to determine whether the data of this part stored in the DDR is consistent with the data of this part in the original APP. Correspondingly, in Figure 4 or Figure 5 In the shown process, a part of the data in APP i can be replaced with APP i, and the hash value of APP i can be replaced with the hash value of this part of the data.
[0124] As introduced above, an executable file generally includes a code segment and a data segment, where the data segment further includes a program dynamic data segment and a program static data segment. Table 1 schematically shows the impact on APP i when problems occur in each segment and the current countermeasures.
[0125] Table 1
[0126]
[0127] Optionally, the hash list may include the hash values of the program code segments in APP i. Correspondingly, the core can use these hash values to determine whether there are errors in the program code segments of APP i stored at the first address, that is, to identify the errors in Scenario 1. If there is an error, APP i can be reloaded, which helps to avoid resetting the CPU due to program code segment errors during the operation of APP i. Optionally, the hash list may include the hash values of the program static data segments and / or program dynamic data segments in APP i. Correspondingly, the core can use these hash values to determine whether there are errors in the corresponding data segments of APP i stored at the first address, that is, to identify the errors in Scenario 2 and / or Scenario 3. If there is an error, APP i can be reloaded, which helps to avoid re-executing due to data segment errors during the operation of APP i.
[0128] To ensure the data integrity of the reviewed APP, a backup of the reviewed APP can also be saved in the DDR. For the sake of easy distinction, the reviewed APP mentioned above is called the reviewed APP_A, and the backup of the reviewed APP is called the reviewed APP_B. The existing A / B mechanism can be referred to. When the reviewed APP_A fails, the core can manage the data stored in the DDR by running the reviewed APP_B. The way the core manages the data stored in the DDR by running the reviewed APP_B can refer to the way the core manages the data stored in the DDR by running the reviewed APP_A introduced above.
[0129] Before the reviewed APP_A fails, the core may not run the reviewed APP_B, or the core may run the reviewed APP_A and the reviewed APP_B in parallel to manage the data stored in the DDR.
[0130] During the process of the core running the reviewed APP_A and the reviewed APP_B in parallel, a load balancing method can be adopted to manage different data stored in the DDR. Alternatively, during the process of the core running the reviewed APP_A and the reviewed APP_B in parallel, the same data stored in the DDR can be managed, and the host computer can make a decision based on the reliability information reported by the reviewed APP_A and the reviewed APP_B respectively. For example, when the reliability information reported by both indicates that APP i stored in the DDR has an error, the host computer determines that APP i stored in the DDR has an error and restarts the device or reloads APP i. When only the reliability information reported by one reviewed APP_A is received, the host computer determines that APP i stored in the DDR is suspected of having an error and can alarm the user.
[0131] Since the APP i managed by the core during the process of running the reviewed APP is an APP other than the reviewed APP, optionally, the core can manage the reviewed APP_B during the process of running the reviewed APP_A. The process of the core managing the reviewed APP_B can refer to the process of the core managing APP i mentioned above. For example, the core can execute the reviewed APP_BFigure 4 or Figure 5 the process shown. In this way, even if the reviewed APP_B stored in the DDR goes wrong, it is beneficial for the core to identify the error before running the reviewed APP_B and perform corresponding processing, thereby facilitating ensuring the normal operation of the reviewed APP_B by the core.
[0132] Figure 6 Schematically shows another possible process of the method of the present application. The difference between this process and Figure 3 the process shown is that two reviewed APPs (i.e., reviewed APP_A and reviewed APP_B) can be stored in the DDR. The core can manage the reviewed APP_B during the process of running the reviewed APP_A, and the core can manage the reviewed APP_A during the process of running the reviewed APP_B. Correspondingly, in addition to including the hash values in the hash list in the file package, the hash list' can also save the hash value of the reviewed APP_A and the hash value of the reviewed APP_B. The process of the core managing the reviewed APP_B can refer to the process of the core managing APP i mentioned above. For example, the core can execute Figure 4 or Figure 5 the process shown. The process of the core managing the reviewed APP_A during the process of running the reviewed APP_B can refer to the process of the core managing APP i mentioned above. For example, the core can execute Figure 4 or Figure 5 the process shown.
[0133] Above, taking the hash values of different APPs being saved in the hash list as an example, the present application does not limit the saving method of the hash values of multiple APPs, as long as the core can read the hash value of APP i.
[0134] Above, taking the core managing the APP stored in the DDR or a part of the data in the APP by running the reviewed APP as an example, optionally, the core can manage other types of data stored in the DDR by running the reviewed APP.
[0135] Above, taking the core managing the data in the DDR by running the reviewed APP as an example, the present application does not limit the type of the memory managed by the core by running the reviewed APP. For example, the core can manage the data in the flash and / or hard disk by running the reviewed APP.
[0136] Above, taking the reviewed APP being stored in the managed memory as an example, optionally, the reviewed APP can be stored in other memories outside the managed memory.
[0137] After the core reads the executable file (such as the reviewed APP), it can generate Figure 7 the management device 7 shown. This management module 7 can be used to execute S304 orFigure 4 All or part of the steps shown or Figure 5 All or part of the steps shown. Refer to Figure 7 , the management device 7 may include a reading module 701 and a determination module 702. The functions of each software function module will be introduced separately below.
[0138] The reading module 701 can be used to separately read the data at the first address and the data at the second address from the memory through the storage controller, where the first address of the memory is used to store the target data, and the second address is used to store the verification data of the target data.
[0139] The determination module 702 can be used to determine the reliability information of the data at the first address using the data at the second address, and the reliability information is used to indicate whether the data at the first address is consistent or inconsistent with the target data.
[0140] Taking the memory as DDR, with the first address used to store APP i and the second address used to store the hash value of APP i as an example, the reading module 701 can be used to execute S401, and the determination module 702 can be used to execute S402.
[0141] Optionally, the reading module 701 can be used to separately read the data at the first address and the data at the second address from the memory through the storage controller after the first data and the verification data of the first data are written into the memory. Or, the reading module 701 can periodically read the data at the first address and the data at the second address from the memory through the storage controller. For example, manage the APP through the periodic task. Specifically, the core can add a memory management task to the timer and set the corresponding time slice size. When the time slice is exhausted, manage the APP that has been stored in the DDR.
[0142] Optionally, the target data is the data in one or more other executable files other than the executable file. For example, the data in APP i.
[0143] Optionally, the target data is the program code segment or program static data segment or program dynamic data segment in one or more other executable files.
[0144] Optionally, the target data includes the data in the copy of the executable file.
[0145] Optionally, the executable file is stored in the memory. For example, stored at the third address in the memory.
[0146] Optionally, the verification data of the target data is the target data or the characteristic value of the target data.
[0147] Optionally, the management device further includes a calculation module 703 and a writing module 704. The calculation module 703 is configured to calculate the check data of the target data, and the writing module 704 is configured to write the check data of the target data to a second address through a storage controller.
[0148] Optionally, the management device further includes an exception handling module 705. When the reliability information indicates that the data at the first address is inconsistent with the target data, the exception handling module 705 is configured to reload the target data into the memory and / or report the reliability information to a host computer connected to the processing unit.
[0149] Those of ordinary skill in the art will understand that when implementing various aspects of the embodiments of the present application, or possible implementation manners of various aspects, all or part of the above aspects, or possible implementation manners of various aspects, may be implemented in the form of a computer program product. A computer program product refers to instructions (or computer-readable instructions or computer program instructions or functional programs or program codes) stored in a computer-readable medium. When these instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
[0150] The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium includes, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or apparatuses, or any suitable combination of the foregoing. For example, the computer-readable storage medium is a random access memory (RAM), a read only memory (ROM), an erasable programmable read only memory (EPROM), or a compact disc read-only memory (CD-ROM).
[0151] The terms "first", "second", "third", etc. in the specification, claims, and drawings of the present application are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such terms may be interchanged under appropriate circumstances, which is only a way of distinguishing objects with the same attributes when describing the embodiments of the present application. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion, so that a process, method, system, product, or device including a series of units does not have to be limited to those units, but may include other units that are not clearly listed or are inherent to these processes, methods, products, or devices. The term "plurality" as used in the embodiments of the present application refers to two or more.
[0152] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the scope of the present invention. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present invention, the present invention is also intended to include these modifications and variations.
Claims
1. A management method for a memory, characterized in that, The memory is connected to the processing unit through a storage controller. A first address and a second address in the memory are respectively used to store target data and verification data of the target data. The processing unit implements the method by running an executable file. The method includes: Reading, through the storage controller, the data at the first address and the data at the second address from the memory respectively; Using the data at the second address to determine reliability information of the data at the first address, where the reliability information is used to indicate whether the data at the first address is consistent or inconsistent with the target data.
2. The method according to claim 1, characterized in that, The reading, through the storage controller, the data at the first address and the data at the second address from the memory respectively includes: Regularly reading, through the storage controller, the data at the first address and the data at the second address from the memory respectively.
3. The method according to claim 1 or 2, characterized in that, The target data is data in one or more other executable files other than the executable file.
4. The method according to claim 3, wherein The target data is a program code segment or a program static data segment or a program dynamic data segment in the one or more other executable files.
5. The method according to claim 3 or 4, characterized in that, The target data includes data in a copy of the executable file.
6. The method according to claim 5, wherein The executable file is stored at a third address in the memory.
7. The method according to any one of claims 1-6, characterized in that, The verification data of the target data is the target data or a characteristic value of the target data.
8. The method according to claim 7, characterized in that, The method further includes: Calculating the verification data of the target data; Writing, through the storage controller, the verification data of the target data to the second address.
9. The method according to any one of claims 1-8, characterized in that, When the reliability information indicates that the data at the first address is inconsistent with the target data, the method further includes: Reloading the target data into the memory; and / or Reporting the reliability information to the host computer connected to the processing unit.
10. The method according to any one of claims 1-9, characterized in that, The memory is a memory or a flash memory or a hard disk.
11. A management device for a memory, characterized in that, The memory is connected to the processing unit through a storage controller. A first address and a second address in the memory are respectively used to store target data and verification data of the target data. The processing unit generates the management device by running an executable file. The management device includes: A reading module, configured to read, through the storage controller, the data at the first address and the data at the second address from the memory respectively; A determining module, configured to use the data at the second address to determine reliability information of the data at the first address, where the reliability information is used to indicate whether the data at the first address is consistent or inconsistent with the target data.
12. A computer device, characterized in that, It includes a processing unit and a storage controller. The processing unit is connected to the storage controller. The storage controller is used to connect to a memory. The processing unit is used to execute the method according to any one of claims 1 to 10 by running an executable file.
13. The computer device according to claim 12, characterized in that, The processing unit and the storage controller are integrated on the same chip.
14. The computer device according to claim 12 or 13, characterized in that, The computer device further includes the memory.
15. A computer-readable storage medium, characterized in that, Program code is stored in the computer-readable storage medium. When the program code is executed by the computer device, the method according to any one of claims 1 to 10 is implemented.
16. A computer program product, characterized in that, When the program code included in the computer program product is executed by a computer device, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Cited By
DDR test method, apparatus and device, and computer readable storage medium
CN121833378A
Memory management method and related device
WO2025140156A1
