Memory diagnosis method and device, electronic equipment and storage medium

By calling the system diagnostic interface in the user state to enter the kernel state and generating background data based on long-term memory data for detection, the problem that user state applications cannot accurately diagnose memory is solved, and high accuracy and complete memory diagnosis is achieved.

CN119537071APending Publication Date: 2025-02-28HANGZHOU HOLLYSYS AUTOMATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411454341.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the prior art, user-mode applications cannot accurately and completely diagnose memory, resulting in poor diagnostic effects.

Method used

By calling the system diagnostic interface in the user-state operating environment, entering the kernel-state operating environment, using the system diagnostic interface for memory diagnosis, and generating multiple background data based on the bit length of the memory to be detected, respectively, to determine the diagnostic results.

Benefits of technology

It realizes comprehensive and accurate memory diagnosis, improves the accuracy and completeness of diagnosis, and avoids the problem of poor diagnosis results caused by user-mode application permission restrictions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537071A_ABST
    Figure CN119537071A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a memory diagnosis method and device, electronic equipment and a storage medium. According to the method, a system diagnosis interface is preset, so that when an application program in a user mode operation environment calls the system diagnosis interface, a microkernel system can enter a kernel mode operation environment, then subsequent memory diagnosis can completely detect a to-be-detected memory, and the situation that the user mode environment is lack of permission is avoided; in the embodiment of the invention, the problems that a to-be-detected memory cannot be completely diagnosed by an application program in a user mode, and the diagnosis effect is poor are solved, in addition, multiple pieces of background data are generated according to the bit length of the to-be-detected memory, so that the generated multiple pieces of background data can cover different adjacent states of 0 and 1 in the to-be-detected memory; and subsequently detecting the to-be-detected memory through each piece of background data, thereby achieving the effect of comprehensively and accurately detecting the to-be-detected memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a memory diagnosis method, device, electronic device and storage medium. Background Art

[0002] In a microkernel operating system, hard failure diagnosis of memory faults (hereinafter referred to as memory diagnosis) includes power-on diagnosis, wherein the power-on diagnosis method in memory diagnosis is to traverse the entire memory area to perform read and write tests on 0x55 and 0xAA feature data when the memory is powered on. During diagnosis, the test area data is first copied to the backup data area for read and write tests, and the backup data is restored after the test is completed.

[0003] The main reason for memory diagnosis is to ensure the reliability and stability of the system. It can identify and repair errors in the memory, thereby preventing potential system crashes or data corruption. In related technologies, when performing memory diagnosis, memory diagnosis is often performed through applications in user mode. Applications in user mode are usually restricted by the permissions of the operating system and cannot directly access certain memory areas (such as kernel space), which limits the scope and effect of memory diagnosis. Memory diagnosis is crucial to the stability and reliability of the system, but relying solely on user-mode applications for memory diagnosis will face difficulties in permissions, real-time, accuracy, and security. Summary of the invention

[0004] In view of this, embodiments of the present application provide a memory diagnosis method, device, electronic device and storage medium to solve the problem in the prior art that user-mode applications cannot accurately and completely diagnose the memory, resulting in poor diagnostic results.

[0005] In a first aspect of an embodiment of the present application, a memory diagnosis method is provided, which includes: when an application in a user-mode operating environment calls a system diagnostic interface, entering a kernel-mode operating environment, wherein the system diagnostic interface is used to diagnose a memory to be detected; when in the kernel-mode operating environment, generating multiple background data according to the bit length of the memory to be detected; detecting the memory to be detected based on each background data respectively, obtaining a detection result corresponding to each background data, and determining a diagnostic result of the memory to be detected based on each detection result.

[0006] According to a second aspect of an embodiment of the present application, a memory diagnostic device is provided, which includes: a system module, which is used to enter a kernel state operating environment when an application in a user state operating environment calls a system diagnostic interface, and the system diagnostic interface is used to diagnose a memory to be detected; a generation module, which is used to generate multiple background data according to the bit length of the memory to be detected when in the kernel state operating environment; and a detection module, which is used to detect the memory to be detected based on each background data, obtain a detection result corresponding to each background data, and determine a diagnostic result of the memory to be detected based on each detection result.

[0007] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0008] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0009] Compared with the prior art, the embodiments of the present application have the following beneficial effects: in the embodiments of the present application, when an application in a user-mode operating environment calls a system diagnostic interface, the kernel-mode operating environment is entered, and the system diagnostic interface is used to diagnose the memory to be detected; when in the kernel-mode operating environment, multiple background data are generated according to the bit length of the memory to be detected; the memory to be detected is detected based on each background data, respectively, to obtain a detection result corresponding to each background data, and a diagnosis result of the memory to be detected is determined based on each detection result, wherein a system diagnostic interface is pre-set so that when an application in a user-mode operating environment calls the system diagnostic interface, the microkernel system can enter the kernel-mode operating environment, thereby enabling subsequent memory diagnosis to be complete for the memory to be detected. The memory is tested, which avoids the problem that the user-state application cannot completely diagnose the memory to be tested due to lack of permissions in the user-state environment, resulting in poor diagnostic effect. In addition, in this example, multiple background data are generated according to the bit length of the memory to be tested, so that the generated multiple background data can cover different adjacent states of 0 and 1 in the memory to be tested. Subsequently, the memory to be tested is tested separately through each background data, so as to achieve the effect of comprehensive and accurate detection of the memory to be tested. Finally, the diagnosis result of the memory to be tested is confirmed according to the detection result corresponding to each background data, thereby improving the accuracy and completeness of the diagnosis of the memory to be tested, and avoiding the problem that the memory to be tested cannot be accurately and completely diagnosed in the related technology, resulting in poor diagnostic effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 paying any creative work.

[0011] Figure 1 It is a flowchart of a memory diagnostic method provided by an embodiment of the present application;

[0012] Figure 2 This is a basic schematic diagram of the interaction between user mode and kernel mode provided by an embodiment of the present application;

[0013] Figure 3 is a flowchart of another memory diagnostic method provided in an embodiment of the present application;

[0014] Figure 4 is a flowchart of another memory diagnostic method provided in an embodiment of the present application;

[0015] Figure 5 It is a flowchart of another memory diagnosis method provided in an embodiment of the present application;

[0016] Figure 6 It is a flowchart of another memory diagnosis method provided in an embodiment of the present application;

[0017] Figure 7 is a flowchart of another optional memory diagnostic method provided in an embodiment of the present application;

[0018] Figure 8 It is a flowchart of another optional memory diagnosis method provided in an embodiment of the present application;

[0019] Fig. 9 This is a basic flow chart of another optional memory diagnostic method provided in an embodiment of the present application;

[0020] Fig.10 This is a basic flow chart of another optional memory diagnosis method provided in an embodiment of the present application;

[0021] Fig.11 is a structural schematic diagram of a memory diagnostic device provided in an embodiment of the present application;

[0022] Fig.12 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0024] A memory diagnosis method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0025] Figure 1 A memory diagnostic method provided by an embodiment of the present application is as follows: Figure 1 As shown, the method includes:

[0026] S101, when an application in a user-mode operating environment calls a system diagnostic interface, the kernel-mode operating environment is entered, and the system diagnostic interface is used to diagnose a memory to be detected;

[0027] S102, when in the kernel state running environment, generating at least two background data according to the bit length of the memory to be detected;

[0028] S103 , respectively detecting the memory to be detected based on each background data, obtaining a detection result corresponding to each background data, and determining a diagnosis result of the memory to be detected based on each detection result.

[0029] It can be understood that the above-mentioned memory diagnosis method provided in this example is applied to a microkernel operating system, and a memory fault diagnosis module is added to the microkernel operating system, and the memory fault diagnosis module is used to perform fault diagnosis on the memory, and the above-mentioned fault diagnosis on the memory refers to the diagnosis of the variable area of ​​the memory DDR, and the variable area includes the BSS segment, data segment, heap, stack, data sharing area, etc. It can be understood that memory failures can be divided into hard failures and soft failures, and the corresponding diagnostic methods also have two types, namely hard failure diagnosis and soft failure diagnosis. Among them, the soft failure diagnosis method of memory failure usually adopts the memory ECC function of the processing chip to implement the soft failure diagnosis method; the memory diagnosis method provided in this example is used to implement hard failure diagnosis of memory failure.

[0030] It can be understood that the above-mentioned microkernel operating system is a system with multi-threaded scheduling. In the process of the microkernel operating system executing the above-mentioned steps S102 to S103 to diagnose the memory, in order to avoid the software thread of the memory diagnosis method being interrupted by other threads of the system, before diagnosing the memory, it is necessary to first execute the operation of prohibiting task scheduling. In order to achieve the prohibition of task scheduling, taking the hardware operation processor architecture of the microkernel system as the ARMv8 architecture as an example, the above-mentioned steps S102 and S103 are completed in the privilege level of kernel state EL1, and the memory fault diagnosis entry is user state EL0. Therefore, the kernel state memory diagnosis design needs to be designed using the communication method between user state and kernel state.

[0031] Continuing with the above example, when an application in a user-mode operating environment calls the system diagnostic interface, the microkernel system enters the kernel-mode operating environment to run steps S102 and S103 of the memory diagnostic method, thereby enabling the subsequent memory diagnostic method to accurately and completely diagnose the memory. Specifically, this example triggers entry into the kernel state by setting a system call in a user-mode application, and then implements different diagnostic mechanisms in the kernel state according to the diagnostic type parameters passed in. A system call refers to a collection of operating system services that can be called in a program in a manner similar to a function call. It is usually a collection of services provided for operations related to entering kernel state (EL1) from user state (EL0).

[0032] For example, this example adds a system diagnostic interface dedicated to the diagnostic function in the application layer and the kernel respectively: Sel4_SysSelftest=-32 / SysSelftest=-32. The system call implementation needs to be added in syscall.c in kernel / src / api / . In order to reduce the impact on the existing microkernel system calls, the newly added system diagnostic interface call is placed in handleUnknownSyscall. The application layer application uses the system call syscall_send_recv, which generates a system call interrupt corresponding to the system diagnostic interface. In kernel mode, the kernel receives the system call interrupt and calls handleUnknownSyscall through the call number for corresponding processing. Figure 2As shown, the application in user mode generates a system call interrupt by calling syscall_send_recv, enters Sel4_SysSelftest=-32 system diagnosis, and sets parameters such as detection area, test length, test result and test status by setting the diagnosis type [diagnType], [para0], [para1], [para2], [para3], etc.; in kernel mode, handleUnknownSyscall in the kernel completes the implementation of the kernel mode diagnosis mechanism by reading the diagnosis type, input parameters, etc. In memory diagnosis, the diagnosis type is set to memory diagnosis according to the received parameter [diagnType], the input parameters are the detection area and test length, and the output parameters are the test result and test status.

[0033] In some examples, when the system is in a kernel mode operating environment, multiple background data are generated according to the bit length of the memory to be tested. It can be understood that the multiple background data generated according to the bit length of the memory to be tested are different, so that the generated multiple background data can cover different adjacent states of 0 and 1 in the memory, thereby improving the accuracy and completeness of memory diagnosis.

[0034] It can be understood that the amount of background data is related to the bit length of the memory to be detected. How to generate multiple background data according to the bit length of the memory to be detected will be described in detail later and will not be repeated here.

[0035] It can be understood that the generated multiple background data can cover different adjacent states of 0 and 1 in the memory. Therefore, in order to cover different fault conditions in the memory to be detected, after obtaining the background data, the memory to be detected is detected based on each background data respectively, and the detection result corresponding to each background data is obtained. For example, if there are background data A, background data B, background data C and background data D, the memory to be detected is detected by background data A to obtain the detection result corresponding to background data A; the memory to be detected is detected by background data B to obtain the detection result corresponding to background data B; the memory to be detected is detected by background data C to obtain the detection result corresponding to background data C; the memory to be detected is detected by background data D to obtain the detection result corresponding to background data D.

[0036] Continuing with the above example, after obtaining the detection result corresponding to each background data, this example further determines the diagnosis result of the memory to be detected based on each detection result; specifically, if the detection result corresponding to each background data indicates that there is no abnormality in the memory to be detected, then the diagnosis result of the memory to be detected is determined to be no abnormality; if the detection result corresponding to any background data indicates that there is an abnormality in the memory to be detected, then the diagnosis result of the memory to be detected is determined to be abnormal, and the abnormal area is further output.

[0037] According to the technical solution provided in the embodiment of the present application, when an application in a user-mode operating environment calls a system diagnostic interface, the kernel-mode operating environment is entered, and the system diagnostic interface is used to diagnose the memory to be detected; when in the kernel-mode operating environment, multiple background data are generated according to the bit length of the memory to be detected; the memory to be detected is detected based on each background data respectively, and the detection result corresponding to each background data is obtained, and the diagnostic result of the memory to be detected is determined based on each detection result, wherein a system diagnostic interface is pre-set, so that when an application in a user-mode operating environment calls the system diagnostic interface, the microkernel system can enter the kernel-mode operating environment, so that subsequent memory diagnosis can completely detect the memory to be detected , avoiding the problem that the user-state application cannot completely diagnose the memory to be detected due to lack of permissions in the user-state environment, resulting in poor diagnostic effect. In addition, in this example, multiple background data are generated according to the bit length of the memory to be detected, so that the generated multiple background data can cover different adjacent states of 0 and 1 in the memory to be detected. Subsequently, the memory to be detected is detected by each background data respectively, so as to achieve the effect of comprehensive and accurate detection of the memory to be detected. Finally, the diagnostic result of the memory to be detected is confirmed according to the detection result corresponding to each background data, thereby improving the accuracy and completeness of the diagnosis of the memory to be detected, and avoiding the problem that the memory to be detected cannot be accurately and completely diagnosed in the related technology, resulting in poor diagnostic effect.

[0038] In some embodiments, each background data includes first background data and second background data, and the second background data is data obtained by negating the first background data, such as Figure 3 As shown, the memory to be detected is detected based on each background data, and the detection result corresponding to each background data is obtained, including:

[0039] S301, writing first background data into a memory to be detected, and after writing the first background data, detecting a value in the memory to be detected according to a first sequence to obtain a first detection result;

[0040] S302, writing the second background data into the memory to be detected according to the first sequence, and after the second background data is written, re-detecting the value in the memory to be detected according to the first sequence to obtain a second detection result;

[0041] S303, writing the first background data into the memory to be detected according to the first sequence, and after the first background data is written, re-detecting the value in the memory to be detected according to the second sequence to obtain a third detection result, wherein the second sequence is the reverse sequence of the first sequence;

[0042] S304, writing the second background data into the memory to be detected according to the second sequence, and after writing the second background data, re-detecting the value in the memory to be detected according to the second sequence to obtain a fourth detection result;

[0043] S305, writing the first background data into the memory to be detected according to the second sequence, and after writing the first background data, re-detecting the value in the memory to be detected according to the second sequence to obtain a fifth detection result;

[0044] S306: Determine a detection result corresponding to the background data according to the first detection result, the second detection result, the third detection result, the fourth detection result, and the fifth detection result.

[0045] In order to improve the test efficiency and fault coverage of the memory to be detected, in this example, the memory to be detected is detected based on each background data respectively, that is, a word-oriented method is adopted to detect the memory to be detected.

[0046] It can be understood that each background data includes first background data and second background data, the second background data is the data obtained by inverting the first background data, and the above inversion is bitwise inversion. Specifically, the above word is composed of 16 bits. Taking the first background data as 0000000000000000 as an example, the second background data obtained by bitwise inversion is FFFFFFFFFFFFFFFF; for another example, taking the first background data as 0F0F0F0F0F0F0F0F as an example, the second background data obtained by bitwise inversion is F0F0F0F0F0F0F0F0.

[0047] After obtaining the first background data and the second background data, this example first writes the first background data into the memory to be detected. By way of example, taking the first background data as 0F0F0F0F0F0F0F0F as an example, 0F0F0F0F0F0F0F0F is written word by word into the memory to be detected, thereby initializing the memory to be detected and ensuring that each word in the memory to be detected is written into the first background data, thereby verifying whether the write operation of the memory to be detected is working normally and clearing the influence of the data previously existing in the memory to be detected on the memory to be detected.

[0048] It can be understood that the first order is an ascending order or a descending order, and the second order is an order opposite to the first order; for example, if the first order is an ascending order, the second order is a descending order; if the first order is a descending order, the second order is an ascending order. For better explanation, the first order is an ascending order and the second order is a descending order.

[0049] In some examples, after the first background data is written, the value in the memory to be detected is detected according to the first order to obtain a first detection result; wherein, each word in each memory to be detected is read in ascending order, and it is checked whether the data in each word is the first background data, and it is determined whether the data in each word in the memory to be detected is written correctly. If so, the above-mentioned first detection result indicates that no abnormality occurs when the first background data is written to the memory to be detected, and there is no abnormality in reading the above-mentioned first background data in the ascending order. If not, the first detection result indicates that there is an abnormality in reading the above-mentioned first background data in the ascending order.

[0050] Exemplarily, taking the first background data of 0F0F0F0F0F0F0F0F as an example, 0F0F0F0F0F0F0F0F is written word by word into the memory to be detected, and then the data of each word in the memory to be detected is detected in ascending order. If each word in the memory to be detected is 0F0F0F0F0F0F0F0F, then the first detection result indicates that there is no abnormality in the memory to be detected when writing the first background data, and there is no abnormality when reading each word in the memory to be detected in ascending order; if any word in the memory to be detected is not 0F0F0F0F0F0F0F0F, then the first detection result indicates that there is an abnormality in reading the word in ascending order (it may be an abnormality when writing or it may be an abnormality when reading).

[0051] It can be understood that the above steps realize initializing the memory to be detected, ensure that each word in the memory to be detected is written into the first background data, and realize verifying the correctness of the first background data in the memory to be detected in ascending order.

[0052] In some examples, after obtaining the first detection result, this example writes the second background data into the memory to be detected according to the first order, and after writing the second background data is completed, the value in the memory to be detected is re-detected according to the first order to obtain the second detection result; wherein, taking the second background data as F0F0F0F0F0F0F0F0 as an example, F0F0F0F0F0F0F0F0 is written into the memory to be detected according to the ascending order, and after writing is completed, the value in the memory to be detected is re-detected according to the first order to obtain the second detection result. If the above test result is that every word in the memory to be tested is F0F0F0F0F0F0F0F0, then the second test result indicates that there is no abnormality in writing and reading the above F0F0F0F0F0F0F0F0 in the memory to be tested in ascending order; conversely, if the above test result is that any word in the memory to be tested is not F0F0F0F0F0F0F0F0, then the second test result indicates that there is an abnormality in writing and / or reading the above F0F0F0F0F0F0F0F0 in the memory to be tested in ascending order.

[0053] It can be understood that the above steps realize the correctness of writing and reading the second background data in the ascending order, and realize the verification of whether the conversion from the first background data to the second background data is correct, and whether the writing of the first background data to the second background data is successful, and realize the determination of the integrity and correctness of the data in the memory to be detected, and realize the determination of whether there are address increment-related faults in the memory to be detected.

[0054] In some examples, the present example will also write the first background data into the memory to be detected according to the first sequence, wherein the step of writing the first background data according to the first sequence is not repeated here.

[0055] Continuing with the above example, after the writing of the first background data is completed, the value in the memory to be detected is re-detected according to the second order to obtain a third detection result, wherein each word in each memory to be detected is read in descending order, and it is checked whether the data in each word is the first background data, and it is determined whether there is an abnormality in reading the above-mentioned first background data in the descending order. If so, the above-mentioned third detection result indicates that there is no abnormality in reading the above-mentioned first background data in the descending order of the memory to be detected. If not, the third detection result indicates that there is an abnormality in reading the above-mentioned first background data in the descending order.

[0056] Exemplarily, taking the first background data of 0F0F0F0F0F0F0F0F as an example, 0F0F0F0F0F0F0F0F is written word by word into the memory to be detected in ascending order, and then the data of each word in the memory to be detected is detected in descending order. If each word in the memory to be detected is 0F0F0F0F0F0F0F0F, then the third detection result indicates that there is no abnormality when 0F0F0F0F0F0F0F0F is written to the memory to be detected in ascending order, and there is no abnormality when each word in the memory to be detected is read in descending order; if any word in the memory to be detected is not 0F0F0F0F0F0F0F0F, then the third detection result indicates that there is an abnormality when reading the word in descending order (it may be an abnormality when writing or it may be an abnormality when reading).

[0057] In some examples, the second background data is written into the memory to be detected according to the second order. Taking the second background data as F0F0F0F0F0F0F0F0 as an example, F0F0F0F0F0F0F0F0 is written into the memory to be detected in descending order, thereby modifying the data in the memory to be detected from the first background data to the second background data in descending order.

[0058] Continuing with the above example, after writing the second background data, the value in the memory to be tested is re-detected according to the second order to obtain a fourth test result, thereby realizing the correctness of reading and writing the second background data in descending order.

[0059] In some examples, this example will also write the first background data into the memory to be detected according to the second order. After the writing of the first background data is completed, the value in the memory to be detected is re-detected according to the second order to obtain a fifth detection result, thereby realizing the modification of the data in the memory to be detected from the second background data to the first background data in descending order, and determining the correctness of reading and writing the second background data in the memory to be detected in descending order.

[0060] It can be understood that in order to better understand the above steps S301 to S305, this embodiment provides a more specific example for illustration, as shown in Table 1 below. Table 1 shows the above steps of detecting the memory to be detected based on each background data respectively to obtain the detection results corresponding to each background data.

[0061] Table 1: Execution table of testing memory to be tested based on each background data

[0062]

[0063]

[0064] Among them, the above DB is the first background data, DBbar is the second background data, w_DB is writing the first background data, r_DB is reading the first background data, w_DBbar is writing the second background data, r_DBbar is reading the second background data, then the above M1 is writing the first background data in ascending order...M6 is reading the above first background data in ascending order.

[0065] Finally, this example determines the detection result corresponding to the background data based on the first detection result, the second detection result, the third detection result, the fourth detection result and the fifth detection result. Specifically, if any one of the first detection result, the second detection result, the third detection result, the fourth detection result and the fifth detection result indicates that there is an abnormality in the memory to be detected, then the detection result corresponding to the background data is that there is an abnormality in the memory to be detected; conversely, if the first detection result, the second detection result, the third detection result, the fourth detection result and the fifth detection result all indicate that there is no abnormality in the memory to be detected, then the detection result corresponding to the background data is that there is no abnormality in the memory to be detected.

[0066] It can be understood that the above method needs to be executed once for each background data, which will not be described in detail here.

[0067] It can be understood that the cycle diagnosis method for memory fault hard failure can also use the March algorithm, which has lower time complexity and higher fault coverage. During the test, the March algorithm traverses each storage unit in different ways (address increment or address decrement) and performs the same operation on all storage units during each traversal. Different traversal methods and storage unit operation methods can detect different types of faults, and the required test time is also different. The analysis of the March algorithm is shown in Table 2 below, and the memory diagnosis fault type table is shown in Table 3 below.

[0068] Table 2: March algorithm analysis table

[0069]

[0070]

[0071] Table 3: Memory diagnostic fault type table

[0072]

[0073] It can be understood that the detection data in the above March algorithm can be operated bit by bit, that is, only one bit in the memory to be detected is read and written each time. The method provided in this example can also be performed bit by bit, as shown in Table 2, where 0 is the first background data, 1 is the second background data, and similarly w0 is writing the first background data, r1 is reading the second background data, and the rest is similar, which will not be repeated here.

[0074] According to the technical solution provided in the embodiment of the present application, the above steps are used to verify the read and write operations of the memory to be tested, ensuring the correctness of the background data in different orders. By alternating read and write operations and increasing / decreasing sequential checks, various faults in the memory to be tested, such as inter-word coupling faults and intra-word coupling faults, can be effectively detected. This method can ensure the high reliability and data integrity of the memory to be tested.

[0075] In some embodiments, Figure 4 As shown, before detecting the memory to be detected based on each background data and obtaining the detection result corresponding to each background data, the method further includes:

[0076] S401, determining a detection area and a non-detection area from the memory to be detected, using data in the detection area as migration data, and migrating the migration data to the non-detection area;

[0077] S402, determining a first verification code corresponding to the migration data when the detection area stores the migration data, determining a second verification code corresponding to the migration data when the non-detection area stores the migration data, and verifying the migration data using the first verification code and the second verification code.

[0078] It can be understood that when the memory to be tested is tested, the data stored in the memory to be tested will be changed. In order to ensure the integrity and reliability of the data originally existing in the memory to be tested, this example divides the memory to be tested into a detection area and a non-detection area, among which the non-detection area is a security reserved area for storing the original data.

[0079] Specifically, this example determines the detection area and the non-detection area from the memory to be detected, wherein the detection area is the area that needs to be detected currently, and the non-detection area is the other area in the memory to be detected except the detection area. It can be understood that this embodiment determines the detection area according to the specified step distance period. For example, taking the step distance as X as an example, at the beginning, the area of ​​0-X in the memory to be detected is used as the detection area, and the other areas are used as non-detection areas; after the detection of 0-X is completed, the area of ​​X-2X is used as the detection area, and the other areas are used as non-detection areas, and so on.

[0080] After determining the detection area, this example uses the data in the detection area as migration data, and migrates the migration data to the non-detection area. In order to ensure the integrity and reliability of the migration data, this embodiment will determine the first verification code corresponding to the migration data when the detection area stores the migration data, and determine the second verification code corresponding to the migration data when the non-detection area stores the migration data, and verify the migration data through the first verification code and the second verification code. Specifically, if the first verification code and the second verification code are consistent, it indicates that there is no migration error in the migration data. If the first verification code and the second verification code are inconsistent, it indicates that there is a migration error in the migration data.

[0081] It is understandable that if there is a migration error in the migration data, the migration data is re-migrated, thereby ensuring the integrity and reliability of the data originally existing in the memory to be detected.

[0082] According to the technical solution provided in the embodiment of the present application, a detection area and a non-detection area are determined from the memory to be detected, the data in the detection area is used as migration data, and the migration data is migrated to the non-detection area; a first verification code corresponding to the migration data is determined when the detection area stores the migration data, and a second verification code corresponding to the migration data is determined when the non-detection area stores the migration data, and the migration data is verified by the first verification code and the second verification code, thereby achieving the problem of accurately determining whether there is a migration error in the data migrated from the detection area to the non-detection area, thereby ensuring the integrity and reliability of the data originally existing in the memory to be detected, and avoiding the problem that when a migration error occurs, the migration error cannot be accurately discovered, resulting in damage to the integrity and reliability of the migration data.

[0083] In some embodiments, Figure 5As shown, after the data in the detection area is used as migration data and the migration data is migrated to the non-detection area, the method further includes:

[0084] S501, after determining that the detection of the detection area is completed, migrate the migration data to the detection area, and re-determine the third verification code corresponding to the migration data when the detection area stores the migration data;

[0085] S502: Verify the migration data using the third verification code and the second verification code.

[0086] Specifically, after the detection of the detection area of ​​the memory to be detected is completed, in order to restore the migration data, this example also needs to migrate the migration data to the detection area.

[0087] After the migration data is migrated to the detection area, this example also needs to re-determine the third verification code corresponding to the migration data when the detection area stores the migration data, and then compare the third verification code with the second verification code. If the third verification code and the second verification code are the same, it is determined that the migration data verification has passed. If the third verification code and the second verification code are different, it is determined that the migration data verification has not passed. It can be understood that if there is a migration error in the migration data, the above migration data needs to be re-migrated, thereby ensuring the integrity and reliability of the migration data migrated back to the detection area.

[0088] In order to better understand this method, this embodiment provides a more specific example for illustration. The memory to be detected is used as a DDR variable area, and the detection area is detected according to the specified step distance cycle until the detection of all variable areas in the memory to be detected is completed as a complete detection cycle. Because the original stored information in the detection area will be changed when the detection area of ​​the memory to be detected is detected, before the current detection area is detected, the data in the detection area is first copied to the security reserve area (non-detection area) as migration data, and the security reserve area information is copied back to the original detection area after the detection is completed to ensure the integrity and reliability of the data in the detection area. In order to avoid copy errors in the process of copying the migration data from the detection area to the security reserve area and then copying it back to the detection area from the security reserve area, the detection area data is subjected to CRC32 verification before and after the copy is executed, and whether a copy error occurs is determined by judging whether the two verification values ​​are consistent.

[0089] According to the technical solution provided in the embodiment of the present application, after determining that the detection of the detection area is completed, the migration data is migrated to the detection area, and the third verification code corresponding to the migration data when the detection area stores the migration data is re-determined; the migration data is verified by the third verification code and the second verification code to ensure the integrity and reliability of the migration data migrated back to the detection area.

[0090] In some examples, such as Figure 6 As shown, the data in the detection area is used as migration data, and the migration data is migrated to the non-detection area, including:

[0091] S601, determining whether the migration data is running software, and when it is determined that the migration data is running software, defining a global structure based on the migration data, the global structure being used to store the migration data;

[0092] S602: construct a global structure in the non-detection area, and migrate the migration data stored in the detection area to the global structure of the non-detection area, so that the running software continues to run based on the migration data stored in the global structure of the non-detection area.

[0093] It can be understood that although the method provided in this example will migrate the migration data back to the detection area for recovery after destroying the data in the detection area, when the detection area happens to be the running software, if no measures are taken, the data in the detection area will be changed, which will cause the running software to be abnormal. Therefore, this example will first determine whether the migration data is the running software. When it is determined that the migration data is the running software, in order to ensure the normal execution of the running software, this example will define a global structure based on the migration data, and the global structure is used to store the migration data. It can be understood that the above-mentioned running software includes the software body and the parameters corresponding to the software.

[0094] In order to enable the above-mentioned running software to execute normally after migrating to the non-detection area, this example defines a global structure and migrates the migration data stored in the detection area to the global structure of the non-detection area, so that the running software continues to run based on the migration data stored in the global structure of the non-detection area.

[0095] In order to better understand the present method, this embodiment provides a more specific example for illustration. In this example, another division is performed on the memory to be detected, as shown in the following Table 4:

[0096] Table 4: Memory partition table to be tested

[0097]

[0098] As shown in Table 4 above, this example divides the memory to be tested into a software running area, a detection parameter storage area, a security reservation area, and a device tree data area.

[0099] Among them, the software running area is the system code execution area, and the code corresponding to the memory diagnostic method provided in this example is also executed in this area. Although the method provided in this example will migrate the migrated data back to the detection area for recovery after destroying the data in the detection area, when the detection area happens to be the above-mentioned software running area, if no measures are taken, the data in the detection area will be changed, which will cause the system or memory diagnostic method to run abnormally. The function call information, function parameters, local variables, etc. corresponding to the system or memory diagnostic method in the software running area belong to the stack segment. If the stack segment is changed, it will cause the system and / or memory diagnostic method to run abnormally.

[0100] Exemplarily, in order to avoid abnormal operation of the memory diagnosis method due to the stack segment being changed when the memory diagnosis method is executed, the execution part of the code of the memory diagnosis method uses a for loop to perform method detection step by step without adding function calls. The variables used in this part of the code are uniformly defined in a global structure s_stRamMessage, which is stored in the data segment.

[0101] When the software running area is used as the detection area, the above detection parameter storage area, security reserve area and device tree data area are used as non-detection areas, wherein a structure pX_BLOCK memory area consistent with s_stRamMessage is defined in the detection parameter storage area by means of a custom segment. When the software running area is detected or when the detection reaches the area where the data segment structure s_stRamMessage is located, the content of stRamMessage is first copied to pX_BLOCK, and then the step of "detecting the memory to be detected based on each background data" is executed. At this time, the memory diagnosis method uses variables to use the information in pX_BLOCK to avoid the information in stRamMessage being changed and affecting the execution of the memory diagnosis method. After the detection of the area where the structure s_stRamMessage is located is completed, the content of pX_BLOCK is copied back to stRamMessage, and the information in stRamMessage continues to be used to perform detection of subsequent areas.

[0102] Because pX_BLOCK is located in the detection parameter storage area, and s_stRamMessage is located in the system data area, the detection of pX_BLOCK and s_stRamMessage will not be detected at the same time. Therefore, it is safe to call the information in pX_BLOCK during the detection process of the software running area, and it will not be changed during the detection execution process.

[0103] like Figure 7 As shown, Figure 7The figure shows a basic schematic diagram of memory diagnosis for a global structure provided by this example. This example first determines whether the detection area is the global structure stRamMessage area. If so, the data in stRamMessage is copied to pX_block, and the variables in the structure pX_block are used to perform memory diagnosis. After the diagnosis is completed, the information in pX_block is copied back to stRamMessage, and the DSB instruction is executed to ensure that the above memory operations are completed. Then the detection area is updated to the next detection segment to determine whether the detection of the current detection area is completed. If so, the detection is determined to be completed and the process ends. If not, it is re-determined whether the detection area is the global structure stRamMessage area; when it is determined that the detection area is not the global structure stRamMessage area, the variables in the structure srRamMessage can be directly used to perform memory diagnosis.

[0104] Among them, when the memory diagnosis method detects the memory to be detected, a cache refresh operation is performed on the current area after each write operation is completed, and the information written into the cache is updated into the memory to be detected. At the same time, it is ensured that the data read out in the next read operation on the address area comes from the updated data in the memory to be detected.

[0105] According to the technical solution provided in the embodiment of the present application, it is determined whether the migration data is the running software. When it is determined that the migration data is the running software, a global structure is defined based on the migration data, and the global structure is used to store the migration data. A global structure is constructed in the non-detection area, and the migration data stored in the detection area is migrated to the global structure of the non-detection area, so that the running software continues to run based on the migration data stored in the global structure of the non-detection area, thereby ensuring the stability of the diagnosis of the memory to be detected and avoiding the problem of failure of the diagnosis of the memory to be detected due to modification of the data of the running software.

[0106] In some examples, such as Figure 8 As shown, multiple background data are generated according to the bit length of the memory to be detected, including:

[0107] S801, inputting the bit length of the memory to be detected into the quantity determination formula to determine the generated quantity;

[0108] S802: Generate corresponding background data according to the generated quantity.

[0109] Specifically, the quantity determination formula is as follows:

[0110] K = log2W + 1;

[0111] Among them, K is the number of generation, and W is the bit length of the memory to be detected.

[0112] For example, taking the bit length of the memory to be detected as 64 as an example, substituting 64 into the above quantity determination formula to obtain a generated quantity of 7, and then generating 7 background data. For example, the 7 background data can be shown in the following Table 5:

[0113] Table 5: Background data table

[0114]

[0115]

[0116] The DB is the first background data, and DBbar is the second background data. Taking the first row of Table 5 as an example, the background data in the first row consists of the first background data 0000000000000000 and the second background data FFFFFFFFFFFFFFFF.

[0117] According to the technical solution provided in the embodiment of the present application, the bit length of the memory to be detected is input into the quantity determination formula to determine the generated quantity; the corresponding background data is generated according to the generated quantity, so that the generated multiple background data can cover all adjacent states of 0 and 1 of the memory to be detected, thereby improving the accuracy and completeness of the detection of the memory to be detected.

[0118] In some examples, such as Fig. 9 As shown, after determining the diagnosis result of the memory to be tested based on each of the test results, the method further includes:

[0119] S901. Transmit the diagnosis result to the application program in the user mode running environment.

[0120] It can be understood that the memory diagnosis method provided in this example is designed based on the system security requirements, with the purpose of ensuring that the memory environment on which the system depends is correct, and also ensuring that in the event of a memory failure in the system, the exception can be captured in time and the system can be guided into the fault handling process. A diagnostic module is added to the microkernel operating system, and a microkernel operation memory fault diagnosis interface is provided to the application layer. The application layer designs the timing of calling the memory fault diagnosis interface according to the requirements of the application system.

[0121] like Fig.10As shown, when the microkernel operating system detects a memory fault, it reports the address information of the memory fault layer by layer until it is reported to the application layer of the system, and performs preset fault processing based on the fault information. Specifically, after the microkernel performs memory diagnosis, when a memory fault occurs, the address information of the memory fault (diagnosis result) is reported to the microkernel function extension layer, the microkernel function fault layer reports the address information of the memory fault to the application development interface layer, and the application development interface layer reports the address information of the memory fault to the application layer, thereby enabling the application layer to obtain the address information of the memory fault.

[0122] According to the technical solution provided in the embodiment of the present application, the diagnosis result is transmitted to the application program in the user mode operating environment, so that the system can perform fault processing according to the specific fault information, thereby improving the reliability of the memory to be detected.

[0123] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0124] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0125] This embodiment also provides a memory diagnostic device, such as Fig.11 As shown, the device comprises:

[0126] System module 1101, used to enter kernel mode running environment when an application in user mode running environment calls a system diagnostic interface, the system diagnostic interface is used to diagnose the memory to be tested;

[0127] A generating module 1102, used for generating a plurality of background data according to the bit length of the memory to be detected when in the kernel state running environment;

[0128] The detection module 1103 is used to detect the memory to be detected based on each background data, obtain the detection result corresponding to each background data, and determine the diagnosis result of the memory to be detected based on each detection result.

[0129] In some examples, each background data includes first background data and second background data, and the second background data is data obtained by negating the first background data; the detection module 1103 is also used to write the first background data into the memory to be detected, and after writing the first background data, detect the value in the memory to be detected according to the first order to obtain a first detection result; write the second background data into the memory to be detected according to the first order, and after writing the second background data, re-detect the value in the memory to be detected according to the first order to obtain a second detection result; write the first background data into the memory to be detected according to the first order, and after writing the first background data, re-detect the value in the memory to be detected according to the second order to obtain a third detection result, the second order is an order opposite to the first order; write the second background data into the memory to be detected according to the second order, and after writing the second background data, re-detect the value in the memory to be detected according to the second order to obtain a fourth detection result; write the first background data into the memory to be detected according to the second order, and after writing the first background data, re-detect the value in the memory to be detected according to the second order to obtain a fifth detection result; determine the detection result corresponding to the background data according to the first detection result, the second detection result, the third detection result, the fourth detection result and the fifth detection result.

[0130] In some examples, the detection module 1103 is also used to determine a detection area and a non-detection area from the memory to be detected, use the data in the detection area as migration data, and migrate the migration data to the non-detection area; determine a first verification code corresponding to the migration data when the detection area stores the migration data, and determine a second verification code corresponding to the migration data when the non-detection area stores the migration data, and verify the migration data using the first verification code and the second verification code.

[0131] In some examples, the detection module 1103 is also used to migrate the migration data to the detection area after the detection of the detection area is completed, and re-determine the third verification code corresponding to the migration data when the detection area stores the migration data; and verify the migration data using the third verification code and the second verification code.

[0132] In some examples, the detection module 1103 is also used to determine whether the migration data is running software. When it is determined that the migration data is running software, a global structure is defined based on the migration data, and the global structure is used to store the migration data; a global structure is constructed in a non-detection area, and the migration data stored in the detection area is migrated to the global structure of the non-detection area, so that the running software continues to run based on the migration data stored in the global structure of the non-detection area.

[0133] In some examples, the generation module 1102 is also used to input the bit length of the memory to be detected into the quantity determination formula to determine the generation quantity, and the quantity determination formula is as follows: K=log2W+1; wherein K is the generation quantity and W is the bit length of the memory to be detected; and the corresponding background data is generated according to the generation quantity.

[0134] In some examples, the detection module 1103 is also used to transmit the diagnosis result to the application in the user mode running environment.

[0135] According to the technical solution provided by the embodiment of the present application, the memory diagnostic device provided by the present embodiment enters the kernel state operating environment when the application in the user state operating environment calls the system diagnostic interface, and the system diagnostic interface is used to diagnose the memory to be detected; when in the kernel state operating environment, multiple background data are generated according to the bit length of the memory to be detected; the memory to be detected is detected based on each background data respectively, and the detection result corresponding to each background data is obtained, and the diagnosis result of the memory to be detected is determined based on each detection result, wherein, by pre-setting a system diagnostic interface, when the application in the user state operating environment calls the system diagnostic interface, the microkernel system can enter the kernel state operating environment, so that subsequent memory diagnosis can be complete for the memory to be detected. The memory is tested, which avoids the problem that the user-state application cannot completely diagnose the memory to be tested due to lack of permissions in the user-state environment, resulting in poor diagnostic effect. In addition, in this example, multiple background data are generated according to the bit length of the memory to be tested, so that the generated multiple background data can cover different adjacent states of 0 and 1 in the memory to be tested. Subsequently, the memory to be tested is tested separately through each background data, so as to achieve the effect of comprehensive and accurate detection of the memory to be tested. Finally, the diagnosis result of the memory to be tested is confirmed according to the detection result corresponding to each background data, thereby improving the accuracy and completeness of the diagnosis of the memory to be tested, and avoiding the problem that the memory to be tested cannot be accurately and completely diagnosed in the related technology, resulting in poor diagnostic effect.

[0136] Fig.12 Schematic diagram of an electronic device 12 provided in an embodiment of the present application. Fig.12 As shown, the electronic device 12 of this embodiment includes: a processor 1201, a memory 1202, and a computer program 1203 stored in the memory 1202 and executable on the processor 1201. When the processor 1201 executes the computer program 1203, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1201 executes the computer program 1203, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0137] The electronic device 12 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 12 may include, but is not limited to, a processor 1201 and a memory 1202. Those skilled in the art will appreciate that Fig.12 The electronic device 12 is merely an example and does not limit the electronic device 12 , and may include more or fewer components than those shown in the figure, or different components.

[0138] Processor 1201 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0139] The memory 1202 may be an internal storage unit of the electronic device 12, for example, a hard disk or memory of the electronic device 12. The memory 1202 may also be an external storage device of the electronic device 12, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FlashCard), etc. equipped on the electronic device 12. The memory 1202 may also include both an internal storage unit of the electronic device 12 and an external storage device. The memory 1202 is used to store computer programs and other programs and data required by the electronic device.

[0140] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0141] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of regional requirements and patent practice. For example, in some areas, according to regional requirements and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0142] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A memory diagnostic method, characterized in that: The method comprises: When an application in a user-mode operating environment calls a system diagnostic interface, a kernel-mode operating environment is entered, wherein the system diagnostic interface is used to diagnose the memory to be detected; When in the kernel state running environment, generating a plurality of background data according to the bit length of the memory to be detected; The memory to be detected is detected based on each of the background data to obtain a detection result corresponding to each of the background data, and a diagnosis result of the memory to be detected is determined based on each of the detection results.

2. The method according to claim 1, characterized in that Each of the background data includes first background data and second background data, wherein the second background data is data obtained by negating the first background data; The memory to be detected is detected based on each of the background data to obtain a detection result corresponding to each of the background data, including: Writing the first background data into the memory to be detected, and after writing the first background data, detecting the value in the memory to be detected according to a first sequence to obtain a first detection result; Writing the second background data into the memory to be detected according to the first sequence, and after writing the second background data, re-detecting the value in the memory to be detected according to the first sequence to obtain a second detection result; Writing the first background data into the memory to be detected according to the first sequence, and after writing the first background data, re-detecting the value in the memory to be detected according to a second sequence to obtain a third detection result, wherein the second sequence is an order opposite to the first sequence; Writing the second background data into the memory to be detected according to the second sequence, and after writing the second background data, re-detecting the value in the memory to be detected according to the second sequence to obtain a fourth detection result; Writing the first background data into the memory to be detected according to the second sequence, and after writing the first background data, re-detecting the value in the memory to be detected according to the second sequence to obtain a fifth detection result; The detection result corresponding to the background data is determined according to the first detection result, the second detection result, the third detection result, the fourth detection result, and the fifth detection result.

3. The method according to claim 1, characterized in that Before detecting the memory to be detected based on each of the background data and obtaining the detection result corresponding to each of the background data, the method further includes: Determine a detection area and a non-detection area from the memory to be detected, use data in the detection area as migration data, and migrate the migration data to the non-detection area; Determine a first verification code corresponding to the migration data when the detection area stores the migration data, determine a second verification code corresponding to the migration data when the non-detection area stores the migration data, and verify the migration data using the first verification code and the second verification code.

4. The method according to claim 3, characterized in that After using the data in the detection area as migration data and migrating the migration data to the non-detection area, the method further includes: After determining that the detection of the detection area is completed, migrating the migration data to the detection area, and re-determining a third check code corresponding to the migration data when the detection area stores the migration data; The migration data is verified by using the third verification code and the second verification code.

5. The method according to claim 3, characterized in that: Using the data in the detection area as migration data, and migrating the migration data to the non-detection area, comprises: Determining whether the migration data is running software, and when it is determined that the migration data is running software, defining a global structure based on the migration data, wherein the global structure is used to store the migration data; The global structure is constructed in the non-detection area, and the migration data stored in the detection area is migrated to the global structure of the non-detection area, so that the running software continues to run based on the migration data stored in the global structure of the non-detection area.

6. The method according to claim 5, characterized in that Generate multiple background data according to the bit length of the memory to be detected, including: The bit length of the memory to be detected is input into the quantity determination formula to determine the generated quantity. The quantity determination formula is as follows: K = log2W + 1; Wherein, K is the number of generated bits, and W is the bit length of the memory to be detected; The corresponding background data is generated according to the generated quantity.

7. The method according to claim 1, characterized in that After determining the diagnosis result of the memory to be tested based on each of the test results, the method further includes: The diagnostic result is transmitted to the application program in the user mode operating environment.

8. A memory diagnostic device, characterized in that: The device comprises: A system module, used to enter a kernel state operating environment when an application in a user state operating environment calls a system diagnostic interface, wherein the system diagnostic interface is used to diagnose a memory to be detected; A generating module, used for generating a plurality of background data according to the bit length of the memory to be detected when in a kernel state running environment; The detection module is used to detect the memory to be detected based on each of the background data, obtain the detection result corresponding to each of the background data, and determine the diagnosis result of the memory to be detected based on each of the detection results.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.