Fault processing method for memory and related equipment
By continuously detecting and recording memory failure information in electronic devices, identifying serious problems and triggering backup operating systems, the problem of bad blocks and failures of storage devices during use is solved, and emergency download mode and user data loss is avoided.
Patent Information
- Application Number
- CN202311658331.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2043-12-05
AI Technical Summary
The prior art is difficult to effectively deal with the bad blocks and failure problems caused by memory devices during use, resulting in the impact of user use.
By enabling continuous detection and recording of fault information in electronic devices, serious problems in memory are identified and triggered to enter the standby operating system when serious problems are detected to avoid entering emergency download mode and avoid loss of user data.
It realizes continuous detection and recording of fault information when the memory is not seriously damaged, so as to promptly identify serious problems in the memory, avoid entering the emergency download mode, and protect user data.
Smart Images

Figure CN120144374A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of terminals, and in particular, to a method for handling faults of a memory and related devices. Background Art
[0002] A storage device (which may be simply referred to as a memory), as the carrier of all files in an electronic device, its working state plays a decisive role in the user experience of the electronic device. However, during a long usage cycle, the storage device will gradually generate bad blocks, and even have the risk of complete failure, due to the passage of time and different specific usage environments (extreme high and low temperatures, drops). Once the above problems occur, it will have a very serious impact on the user's use. Therefore, corresponding solutions need to be formulated for problems such as bad blocks and failures of the storage device to avoid and intercept faults (testing before leaving the factory). For example, before the electronic device leaves the factory, tests are carried out for problems such as bad blocks and failures of the storage device. However, there is still no suitable solution for the problems of the storage device generated during the user's use process. Summary of the Invention
[0003] This application provides a method for handling faults of a memory and related devices. According to this method, an electronic device can record corresponding fault information and perform preliminary identification and judgment when it does not detect serious problems in its memory, and trigger to enter a standby operating system during a subsequent startup process when serious problems are detected, and identify a faulty partition based on the previously recorded fault information. Through this method, the electronic device can continuously detect and record corresponding fault information when the memory does not have serious problems, so as to timely identify serious problems of the memory and start the standby operating system subsequently, thereby avoiding entering the emergency download mode, and further avoiding the loss of user data due to entering the emergency download mode.
[0004] In a first aspect, this application provides a method for handling faults of a memory. This method can be applied to an electronic device provided with a memory. The partitions corresponding to the memory include a key partition and a common partition. This method can include: the electronic device can detect an operation that triggers the startup of the electronic device, and in response to the operation that triggers the startup of the electronic device, the electronic device can start to start; when the abnormality detected by the electronic device in the first state meets the condition for entering the emergency download mode, if the electronic device scans and confirms that the key partition is abnormal and the migration of the affected key image file in the key partition fails, or scans and confirms that the common partition is abnormal and meets a first preset condition in the second state before the startup of the electronic device, the electronic device can start the first operating system. Wherein, the first state is the state when the electronic device is in the boot startup stage, and the second state is the state after the kernel of the second operating system in the electronic device starts.
[0005] In the solution provided in this application, after the electronic device is normally started (i.e., the kernel of the common operating system in the electronic device is started), the electronic device can scan the key partitions. In the case where it is confirmed through scanning that the key partitions are abnormal and the migration of the affected key image files in the key partitions fails, if the electronic device detects an abnormality and triggers the upcoming entry into the emergency download mode after the next start, the electronic device can start the standby operating system instead of the common operating system. Similarly, after the electronic device is normally started, the electronic device can also scan the common partitions. In the case where it is confirmed through scanning that the common partitions are abnormal and meet the first preset condition, if the electronic device detects an abnormality and triggers the upcoming entry into the emergency download mode after the next start, the electronic device can start the standby operating system instead of the common operating system. Through this method, the electronic device can detect the partitions corresponding to the memory after startup and record the corresponding fault information. Moreover, once it is detected that there are serious problems with the partitions corresponding to the memory, the electronic device can determine that the memory is severely damaged. In this way, when the electronic device starts up next time, it can trigger the startup of the standby operating system to avoid being unable to recover after entering the emergency download mode, resulting in the electronic device being unable to continue to be used, thereby avoiding the loss of user data.
[0006] In some embodiments of this application, the first operating system may refer to the standby operating system of the electronic device. The second operating system may be the common operating system of the electronic device, that is, the operating system generally used by the electronic device. For example, the second operating system may be an advanced operating system (as shown in step S101).
[0007] It should be noted that the first operating system is an additional operating system set to handle memory failure situations and is different from the operating system originally used by the electronic device (i.e., the second operating system). Under normal circumstances (for example, in cases other than severe memory damage), the operating system used by the electronic device is the second operating system, and the first operating system will not be used.
[0008] In some embodiments of this application, the memory refers to UFS. Of course, the memory involved in this application may also specifically be other types of memories, and this application does not limit this.
[0009] In some embodiments of this application, the first state refers to the boot startup stage, which can be understood as the stage when the electronic device runs the bootloader. The second state may be the standby state mentioned later.
[0010] In some embodiments of this application, the first preset condition may be the preset condition 1 mentioned later.
[0011] It should be noted that the abnormality detected by the electronic device in the first state meets the condition for entering the emergency download mode. Specifically, it may include: an abnormality is detected during the startup process of the electronic device and triggers the upcoming entry into the emergency download mode (as shown in step S112).
[0012] Combined with the first aspect, in a possible implementation, before the electronic device detects an operation that triggers the startup of the electronic device, the method may further include: in the second state, the electronic device can scan the critical partition, generate first fault information, and determine whether the critical partition has an abnormality based on the first fault information; in the case where the critical partition has an abnormality, the electronic device can migrate the affected critical image files in the critical partition; in the case where the migration of the critical image files by the electronic device fails, the electronic device can set the content corresponding to the first parameter to the first content; in the case where the critical partition has no abnormality, the electronic device can scan the common partition, generate second fault information, and determine whether the common partition has an abnormality based on the second fault information; in the case where the common partition has an abnormality and the abnormality of the common partition meets the first preset condition, the electronic device can set the content corresponding to the first parameter to the first content. If, in the second state before the electronic device starts up, it is scanned and confirmed that the critical partition has an abnormality and the migration of the affected critical image files in the critical partition fails, or it is scanned and confirmed that the common partition has an abnormality and meets the first preset condition, then the electronic device starts the first operating system. Specifically, it may include: if the content corresponding to the first parameter is the first content, the electronic device can start the first operating system.
[0013] In the solution provided in this application, after the electronic device starts up normally (i.e., the kernel of the common operating system in the electronic device starts up), the electronic device can first scan the critical partition, and then scan the common partition when no abnormality of the critical partition is detected. In the case where an abnormality of the critical partition is detected, the electronic device can migrate the critical image files, and in the case where the migration fails, mark the serious damage of the memory by setting the content corresponding to the first parameter to the first content. In the case where an abnormality of the common partition is detected and the abnormality meets the first preset condition, the electronic device can also mark the serious damage of the memory by setting the content corresponding to the first parameter to the first content. In this way, during the subsequent startup process of the electronic device, it can directly confirm whether it is necessary to start the standby operating system based on the content corresponding to the first parameter. This method can not only enable the electronic device to timely confirm the degree of memory damage, so that the electronic device does not miss the situation of serious memory damage, but also reduce the number of scans and simplify the process to a certain extent, thereby saving energy to a certain extent.
[0014] In some embodiments of this application, the first fault information may be fault information 2, and the second fault information may be fault information 3.
[0015] In some embodiments of the present application, in the case where the migration of a critical mirror file fails, or in the case where an abnormality in a common partition is scanned and the abnormality meets a first preset condition, the electronic device may further record first information. The first information can be used to mark that there is a serious problem (i.e., serious damage) in the memory of the electronic device. In this way, in the case where an abnormality is detected during the subsequent startup process of the electronic device and it is triggered to enter the emergency download mode, the electronic device can determine whether to start the alternative operating system according to whether the first information is recorded. Specifically, if the electronic device records the first information, the electronic device can start the operating system. It can be understood that the present application does not limit the specific content and specific form of the first information.
[0016] Combined with the first aspect, in a possible implementation manner, before the electronic device detects an operation that triggers the startup of the electronic device, the method may further include: in the second state, the electronic device can scan the critical partition and the common partition, generate first fault information and second fault information respectively, and determine whether there are abnormalities in the critical partition and the common partition respectively based on the first fault information and the second fault information; in the case where an abnormality occurs in the critical partition, the electronic device can migrate the critical mirror file affected in the critical partition; in the case where an abnormality occurs in the common partition and the abnormality in the common partition meets the first preset condition, or, in the case where the migration of the critical mirror file affected in the critical partition fails, the electronic device can set the content corresponding to the first parameter to the first content. If the electronic device scans and confirms that an abnormality occurs in the critical partition and the migration of the critical mirror file affected in the critical partition fails, or scans and confirms that an abnormality occurs in the common partition and meets the first preset condition during the second state before startup, the electronic device starts the first operating system. Specifically, if the content corresponding to the first parameter is the first content, the electronic device can start the first operating system.
[0017] In the solution provided by the present application, after the electronic device is normally started (i.e., the kernel of the common operating system in the electronic device is started), the electronic device can scan the critical partition and the common partition. In the case where an abnormality in the critical partition is scanned, the electronic device can migrate the critical mirror file, and in the case where the migration fails, mark the serious damage of the memory by setting the content corresponding to the first parameter to the first content. In the case where an abnormality in the common partition is scanned and the abnormality meets the first preset condition, the electronic device can also mark the serious damage of the memory by setting the content corresponding to the first parameter to the first content. In this way, during the subsequent startup process of the electronic device, it can directly confirm whether to start the alternative operating system based on the content corresponding to the first parameter. This method can enable the electronic device to perform a more comprehensive scan of the partition corresponding to the memory, which helps the electronic device confirm the fault condition of the memory and obtain relatively comprehensive fault information.
[0018] It is understandable that in the above situation, the present application does not limit the order in which the electronic device scans the critical partition and the common partition. In some embodiments of the present application, the electronic device may first scan the critical partition and then scan the common partition, but the electronic device does not determine whether to scan the common partition based on the scanning result of the critical partition.
[0019] Combined with the first aspect, in a possible implementation manner, the electronic device determines that the critical partition is abnormal based on the first fault information, which may specifically include any one or more of the following: the electronic device determines that the number of failure addresses included in the first fault information is not less than the first threshold; the electronic device determines that the number of times of failed access to the logical area included in the first fault information is not less than the second threshold; the electronic device determines that the number of times of failed access to the IO in one access included in the first fault information is not less than the third threshold.
[0020] In the solution provided by the present application, the abnormal partition corresponding to the memory may include a memory damage situation that does not conform to the device wear rule, rather than a natural damage situation of the memory caused by factors such as user use. The electronic device may specifically determine whether the critical partition is abnormal according to the number of failure addresses and / or the number of times of failed access to the logical area and / or the number of times of failed access to the IO included in the fault information. Through this method, the electronic device can timely record the abnormal situation that does not conform to the device wear rule (that is, the degree of memory damage does not conform to its service life and usage degree).
[0021] In some embodiments of the present application, the first threshold may be the threshold 1 mentioned later, the second threshold may be the threshold 2 mentioned later, and the third threshold may be the threshold 3 mentioned later.
[0022] Combined with the first aspect, in a possible implementation manner, the electronic device determines that the critical partition is abnormal based on the first fault information, which may specifically further include: the electronic device may determine that the failure addresses included in the first fault information are concentrated.
[0023] In the solution provided by the present application, the abnormal critical partition corresponding to the memory may include concentrated failure addresses. In this case, only when the failure addresses are concentrated and the first fault information meets certain requirements (the specific conditions related to the first threshold, the second threshold, or the third threshold mentioned above), the electronic device will migrate the critical mirror file. It is understandable that compared with the situation where the failure addresses are scattered, it is easier for the electronic device to migrate the critical mirror file when the failure addresses are concentrated.
[0024] In combination with the first aspect, in a possible implementation, among the failure addresses included in the first failure information, it may specifically include any one or more of the following: the ratio of the number of failure addresses belonging to the same sector included in the first failure information to the total number of all failure addresses included in the first failure information is not less than the first ratio; the number of the first type of failure addresses included in the first failure information is greater than the first value; the ratio of the number of the first type of failure addresses included in the first failure information to the total number of all failure addresses included in the first failure information is greater than the second ratio. Wherein, the difference between the number corresponding to the first type of failure addresses and the numbers corresponding to the other failure addresses included in the first failure information is less than the second value.
[0025] In some embodiments of the present application, the first ratio may be a% mentioned later, the first value may be c mentioned later, the second value may be b mentioned later, and the second ratio may be d mentioned later.
[0026] In some embodiments of the present application, the difference between the number corresponding to the first type of failure addresses and the numbers corresponding to all other failure addresses included in the first failure information is less than the second value.
[0027] In some embodiments of the present application, the difference between the number corresponding to the first type of failure addresses and the numbers corresponding to some other failure addresses (for example, e% of the failure addresses among all other failure addresses included in the first failure information) included in the first failure information is less than the second value. It can be understood that e can be set according to actual needs, and the present application does not limit its specific value.
[0028] In combination with the first aspect, in a possible implementation, the electronic device determines that an abnormality occurs in the common partition based on the second failure information, which may specifically include any one or more of the following: the electronic device determines that the number of failure addresses included in the second failure information is not less than the fourth threshold; the electronic device determines that the number of times of failed access to the logical area included in the second failure information is not less than the fifth threshold; the electronic device determines that the number of IO failures included in the second failure information is not less than the sixth threshold.
[0029] In the solution provided by the present application, the abnormality of the partition corresponding to the memory may include a memory damage situation that does not conform to the device loss law, rather than a natural damage situation of the memory caused by factors such as user use. The electronic device can specifically determine whether an abnormality occurs in the common partition according to the number of failure addresses and / or the number of times of failed access to the logical area and / or the number of IO failures included in the failure information. Through this method, the electronic device can timely record the abnormal situation that does not conform to the device loss law (that is, the degree of memory damage does not conform to its service life and usage degree).
[0030] In some embodiments of the present application, the fourth threshold may be the threshold 4 mentioned later, the fifth threshold may be the threshold 5 mentioned later, and the sixth threshold may be the threshold 6 mentioned later.
[0031] Combined with the first aspect, in a possible implementation, the anomalies occurring in the common partition satisfy the first preset condition, which may specifically include any one or more of the following: the number of failed addresses included in the second failure information is not less than the seventh threshold; the number of times of failed access to the logical area included in the second failure information is not less than the eighth threshold; the number of IO failures included in the second failure information is not less than the ninth threshold. Among them, the seventh threshold is greater than the fourth threshold, the eighth threshold is greater than the fifth threshold, and the ninth threshold is greater than the sixth threshold.
[0032] In the solution provided by the present application, the electronic device can set different thresholds to determine the degree of anomaly of the common partition. The electronic device can set relatively smaller thresholds to determine that an anomaly occurs in the common partition, and set relatively larger thresholds to determine that the degree of anomaly of the common partition is relatively serious (i.e., satisfies the first preset condition). By this method, the electronic device can not only record the less serious memory anomalies, but also process the serious memory anomalies in a timely manner.
[0033] In some embodiments of the present application, the seventh threshold may be the threshold 7 mentioned later, the eighth threshold may be the threshold 8 mentioned later, and the ninth threshold may be the threshold 9 mentioned later.
[0034] Combined with the first aspect, in a possible implementation, when the electronic device determines that an anomaly occurs in the common partition based on the second failure information, the method may further include: the electronic device can determine the failure level of the memory based on the second failure information; when the electronic device determines that the failure level of the memory satisfies the second preset condition, the electronic device can determine that the anomaly occurring in the common partition satisfies the first preset condition.
[0035] In the solution provided by the present application, the electronic device can set different failure levels to determine the degree of anomaly of the common partition. By this method, the electronic device can not only record the less serious memory anomalies, but also process the serious memory anomalies in a timely manner.
[0036] In some embodiments of the present application, that the failure level of the memory satisfies the second preset condition may specifically include: the failure level corresponding to the memory (for example, the UFS failure mentioned later) is among the top b% of the failure levels.
[0037] In some embodiments of the present application, that the failure level of the memory satisfies the second preset condition may specifically include: the failure level corresponding to the memory is the most serious failure level.
[0038] In some embodiments of the present application, the failure level of the memory meets a second preset condition, which may specifically include: the number of failure levels is greater than 2, and the failure level corresponding to the memory is one of the two most serious failure levels.
[0039] Of course, the second preset condition that the failure level of the memory meets may also specifically include other contents, and the present application does not limit this.
[0040] In combination with the first aspect, in a possible implementation manner, the electronic device determines the failure level of the memory based on the second failure information, which may specifically include: the electronic device determines the failure level of the memory based on the number of failure addresses included in the second failure information; the electronic device determines the failure level of the memory based on the number of times of failed access to the logical area included in the second failure information; the electronic device determines the failure level of the memory based on the number of IO failures included in the second failure information; the electronic device determines the failure level of the memory based on the concentration of failure addresses included in the second failure information; the electronic device determines the failure level of the memory based on the number of interaction failures between the memory involved in the second failure information and the processor in the electronic device; the electronic device determines the failure level of the memory based on the ratio of the number of interaction failures between the memory involved in the second failure information and the processor to the total number of interactions between the memory and the processor.
[0041] In the solution provided by the present application, the electronic device may specifically determine the failure level based on the failure addresses involved in the second failure information and / or the access situation of the logical area and / or the IO access situation, etc.
[0042] In some embodiments of the present application, the processor in the electronic device may be a SOC.
[0043] In combination with the first aspect, in a possible implementation manner, the electronic device scans the common partition to generate the second failure information, which may specifically include: the electronic device scans the common partition at a preset frequency, and after each scan of the common partition, the electronic device generates the corresponding second failure information.
[0044] In some embodiments of the present application, the electronic device does not scan the common partition only once, but scans the common partition at a preset frequency, and corresponding failure information (i.e., the second failure information) can be generated after each scan of the common partition. By this method, the electronic device can continuously detect the abnormal situation of the common partition and record the corresponding failure information in a timely manner, so as to discover serious abnormal situations in a timely manner subsequently.
[0045] In some embodiments of the present application, the preset frequency may be a certain frequency mentioned later. It can be understood that the preset frequency can be set according to actual needs, and the present application does not make specific limitations on this.
[0046] In combination with the first aspect, in a possible implementation, after the electronic device scans the common partition, the method may further include: when an exception occurs in the common partition and the exception that occurs in the common partition does not meet the first preset condition, the electronic device may save the second fault information obtained from this scan, and when it is determined in the next scan that an exception occurs in the common partition, combine the second fault information obtained from the historical scan of the common partition and the second fault information obtained after the next scan of the common partition to determine whether the exception that occurs in the common partition meets the first preset condition. Among them, the second fault information obtained from the historical scan of the common partition includes the second fault information obtained from this scan.
[0047] In the solution provided in this application, when the electronic device determines that an exception occurs in the common partition but the exception does not meet the first preset condition, the electronic device may save the corresponding fault information, and in the subsequent scanning process, it may combine the saved fault information to comprehensively determine whether the exception in the common partition meets the first preset condition. Through this method, the electronic device can continuously detect the abnormal conditions of the common partition and record the corresponding fault information in a timely manner, so as to discover serious abnormal conditions in a timely manner later.
[0048] In combination with the first aspect, in a possible implementation, the partition corresponding to the memory further includes a partition related to the startup of the electronic device. Before the electronic device detects an operation that triggers the startup of the electronic device, the method may further include: if the electronic device detects an exception during the boot startup phase in the previous startup process, the electronic device may generate third fault information and store the third fault information in the partition related to the startup of the electronic device.
[0049] In the solution provided in this application, the electronic device may also perform detection during the boot startup phase to generate fault information corresponding to the partition related to startup. In this way, the electronic device can perform a more comprehensive detection on the partition corresponding to the memory, so as to obtain more comprehensive fault information, which is convenient for determining the faulty partition later.
[0050] In some embodiments of this application, the third fault information may be the fault information 1 mentioned later.
[0051] In combination with the first aspect, in a possible implementation, after the electronic device starts the first operating system, the method may further include: the electronic device may capture the third fault information to determine the faulty partition of the memory, and perform a recovery operation on the faulty partition of the memory.
[0052] In the solution provided by this application, the electronic device can determine the faulty partition of the memory based on the third fault information, and then perform a recovery operation on the faulty partition. Through this method, the electronic device can handle the faults of the memory to a certain extent, obtain some user data, and thus avoid the inaccessibility of the electronic device and the loss of user data caused by entering the emergency download mode.
[0053] Combined with the first aspect, in a possible implementation manner, after the electronic device starts the first operating system, the method may further include: the electronic device can capture the first fault information and the second fault information to determine the faulty partition of the memory, and perform a recovery operation on the faulty partition of the memory.
[0054] In the solution provided by this application, the electronic device can determine the faulty partition of the memory based on the first fault information and the second fault information, and then perform a recovery operation on the faulty partition. Through this method, the electronic device can handle the faults of the memory to a certain extent, obtain some user data, and thus avoid the inaccessibility of the electronic device and the loss of user data caused by entering the emergency download mode.
[0055] Combined with the first aspect, in a possible implementation manner, the first operating system may be a recovery partition that shields non-critical disk read and write operations, or a fastboot partition that shields non-critical disk read and write operations.
[0056] In the solution provided by this application, the electronic device can obtain a standby operating system based on the recovery partition or the fastboot partition. The electronic device can shield non-critical disk read and write operations for the recovery partition to obtain a standby operating system. Similarly, the electronic device can shield non-critical disk read and write operations for the fastboot partition to obtain a standby operating system.
[0057] It should be noted that the standby operating system set by the electronic device will not affect the original recovery partition and fastboot partition of the electronic device, that is, the recovery partition and fastboot partition in the common operating system.
[0058] Combined with the first aspect, in a possible implementation manner, the abnormality detected by the electronic device in the first state that satisfies entering the emergency download mode may specifically include any one or more of the following: the interaction between the memory and the processor in the electronic device fails; the electronic device cannot read the image file in the memory; the electronic device fails to load.
[0059] In the solution provided by this application, many reasons can cause the electronic device to enter the emergency download mode, not limited to memory damage. Therefore, when the electronic device detects an abnormality, it needs to determine whether it enters the emergency download mode due to reasons related to memory damage. If the electronic device enters the emergency download mode due to reasons related to memory damage, the electronic device can further determine whether to start the standby operating system. If the electronic device does not enter the emergency download mode due to reasons related to memory damage, the electronic device does not need to further determine whether to start the standby operating system.
[0060] In a second aspect, this application provides an electronic device, which includes: one or more memories, and one or more processors; the one or more memories are coupled to the one or more processors, and the memories are used to store computer program code, and the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the electronic device to execute the method described in the first aspect or any implementation manner of the first aspect.
[0061] In a third aspect, this application provides a computer storage medium. The computer storage medium includes computer instructions, and when the computer instructions run on the electronic device, the electronic device is caused to execute the method described in the first aspect or any implementation manner of the first aspect.
[0062] In a fourth aspect, an embodiment of this application provides a chip. The chip can be applied to an electronic device, and the chip includes one or more processors, and the processors are used to call computer instructions to cause the electronic device to execute the method described in the first aspect or any implementation manner of the first aspect.
[0063] In a fifth aspect, an embodiment of this application provides a computer program product containing instructions. When the computer program product runs on the electronic device, the electronic device is caused to execute the method described in the first aspect or any implementation manner of the first aspect.
[0064] It can be understood that the electronic device provided in the second aspect, the computer storage medium provided in the third aspect, the chip provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method described in the first aspect or any implementation manner of the first aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of any possible implementation manner in the first aspect, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 It is a flowchart of entering the emergency download mode when a memory fails provided by an embodiment of this application;
[0066] Figure 2AFlowchart of a method for handling faults in a memory provided by an embodiment of the present application;
[0067] Figure 2B Flowchart of another method for handling faults in a memory provided by an embodiment of the present application;
[0068] Figure 3 Schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application;
[0069] Figure 4 Schematic diagram of the software structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0070] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality of" means two or more than two.
[0071] It should be understood that the terms "first", "second", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.
[0072] Referring to "embodiment" in the present application means that a specific feature, structure, or characteristic described in combination with the embodiment may be included in at least one embodiment of the present application. The appearance of this phrase in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments.
[0073] Memory is a memory device used to store information in modern information technology. All the information in an electronic device, including the input original data, programs, intermediate operation results, and final operation results, is stored in the memory. It stores and retrieves information according to the locations specified by the controller. With the memory, the electronic device has the memory function and can ensure normal operation. According to the above text, the memory may gradually generate bad blocks over time and specific usage conditions, which will seriously affect the use of the electronic device.
[0074] It can be understood that the memory involved in this application may include Universal Flash Storage (UFS), and may also include other types of memories. This application does not limit this. Among them, UFS is an internal file memory, and its specific meaning can be referred to in relevant technical documents. This application will not elaborate here.
[0075] In some embodiments of this application, when the electronic device detects an abnormal memory, it can enter the emergency download mode and cannot actively exit. "Cannot actively exit" means that after the electronic device enters the emergency download mode, it only supports a few command-line instructions for single enumeration. Even if the electronic device is powered off and restarted, the electronic device will still enter the emergency download mode again. After the electronic device enters the emergency download mode, it will always be black-screened and unresponsive to the user pressing the keys.
[0076] It can be understood that the emergency download mode is a special state that will be entered only when there is a device abnormality during the startup phase or when the corresponding flag bit is manually turned on during the debugging phase.
[0077] Specifically, as Figure 1 shown, once the electronic device suffers physical damage, crashes, shuts down due to power loss, etc., the user can trigger the electronic device to power on and restart. Once the memory is detected to be abnormal during the restart process of the electronic device, the electronic device can enter the emergency download mode and remain in the emergency download mode without exiting. If the electronic device is powered off and restarted, the electronic device will detect that the memory is abnormal again and enter the emergency download mode again.
[0078] After the electronic device enters the emergency download mode, the tester can capture the dump log through the command-line instructions for single enumeration to obtain some information about this memory abnormality. It can be understood that the dump log generally refers to the operating system kernel log. When the operating system has an abnormal lockup / blue screen / crash, the system kernel process will generate a dump log for diagnosing and analyzing system, application, and hardware failures.
[0079] It should be noted that after the electronic device enters the emergency download mode, it remains black-screened all the time, has no Android Debug Bridge (ADB) port, and does not respond to user operations on the keys. Therefore, once the electronic device enters the emergency download mode, the user can only replace the electronic device, and the user data originally stored in the electronic device cannot be obtained either.
[0080] Based on the above, the embodiments of the present application provide a method for handling memory faults and related devices. According to this method, the electronic device can continuously detect whether the memory has an abnormality, and when an abnormality occurs in the memory, determine the category of the abnormality. For a memory abnormality related to a key partition, the electronic device can migrate the key image file, and set a flag bit in case of migration failure. However, for other memory abnormalities related to common partitions that meet certain conditions (for example, preset condition 1), the electronic device can set a flag bit. After the electronic device restarts, if the electronic device determines that it is about to enter the emergency download state and the flag bit has been set, the electronic device can start the backup operating system and analyze the relevant fault information of the current memory abnormality. Through this method, the user can continue to use the electronic device when an abnormality occurs in the memory of the electronic device, avoiding the loss of user data after it directly enters the emergency download mode.
[0081] The following takes UFS as an example to introduce a method for handling memory faults provided by the embodiments of the present application.
[0082] Please refer to Figure 2A , Figure 2A which is a flowchart of a method for handling memory faults provided by the embodiments of the present application. The method may include but is not limited to the following steps:
[0083] S101: The electronic device receives an instruction to start the electronic device. In response to the instruction to start the electronic device, the electronic device starts to boot.
[0084] The user can trigger the start of the electronic device by long-pressing the corresponding key (for example, long-pressing the power key, long-pressing the volume down key and the power key, etc.). Correspondingly, the electronic device can receive an instruction to start the electronic device, and in response to the instruction to start the electronic device, the electronic device can start to boot.
[0085] During the startup process of the electronic device, the kernel of the electronic device starts. Specifically, in response to the instruction to start the electronic device, the electronic device is powered on and enters the boot startup stage to prepare for loading the kernel for the electronic device. After the electronic device is ready to load the kernel, the electronic device can start the kernel. It can be understood that power-on means the electronic device is powered on.
[0086] In some embodiments of the present application, when the electronic device enters the boot-up phase, it may specifically include: the electronic device runs a bootloader. It should be noted that when the chip platforms used by the electronic device are different, the boot-up phase of the electronic device may include different specific processes.
[0087] It can be understood that the bootloader is a boot program before starting the operating system (for example, the Android operating system), mainly for functions such as checking the Random Access Memory (RAM) and initializing parameters. The electronic device can initialize and load the hardware (such as the memory, central processing unit, etc.) in the electronic device into the RAM through the bootloader, thereby establishing a memory space mapping and preparing for loading the kernel.
[0088] It should be noted that during the execution of step S101, the kernel started during the startup process of the electronic device is the kernel of the High Level Operating System (HLOS). It can be understood that the high-level operating system may include operating systems such as Linux and the Android operating system. For example, when the operating system of the electronic device is the Android operating system (which can be abbreviated as the Android system), the kernel of the Android operating system can be started when the electronic device starts up.
[0089] S102: During the startup phase, the electronic device detects whether an abnormal situation occurs.
[0090] During the startup phase of the electronic device, the electronic device can detect whether an abnormal situation occurs, that is, determine whether the electronic device meets the conditions for normal startup. If the electronic device does not meet the requirements for normal startup, the electronic device can determine that an abnormal situation has occurred. In some embodiments of the present application, the conditions for the electronic device to meet normal startup may specifically include but are not limited to: the core components in the electronic device can work normally. Among them, the core components may include but are not limited to: UFS, System on Chip (SOC), and Double DataRate Synchronous Dynamic Random Access Memory (DDR).
[0091] In some embodiments of the present application, during the boot-up phase, the electronic device can detect whether an abnormal situation occurs.
[0092] In some embodiments of the present application, the electronic device detects whether an abnormal situation occurs, which may specifically include one or more of the following: the electronic device detects whether the mirror file (which may be simply referred to as the mirror) is complete, the electronic device detects whether the device is damaged, and the electronic device detects whether there is a problem with the interaction between the UFS and the SOC. Of course, the electronic device can also detect other aspects related to the UFS, and the present application does not limit this.
[0093] It can be understood that the mirror file is the physical carrier of the operating system, and all the logics of the system operation should be reflected in the mirror file of the operating system. When the electronic device detects whether the mirror file is complete, it may specifically include: the electronic device can detect whether the mirror file related to the UFS is complete. The mirror file mentioned here may refer to the UFS file.
[0094] It can be understood that the SOC refers to a system or product formed by combining multiple integrated circuits with specific functions on a single chip, which includes a complete hardware system and the embedded software it carries. For example, a central processing unit, a Graphics Processing Unit (GPU), a digital signal processor, a memory, a modem, a navigation and positioning module, and a multimedia module, etc. can be integrated on the SOC.
[0095] It can be understood that if the electronic device detects that the mirror file is incomplete, the electronic device can determine that an abnormal situation has occurred. Similarly, if the electronic device detects that the device is damaged, the electronic device can determine that an abnormal situation has occurred. Similarly, if the electronic device detects that there is a problem with the interaction between the UFS and the SOC (for example, the UFS does not respond to the message sent by the SOC, the SOC does not respond to the message sent by the UFS, etc.), the electronic device can determine that an abnormal situation has occurred.
[0096] In some embodiments of the present application, during the startup phase of the electronic device, the electronic device only detects whether an abnormal situation occurs once.
[0097] S103: When the electronic device detects an abnormal situation, the electronic device stores the generated fault information in the partition related to the startup of the electronic device.
[0098] When the electronic device detects an abnormal situation, the electronic device can record the fault information corresponding to this abnormal situation and store the fault information in the partition related to the startup of the electronic device. That is to say, after the electronic device detects an abnormal situation, it can store the generated fault information in a file in the corresponding storage area. It can be understood that the partition related to the startup of the electronic device involved in the present application may specifically refer to: the partition in the UFS corresponding to the partition related to the startup of the electronic device.
[0099] For ease of description, in this application, the fault information generated when the electronic device detects an abnormal situation during the boot-up phase is denoted as fault information 1. That is to say, the fault information stored in the partition related to the start-up of the electronic device is fault information 1.
[0100] It can be understood that a partition is a storage area in an electronic device. In some embodiments of this application, the partition involved in this application may refer to a logical partition formed by partitioning a physical hard disk. Each partition looks like an independent hard disk, having its own file system, folders, and files. Different types of data and operating systems can be stored in different partitions respectively, which can better organize and manage files and can also better protect the security of data.
[0101] It can be understood that the partition related to the start-up of the electronic device can be set according to actual needs, and this application does not limit this. For example, the partition related to the start-up of the electronic device may include a recovery partition. It can be understood that the recovery partition is a recovery partition that contains a simple Linux system for recovering and maintaining the mobile phone and can also be used for operations such as erasing and restarting other partitions. For another example, the partition related to the start-up of the electronic device may include an xbl partition. It can be understood that the xbl partition is one of the important partitions for system startup.
[0102] In some embodiments of this application, the partition related to the start-up of the electronic device is a specific partition. For example, the partition related to the start-up of the electronic device may be the xbl partition.
[0103] In some embodiments of this application, the partition related to the start-up of the electronic device may include multiple specific partitions. For example, the partition related to the start-up of the electronic device may include a recovery partition and an xbl partition. Among them, the recovery partition is used to record the fault information generated due to multiple start-up failures, and the xbl partition is used to record the fault information generated during the start-up process.
[0104] In some embodiments of this application, after the electronic device fails to start up multiple times, it can generate fault information 1 and store the fault information 1 in the recovery partition and the xbl partition. In this case, the fault information 1 stored in the recovery partition and the xbl partition may be different.
[0105] In some embodiments of this application, the electronic device can determine which specific partition included in the partition related to the start-up of the electronic device to store the fault information 1 according to the timing of detecting the abnormal situation.
[0106] In some embodiments of the present application, the electronic device may record the fault information 1 in a log, and output the log recording the fault information 1 to a partition related to the startup of the electronic device. That is, the electronic device may mark abnormal conditions through a log. In a possible implementation, the electronic device may add an additional log to record the fault information 1, rather than recording the fault information 1 in an already generated log.
[0107] It is understandable that the present application may also store the fault information 1 in a partition related to the startup of the electronic device in other forms, and the present application does not impose any limitation on this.
[0108] S104: In the standby state, the electronic device scans the key partition to determine whether the key partition is abnormal.
[0109] It can be understood that the standby state involved in the present application refers to the state after the kernel in the electronic device (for example, the kernel of the HLOS mentioned in step S101) is started. In the standby state, the electronic device can first scan one or more specific key partitions, and record the dotting information, summarize the recorded dotting information, obtain the corresponding fault information, and determine whether the key partition is abnormal based on the fault information, that is, determine whether the above-mentioned abnormal situation detected in the startup phase is specifically a UFS fault that affects the key image file. If the electronic device determines that the key partition is abnormal, the electronic device can execute step S105. If the electronic device determines that the key partition is normal, the electronic device can execute step S108.
[0110] It is understandable that a key partition refers to a partition that plays a key role in the operation of the operating system. Key partitions may include vendor partitions and system partitions, etc. The vendor partition is used to store some system files and drivers provided by the manufacturer. The system partition is the core partition of the Android system, which contains all files and applications of the operating system. In this partition, users can install and uninstall applications, update the system, etc. Of course, key partitions may also include other partitions, and this application does not make specific restrictions on this.
[0111] It is understandable that the dotting information may include relevant records of the scanned partition, including the scan time and the scan result. In some embodiments of the present application, the dotting information recorded by the electronic device when scanning the key partition may specifically include: a log obtained by the electronic device when scanning the key partition, which records the scan time and the scan result.
[0112] For the convenience of description, the present application records the fault information generated by the electronic device scanning the key partition in the standby state as fault information 2.
[0113] In some embodiments of the present application, the fault information 2 may relate to one or more of the following: the failure address, the logical area access situation, and the situation of an access (Input / Output, IO). Among them, the failure address refers to the address corresponding to the data that fails to be read. The read failure may include IO exceptions (e.g., IO timeouts), unresponsive read operations, etc. The logical area refers to the detection logic of a UFS driver. IO refers to the interaction with the storage medium.
[0114] Of course, the fault information 2 may also relate to other content, and the present application does not make specific restrictions on this.
[0115] In some embodiments of the present application, the fault information 2 may specifically include one or more of the following: the number of failure addresses, the number of times of logical area access failures, and the number of IO failures. The logical area access failure may include logical area access timeouts, access unresponsiveness, etc. The IO failure may include access timeouts, access unresponsiveness, etc.
[0116] In some embodiments of the present application, when the electronic device determines that the critical partition is abnormal according to the fault information 2, it may specifically include one or more of the following: the electronic device determines that the number of failure addresses included in the fault information 2 is not less than a threshold 1; the electronic device determines that the number of times of logical area access failures included in the fault information 2 is not less than a threshold 2; the electronic device determines that the number of IO failures included in the fault information 2 is not less than a threshold 3.
[0117] It can be understood that the threshold 1, the threshold 2, and the threshold 3 are positive integers, and their specific values can be set according to actual needs, and the present application does not limit this. The threshold 1, the threshold 2, and the threshold 3 may be the same or different. In some embodiments of the present application, the threshold 1, the threshold 2, and the threshold 3 may be determined according to factors such as the service life, model, and the self-life of the device. That is to say, when the service life of the electronic device changes, the threshold 1, the threshold 2, and the threshold 3 may be determined accordingly based on the changed service life. For example, when the service life of the electronic device is 1, the threshold 1 is 2, and when the service life of the electronic device is 5, the threshold 1 is 6.
[0118] In some embodiments of the present application, after starting the corresponding process, the electronic device may scan the critical partition in the corresponding process. It can be understood that the corresponding process can be set according to actual needs, and the present application does not make specific restrictions on it.
[0119] S105: The electronic device migrates the affected critical image files in the critical partition.
[0120] If the electronic device determines that a critical partition is abnormal, that is, the electronic device has a UFS failure that affects the critical image file, the electronic device can migrate the critical image file affected by the UFS failure in the critical partition. Specifically, the electronic device can migrate the critical image file affected by the UFS failure to other storage areas to ensure the normal operation of core services such as startup. It can be understood that the other storage area can refer to the backup partition corresponding to the UFS. The backup partition corresponding to the UFS is a partition that is pre-set to prevent UFS failures and is different from the partition originally corresponding to the UFS (including the partition related to the startup of the electronic device, the critical partition, and the common partition).
[0121] It can be understood that the critical image file refers to the image file in the critical partition that affects the startup of the electronic device. Among them, the critical partitions that affect the startup of the electronic device can include the vendor partition, the boot partition, and the system partition, etc. The main task of the boot partition is to provide all the files required during system startup. It can be understood that the specific functions of the vendor partition, the boot partition, and the system partition can be further referred to the relevant technical documents, and this application will not elaborate here.
[0122] In some embodiments of the present application, the electronic device can also determine whether the failure addresses included in the failure information 2 are concentrated. In a possible implementation manner, when the electronic device determines that the critical partition is abnormal according to the specific implementation manner provided in step S104 and the failure addresses included in the failure information 2 are concentrated, the electronic device can execute step S105. In another possible implementation manner, regardless of whether the failure addresses included in the failure information 2 are concentrated, the electronic device will execute step S105 when it determines that the critical partition is abnormal according to the specific implementation manner provided in step S104.
[0123] In some embodiments of the present application, the electronic device can also determine whether the critical partition is abnormal in combination with the concentration of the failure addresses involved in the failure information 2.
[0124] In some embodiments of the present application, to determine whether the failure addresses included in the failure information 2 are concentrated, specifically, the electronic device can determine whether the failure addresses included in the failure information 2 in the same sector are not less than a%. If the failure addresses included in the failure information 2 in the same sector are not less than a%, the electronic device can determine that the failure addresses are concentrated.
[0125] It can be understood that the sector refers to a storage area smaller than the partition. It can be understood that a is less than 100 and greater than 0. a can be set according to actual needs, and the present application does not limit its specific value. For example, a can be 70. For another example, a can be 85.
[0126] In some embodiments of the present application, the electronic device determines whether the failure addresses included in the failure information 2 are concentrated. Specifically, it may include: The electronic device may determine that the number of failure addresses whose difference between the corresponding number of itself included in the failure information 2 and the numbers corresponding to other failure addresses is less than b is greater than c.
[0127] In some embodiments of the present application, the electronic device determines whether the failure addresses included in the failure information 2 are concentrated. Specifically, it may include: The electronic device may determine the ratio of the number of failure addresses whose difference between the corresponding number of itself included in the failure information 2 and the numbers corresponding to other failure addresses is less than b to the total number of failure addresses included in the failure information 2 is greater than d.
[0128] It can be understood that c is a positive integer, and b, c, and d can be set according to actual needs, and the present application does not limit their specific values.
[0129] Exemplarily, b can be 100, c can be 3, and the failure addresses included in the failure information 2 can include 135842, 165212, 135840, 135846, and 135870. Among the above failure addresses, the failure addresses whose difference between the corresponding number of itself and the numbers corresponding to other failure addresses is less than 100 include 135842, 135840, 135846, and 135870. This number is greater than 3, so the electronic device can determine that the failure addresses included in the failure information 2 are concentrated.
[0130] S106: The electronic device determines whether it has successfully migrated the affected critical image files in the critical partition.
[0131] After the electronic device migrates the affected critical image files in the critical partition, it can determine whether the migration is successful. If the electronic device successfully migrates the affected critical image files in the critical partition, the electronic device may execute step S107. If the electronic device fails to successfully migrate the affected critical image files in the critical partition, the electronic device may execute step S110.
[0132] S107: The electronic device continues to work.
[0133] If the electronic device successfully migrates the affected critical image files in the critical partition, it indicates that the electronic device can work normally. Next, the electronic device can continue to work as usual.
[0134] S108: In the standby state, the electronic device scans the common partition to determine whether the common partition is abnormal.
[0135] In the standby state, if the electronic device determines that there is no abnormality in the key partition, the electronic device can continue to scan one or more specific common partitions, and record the dotting information, summarize the recorded dotting information, obtain the corresponding fault information, and determine whether the key partition is abnormal based on the fault information, that is, determine whether the abnormal situation detected in the startup phase is specifically other UFS faults other than those affecting the key image file. If the electronic device determines that the common partition is abnormal, the electronic device can execute step S109, and if the electronic device determines that there is no abnormality in the common partition, the electronic device can execute step S107.
[0136] It is understandable that commonly used partitions refer to frequently used partitions that the operating system relies on to run. Common partitions may include data partitions, original design manufacturer (ODM) partitions, and product partitions, etc. The data partition can be used to store configuration files and data required for system operation. The ODM partition is used for original design manufacturers to customize their own board support packages, that is, it contains the original design manufacturer's customization of the board support package of the system-on-chip supplier. The product partition is an extension of the system partition and can be used to store partitions for content such as some system components and themes. It is understandable that the specific functions of the data partition, the ODM partition, and the product partition can be further referred to the relevant technical documents, and this application will not elaborate on them here.
[0137] In some embodiments of the present application, the dot information recorded when the electronic device scans the commonly used partitions may specifically include: a log obtained when the electronic device scans the commonly used partitions, in which the scanning time and the scanning results are recorded.
[0138] For the convenience of description, the present application records the fault information generated when the electronic device scans the common partitions in the standby state as fault information 3.
[0139] In some embodiments of the present application, the fault information 3 may involve one or more of the following: failed address, logical area access condition, IO condition. Of course, the fault information 3 may also involve other contents, which are not specifically limited in the present application.
[0140] In some embodiments of the present application, the fault information 3 may specifically include one or more of the following: the number of failed addresses, the number of failed logical area accesses, and the number of IO failures. Of course, the fault information 3 may also include other contents, which are not limited by the present application.
[0141] In some embodiments of the present application, the electronic device determines that the common partition is abnormal based on the fault information 3, which may specifically include one or more of the following: the electronic device determines that the number of failed addresses included in the fault information 3 is not less than the threshold 4; the electronic device determines that the number of times of failed access to the logical area included in the fault information 3 is not less than the threshold 5; the electronic device determines that the number of IO failures included in the fault information 3 is not less than the threshold 6.
[0142] It can be understood that the threshold 4, the threshold 5, and the threshold 6 are positive integers, and their specific values can be set according to actual needs, and the present application does not limit this. The threshold 4, the threshold 5, and the threshold 6 may be the same or different. In some embodiments of the present application, the threshold 4, the threshold 5, and the threshold 6 may be determined according to factors such as the service life of the device, the model, and the self-life of the device. That is to say, in the case where the service life of the electronic device changes, the threshold 4, the threshold 5, and the threshold 6 may be correspondingly determined based on the changed service life. For example, when the service life of the electronic device is 1, the threshold 4 is 3, and when the service life of the electronic device is 5, the threshold 4 is 7.
[0143] It can be understood that the threshold 1 and the threshold 4 may be the same or different, the threshold 2 and the threshold 5 may be the same or different, and the threshold 3 and the threshold 6 may be the same or different. In some embodiments of the present application, the threshold 4 is greater than the threshold 1, the threshold 5 is greater than the threshold 2, and the threshold 6 is greater than the threshold 3.
[0144] In some embodiments of the present application, the electronic device may not execute step S108, but directly execute step S109. Specifically, if the electronic device determines that the critical partition is normal, the electronic device may directly execute step S109, that is, the electronic device may directly determine whether the abnormal situation of the common partition meets the preset condition 1.
[0145] In some embodiments of the present application, after the electronic device is started, it may execute step S104 once, and then execute step S108 at a certain frequency. For example, step S108 is executed 3 times per week. After the electronic device is started again, it may execute step S104 once and then execute step S108 at a certain frequency. That is to say, in the standby state after each start, the electronic device may scan the critical partition once, and then scan the common partition at a certain frequency. That is, the critical partition is scanned only once, while the common partition may be scanned multiple times.
[0146] S109: The electronic device determines whether the abnormal situation of the common partition meets the preset condition 1.
[0147] If the electronic device determines that the critical partition is normal and the common partition is abnormal, the electronic device can further determine whether the abnormal situation of the common partition meets the preset condition 1. If the electronic device determines that the abnormal situation of the common partition meets the preset condition 1, the electronic device can execute step S110. If the electronic device determines that the abnormal situation of the common partition does not meet the preset condition 1, the electronic device can execute step S107. It can be understood that if the abnormal situation of the common partition meets the preset condition 1, it can indicate that this UFS failure is relatively serious.
[0148] In some embodiments of the present application, for the electronic device to determine that the abnormal situation of the common partition meets the preset condition 1, it may specifically include: the electronic device determines that the number of failed addresses included in the fault information 3 is not less than the threshold 7.
[0149] In some embodiments of the present application, for the electronic device to determine that the abnormal situation of the common partition meets the preset condition 1, it may specifically include: the electronic device determines that the number of PA access failures included in the fault information 3 is not less than the threshold 8.
[0150] In some embodiments of the present application, for the electronic device to determine that the abnormal situation of the common partition meets the preset condition 1, it may specifically include: the electronic device determines that the number of IO failures included in the fault information 3 is not less than the threshold 9.
[0151] It can be understood that the threshold 7, the threshold 8, and the threshold 9 are positive integers, and their specific values can be set according to actual needs, and the present application does not limit this. The threshold 7, the threshold 8, and the threshold 9 may be the same or different. In some embodiments of the present application, the threshold 7, the threshold 8, and the threshold 9 may be determined according to factors such as the service life, model, and self-life of the device. That is to say, in the case where the service life of the electronic device changes, the threshold 7, the threshold 8, and the threshold 9 may be correspondingly determined based on the changed service life. For example, when the service life of the electronic device is 1, the threshold 4 is 10, and when the service life of the electronic device is 5, the threshold 4 is 30.
[0152] It should be noted that the threshold 7 is greater than the threshold 4, the threshold 8 is greater than the threshold 5, and the threshold 9 is greater than the threshold 6.
[0153] In some embodiments of the present application, for the electronic device to determine that the abnormal situation of the common partition meets the preset condition 1, it may specifically include: the electronic device can determine that the number of interaction failures between the UFS and the SOC involved in the fault information 3 is not less than K. If the number of interaction failures between the UFS and the SOC involved in the fault information 3 is not less than K, the electronic device can determine that this UFS failure is relatively serious. It can be understood that K is a positive integer, and its specific value can be set according to actual needs, and the present application does not limit this.
[0154] In some embodiments of the present application, the electronic device determines that the abnormal situation of the common partition meets the preset condition 1, which may specifically include: the electronic device may determine whether the ratio of the number of interaction failures between the UFS and the SOC involved in the fault information 3 to the total number of interactions is not less than L. If the ratio of the number of interaction failures between the UFS and the SOC involved in the fault information 3 to the total number of interactions between the UFS and the SOC involved in the fault information 3 is not less than L, the electronic device may determine that this UFS fault is relatively serious. It can be understood that L is not less than 0 and not greater than 1, and its specific value can be set according to actual needs, and the present application does not limit this.
[0155] It can be understood that the interactions between the UFS and the SOC mentioned in the present application may include, but are not limited to: the UFS reads relevant information of the SOC, the SOC reads relevant information of the UFS, and the message sending and receiving between the UFS and the SOC.
[0156] In some embodiments of the present application, the electronic device determines that the abnormal situation of the common partition meets the preset condition 1, which may specifically include: the electronic device determines whether the failure addresses included in the fault information 3 are concentrated. It can be understood that the specific implementation method adopted by the electronic device to determine whether the failure addresses included in the fault information 3 are concentrated can refer to the above (such as the specific judgment method for whether the failure addresses included in the fault information 2 are concentrated involved in step S105), and the present application will not elaborate here.
[0157] In some embodiments of the present application, the electronic device may determine the fault level corresponding to this UFS fault according to the fault information 3.
[0158] In a possible implementation manner, if the fault level corresponding to this UFS fault is among the top b% of the fault levels, the electronic device may determine that this UFS fault is relatively serious, that is, the electronic device may determine that the abnormality of the common partition meets the preset condition 1.
[0159] It can be understood that b is less than 100 and greater than 0. b can be set according to actual needs, and the present application does not limit its specific value. Exemplarily, b can be 30, and the fault levels may include four types: the first level, the second level, the third level, and the fourth level. Among these four fault levels, the first level indicates the most serious UFS fault and belongs to the fault level at the very front, while the UFS fault degrees indicated by the second level, the third level, and the fourth level decrease in turn. In this case, only when the fault level corresponding to the UFS fault is among the top 30% of the fault levels, this UFS fault is relatively serious. In this case, the abnormal situation of the common partition meets the preset condition 1. Since 30% * 4 = 1.2, only when the fault level corresponding to the UFS fault is the first level, the abnormal situation of the common partition meets the preset condition 1.
[0160] In a possible implementation, if the fault level corresponding to this UFS fault is the most serious fault level, the electronic device can determine that the abnormality of the common partition meets preset condition 1.
[0161] Exemplarily, the fault levels can include a first level, a second level, and a third level, and the UFS fault degrees represented by them decrease in turn. If the fault level corresponding to this UFS fault is the first level, the electronic device can determine that the abnormality of the common partition meets preset condition 1.
[0162] In a possible implementation, if the number of fault levels is greater than 2, and the fault level corresponding to this UFS fault is one of the two most serious fault levels, the electronic device can determine that the abnormality of the common partition meets preset condition 1.
[0163] Exemplarily, the fault levels can include a first level, a second level, a third level, a fourth level, and a fifth level, and the UFS fault degrees represented by them decrease in turn. If the fault level corresponding to this UFS fault is the first level or the second level, the electronic device can determine that the abnormality of the common partition meets preset condition 1.
[0164] In some embodiments of the present application, the electronic device can specifically determine the fault level corresponding to this UFS fault based on one or more of the following:
[0165] (1) The number of failed addresses included in the fault information 3;
[0166] (2) The number of times of failed access to the logical area included in the fault information 3;
[0167] (3) The number of IO failures included in the fault information 3;
[0168] (4) The number of interaction failures between the UFS and the SOC involved in the fault information 3;
[0169] (5) The ratio of the number of interaction failures between the UFS and the SOC involved in the fault information 3 to the total number of interactions;
[0170] (6) The concentration of the failed addresses included in the fault information 3.
[0171] It should be noted that if the abnormal situation of the common partition does not meet preset condition 1, while continuing to work, the electronic device needs to continue to monitor the abnormal situation of the common partition and continue to collect relevant fault information of the UFS. In some embodiments of the present application, if the electronic device determines that the common partition is abnormal, but its abnormal situation does not meet preset condition 1, the electronic device can accumulate the fault information 3 generated after multiple startups, and then determine whether the abnormal situation of the common partition meets preset condition 1 based on the accumulated fault information 3.
[0172] S110: The electronic device sets a flag bit.
[0173] If the electronic device fails to successfully migrate the affected critical image file in the critical partition, or the electronic device determines that the abnormal situation in the common partition does not meet the preset condition 1, the electronic device can set a flag bit. In some embodiments of the present application, for the electronic device to set a flag bit, it may specifically include: the electronic device sets a flag bit and sets the flag bit to 1. It can be understood that the flag bit can also be referred to as a status bit, which means using a variable to record the information of a call without affecting other information.
[0174] In some embodiments of the present application, if the electronic device fails to successfully migrate the affected critical image file in the critical partition, or the electronic device determines that the abnormal situation in the common partition does not meet the preset condition 1, the electronic device can set the first parameter to the first content.
[0175] It can be understood that the first parameter can be set according to actual needs, and the present application does not limit the specific form of the first parameter (for example, letters, strings, numbers, etc.). For example, the first parameter can be represented by the letter x. It can be understood that the first content can be set according to actual needs, and the present application does not specifically limit its specific form (for example, letters, strings, numbers, etc.) and specific content. For example, the first content can be 1. For another example, the first content can be true.
[0176] S111: The electronic device receives an instruction to start the electronic device. In response to the instruction to start the electronic device, the electronic device starts to boot.
[0177] It can be understood that after the electronic device receives the instruction to start the electronic device again, in response to the instruction to start the electronic device, the electronic device can start to boot, and the specific description can refer to the relevant description in step S101.
[0178] S112: If the electronic device detects an abnormality during the startup process and triggers the imminent entry into the emergency download mode, the electronic device determines whether the flag bit has been set.
[0179] During the startup process of the electronic device, once the electronic device detects an abnormality in the boot startup stage and triggers the imminent entry into the emergency download mode, the electronic device determines whether the flag bit has been set. For example, in the case where the electronic device detects an abnormality in the boot startup stage and triggers the imminent entry into the emergency download mode, if the electronic device determines that the flag bit is 1, the electronic device can determine that the flag bit has been set.
[0180] It can be understood that the electronic device detects an abnormality during the startup process and triggers the imminent entry into the emergency download mode, which may specifically include one or more of the following: the interaction between UFS and SOC fails, the mirror file in UFS cannot be read, and the loading fails.
[0181] In some embodiments of the present application, if an anomaly is detected during the startup process of the electronic device and it is triggered to enter the emergency download mode, the electronic device determines whether the first parameter is specifically the first content.
[0182] S113: The electronic device starts the backup operating system.
[0183] If an anomaly is detected during the startup process of the electronic device and it is triggered to enter the emergency download mode, and the electronic device determines that the flag bit has been set, then the electronic device can start the backup operating system.
[0184] In some embodiments of the present application, the backup operating system can be the recovery partition that shields non-critical disk read and write operations. It is an additionally set operating system, different from the recovery partition in the original operating system (such as the Android system) used by the electronic device.
[0185] In some embodiments of the present application, the backup operating system can be the fastboot partition that shields non-critical disk read and write operations. It is an additionally set operating system, different from the fastboot partition in the original operating system (such as the Android system) used by the electronic device.
[0186] It can be understood that after the electronic device starts the backup operating system, it can support partial maintenance testing. For example, capturing fault information 1, fault information 2, and fault information 3 to determine the faulty partition in the UFS, and for another example, skipping the faulty partition to resume the operation.
[0187] In some embodiments of the present application, the electronic device can skip steps S101 - S103 and only execute according to the logic of steps S104 - S113.
[0188] Next, another method for handling memory faults provided by the embodiments of the present application is introduced.
[0189] Please refer to Figure 2B , Figure 2B which is a flowchart of a method for handling memory faults provided by the embodiments of the present application. Figure 2B The specific implementation manners of the steps (steps S101 - S113) shown can refer to the relevant descriptions above Figure 2A and are different from the method shown in Figure 2A In the method shown in Figure 2B after the electronic device executes step S103, it can continue to execute step S104 and step S108, rather than as shown in Figure 2AAs shown, after performing step S104, step S108 is executed only when it is determined that there is no abnormality in the critical partition.
[0190] In some embodiments of the present application, the electronic device may first execute step S104 and then execute step S108.
[0191] In some embodiments of the present application, after the electronic device is started, step S104 may be executed once, and step S108 may be executed at a certain frequency. For example, step S108 is executed 3 times per week. After the electronic device is started again, step S104 may be executed once, and step S108 may be executed at a certain frequency. That is to say, in the standby state after each start, the electronic device may scan the critical partition once, and may scan the common partition at a certain frequency. That is, the critical partition is scanned only once, while the common partition may be scanned multiple times.
[0192] The following introduces the device involved in the embodiments of the present application.
[0193] Figure 3 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application.
[0194] As Figure 3 shown, the electronic device may include: a processor, a mobile communication module, a wireless communication module, an audio module, a speaker, a receiver, a microphone, a headphone jack, an internal memory, an external memory interface, a sensor module, a subscriber identity module (SIM) card slot, a display screen, a camera, a button, and a universal serial bus (USB) interface, etc. Among them, the sensor module may include: a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0195] The structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the electronic device. In some embodiments of the present application, the electronic device may include more components than shown. For example, other types of sensors. For another example, a charging management module, a power management module, a battery, a motor, an indicator, etc. In some embodiments of the present application, the electronic device may include fewer components than shown, or combine certain components, or split certain components, or have different component arrangements. The components shown may be implemented in hardware, software, or a combination of software and hardware. The interface connection relationships between the modules schematically shown in the embodiments of the present application are only illustrative and do not constitute a structural limitation on the electronic device.
[0196] The processor may include one or more processing units. For example, the processor may include a System on Chip (SOC), an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a codec (e.g., a video codec), a Digital Signal Processor (DSP), a baseband processor, and / or a Neural-network Processing Unit (NPU), etc. Among them, the codec can be used to transform a signal or a data stream. A memory may also be provided in the processor for storing instructions and data.
[0197] The electronic device can implement the display function through the GPU, the display screen, and the application processor, etc. The GPU is a microprocessor for image processing, connecting the display screen and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor may include one or more GPUs, which execute program instructions to generate or change the display information. The display screen is used to display images, videos, etc. In some embodiments, the electronic device may include one or more display screens.
[0198] The camera is used to capture static images or videos. The ISP is used to process the data fed back by the camera. The camera may include a lens and an image sensor, etc. The image sensor is a photosensitive element. Light is transmitted to the image sensor through the lens, the optical signal is converted into an electrical signal, and then the image sensor transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye.
[0199] It can be understood that the internal memory may include UFS. In some embodiments of the present application, the internal memory may include one or more Random Access Memories (RAMs) and one or more non-volatile memories (NVMs). The random access memory can be directly read and written by the processor, and can be used to store the operating system or executable programs of other running programs (e.g., machine instructions), and can also be used to store data of users and application programs, etc. The non-volatile memory can also store executable programs and data of users and application programs, etc., and can be pre-loaded into the random access memory for the processor to directly read and write.
[0200] In the embodiments of the present application, the code for implementing the method described in the embodiments of the present application can be stored on the non-volatile memory. After the electronic device is started, the electronic device can load the executable code stored in the non-volatile memory into the random access memory.
[0201] The external memory interface can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device.
[0202] The electronic device can implement audio functions through an audio module, a speaker, a receiver, a microphone, a headphone jack, and an application processor, etc.
[0203] The audio module is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The speaker, also known as the "loudspeaker", is used to convert an audio electrical signal into a sound signal. The receiver, also known as the "earpiece", is used to convert an audio electrical signal into a sound signal. The microphone, also known as the "microphone", "transmitter", is used to convert a sound signal into an electrical signal. The headphone jack is used to connect a wired headphone.
[0204] The touch sensor, also known as the "touch device". The touch sensor can be disposed on the display screen, and together with the display screen forms a touch screen, also known as the "touch panel". The touch sensor is used to detect a touch operation acting thereon or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen. In some other embodiments, the touch sensor can also be disposed on the surface of the electronic device, at a different position from that of the display screen.
[0205] It can be understood that the meanings and functions of other sensors can be referred to relevant technical documents and will not be elaborated here.
[0206] The electronic device can implement communication functions with other devices through a mobile communication module and a wireless communication module.
[0207] The mobile communication module can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc. applied to the electronic device.
[0208] The wireless communication module can provide solutions for wireless communications applied to electronic devices, including Wireless Local Area Network (WLAN) (e.g., Wireless Fidelity network, simply referred to as Wi-Fi network), Bluetooth (BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), etc. The wireless communication module can be one or more devices integrating at least one communication processing module. The wireless communication module can receive electromagnetic waves via antenna 2, or convert signals into electromagnetic waves for radiation.
[0209] The software system of the electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservices architecture, or cloud architecture. Among them, the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Communication between layers is carried out through software interfaces. In the embodiments of this application, the Android system with a layered architecture is taken as an example to exemplarily illustrate the software structure of the electronic device.
[0210] Figure 4 This is a schematic diagram of the software structure of an electronic device provided by the embodiments of this application.
[0211] As Figure 4 shown, the software framework of the electronic device can include an application layer, an application framework layer, system libraries, Runtime, Hardware Abstraction Layer (HAL), and a kernel layer.
[0212] The application layer can include a series of application packages. Generally speaking, the application layer can include system applications and third-party applications. System applications are a series of core applications attached to the Android system. For example, system applications can include applications such as camera, music, calendar, short message, WLAN, call, and gallery. Third-party applications are applications that users can choose to install. In some embodiments of this application, users can download and install third-party applications in the application store.
[0213] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions. The application framework layer can include a series of system services. System services are modular components focused on specific functions. The functions provided by the application framework APIs can communicate with the system services to access the underlying hardware.
[0214] As Figure 4 shown, the application framework layer can include a content provider, a window manager, a resource manager, a phone manager, a notification manager, and a view system, etc. The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data, and make this data accessible to applications. The data can include videos, images, audio, dialed and answered calls, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon can include a view for displaying text and a view for displaying pictures. The phone manager is used to provide the communication functions of the electronic device. For example, the management of call states (including connection, hanging up, etc.). The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables applications to display notification information in the status bar, can be used to convey notification-type messages, and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify the completion of a download, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as a notification of a background-running application, and can also be a notification that appears on the screen in the form of a dialogue window. For example, prompt text information in the status bar, emit a prompt sound, the electronic device vibrates, the indicator light flashes, etc.
[0215] The system library can include multiple functional modules. For example: Surface Manager, Media Libraries, 3D graphics processing library (e.g., OpenGL ES), 2D graphics engine (e.g., SGL), etc. The specific meanings and functions of these functional modules can be referred to relevant technical documents and will not be elaborated here. The specific meanings and functions of these functional modules can be referred to relevant technical documents and will not be elaborated here.
[0216] Runtime is responsible for the scheduling and management of the system. Runtime includes a core library and a virtual machine.
[0217] The Hardware Abstraction Layer (HAL) is an interface layer located between the operating system kernel and the upper-layer software, and its purpose is to abstract the hardware. The HAL is an abstract interface for device kernel drivers and is used to implement application programming interfaces that provide access to underlying devices to a higher-level Java API framework. The HAL can provide a standard interface to display the hardware functions of the device to a higher-level Java API framework. The HAL contains multiple library modules. Each of these library modules implements an interface for a specific type of hardware component. When the system framework layer API requests access to the hardware of a portable device, the operating system will load the library module for this hardware component.
[0218] The kernel layer is the layer between hardware and software. The kernel layer is the foundation of the Android system. The kernel layer is responsible for functions such as hardware driver programs, networking, power supply, system security, and memory management. The kernel layer is an intermediate layer between hardware and software, and its role is to pass the requests of application programs to the hardware. The kernel layer may include display drivers, camera drivers, audio drivers, and sensor drivers, etc.
[0219] It should be noted that the software architecture schematic diagram of the electronic device provided in this application is only an example and does not limit the specific module division in different layers of the Android system. Specifically, reference can be made to the introduction of the Android system software architecture in conventional technologies. In addition, the display method provided in this application can also be implemented based on other operating systems, and this application will not list them one by one. Figure 4 The above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0220] The above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for fault handling of a memory, characterized in that, the method is applied to an electronic device provided with a memory, and the partitions corresponding to the memory include a critical partition and a common partition, and the method includes: the electronic device detects an operation that triggers the startup of the electronic device, and in response to the operation that triggers the startup of the electronic device, the electronic device starts to start up; when an exception detected by the electronic device in the first state meets the condition for entering the emergency download mode, if in the second state before the startup of the electronic device, it is scanned and confirmed that the critical partition has an exception and the migration of the affected critical image file in the critical partition fails, or it is scanned and confirmed that the common partition has an exception and meets the first preset condition, then the electronic device starts the first operating system; wherein, the first state is the state when the electronic device is in the boot startup stage, and the second state is the state after the kernel of the second operating system in the electronic device starts up.
2. The method according to claim 1, characterized in that, before the electronic device detects an operation that triggers the startup of the electronic device, the method further includes: in the second state, the electronic device scans the critical partition, generates first fault information, and determines whether the critical partition has an exception based on the first fault information; when the critical partition has an exception, the electronic device migrates the affected critical image file in the critical partition; when the migration of the critical image file by the electronic device fails, the electronic device sets the content corresponding to the first parameter to the first content; when the critical partition has no exception, the electronic device scans the common partition, generates second fault information, and determines whether the common partition has an exception based on the second fault information; when the common partition has an exception and the exception that occurs in the common partition meets the first preset condition, the electronic device sets the content corresponding to the first parameter to the first content; the step that if in the second state before the startup of the electronic device, it is scanned and confirmed that the critical partition has an exception and the migration of the affected critical image file in the critical partition fails, or it is scanned and confirmed that the common partition has an exception and meets the first preset condition, then the electronic device starts the first operating system, specifically includes: if the content corresponding to the first parameter is the first content, then the electronic device starts the first operating system.
3. The method according to claim 1, characterized in that, before the electronic device detects an operation that triggers the startup of the electronic device, the method further includes: in the second state, the electronic device scans the critical partition and the common partition, generates first fault information and second fault information respectively, and determines whether the critical partition and the common partition have an exception based on the first fault information and the second fault information respectively. When an exception occurs in the critical partition, the electronic device migrates the affected critical mirror files in the critical partition; When an exception occurs in the common partition and the exception in the common partition meets the first preset condition, or when the migration of the critical mirror file fails, the electronic device sets the content corresponding to the first parameter to the first content; If the electronic device scans and confirms that an exception occurs in the critical partition and the migration of the affected critical mirror files in the critical partition fails, or scans and confirms that an exception occurs in the common partition and meets the first preset condition in the second state before the startup of the electronic device, then the electronic device starts the first operating system, specifically including: if the content corresponding to the first parameter is the first content, the electronic device starts the first operating system.
4. The method according to claim 2 or 3, wherein, the electronic device determines that an exception occurs in the critical partition based on the first fault information, specifically including any one or more of the following: the electronic device determines that the number of failure addresses included in the first fault information is not less than a first threshold; the electronic device determines that the number of times of failed access to the logical area included in the first fault information is not less than a second threshold; the electronic device determines that the number of times of failed access to IO for one time included in the first fault information is not less than a third threshold.
5. The method according to claim 4, wherein, the electronic device determines that an exception occurs in the critical partition based on the first fault information, and specifically further includes: the electronic device determines that the failure addresses included in the first fault information are concentrated.
6. The method according to claim 5, wherein, in the concentrated failure addresses included in the first fault information, specifically including any one or more of the following: the ratio of the number of failure addresses belonging to the same sector included in the first fault information to the total number of failure addresses included in the first fault information is not less than a first ratio; the number of the first type of failure addresses included in the first fault information is greater than a first value; the difference between the numbers corresponding to the first type of failure addresses and the numbers corresponding to the other failure addresses included in the first fault information is less than a second value; the ratio of the number of the first type of failure addresses included in the first fault information to the total number of failure addresses included in the first fault information is greater than a second ratio.
7. The method according to claim 2 or 3, wherein, the electronic device determines that an exception occurs in the common partition based on the second fault information, specifically including any one or more of the following: the electronic device determines that the number of failure addresses included in the second fault information is not less than a fourth threshold; the electronic device determines that the number of times of failed access to the logical area included in the second fault information is not less than a fifth threshold; the electronic device determines that the number of IO failures included in the second fault information is not less than a sixth threshold.
8. The method according to claim 7, wherein, The anomalies occurring in the common partition satisfy the first preset condition, specifically including any one or more of the following: The number of failed addresses included in the second fault information is not less than the seventh threshold; The number of times of failed access to the logical area included in the second fault information is not less than the eighth threshold; The number of IO failures included in the second fault information is not less than the ninth threshold; Wherein, the seventh threshold is greater than the fourth threshold, the eighth threshold is greater than the fifth threshold, and the ninth threshold is greater than the sixth threshold.
9. The method according to claim 2 or 3, wherein, when the electronic device determines that the common partition is abnormal based on the second fault information, the method further includes: The electronic device determines the fault level of the memory based on the second fault information; When the electronic device determines that the fault level of the memory satisfies the second preset condition, the electronic device determines that the anomalies occurring in the common partition satisfy the first preset condition.
10. The method according to claim 9, wherein, The electronic device determines the fault level of the memory based on the second fault information, specifically including any one or more of the following: The electronic device determines the fault level of the memory based on the number of failed addresses included in the second fault information; The electronic device determines the fault level of the memory based on the number of times of failed access to the logical area included in the second fault information; The electronic device determines the fault level of the memory based on the number of IO failures included in the second fault information; The electronic device determines the fault level of the memory based on the concentration of the failed addresses included in the second fault information; The electronic device determines the fault level of the memory based on the number of interaction failures between the memory involved in the second fault information and the processor in the electronic device; The electronic device determines the fault level of the memory based on the ratio of the number of interaction failures between the memory involved in the second fault information and the processor to the total number of interactions between the memory and the processor.
11. The method according to any one of claims 2-10, wherein, The electronic device scans the common partition to generate the second fault information, specifically including: the electronic device scans the common partition at a preset frequency, and after each scan of the common partition, the electronic device generates corresponding second fault information.
12. The method according to claim 11, wherein, after the electronic device scans the common partition, the method further includes: When an abnormality occurs in the common partition and the abnormality occurring in the common partition does not meet the first preset condition, the electronic device saves the second fault information obtained from the current scan, and when it is determined in the next scan that an abnormality occurs in the common partition, combines the second fault information obtained from the historical scan of the common partition and the second fault information obtained after the next scan of the common partition to determine whether the abnormality occurring in the common partition meets the first preset condition; the second fault information obtained from the historical scan of the common partition includes the second fault information obtained from the current scan.
13. The method according to any one of claims 1-12, wherein, the partition corresponding to the memory further includes a partition related to the startup of the electronic device; before the electronic device detects an operation that triggers the startup of the electronic device, the method further includes: if the electronic device detects an abnormality during the boot startup phase in the previous startup process, the electronic device generates third fault information and stores the third fault information in the partition related to the startup of the electronic device.
14. The method according to claim 13, wherein, after the electronic device starts the first operating system, the method further includes: the electronic device grabs the third fault information to determine the faulty partition of the memory, and performs a recovery operation on the faulty partition of the memory.
15. The method according to any one of claims 2-12, wherein, after the electronic device starts the first operating system, the method further includes: the electronic device grabs the first fault information and the second fault information to determine the faulty partition of the memory, and performs a recovery operation on the faulty partition of the memory.
16. The method according to any one of claims 1-15, wherein, the first operating system is a recovery partition that shields non-critical disk read and write operations, or a fastboot partition that shields non-critical disk read and write operations.
17. The method according to any one of claims 1-16, wherein, the abnormality detected by the electronic device in the first state satisfies entering the emergency download mode, specifically including any one or more of the following: the interaction between the memory and the processor in the electronic device fails; the electronic device cannot read the image file in the memory; the electronic device fails to load.
18. An electronic device, including one or more memories, one or more processors, wherein, the memory is used to store a computer program; the processor is used to call the computer program so that the electronic device executes the method according to any one of claims 1-17.
19. A computer storage medium, wherein, including: computer instructions; when the computer instructions run on an electronic device, the electronic device is caused to execute the method according to any one of claims 1-17.
Citation Information
Patent Citations
Operating system starting method and device, equipment, and storage medium
CN113722004A
Storage space configuration method and related equipment
CN117130541A
Method, server and user terminal for providing gift card
KR102818060B1
Storage system and storage system control method
US20200201724A1
Memory system and method of operating the memory system
US20220075531A1