Address management method and device

By identifying the original virtual address before the virtual address error is reported in the mobile device and isolating the faulty physical memory area, the problem of cycle collapse caused by RAM multi-bit jumps or memory failures is solved, reducing the need to replace equipment or motherboards, and achieving low cost. , Troubleshooting with low performance loss.

CN113515405BActive Publication Date: 2024-10-29VIVO MOBILE COMM CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202110782421.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-09
Publication Date
2024-10-29
Estimated Expiration
2041-07-09

AI Technical Summary

Technical Problem

When RAM hardware problems in mobile devices lead to multi-bit jumps or memory failures, existing technologies cannot effectively solve the problem, causing the device to cycle and crash. Users need to replace the device or motherboard, and the existing solutions are expensive or require high performance, so they are not applicable Poor sex.

Method used

By determining whether a virtual address belongs to a hole space when an error occurs, identifying the original virtual address before the error is reported, and isolating the corresponding target physical memory area to avoid access again, achieving software-based fault isolation, reducing costs and performance losses. .

Benefits of technology

It effectively avoids the cycle crash caused by the faulty physical memory area in RAM being accessed again, reducing the need to replace equipment or motherboards, and does not require additional hardware support. The system performance loss is low and the fluency is good.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113515405B_ABST
    Figure CN113515405B_ABST
Patent Text Reader

Abstract

The present application discloses an address management method and device, belonging to the field of electronic equipment. The method comprises: in the case of a first virtual address reporting an error, if the first virtual address belongs to a hole space of a virtual address, determining a second virtual address before the first virtual address reports an error, wherein the second virtual address is a virtual address in a user space or a kernel space; isolating a target physical memory area corresponding to the second virtual address.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of electronic equipment, and specifically relates to an address management method and device. Background Art

[0002] RAM (Random Access Memory) is an essential core component of many electronic devices. In mobile devices such as mobile phones, RAM hardware problems generally lead to system errors, which can cause program crashes at the least and even cause the entire system to crash and user data to be lost at the worst.

[0003] For RAM hardware problems, traditional solutions include the following two:

[0004] (1) ECC (Error Correcting Code) RAM: The ECC algorithm is used to correct single-bit transition errors in RAM. However, for multi-bit transition problems, this method can only report an error but cannot correct it. The correction capability is limited and a separate hardware detection unit is required. It is expensive and is generally used in servers and important devices with large memory.

[0005] (2) Hwpoison (a detection program) and memory isolation: Figure 1 As shown, Hwpoison can mark the physical memory with faults in RAM (here is the physical page Page3). After detecting the faulty page, the memory failure program can first kill process A and process B that use Page3, and delete the mapping between the physical memory and virtual memory of Page3. Finally, Page3 is added to the isolation space. Although this method can detect the multi-bit jump problem of RAM, it detects whether there is a faulty page before the application accesses the memory, so the application needs to wait to access the memory. Therefore, this real-time detection method of runtime detection is more performance-intensive and is not suitable for embedded systems such as mobile phones, which may cause system freezes.

[0006] In summary, existing solutions are not applicable to embedded mobile devices such as mobile phones due to limited detection capabilities, high prices, and performance consumption. When there are multi-bit jumps in the RAM of a mobile device or a hardware problem in a certain memory block, the mobile device will crash cyclically, and users can only replace the board or the device. Summary of the invention

[0007] The purpose of the embodiments of the present application is to provide an address management method and device, which can solve the problem in the related art that when there are multi-bit jumps in the RAM of the mobile device or a hardware problem in a certain memory block, the mobile device will crash cyclically and the user can only replace the board or replace the device.

[0008] In a first aspect, an embodiment of the present application provides an address management method, the method comprising:

[0009] In the case where there is a first virtual address reporting an error, if the first virtual address belongs to a hole space of a virtual address, determining a second virtual address before the first virtual address reports an error, wherein the second virtual address is a virtual address in a user space or a kernel space;

[0010] The target physical memory area corresponding to the second virtual address is isolated.

[0011] In a second aspect, an embodiment of the present application provides an address management device, the device comprising:

[0012] A first determination module is used to determine, in the case where there is a first virtual address reporting an error, a second virtual address before the first virtual address reports an error if the first virtual address belongs to a hole space of a virtual address, wherein the second virtual address is a virtual address in a user space or a kernel space;

[0013] An isolation module is used to isolate the target physical memory area corresponding to the second virtual address.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0015] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0016] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0017] In an embodiment of the present application, when an error occurs when an object accesses the first virtual address of the virtual memory, it can be determined whether the first virtual address of the error belongs to the empty space of the system's virtual memory. If the first virtual address belongs to the empty space, it means that there is a high probability that a hardware failure or a multi-bit jump has occurred in the RAM, because the valid virtual address used normally does not belong to the virtual address in the empty space. Therefore, the possible original virtual address before the first virtual address reports an error, that is, the second virtual address, can be identified. Before the virtual address error occurs, the original virtual address used by the user's application or kernel code to access the memory must belong to the user space or kernel space. Therefore, the second virtual address is a virtual address belonging to the user space or kernel space generated by the conversion of the first virtual address. Then, the target physical memory area corresponding to the second virtual address is isolated, so as to avoid the situation where the target physical memory area with fault in the RAM reports an error again due to being accessed again, resulting in a cyclic crash and freeze. Even if there is a physical memory failure of one or more bits, the physical memory block has been isolated when the failure is first discovered and can no longer be accessed and used. Therefore, it will not affect the subsequent use of the physical memory, and the user does not need to replace the motherboard or replace the device. Moreover, in the above technical solution, no additional hardware support is required, which can reduce costs. In addition, the triggering of the method is executed when the virtual address of the error is detected, and there is no need to detect in real time whether there is a faulty physical memory. Therefore, the loss of system performance is low, it is not easy to cause system jams, and the system fluency is good. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a flow chart of an address management method in traditional technology;

[0019] Figure 2 is a flow chart of an address management method according to an embodiment of the present application;

[0020] Figure 3 is a flowchart of an address management method according to another embodiment of the present application;

[0021] Figure 4 is a flow chart of an address management method according to another embodiment of the present application;

[0022] Figure 5 is a block diagram of an address management device according to an embodiment of the present application;

[0023] Figure 6 It is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application;

[0024] Figure 7 It is a schematic diagram of the hardware structure of an electronic device according to another embodiment of the present application. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0026] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0027] In mobile devices such as mobile phones, hardware problems with RAM and ROM (Read-Only Memory) generally lead to system errors, which may cause program crashes or even cause the entire system to crash and user data to be lost. Therefore, hardware problems such as RAM / ROM need to be solved urgently. In different systems and architectures, RAM / ROM has certain error detection and correction and bad block management functions, which can effectively reduce problems such as data corruption and loss.

[0028] (1) Error detection and correction: For data corruption caused by hardware problems, some algorithms can be used to correct the errors.

[0029] (2) Bad-block management: If a unit circuit in the hardware is damaged due to a short circuit or other reasons, these bad-blocks can be marked as unavailable and then managed in a unified manner.

[0030] For ROM, functions such as error detection and correction and bad block management have been widely used, but there are relatively few existing solutions for RAM hardware problems. Among them, the ECC method applicable to RAM cannot solve the problem of multi-bit transitions; while Hwposion and memory isolation methods consume more performance and are prone to cause jamming.

[0031] Then if a small piece of memory hardware in the RAM has an error or there are multi-bit jumps, it will cause the entire machine to crash. Considering that users of mobile devices can tolerate an occasional crash and restart, the inventors found in the process of implementing this application that if the physical memory with the error is used again, it will cause a crash again, resulting in a high probability of cyclic crashes, which will be unbearable for users. To this end, the present application provides an address management method, which can identify the physical address of the problematic memory by software after the RAM hardware has a problem and reports an error for the first time, and isolate the physical memory that reports the error, so that the isolated physical memory is inaccessible to the system, avoiding the high probability of crashing and restarting of the mobile device. The method is implemented by software, does not require hardware support, and does not require real-time detection. Therefore, there is almost no loss in performance and will not cause system freezes.

[0032] The address management method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0033] Reference Figure 1 , shows a flow chart of an address management method according to an embodiment of the present application, and the method may specifically include step 101 and step 102:

[0034] Step 101, in the case where there is a first virtual address reporting an error, if the first virtual address belongs to a hole space of a virtual address, determining a second virtual address before the first virtual address reports an error, wherein the second virtual address is a virtual address in a user space or a kernel space;

[0035] The method of the embodiment of the present application is directed to a 64-bit or higher operating system, because there is no hole space in the virtual memory of an operating system lower than 64 bits, and in the case of an operating system higher than 64 bits, the virtual memory space of the system includes not only user space and kernel space, but also some space that is not occupied and belongs to redundant space, which is referred to as hole space. The user space is for the user's application to execute, and the kernel space is for the kernel code to run.

[0036] Among them, the virtual addresses in the hole space can be called invalid virtual addresses, and the virtual addresses in the user space and the kernel space can be called valid virtual addresses.

[0037] Then, when an error occurs when the object accesses the first virtual address of the virtual memory, it can be determined whether the first virtual address of the error belongs to the empty space of the system's virtual memory. If the first virtual address belongs to the empty space, it means that there is a high probability that the RAM has a hardware failure or a multi-bit jump, because the valid virtual address used normally does not belong to the virtual address in the empty space. Therefore, the possible original virtual address before the first virtual address error occurs can be identified, that is, the second virtual address. Before the virtual address error occurs, the original virtual address used by the user's application or kernel code to access the memory must belong to the user space or kernel space. Therefore, the second virtual address is a virtual address belonging to the user space or kernel space generated by the conversion of the first virtual address.

[0038] Optionally, before step 101, the method according to the embodiment of the present application may further include: determining the address range of the user space, the address range of the kernel space and the address range of the hole space of the virtual address according to the system configuration information of the virtual address space.

[0039] Among them, during the boot process of the mobile device, the method of the embodiment of the present application can check how many bits the system's virtual address space is configured to be, that is, the address space size of the virtual memory (or the hardware addressing capability of the RAM). For example, the address space size of ARM64 (Advanced RISC Machines, an ARM chip, a type of RAM) is 64 bits.

[0040] It should be noted that the system targeted by the method of the embodiment of the present application is at least 64 bits, because there is no redundant address space, i.e., hole space, in the memory below 64 bits, and the method of the embodiment of the present application needs to use the hole space to correct the virtual address of the error report;

[0041] In addition, the software addressing capability of RAM in an embedded system can be obtained by reading CONFIG_ARM64_VA_BITS (abbreviated as Vbit), for example, Vbit = 39, that is, 39 bits. With the help of the above two configuration information, the effective virtual address range of virtual memory can be determined. Here, the virtual addresses of user space and kernel space are the effective virtual address range. The virtual address layout is as follows:

[0042] The virtual address range KVAddr of kernel space is: (2^64-2^39)~(2^64), corresponding to hexadecimal, KVAddr is 0xFFFFFF8000000000~0xFFFFFFFFFFFFFFFF;

[0043] The prefix 0x is used to represent hexadecimal.

[0044] The address specification of the hexadecimal address range of KVAddr is: at least the upper 6 bits are all F.

[0045] The virtual address range UVAddr of user space is: 0~2^39, corresponding to hexadecimal, UVAddr is 0~0x8000000000;

[0046] Among them, the maximum hexadecimal address of UVAddr is 8000000000, which is a total of 10 bits. It is unified with the hexadecimal 16-bit address of KVAddr. The first 6 bits from the high-order 10 bits "8" onwards are 0. Therefore, the address specification of the hexadecimal 16-bit address range of UVAddr is that at least the first 6 bits are 0.

[0047] Of course, this is a 64-bit operating system, and Vbit=39. If it is a higher-bit operating system such as a 128-bit operating system, the value of Vbit is not 39, then the address specifications of the hexadecimal address range of KVAddr and the hexadecimal address range of UVAddr can be different from the above example, with at least the first 6 bits being F or 0.

[0048] Specifically, when the virtual address space is M bits, and the parameter Vbit, at least the first X bits of the effective virtual address represented in hexadecimal are F or 0, where the functional relationship is X=(M-Vbit) / 4, where the value of X is the integer result of (M-Vbit) / 4. When M is 128 and Vbit=39, at least the first 22 bits of the effective virtual address represented in hexadecimal are 0 or F.

[0049] The virtual address range NVAddr of the hole space is: 2^39~(2^64-2^39), corresponding to hexadecimal, NVAddr is 0x8000000000~0xFFFFFF8000000000. The virtual addresses in the hole space are not used. Applications access the virtual memory of the user space, and kernel code accesses the virtual memory of the kernel space. That is, the virtual addresses used should not belong to the hole space. If they do, it means that the virtual address is changed from the virtual address of the user space or the virtual address of the kernel space to the virtual address of the hole space due to an error (such as a jump or hardware failure or a memory corruption).

[0050] In addition, when determining the address ranges of the above three types of spaces, the address range of the kernel space and the address range of the user space can be determined first, and then the remaining space in the 64-bit storage space can be determined as the address range of the hole space.

[0051] In the embodiments of the present application, the address ranges of the user space, kernel space, and hole space of the virtual address can be determined according to the system configuration information of the virtual address space, so as to facilitate the reverse deduction and correction of the reported virtual address based on the formats and specifications of the address ranges of various spaces, and determine the virtual address that may be correct before the error is reported.

[0052] Optionally, when determining the second virtual address before the first virtual address reports an error, the second virtual address before the first virtual address reports an error can be determined according to the address range of the user space and the address range of the kernel space.

[0053] Among them, whether it is the user space of virtual memory or the kernel space of virtual memory, they both have their own address ranges of virtual addresses, and there are certain specifications for the address ranges of the user space and the kernel space. For example, in a 64-bit operating system, when the parameter value of CONFIG_ARM64_VA_BITS is 39 bits, referring to the examples in the above embodiments, it can be determined that the address specification of the hexadecimal address range of KVAddr is: at least the first 6 bits are all F; the address specification of the 16-bit hexadecimal address range of UVAddr is that at least the first 6 bits are all 0.

[0054] Then, according to the specifications of the address ranges of these two address spaces, the original virtual address before the reported first virtual address reports an error can be determined.

[0055] For example, in a 64-bit system, CONFIG_ARM64_VA_BITS = 39, and the page size is 4096 bytes;

[0056] Among them, page size: the page size, generally set to 4KB, is the smallest management unit of memory;

[0057] page shift: page size = 1 << page shift, where page shift is 12;

[0058] KVAddr is 0xFFFFFF8000000000 to 0xFFFFFFFFFFFFFFFF;

[0059] UVAddr is 0 to 0x8000000000;

[0060] NVAddr is 0x8000000000 to 0xFFFFFF8000000000;

[0061] Such as Figure 3As shown, the physical memory can be divided into 10 pages. The physical memory and the virtual memory can be mapped through Page. The virtual memory here shows the virtual memory of the user space and the virtual memory of the kernel space.

[0062] Example 1: The upper-layer application reports an error when accessing the virtual address 0x0021000074121000. After judgment, the virtual address of the error belongs to the address range of NVAddr in the above three types of space: 0x8000000000~0xFFFFFF8000000000. Therefore, the upper 6 bits of the virtual address of the error are all "0" except "2" and "1", which means that the virtual address of the error may be caused by an error in a virtual address in the user space. Therefore, based on the specification of the virtual address range of the user space: the upper 6 bits are 0, it can be inferred that the correct virtual address of 0x0021000074121000 before the error occurs (that is, the original virtual address, the above-mentioned second virtual address) is 0x0000000074121000.

[0063] The second virtual address is a possible correct virtual address because the original virtual address before the first virtual address reports an error may also be a 16-bit hexadecimal virtual address where bits other than the first 6 bits jump or are wrong, resulting in the above 0x0021000074121000.

[0064] Example 2: The kernel layer reports an error when accessing the virtual address 0xff21ff0074121000. 0xff21ff0074121000 belongs to the hole NVAddr: 0x8000000000~0xFFFFFF8000000000. Then the possible original virtual address (i.e., the second virtual address) before the error of 0xff21ff0074121000 is 0xffffff0074121000.

[0065] In an embodiment of the present application, when an error occurs when accessing the first virtual address, if the first virtual address belongs to a hole in the virtual address space, it means that the original virtual address of the first virtual address before the error occurs, that is, the second virtual address belongs to the user space or the kernel space. In order to determine the second virtual address, it is possible to determine which space of the user space and the kernel space the second virtual address may belong to based on the address ranges of the virtual addresses of the user space and the kernel space, as well as the specific content of the first virtual address. After determining the address space to which the second virtual address may belong, it is possible to determine the second virtual address of the first virtual address before the error occurs. The present application can use the address ranges of the virtual addresses of the user space and the kernel space to reversely determine the second virtual address that may be correct before the error occurs for the first virtual address that has an error, thereby facilitating the finding of a faulty physical memory block in the memory for isolation, thereby avoiding repeated access to the faulty memory block and causing a high probability of machine cycle crashes.

[0066] Step 102: Isolate the target physical memory area corresponding to the second virtual address.

[0067] Among them, since there is a mapping relationship between the physical memory and the virtual memory, the second virtual address of the virtual memory can be used to find the corresponding target physical address based on the mapping relationship, so as to isolate the target physical memory area pointed to by the target physical address in the physical memory.

[0068] For example, Figure 3 As shown, the faulty physical memory corresponding to the second virtual address (0x0000000074121000, and / or 0xffffff0074121000) can be determined, and then the faulty physical memory can be isolated.

[0069] Optionally, when executing step 102, if the second virtual address exists in the candidate physical addresses of the physical memory, the target physical memory area pointed to by the target physical address can be isolated, wherein the target physical address is the physical address of the memory area in the physical memory that has a mapping relationship with the second virtual address.

[0070] Among them, each physical address of the physical memory is named here as each candidate physical address. Since there is a mapping relationship between the physical address of the physical memory and the virtual address of the virtual memory, if the effective virtual address obtained by reverse deduction, that is, the second virtual address, has a target physical address with a mapping relationship, it means that the determined second virtual address is the original virtual address of the correct first virtual address before the error occurs. Therefore, it can be determined that the target physical memory area pointed to by the target physical address in the physical memory (that is, RAM) has a hardware problem or a multi-bit jump. In order to avoid the target physical memory area from being called and used again, causing the mobile device to shut down cyclically, the target physical memory area can be isolated.

[0071] In the embodiment of the present application, in order to further ensure the effective virtual address determined for the first virtual address, here the second virtual address is the accurate original virtual address before the first virtual address reports an error, it can be determined whether the second virtual address has a target physical address with which it has a mapping relationship, so as to improve the accuracy of the determined second virtual address. If so, it means that the second virtual address is an accurate and effective virtual address before the error is reported, and in order to avoid the physical memory block pointed to by the second virtual address being used again and causing an error loop crash, the target physical memory block pointed to by the target physical address in the physical memory can be isolated, thereby reducing the probability of device loop crashes caused by RAM hardware problems or multi-bit jumps.

[0072] Optionally, when isolating the target physical memory area pointed to by the target physical address, it can be achieved through steps 201, 202, and 203:

[0073] Step 201, saving the target physical page frame corresponding to the target physical address to the first storage area;

[0074] Among them, the page frame number (pfn) of the physical page frame is the unique identifier of the physical page frame;

[0075] The relationship between the physical address PAddr and pfn is: pfn = PAddr >> page shift;

[0076] page size=1< <page shift;

[0077] Therefore, each physical address of the RAM can correspond to a unique physical page frame, that is, the specific information of the physical address can be determined by pfn. Therefore, this step can use the logical relationship between the physical address and the physical page frame to obtain the target physical page frame corresponding to the target physical address. Specifically, the page frame number of the target physical page frame can be saved in the first storage area.

[0078] Among them, the first storage area is a storage area in the ROM, such as partition PartA. Here, the pfn of the physical memory block that reports an error is saved in the ROM. The reason is that when the device is powered off, the data in the ROM will not be lost, thereby ensuring that the pfn of the physical memory block that reported an error before can be obtained at any time by reading the first storage area in the ROM.

[0079] In an example, the first storage area is a partition of a fixed size configured in the ROM, for example, a pfn that can store MAX_ADDR physical addresses.

[0080] Step 202, during the initialization of the physical memory allocator, determining each of the target physical addresses pointed to by each of the target physical page frames in the first storage area, and target page information of each of the target physical addresses;

[0081] In one example, after step 201, the method of the embodiment of the present application can report an error and restart the mobile device. Then, after the mobile device is restarted and before the physical memory allocator is initialized, the method of the embodiment of the present application can read the pfn of the physical address of the error from PartA into RAM, for example, ARRY of RAM, where ARRY can be an array or a linked list;

[0082] Then, the physical memory allocator is initialized;

[0083] During the initialization of the physical memory allocator, the physical memory allocator can traverse the physical page frames of the physical memory (i.e., RAM) and determine whether each physical page frame exists in the ARRY. If so, it means that the physical memory block pointed to by the currently traversed physical page frame is faulty. The currently traversed physical page frame corresponding to the faulty physical memory block can be obtained from the physical memory allocator, and the Page information of the physical address pointed to by the physical page frame can be obtained.

[0084] Here, after the faulty physical memory block is detected, the pfn of the faulty physical memory block is saved in ROM, and then, after the device is restarted, the pfn stored in ROM is read out to the ARRY in RAM. In this embodiment, after each startup, the previously isolated memory is read from ROM to RAM, because RAM cannot save data when it is turned off and powered off, while ROM can save data when it is powered off. In this way, after the faulty physical memory block is detected by the above method, the pfn of the faulty physical memory block is saved in ROM in time, and even if the mobile device is powered off, the pfn can be saved to prevent the faulty physical memory block from being called and used again.

[0085] Step 203: Delete the target page information from the buddy system.

[0086] Among them, when the system needs to allocate memory, it can be obtained from the buddy system. In order to avoid allocating the faulty memory block, the target page information of the detected faulty physical memory block can be deleted from the buddy system, thereby avoiding the faulty memory block from being allocated, causing process failure and other problems.

[0087] In addition, since the pfn of the physical memory is fixed, but the page information of the physical memory is dynamically allocated, that is, the same pfn may correspond to different pages each time the computer is turned on. Therefore, the page corresponding to the pfn needs to be deleted from the buddy system after the computer is turned on; optionally, the page corresponding to the pfn of the faulty physical memory block can also be written to the isolated area Isolated_area.

[0088] Among them, each time the computer is started, the memory block of the physical address represented by the pfn is extracted from the buddy system and stored in the isolation area, which can prevent the faulty memory block from being accessed again.

[0089] This is explained with reference to Example 1 and Example 2 above.

[0090] After obtaining the possible correct virtual address before the error is reported, the mapping between the virtual address and the physical address, and the logical relationship between the physical address and the pfn can be used to obtain the pfn of the possible correct virtual address before the error is reported.

[0091] For example, if 0x0000000074121000 is mapped to physical memory 0x54641000, the pfn (0x54641=0x54641000>>12) corresponding to 0x54641000 is written to the partition PartA of the ROM and an error is reported and the mobile device is restarted; then the next time the mobile device is restarted, the memory address with the problem of the RAM hardware in the ROM can be read, that is, the address information pfn in the partition PartA is read out, and the problematic memory address is removed from the buddy system. Here, the page corresponding to pfn (0x54641) is extracted from the buddy system and added to the isolation area, which is no longer used by the system.

[0092] For another example, 0xffffff0074121000 is mapped to physical memory 0x78191450, then the pfn (0x78191=0x78191450>>12) corresponding to 0x78191450 is written to the partition PartA of the ROM and an error is reported and restarted; then the next time the mobile device is restarted, the memory address with the problem of the RAM hardware in the ROM can be read, that is, the address information pfn in the partition PartA is read out, and the problematic memory address is removed from the buddy system. Here, the page corresponding to pfn (0x78191) is extracted from the buddy system and added to the isolation area, which is no longer used by the system.

[0093] Optionally, after adding the page of the faulty physical memory to the isolation area, the detection system may further test the memory block corresponding to the page added to the isolation area to confirm whether there is a hardware problem with the RAM.

[0094] It should be noted that there are many holes in the physical memory. The kernel needs to manage the valid area and only establish page structures, that is, page information, for page frames in the valid area, to avoid wasting physical memory. The page information can be understood as a pointer to the physical memory.

[0095] In an embodiment of the present application, when isolating the target physical memory area pointed to by the target physical address, the target physical page frame corresponding to the target physical address can be saved in the first storage area. Since the physical page frame of each physical address is unique, but the page information of the physical address is dynamically allocated after each startup, that is, the page information of the same physical address may be different each time the computer is started. Therefore, after startup, during the initialization of the physical memory allocator, the target page information corresponding to the target physical address pointed to by the target physical page frame in the first storage area needs to be deleted from the buddy system to avoid the problem that the physical memory block that reported an error before was initialized in the memory allocator initialization stage and retained in the buddy system, which causes the faulty physical memory block to be accessed again.

[0096] In an embodiment of the present application, when an error occurs when an object accesses the first virtual address of the virtual memory, it can be determined whether the first virtual address of the error belongs to the empty space of the system's virtual memory. If the first virtual address belongs to the empty space, it means that there is a high probability that a hardware failure or a multi-bit jump has occurred in the RAM, because the valid virtual address used normally does not belong to the virtual address in the empty space. Therefore, the possible original virtual address before the first virtual address reports an error, that is, the second virtual address, can be identified. Before the virtual address error occurs, the original virtual address used by the user's application or kernel code to access the memory must belong to the user space or kernel space. Therefore, the second virtual address is a virtual address belonging to the user space or kernel space generated by the conversion of the first virtual address. Then, the target physical memory area corresponding to the second virtual address is isolated, so as to avoid the situation where the target physical memory area with fault in the RAM reports an error again due to being accessed again, resulting in a cyclic crash and freeze. Even if there is a physical memory failure of one or more bits, the physical memory block has been isolated when the failure is first discovered and can no longer be accessed and used. Therefore, it will not affect the subsequent use of the physical memory, and the user does not need to replace the motherboard or replace the device. Moreover, in the above technical solution, no additional hardware support is required, which can reduce costs. In addition, the triggering of the method is executed when the virtual address of the error is detected, and there is no need to detect in real time whether there is a faulty physical memory. Therefore, the loss of system performance is low, it is not easy to cause system jams, and the system fluency is good.

[0097] In one embodiment, the present application also provides an address management method, which is applied to a mobile phone. The flowchart of the method is as follows: Figure 4 As shown, the method may include the following steps:

[0098] Optionally, step 300 (not shown), a partition PartA of a fixed size is configured in the ROM of the mobile phone, assuming that it can store MAX_ADDR physical addresses, wherein specifically the physical address of the fault in the RAM is stored, and the physical address can be represented and stored as pfn;

[0099] Among them, the operating system of the mobile phone can be an Android operating system based on the Linux operating system.

[0100] The ROM may be an eMMC (Embedded Multi Media Card) or a UFS (Universal Flash Storage), and the RAM may be a DDR (Double Data Rate SDRAM).

[0101] Optionally, after step 300, step 301 (not shown) is performed to start the machine;

[0102] Step 302, read the saved physical page frame from the partition PartA to ARRY;

[0103] In the process of starting up the mobile phone, before the physical memory allocator is initialized, the method of the embodiment of the present application can read the pfn of the physical address of the memory stored in the partition PartA into the ARRY of the RAM, where the ARRY can be an array or a linked list;

[0104] Optionally, after step 302, step 303 (not shown) is executed, and the physical memory allocator starts initialization;

[0105] After step 303, in step 304, all pfns of the physical memory of the RAM are obtained in a loop, and it is determined whether each obtained physical page frame exists in the ARRY;

[0106] After step 304, if yes, go to step 305;

[0107] Step 305, isolating the memory block represented by the pfn from the physical memory allocator;

[0108] Step 306, adding the page information of the memory block to Isolated_area;

[0109] In the memory initialization stage, after booting up, the method of the embodiment of the present application can obtain all pfns of the physical memory of the RAM, and then loop through which pfns are in the ARRY. If the pfn is in the ARRY, the page information corresponding to the pfn is extracted from the buddy system and stored in the Isolated_area; if the pfn is not in the ARRY, it runs normally until a virtual address error occurs.

[0110] Since the pfn of the faulty physical address is stored in the ARRY array or pointer, each time the computer is powered on, the memory block of the physical address represented by the pfn is extracted from the buddy system and stored in the isolation area to prevent the faulty memory block from being accessed again.

[0111] During the initialization process of the physical memory allocator, this application loops to obtain the physical page frames of the RAM for array judgment. The reason is that the physical memory allocator needs to initialize the memory of each physical page frame of the RAM during the initialization process, and this application performs judgment during the traversal process.

[0112] Optionally, after step 306, in step 307, a check program is used to test the physical memory represented by the pfn added to the isolation area to confirm what kind of memory problem exists in the DDR.

[0113] After step 304, if no, go to step 308;

[0114] Step 308, determining whether the physical memory allocator has initialized all memory;

[0115] When it is determined that a certain physical page frame does not belong to ARRY, it is determined whether the physical memory allocator has initialized all physical memories of the RAM.

[0116] The above steps are performed during the physical memory initialization process, which can isolate the faulty physical memory previously discovered through the method of the embodiment of the present application; the subsequent steps, namely step 309 and the steps after step 309, are to determine whether the physical address of the subsequent error report needs to be isolated.

[0117] After step 308, if no, then go to step 304, if yes, then go to step 309 to start initializing the isolation function, which is the detection standard of this application;

[0118] Step 309, reading the system configuration information of the virtual address space;

[0119] The system configuration information may include the system bit number, for example, the operating system is a 64-bit system;

[0120] Among them, this step can check whether the mobile phone is a 64-bit or above system. If it is a 32-bit system, the virtual address of the physical memory has been exhausted, and there is no redundant virtual address. This application cannot be used, so it ends. This application needs to borrow the redundant virtual address. If it is a 64-bit or above system, read the parameter value of CONFIG_ARM64_VA_BITS, where the value of this parameter is 39bit;

[0121] In step 309, during the boot process of the mobile phone, it is possible to check how many bits the system's virtual address space is configured with, as well as the configuration parameter CONFIG_ARM64_VA_BITS in the embedded system, so as to determine the space layout of the virtual address;

[0122] After step 309 , the hexadecimal address range of KVAddr, the hexadecimal address range of UVAddr, and the hexadecimal address range of NVAddr may be determined respectively through steps 310 , 311 , and 312 .

[0123] After step 310, step 311, and step 312, the isolation function of the embodiment of the present invention is initialized, the system runs normally, and then the process can proceed to step 313;

[0124] Step 313, accessing virtual memory EVAddr reports an error;

[0125] During the operation of the mobile phone after it is turned on, it can be determined whether an error occurs when accessing the virtual memory EVAddr. If an error occurs when accessing the virtual memory, the process goes to step 314 and step 315.

[0126] Step 314, determine whether EVAddr belongs to UVAddr;

[0127] Step 315, determine whether EVAddr belongs to KVAddr;

[0128] At this time, it is detected whether the virtual memory address EVAddr of the error belongs to the KVAddr or UVAddr interval. After step 314, optionally, if yes, the user space process crashes; after step 315, if yes, the kernel space system crashes.

[0129] Because, when the virtual memory where the error occurs is within the range of KVAddr or UVAddr, that is, within the normal range, it is impossible to reversely infer the correct virtual address before the error is reported, because the virtual address of the error itself is within the range of the correct virtual address;

[0130] After step 314, if no, go to step 319; after step 315, if no, also go to step 316;

[0131] Step 316, EVAddr->VAddr->PAddr;

[0132] Among them, if EVAddr does not belong to the KVAddr or UVAddr interval, but belongs to NVAddr, the wrong virtual address EVAddr can be converted to a valid virtual address VAddr, and then, it is detected whether VAddr is mapped to the physical address PAddr. If the physical address PAdd is not mapped, it will exit, because the virtual address accessed by the upper layer can be converted to a physical address through mapping. If there is no mapping, it means that not only the first 6 bits of the virtual address have jumped, but also the following 8 bits have mutated. Therefore, the mapped physical address cannot be found; if VAddr is mapped to the physical address PAddr, the PAddr can be obtained;

[0133] Step 317, determine whether pfn corresponding to PAddr has been added to partition PartA;

[0134] Optionally, after step 317, if so, it indicates that the PFN is the PFN of the physical address of the fault, and it returns to execute the step of crashing the user-space process or crashing the kernel-space system. Among them, if the reported virtual address is accessed by the user process, the user-space process is crashed; if the reported virtual address is accessed by the kernel code, the kernel-space system is crashed.

[0135] After step 317, if not, execute step 318 to determine whether NUM_ADDR < MAX_ADDR;

[0136] Among them, NUM_ADDR is the number of physical page frames already stored in partition PartA. If NUM_ADDR < MAX_ADDR, it indicates that there is still available space in partition PartA;

[0137] After step 318, if so, execute step 319 to add the page frame number of the physical page frame corresponding to PAddr to partition PartA, and NUM_ADDR + 1.

[0138] Optionally, after step 318, if not, crash the user-space process or crash the kernel-space system;

[0139] Among them, if NUM_ADDR >= MAX_ADDR, it indicates that there is no available space in partition PartA. Similarly, it also returns to execute the step of crashing the user-space process or crashing the kernel-space system. Among them, if the reported virtual address is accessed by the user process, the user-space process is crashed; if the reported virtual address is accessed by the kernel code, the kernel-space system is crashed;

[0140] After step 319, it can report an error and restart the mobile phone, thus turning to execute step 302.

[0141] It should be noted that the meanings of the parameters or variables (such as KVAddr, MAX_ADDR, etc.) in this embodiment are the same as those of the parameters or variables with the same names described in the above Figures 1 to 3 embodiment, so they will not be elaborated one by one.

[0142] The triggering reasons for the virtual memory access error in the system may include OOB / UAF / and other software problems; memory access errors caused by concurrency; CPU / DRAM hardware problems; the method of the above embodiment of the present application can solve the problems of cyclic errors and cyclic freezes caused by virtual memory errors caused by the above various triggering reasons. In addition, the ARMV9 architecture introduces the MTE function to detect memory errors caused by software problems such as OOB / UAF in the user layer and kernel layer, so the method of the embodiment of the present application can be combined with KCSAN to detect kernel layer concurrency problems. Then, combined with detection technologies such as MTE / KCSAN, virtual memory access errors can basically be considered to be caused by hardware problems, which can increase the probability of the function identifying problematic physical memory. For the quality defects of RAM itself, it can cause a fixed physical address error. Therefore, the pfn of the physical address is saved, and reliability can be ensured when detecting whether it has a fault. There will be no situation where the physical address has a fault when an error is reported, and the detection is that the physical address fault disappears.

[0143] With the help of the technical solution of the above method, the method of the embodiment of the present application can isolate the physical memory that reports the error when the RAM hardware has a problem for the first time, thereby avoiding the user's mobile phone from cyclically freezing and restarting with a high probability.

[0144] It should be noted that the address management method provided in the embodiment of the present application can be executed by an address management device or a control module in the address management device for executing the address management method. In the embodiment of the present application, the address management device provided in the embodiment of the present application is described by taking the address management device executing the address management method as an example.

[0145] Reference Figure 5 , shows a block diagram of an address management device according to an embodiment of the present application. The address management device includes:

[0146] A first determination module 401 is used for, in the case where there is a first virtual address reporting an error, if the first virtual address belongs to a hole space of a virtual address, determining a second virtual address before the first virtual address reports an error, wherein the second virtual address is a virtual address in a user space or a kernel space;

[0147] The isolation module 402 is used to isolate the target physical memory area corresponding to the second virtual address.

[0148] Optionally, the device further comprises:

[0149] The second determination module is used to determine the address range of the user space, the address range of the kernel space and the address range of the hole space of the virtual address according to the system configuration information of the virtual address space.

[0150] Optionally, the first determining module 401 includes:

[0151] The first determination submodule is used to determine the second virtual address before an error occurs at the first virtual address according to the address range of the user space and the address range of the kernel space.

[0152] Optionally, the isolation module 402 is also used to isolate the target physical memory area pointed to by the target physical address when there is a target physical address in the candidate physical addresses of the physical memory, wherein the target physical address is the physical address of the memory area in the physical memory that has a mapping relationship with the second virtual address.

[0153] Optionally, the isolation module 402 includes:

[0154] A saving submodule, used for saving the target physical page frame corresponding to the target physical address to the first storage area;

[0155] A second determination submodule is used to determine each of the target physical addresses pointed to by each of the target physical page frames in the first storage area, and target page information of each of the target physical addresses during initialization of the physical memory allocator;

[0156] The deletion submodule is used to delete the target page information from the buddy system.

[0157] In an embodiment of the present application, when an error occurs when an object accesses the first virtual address of the virtual memory, it can be determined whether the first virtual address of the error belongs to the empty space of the system's virtual memory. If the first virtual address belongs to the empty space, it means that there is a high probability that a hardware failure or a multi-bit jump has occurred in the RAM, because the valid virtual address used normally does not belong to the virtual address in the empty space. Therefore, the possible original virtual address before the first virtual address reports an error, that is, the second virtual address, can be identified. Before the virtual address error occurs, the original virtual address used by the user's application or kernel code to access the memory must belong to the user space or kernel space. Therefore, the second virtual address is a virtual address belonging to the user space or kernel space generated by the conversion of the first virtual address. Then, the target physical memory area corresponding to the second virtual address is isolated, so as to avoid the situation where the target physical memory area with fault in the RAM reports an error again due to being accessed again, resulting in a cyclic crash and freeze. Even if there is a physical memory failure of one or more bits, the physical memory block has been isolated when the failure is first discovered and can no longer be accessed and used. Therefore, it will not affect the subsequent use of the physical memory, and the user does not need to replace the motherboard or replace the device. Moreover, in the above technical solution, no additional hardware support is required, which can reduce costs. In addition, the triggering of the method is executed when the virtual address of the error is detected, and there is no need to detect in real time whether there is a faulty physical memory. Therefore, the loss of system performance is low, it is not easy to cause system jams, and the system fluency is good.

[0158] The address management device in the embodiment of the present application may be a device, or a component, integrated circuit, or chip in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., which is not specifically limited in the embodiment of the present application.

[0159] The address management device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0160] The address management device provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.

[0161] Alternatively, if Figure 6 As shown, an embodiment of the present application also provides an electronic device 2000, including a processor 2002, a memory 2001, and a program or instruction stored in the memory 2001 and executable on the processor 2002. When the program or instruction is executed by the processor 2002, each process of the above-mentioned address management method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0162] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0163] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0164] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.

[0165] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0166] Among them, the processor 1010, when there is a first virtual address that reports an error, if the first virtual address belongs to a hole space of the virtual address, determines the second virtual address before the first virtual address reports an error, wherein the second virtual address is a virtual address in the user space or the kernel space; and isolates the target physical memory area corresponding to the second virtual address.

[0167] In an embodiment of the present application, when an error occurs when an object accesses the first virtual address of the virtual memory, it can be determined whether the first virtual address of the error belongs to the empty space of the system's virtual memory. If the first virtual address belongs to the empty space, it means that there is a high probability that a hardware failure or a multi-bit jump has occurred in the RAM, because the valid virtual address used normally does not belong to the virtual address in the empty space. Therefore, the possible original virtual address before the first virtual address reports an error, that is, the second virtual address, can be identified. Before the virtual address error occurs, the original virtual address used by the user's application or kernel code to access the memory must belong to the user space or kernel space. Therefore, the second virtual address is a virtual address belonging to the user space or kernel space generated by the conversion of the first virtual address. Then, the target physical memory area corresponding to the second virtual address is isolated, so as to avoid the situation where the target physical memory area with fault in the RAM reports an error again due to being accessed again, resulting in a cyclic crash and freeze. Even if there is a physical memory failure of one or more bits, the physical memory block has been isolated when the failure is first discovered and can no longer be accessed and used. Therefore, it will not affect the subsequent use of the physical memory, and the user does not need to replace the motherboard or replace the device. Moreover, in the above technical solution, no additional hardware support is required, which can reduce costs. In addition, the triggering of the method is executed when the virtual address of the error is detected, and there is no need to detect in real time whether there is a faulty physical memory. Therefore, the loss of system performance is low, it is not easy to cause system jams, and the system fluency is good.

[0168] Optionally, the processor 1010 is further configured to determine an address range of a user space, an address range of a kernel space, and an address range of a hole space of the virtual address according to system configuration information of the virtual address space.

[0169] In an embodiment of the present application, the address range of the user space, the address range of the kernel space, and the address range of the hole space of the virtual address can be determined according to the system configuration information of the virtual address space, thereby facilitating the reverse correction of the erroneous virtual address based on the format and specifications of the address ranges of various types of spaces, and determining the virtual address that may be correct before the error is reported.

[0170] Optionally, the processor 1010 is further configured to determine, based on the address range of the user space and the address range of the kernel space, a second virtual address before an error occurs at the first virtual address.

[0171] In an embodiment of the present application, when an error occurs when accessing the first virtual address, if the first virtual address belongs to a hole in the virtual address space, it means that the original virtual address of the first virtual address before the error occurs, that is, the second virtual address belongs to the user space or the kernel space. In order to determine the second virtual address, it is possible to determine which space of the user space and the kernel space the second virtual address may belong to based on the address ranges of the virtual addresses of the user space and the kernel space, and the specific content of the first virtual address. After determining the address space to which the second virtual address may belong, it is possible to determine the second virtual address of the first virtual address before the error occurs. The present application can use the address ranges of the virtual addresses of the user space and the kernel space to reversely determine the second virtual address that may be correct before the error occurs for the first virtual address that has an error, thereby facilitating the finding of a faulty physical memory block in the memory for isolation, thereby avoiding repeated access to the faulty memory block and causing a high probability of machine cycle crashes.

[0172] Optionally, the processor 1010 is also used to isolate the target physical memory area pointed to by the target physical address when there is a target physical address in the candidate physical addresses of the physical memory, wherein the target physical address is the physical address of the memory area in the physical memory that has a mapping relationship with the second virtual address.

[0173] In the embodiment of the present application, in order to further ensure the effective virtual address determined for the first virtual address, here the second virtual address is the accurate original virtual address before the first virtual address reports an error, it can be determined whether the second virtual address has a target physical address with which it has a mapping relationship, so as to improve the accuracy of the determined second virtual address. If so, it means that the second virtual address is an accurate and effective virtual address before the error is reported. In order to avoid the physical memory block pointed to by the second virtual address being used again and causing an error loop crash, the target physical memory block pointed to by the target physical address in the physical memory can be isolated, thereby reducing the probability of device loop crashes caused by RAM hardware problems or multi-bit jumps.

[0174] Optionally, the processor 1010 is also used to save the target physical page frame corresponding to the target physical address to the first storage area; during the initialization of the physical memory allocator, determine each target physical address pointed to by each target physical page frame in the first storage area, and the target page information of each target physical address; and delete the target page information from the buddy system.

[0175] In an embodiment of the present application, when isolating the target physical memory area pointed to by the target physical address, the target physical page frame corresponding to the target physical address can be saved in the first storage area. Since the physical page frame of each physical address is unique, but the page information of the physical address is dynamically allocated after each startup, that is, the page information of the same physical address may be different each time the computer is started. Therefore, after startup, during the initialization of the physical memory allocator, the target page information corresponding to the target physical address pointed to by the target physical page frame in the first storage area needs to be deleted from the buddy system to avoid the problem that the physical memory block that reported an error before was initialized in the memory allocator initialization stage and retained in the buddy system, which causes the faulty physical memory block to be accessed again.

[0176] It should be understood that in the embodiment of the present application, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1009 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1010.

[0177] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned address management method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0178] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0179] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned address management method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0180] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0181] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0182] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0183] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. An address management method, It is characterized in that The method comprises: In the case where there is a first virtual address that reports an error, if the first virtual address belongs to a hole space of a virtual address, determining a second virtual address before the first virtual address reports an error, wherein the second virtual address is a virtual address in a user space or a kernel space generated by converting the first virtual address; The target physical memory area corresponding to the second virtual address is isolated.

2. The method according to claim 1, It is characterized in that In the case where there is a first virtual address reporting an error, if the first virtual address belongs to a hole space of a virtual address, before determining a second virtual address before the first virtual address reports an error, the method further includes: According to the system configuration information of the virtual address space, the address range of the user space of the virtual address, the address range of the kernel space and the address range of the hole space are determined.

3. The method according to claim 2, It is characterized in that The determining the second virtual address before the first virtual address reports an error includes: A second virtual address before an error occurs at the first virtual address is determined according to the address range of the user space and the address range of the kernel space.

4. The method according to claim 1, It is characterized in that The isolating the target physical memory area corresponding to the second virtual address includes: When there is a target physical address in the candidate physical addresses of the physical memory, the target physical memory area pointed to by the target physical address is isolated, wherein the target physical address is the physical address of the memory area in the physical memory that has a mapping relationship with the second virtual address.

5. The method according to claim 4, It is characterized in that The isolating the target physical memory area pointed to by the target physical address includes: Saving the target physical page frame corresponding to the target physical address to the first storage area; During the initialization of the physical memory allocator, determining each of the target physical addresses pointed to by each of the target physical page frames in the first storage area, and target page information of each of the target physical addresses; The target page information is deleted from the buddy system.

6. An address management device, It is characterized in that The device comprises: A first determination module is used to determine, in the case where there is a first virtual address reporting an error, a second virtual address before the first virtual address reports an error if the first virtual address belongs to a hole space of a virtual address, wherein the second virtual address is a virtual address in a user space or a kernel space generated by converting the first virtual address; An isolation module is used to isolate the target physical memory area corresponding to the second virtual address.

7. The device according to claim 6, It is characterized in that The device also includes: The second determination module is used to determine the address range of the user space, the address range of the kernel space and the address range of the hole space of the virtual address according to the system configuration information of the virtual address space.

8. The device according to claim 7, It is characterized in that The first determining module comprises: The first determination submodule is used to determine the second virtual address before an error occurs at the first virtual address according to the address range of the user space and the address range of the kernel space.

9. The device according to claim 6, It is characterized in that The isolation module is also used to isolate the target physical memory area pointed to by the target physical address when there is a target physical address in the candidate physical addresses of the physical memory, wherein the target physical address is the physical address of the memory area in the physical memory that has a mapping relationship with the second virtual address.

10. The device according to claim 9, It is characterized in that The isolation module comprises: A saving submodule, used for saving the target physical page frame corresponding to the target physical address to the first storage area; A second determination submodule is used to determine each of the target physical addresses pointed to by each of the target physical page frames in the first storage area, and target page information of each of the target physical addresses during initialization of the physical memory allocator; The deletion submodule is used to delete the target page information from the buddy system.

Citation Information

Patent Citations

  • Method and device for processing memory errors

    CN105893166A

  • Abnormal treatment method and mobile terminal

    CN108228398A

  • Memory fault isolation method, device and system and readable storage medium

    CN109753378A

  • Memory isolation method and device

    CN110532124A

  • Memory fault isolation method and device

    WO2016115661A1