Abnormal restart reason determination method, electronic equipment and storage medium
By analyzing the abnormal restart data of electronic devices, identifying multiple abnormal features and increasing the weight value, the problem of difficulty in timely determining the cause of abnormal restart of electronic devices is solved, and more efficient and accurate abnormal restart cause determination is achieved.
Patent Information
- Application Number
- CN202410745068.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-06-07
AI Technical Summary
The cause of an abnormal restart of an electronic device is difficult to determine in a timely manner, resulting in a decline in user experience and data loss. Existing technical analysis methods have lags and risks of misjudgment.
By obtaining abnormal restart data of electronic devices, analyzing whether there are multiple abnormal features, increasing the weight value of specific abnormal features, and determining the most likely cause of the abnormal restart, including hardware or software problems.
The real-time and accuracy of determining the cause of abnormal restart is improved, misjudgment and missed judgment are reduced, and the performance of electronic equipment is maintained in a timely manner.
Smart Images

Figure CN120743584A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method for determining the cause of an abnormal restart, an electronic device, and a storage medium. Background Art
[0002] With the rapid advancement of technology, electronic devices such as mobile phones and tablets have permeated every aspect of people's lives, becoming indispensable communication and entertainment tools. During daily use, electronic devices may restart without user intervention, which is known as an abnormal restart. Abnormal restarts not only disrupt the user experience but can also lead to data loss or system instability.
[0003] There may be many reasons for the abnormal restart of an electronic device. Therefore, it is necessary to determine the accurate reason for the abnormal restart in a timely manner to facilitate subsequent effective maintenance of the electronic device. Summary of the Invention
[0004] In order to solve the above problems, the present application provides a method for determining the cause of abnormal restart, an electronic device and a storage medium, the purpose of which is to promptly determine the accurate cause of abnormal restart.
[0005] In a first aspect, the present application provides a method for determining the cause of an abnormal restart. Exemplarily, the method can be applied to an electronic device, which may be a mobile phone, a tablet computer, a laptop computer, or the like. In the method, abnormal restart data of the electronic device can be first obtained. Exemplarily, the method can be applied to an electronic device that has experienced an abnormal restart, and the electronic device can obtain its own abnormal restart data. Exemplarily, the method can be applied to an electronic device that has not experienced an abnormal restart, and the electronic device that has not experienced an abnormal restart can obtain the abnormal restart data of the electronic device that has experienced an abnormal restart. Then, it is determined whether the abnormal restart data exhibits an abnormal feature, and it is determined that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features, for example, one, two, or more abnormal features. Then, it is determined whether the at least one abnormal feature exhibited by the abnormal restart data includes a specific abnormal feature. If so, a non-hardware problem is directly determined as the cause of the abnormal restart of the electronic device, indicating that the specific abnormal feature is used to indicate that the electronic device has a non-hardware problem. Otherwise, that is, it is determined that the abnormal restart data exhibits at least one abnormal feature but does not exhibit the specific abnormal feature, indicating that the electronic device has not experienced a non-hardware problem, and a weight value of the preset abnormal restart cause corresponding to the at least one abnormal feature can be increased. Finally, from multiple preset abnormal restart causes, the preset abnormal restart cause with the largest weight value is determined as the abnormal restart cause of the electronic device, and these multiple preset abnormal restart causes are all used to indicate hardware problems.
[0006] In this way, the electronic device can analyze the cause of the abnormal restart in a timely manner based on the abnormal restart data, without the need for manual analysis by technical personnel, avoiding the lag of analysis, and thus improving the real-time determination of the cause of the abnormal restart, facilitating timely maintenance of the performance of the electronic equipment; at the same time, based on multiple abnormal features, the abnormal restart data is comprehensively analyzed to avoid misjudgment or missed judgment caused by a single abnormal feature, which can improve the accuracy of determining the cause of the abnormal restart.
[0007] In one possible implementation, the abnormal restart data may include multiple sets of abnormal restart data of the electronic device during multiple abnormal restart processes, that is, one abnormal restart process corresponds to a set of abnormal restart data; the preset abnormal restart cause may include a DDR memory jump problem; the above-mentioned step of increasing the weight value of the preset abnormal restart cause corresponding to at least one abnormal feature may include: first calculating the same degree value of multiple sets of function call data corresponding one by one to multiple sets of abnormal restart data, which is used to indicate the same degree of function call situations; and then adding the same degree value to the weight value of the DDR memory jump problem.
[0008] In this way, based on the fact that the DDR memory jump problem may affect the same degree of multiple groups of function call data, the abnormal feature analysis of the abnormal restart data is performed, and the weight value of the DDR memory jump problem, a preset abnormal restart cause, is increased accordingly, which facilitates the subsequent analysis of the possibility of multiple preset abnormal restart causes causing the abnormal restart of the electronic device, and is conducive to determining the accurate cause of the abnormal restart.
[0009] In one possible implementation, a set of function call data is used to indicate a function called by at least one function layer, for example, a set of function call data may indicate a function called by the function layer 0, or a set of function call data may indicate functions called by the three function layers 0, 1 and 2 respectively; the above-mentioned step of calculating the same degree values of the multiple sets of function call data corresponding to the multiple sets of abnormal restart data may include: for each function layer of the multiple sets of function call data, for example, a set of function call data indicates functions called by the three function layers 0, 1 and 2 respectively, then each function layer of the multiple sets of function call data refers to the 0th layer of the multiple sets of function call data, the 1st layer of the multiple sets of function call data and the 2nd layer of the multiple sets of function call data, so as to calculate the same degree values of the multiple sets of function call data corresponding to the three function layers 0, 1 and 2 respectively. Taking layer 0 of the function call data as an example, we can first determine the first function from the multiple functions indicated in the function layer from the multiple sets of function call data. The first function is different from all functions other than the first function in the multiple functions, that is, there is no identical first function in the multiple functions. The same is true for layers 1 and 2 of the multiple sets of function call data. We need to determine the number of first functions in each function layer of the multiple sets of function call data respectively. Finally, based on the number of first functions in each function layer of the multiple sets of function call data, such as the number of first functions corresponding to layers 0, 1 and 2 respectively, we can calculate the degree of similarity of the multiple sets of function call data. The degree of similarity is negatively correlated with the degree of similarity of the multiple sets of function call data. The larger the degree of similarity is, the lower the degree of similarity of the multiple sets of function call data is.
[0010] In this way, the number of first functions is used to determine the degree of identity of multiple groups of function call data, and the first function is easy to search, thus improving the convenience of calculating the degree of identity.
[0011] In one possible implementation, each function layer of the above-mentioned multiple sets of function call data includes multiple functions that respectively have corresponding tag values. The above-mentioned step of determining the first function from the multiple functions indicated in the function layer by the multiple sets of function call data may include: first updating the tag values corresponding to the multiple functions to the first value, for example, all updating them to 1; then determining at least two tag values corresponding to the same function from the multiple tag values updated to the first value, for example, there are two tag values corresponding to function 1, and three tag values corresponding to function 2, then updating at least two tag values to values different from the first value, for example, updating the five tag values corresponding to function 1 and function 2 to values different from the first value, that is, values other than 1; finally, determining the function whose tag value is the first value among the multiple functions as the first function, for example, determining the function whose tag value is still 1 as the first function.
[0012] In this way, by updating the tag value corresponding to the function, it is easy to distinguish the first function that is different from other functions, and the convenience of calculating the same degree value is further improved.
[0013] In one possible implementation, the above-mentioned multiple tag values are arranged in sequence according to the time sequence of the abnormal restart, that is, the earlier the time of the abnormal restart occurs, the earlier the tag value corresponding to the function included in the corresponding abnormal restart data is arranged; the above-mentioned step of updating at least two tag values to values different from the first value may include: first updating the first tag value arranged in the at least two tag values corresponding to the same function to a second value, and updating the remaining tag values in the at least two tag values to a third value. The second value can be obtained based on the number of remaining tag values. Based on the above example, there are two tag values corresponding to function 1 and three tag values corresponding to function 2. Then, the first tag value corresponding to function 1 (in front of time) can be superimposed with 1 and updated to 2, and the other tag value corresponding to function 1 can be updated to 0; the first tag value corresponding to function 2 can be superimposed with 2 and updated to 3, and the two tag values corresponding to function 2 can be updated to 0.
[0014] In this way, the number of identical functions can be represented by the tag value, and the tag values with later time are all updated to 0. Then, when comparing whether the functions are identical in the future, the comparison can be based only on the identical functions with earlier time, without having to compare them again with the identical functions with later time. This can reduce computing resources, increase the comparison speed of functions, and thus improve the calculation speed of the same degree values.
[0015] In one possible implementation, before updating the tag values corresponding to multiple functions to the first value, the method for determining the cause of the abnormal restart may also include: first initializing the tag values corresponding to the multiple functions to a fourth value; accordingly, the step of updating the tag values corresponding to the multiple functions to the first value may include: for each function, before comparing the function with other functions in the multiple functions, updating the function to the first value.
[0016] In this way, whether the function starts to perform comparison can be distinguished by the fourth value and the first value, thereby avoiding the occurrence of missed comparisons.
[0017] In one possible implementation, a set of function call data can be used to indicate functions called by multiple function layers respectively; then the above-mentioned step of calculating the same degree values of multiple sets of function call data based on the number of first functions of each function layer of the multiple sets of function call data may include: for each function layer of the multiple sets of function call data, each function layer has a corresponding weight value, first multiplying the number of first functions of the function layer by the weight value of the function layer to obtain the function call basic weight value corresponding to the function layer, for example, the function layer has 0 layer and 1 layer, the number of first functions of layer 0 is multiplied by the weight value of layer 0 to obtain a function call basic weight value, and the number of first functions of layer 1 is multiplied by the weight value of layer 1 to obtain another function call basic weight value; then adding the function call basic weight values corresponding to multiple function layers, for example, adding the function call basic weight value of layer 0 and the function call basic weight value of layer 1, to obtain the same degree values of multiple sets of function call data.
[0018] In this way, the weight value of the function layer can represent the degree of influence of the function layer on the DDR memory jump problem. Taking into full consideration the different degrees of influence of different function layers, it is possible to calculate the same degree value that can better represent the same situation of multiple groups of function call data, thereby ensuring the accuracy of the weight value of the DDR memory jump problem.
[0019] In one possible implementation, the abnormal restart data may include multiple sets of abnormal restart data of the electronic device during multiple abnormal restart processes; the preset abnormal restart cause may include a DDR memory jump problem; the above-mentioned step of determining that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features may include: determining that the multiple sets of function call data corresponding one-to-one to the multiple sets of abnormal restart data are the same, and determining that there is a preset function in the multiple sets of function call data, and the preset function refers to a function with a corresponding problem weight value; accordingly, the above-mentioned step of increasing the weight value of the preset abnormal restart cause corresponding to at least one abnormal feature may include: adding the problem weight value corresponding to the preset function to the weight value of the DDR memory jump problem.
[0020] In this way, if it is determined that the abnormal feature corresponding to the DDR memory jump problem appears, its weight value is increased, which is conducive to subsequently determining the accurate abnormal restart cause among multiple preset abnormal restart causes.
[0021] In one possible implementation, the above-mentioned step of determining that at least one abnormal feature includes a specific abnormal feature and determining that a non-hardware problem is the cause of the abnormal restart of the electronic device may include: determining that at least one abnormal feature includes multiple groups of abnormal restart data, and multiple groups of function call data corresponding one to one are the same, and determining that there is no preset function in the multiple groups of function call data, that is, the specific abnormal feature is that the multiple groups of function call data without the preset function are the same, and the non-hardware problem can be directly determined as the cause of the abnormal restart of the electronic device.
[0022] In this way, when determining the occurrence of specific abnormal features, there is no need to consider the weight values of each preset abnormal restart reason. The cause of the abnormal restart can be directly determined, fully considering the hardware problems and non-hardware problems that may occur in the electronic device. The analysis of the abnormal restart data is more comprehensive, which can improve the accuracy of the determined abnormal restart cause.
[0023] In one possible implementation, the above-mentioned preset abnormal restart cause may include a DDR memory jump problem; the above-mentioned step of determining that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features may include: first determining that there is a bit inversion at the preset position of the address of the abnormal restart data, that is, a jump occurs, for example, 0 becomes 1, etc.; accordingly, the above-mentioned step of increasing the weight value of the preset abnormal restart cause corresponding to at least one abnormal feature may include: increasing the weight value of the DDR memory jump problem.
[0024] In this way, considering that the DDR memory jump problem may affect the preset address position, the abnormal feature analysis of the abnormal restart data is performed to facilitate the subsequent analysis of the possibility of multiple preset abnormal restart reasons causing the abnormal restart of the electronic device.
[0025] In one possible implementation, the abnormal restart data includes multiple groups of abnormal restart data of the electronic device during multiple abnormal restart processes; determining whether there is a bit inversion at a preset position of the address of the abnormal restart data may include: determining whether there is a bit inversion at a preset position of the address contained in each group of abnormal restart data in order from back to front, until it is determined that there is a bit inversion at the preset position of the address of a group of abnormal restart data, and then stopping the analysis of abnormal restart data with a earlier time; accordingly, increasing the weight value of the DDR memory jump problem may include: adding a first threshold to the weight value of the DDR memory jump problem, the first threshold increases as the corresponding time of the determined group of abnormal restart data is shifted back, that is, the later the time corresponding to the abnormal restart data with bit inversion at the preset position of the address of the determined group is, the larger the first threshold.
[0026] In this way, considering that a set of abnormal restart data of the electronic device that is later in time is more consistent with the problem it currently reflects, it is determined that there is a bit inversion in the preset position of the address included in a set of abnormal restart data, and the abnormal restart data that is earlier in time will no longer be analyzed, which can save data analysis time and further improve the speed of determining the cause of the abnormal restart.
[0027] In one possible implementation, the abnormal restart data includes multiple groups of abnormal restart data of the electronic device during multiple abnormal restart processes; the preset abnormal restart cause includes a DDR memory frequency problem; determining that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features may include: determining that the DDR memory frequencies respectively included in the multiple groups of abnormal restart data have the same frequency; accordingly, increasing the weight value of the preset abnormal restart cause corresponding to at least one abnormal feature may include: increasing the weight value of the DDR memory frequency problem based on the number of identical DDR memory frequencies.
[0028] In this way, considering that the more the number of identical DDR memory frequencies is, the greater the possibility of DDR memory frequency problem is, it is convenient to add a more appropriate weight value to this preset abnormal restart reason.
[0029] In one possible implementation, increasing the weight value of the DDR memory frequency problem based on the number of identical DDR memory frequencies may include adding a minimum value between the number of identical DDR memory frequencies and a threshold to the weight value of the DDR memory frequency problem.
[0030] In this way, a threshold is used as the maximum weighted value of the DDR memory frequency problem to avoid increasing the weight value too much, which will affect the final judgment of the cause of the abnormal restart.
[0031] In one possible implementation, the preset abnormal restart cause includes a cache memory jump problem; determining that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features may include: determining that the number of jump interruptions of the abnormal restart data is greater than 0; accordingly, increasing the weight value of the preset abnormal restart cause corresponding to at least one abnormal feature may include: increasing the weight value of the cache memory jump problem.
[0032] In this way, if it is determined that the abnormal feature of the number of jump interrupts is greater than 0, the weight value of the corresponding cache memory jump problem is increased, which facilitates the subsequent comprehensive analysis of the possibility of various preset abnormal restart causes.
[0033] In one possible implementation, the abnormal restart data includes multiple groups of abnormal restart data of the electronic device during multiple abnormal restart processes; determining that the number of jump interruptions of the abnormal restart data is greater than 0 may include: determining whether the number of jump interruptions of each group of abnormal restart data is greater than 0 in order from back to front in time, until it is determined that the number of jump interruptions of a group of abnormal restart data is greater than 0, then stopping the analysis of abnormal restart data with a faster time; accordingly, increasing the weight value of the cache memory jump problem may include: increasing the weight value of the cache memory jump problem based on the determined number of jump interruptions of a group of abnormal restart data.
[0034] In this way, if it is determined that the number of jump interrupts in a set of abnormal restart data is greater than 0, the analysis will no longer be continued, which can improve the speed of determining the cause of the abnormal restart and save computing resources; at the same time, considering that the more jump interrupts there are, the greater the possibility that the electronic device will have a cache memory jump problem, it is convenient to add a more appropriate weight value for it.
[0035] In one possible implementation, increasing the weight value of the cache memory jump problem based on the number of jump interruptions of a determined set of abnormal restart data can include: first multiplying the number of jump interruptions of a determined set of abnormal restart data by the number of abnormal restarts of the electronic device to obtain a product value; then adding the minimum value between the product value and a threshold to the weight value of the cache memory jump problem, and the threshold increases as the corresponding moment of the determined set of abnormal restart data is shifted back, that is, the later the corresponding moment, the larger the threshold.
[0036] In this way, considering that a later set of abnormal restart data is more consistent with the current problem reflected by the electronic device, a more appropriate threshold is set as the maximum weighted value to avoid the weight value being too large, which affects the subsequent comprehensive analysis of multiple preset abnormal restart causes.
[0037] In one possible implementation, the abnormal restart data includes multiple sets of abnormal restart data of the electronic device during multiple abnormal restart processes; the preset abnormal restart cause includes a cache memory jump problem; determining that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features may include: determining that the CPU cores included in the multiple sets of abnormal restart data respectively exist in the same CPU core, and the CPU core included in each set of abnormal restart data is the CPU core that fails during the operation of the electronic device, that is, the CPU core running the problem process; accordingly, increasing the weight value of the preset abnormal restart cause corresponding to at least one abnormal feature may include: increasing the weight value of the cache memory jump problem based on the same number of times of the same CPU core.
[0038] In this way, considering that the more times the CPU cores are identical, the greater the possibility of a cache memory jump problem, a weight value that better represents the possibility can be added to this preset abnormal restart cause.
[0039] In one possible implementation, increasing the weight value of the cache memory jump problem based on the same number of times the same CPU core occurs can include: using the ratio of the maximum number of times the same CPU core occurs to the number of times the electronic device abnormally restarts, multiplying it by a threshold to obtain a product value, for example, if the same number of times CPU core 1 is 3 times and the same number of times CPU core 2 is 4 times, then the same number of times CPU core 2 is used for calculation; and adding the product value to the weight value of the cache memory jump problem.
[0040] In this way, the threshold is used as the maximum weighted value to avoid adding too large a weight value to the cache memory jump problem, which facilitates further comprehensive analysis of multiple preset restart reasons.
[0041] In one possible implementation, the method for determining the cause of the abnormal restart may further include: recording the abnormal restart data of the electronic device when the electronic device is switched from a power-on state to a power-off state. For example, if the method is applied to an electronic device that undergoes an abnormal restart, the electronic device may record its own abnormal restart data when it is switched from a power-on state to a power-off state when an abnormal restart occurs; accordingly, obtaining the abnormal restart data of the electronic device may include: the electronic device that undergoes an abnormal restart may read its own recorded abnormal restart data when it is switched from a power-off state to a power-on state again.
[0042] In this way, analysis can be performed directly after an abnormal restart occurs, avoiding analysis delays, improving the efficiency of determining the cause of the abnormal restart, and facilitating timely maintenance of the performance of the electronic device.
[0043] In a possible implementation, before determining that the abnormal restart data exhibits at least one abnormal feature among a plurality of abnormal features, the method for determining the cause of the abnormal restart may further include: determining that the abnormal restart data satisfies an abnormal restart analysis condition.
[0044] In this way, when the electronic device restarts abnormally multiple times, frequent analysis affecting the boot time of the electronic device is avoided, which is conducive to improving the user experience.
[0045] In one possible implementation, the above-mentioned abnormal restart analysis conditions may include one or more of the following: the number of abnormal restarts of the electronic device exceeds the fifth threshold; the time interval between the most recent abnormal restart of the electronic device and the previous abnormal restart is less than the sixth threshold; the average time interval between multiple abnormal restarts of the electronic device is less than the seventh threshold.
[0046] In this way, when the abnormal restart of an electronic device affects the user's use, it means that the fault of the electronic device cannot be solved by restarting itself. Therefore, analysis of the abnormal restart data is performed at this time to facilitate timely determination of the cause of the abnormal restart and effective maintenance of the electronic device.
[0047] In one possible implementation, the method for determining the cause of the abnormal restart may further include: determining that the cause of the abnormal restart of the electronic device is a DDR memory jump problem, then further determining the faulty storage unit of the DDR memory and isolating the faulty storage unit; or, determining that the cause of the abnormal restart of the electronic device is a DDR memory jump problem, then modifying the parameters of the DDR memory based on the environment in which the electronic device is located, for example, the parameters of the DDR memory can be modified based on the ambient temperature.
[0048] In this way, when an electronic device has a DDR memory jump problem, the electronic device can automatically repair and automatically maintain the performance of the electronic device to avoid affecting the user's subsequent usage experience.
[0049] In a second aspect, the present application provides an electronic device comprising a memory and a processor; the memory stores computer program code, the computer program code comprising computer instructions; one or more processors call computer instructions to enable the electronic device to execute the method for determining the cause of abnormal restart according to the first aspect above.
[0050] In a third aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method for determining the cause of abnormal restart according to the first aspect is implemented.
[0051] In a fourth aspect, the present application provides a computer program product, which includes computer program code. When the computer program code is executed by an electronic device, the method for determining the cause of abnormal restart according to the first aspect is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A flowchart of a method for determining the cause of an abnormal restart provided in an embodiment of the present application;
[0053] Figure 2 A schematic diagram of determining the cause of an abnormal restart provided in an embodiment of the present application;
[0054] Figure 3 A flowchart of a method for calculating a basic weighted value of a function call provided in an embodiment of the present application;
[0055] Figure 4 A schematic diagram of function call data provided in an embodiment of the present application;
[0056] Figure 5 A schematic diagram of calculating a basic weighted value of a function call provided in an embodiment of the present application;
[0057] Figure 6 A schematic diagram of the software architecture of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to make the description of the following embodiments clear and concise, the vocabulary involved in the embodiments of the present application is first explained. It should be understood that this explanation is for a clearer understanding of the embodiments of the present application and does not necessarily constitute a limitation of the embodiments of the present application.
[0059] Kernel: refers to the core, which is the core of the operating system of the electronic device and the basis for the operation of the operating system. In some embodiments, the abnormal restart of the electronic device refers to the abnormal restart of the kernel.
[0060] Kernel phase during reboot: The kernel phase during reboot refers to the kernel's exception handling phase when an electronic device transitions from a powered-on state to a powered-off state. In some embodiments, during the kernel phase during reboot, the electronic device can record abnormal reboot data for use in analyzing the cause of the abnormal reboot. For example, this abnormal reboot data may include a timestamp, virtual address, physical address, and the problematic CPU core.
[0061] Double Data Rate (DDR): This refers to double data rate memory, which may be referred to as DDR memory in the following embodiments. DDR memory can be used as internal memory in electronic devices to store programs and data during operation, and can also provide fast data access and transmission capabilities.
[0062] Cache memory: refers to cache memory, which may be referred to as cache memory in the following embodiments. Cache memory is a small but extremely fast memory that can be used to reduce the pressure on main memory and improve the performance of electronic devices.
[0063] The following is a comparative explanation of the technical advantages of the method for determining the cause of an abnormal restart, the electronic device, and the storage medium provided by the present application, in combination with related technologies. For ease of understanding, an example scenario is used for illustration.
[0064] Currently, the most serious problem causing electronic devices to restart unexpectedly is data access errors, where incorrect data or addresses are used when running programs. This problem can be caused by hardware failures such as DDR memory. This type of hardware can experience long-term bad blocks or short-term jumps in various user scenarios, causing the device to restart unexpectedly. However, it can also be caused by problems with the device's software.
[0065] In the related art, after an electronic device restarts abnormally, on the one hand, technicians can obtain the data of the electronic device from the cloud server, and then summarize the relevant data that may cause the electronic device to restart abnormally from these data, such as the virtual address related to the DDR memory, etc.; then they can check the specific bits in the virtual address related to the DDR memory, and the value of the specific bit is usually fixed. If its value jumps, that is, the value of the specific bit suddenly changes (for example, 0 becomes 1, or 1 becomes 0), it is determined that the electronic device restarts abnormally because of the failure of the DDR memory; on the other hand, technicians can also use hardware testing tools to test whether the DDR memory and other hardware of the electronic device has failed.
[0066] However, the inventors have discovered through research that after an electronic device is put into commercial use (i.e., after it is used by a user), technicians sometimes face the loss of relevant data such as the logs of the electronic device, encounter difficulties in obtaining the electronic device for testing, and sometimes hardware testing tools also find it difficult to test hardware problems; at the same time, when a specific bit in the relevant virtual address of the DDR memory of the electronic device shows a jumping feature, it may be other hardware problems or software failures that cause the electronic device to restart abnormally, and when the electronic device does not show this feature, it may also be a hardware failure of the DDR memory that causes the electronic device to restart abnormally.
[0067] The methods in the related art have a lag in analyzing the cause of abnormal restart, which easily affects the efficiency of determining the cause of abnormal restart, and thus leads to the inability to take effective maintenance measures in a timely manner, affecting the performance of the electronic equipment; at the same time, judging the cause of the abnormal restart of the electronic equipment based solely on this characteristic exhibited by the electronic equipment has limitations, and it is difficult to accurately determine the cause of the abnormal restart of the electronic equipment.
[0068] Therefore, in order to solve the above problems, an embodiment of the present application provides a method for determining the cause of an abnormal restart. The method can be applied to an electronic device. Before analyzing the cause of the abnormal restart, the electronic device can read abnormal restart data, for example, abnormal restart data recorded when the electronic device changes from a power-on state to a power-off state when the electronic device is abnormally restarted, wherein the read abnormal restart data can include data recorded for multiple abnormal restarts respectively; then the abnormal restart data is analyzed to determine whether there are multiple abnormal features. If it is determined that there are abnormal features and the abnormal features do not include specific abnormal features, the weight value of the preset abnormal restart cause (used to indicate a hardware problem, such as a DDR memory jump problem, a cache memory jump problem, etc.) corresponding to the abnormal feature can be increased. After the analysis is completed, the preset abnormal restart cause with the largest weight value can be determined as the abnormal restart cause of the electronic device; or, if the determined abnormal features include specific abnormal features, non-hardware problems such as software problems can be directly determined as the abnormal restart cause of the electronic device.
[0069] In this way, the present application can timely analyze the cause of abnormal restart through electronic equipment, which can improve the real-time performance of determining the cause of abnormal restart, and is conducive to timely maintenance of the performance of electronic equipment; at the same time, compared with the single feature used to determine the cause of abnormal restart in related technologies, the present application provides multiple abnormal features, which can more comprehensively analyze the abnormal restart data. On this basis, multiple abnormal features can be used to determine different causes of abnormal restart, which can reduce misjudgment or missed judgment, and thus improve the accuracy of the determined cause of abnormal restart of electronic equipment.
[0070] Next, the electronic device that has abnormally restarted is used as the execution subject, combined with Figure 1 The present invention introduces a method for determining the cause of an abnormal restart provided in an embodiment of the present application.
[0071] like Figure 1 As shown, the method for determining the cause of the abnormal restart may include the following steps:
[0072] S101: Acquire abnormal restart data.
[0073] Abnormal restart data refers to data recorded during the abnormal restart process of the electronic device, which can be used to analyze the cause of the abnormal restart of the electronic device.
[0074] In some embodiments, the abnormal restart data may be data recorded when an address access error occurs in the electronic device, causing the electronic device to restart.
[0075] Based on the above description, the abnormal restart process of an electronic device includes the process of the electronic device first switching from the power-on state to the power-off state, and then switching from the power-off state to the power-on state. In some embodiments, the abnormal restart process has multiple stages, which may include the kernel stage and the small system stage when the electronic device abnormally restarts.
[0076] The kernel phase refers to the transition from an electronic device's power-on state to its power-off state. When an electronic device encounters an unrecoverable kernel error while powered on, a kernel panic is triggered, triggering the kernel phase. The device then logs the abnormal reboot data and shuts down.
[0077] The mini-system phase refers to the transition from an electronic device's off state to its on state. When an electronic device boots up from its off state into the mini-system phase, abnormal reboot data recorded in the kernel phase can be retrieved to analyze the cause of the abnormal reboot in the mini-system phase.
[0078] In some embodiments, in the kernel stage, after the electronic device records the abnormal restart data, it can store it in a specific storage area of the electronic device's memory (such as random access memory (RAM), read-only memory (ROM), etc.). Subsequently, in the small system stage, the electronic device can obtain the abnormal restart data from the specific storage area of the memory for analyzing the cause of the abnormal restart.
[0079] In a possible implementation, the electronic device may obtain abnormal restart data recorded during the latest abnormal restart, that is, obtain the latest abnormal restart data recorded this time.
[0080] In another possible implementation, the electronic device may further obtain historical abnormal restart data recorded from previous abnormal restarts of the electronic device, based on obtaining the latest abnormal restart data. For example, if the electronic device undergoes a fifth abnormal restart, the electronic device may obtain abnormal restart data corresponding to each of the first through fifth abnormal restarts. The abnormal restart data corresponding to the fifth abnormal restart constitutes a set of the latest abnormal restart data, and the abnormal restart data corresponding to each of the first through fourth abnormal restarts constitute four sets of historical abnormal restart data. This means that each abnormal restart process of the electronic device corresponds to one set of abnormal restart data.
[0081] In some embodiments, the abnormal restart data can be used to indicate one or more of the number of abnormal restarts, the time point of the abnormal restart, the operating status of the electronic device at the time of the abnormal restart, the hardware failure point, and the software failure point, which is not limited in this application.
[0082] Exemplarily, abnormal restart data may include: index value, timestamp, kernel time, process name, problem central processing unit (CPU), high-order jump flag, number of cache memory jump interrupts, physical address, virtual address, DDR memory frequency, problem scenario, and function call data.
[0083] It should be noted that the abnormal restart data may include more or less data than the above examples, and this application does not limit this.
[0084] The index value is used to indicate the number of abnormal restarts of the electronic device, that is, it can be used to distinguish abnormal restart data recorded in multiple abnormal restarts of the electronic device. For example, if the electronic device abnormally restarts for the first time, the index value may be 0, and if the electronic device restarts for the fourth time, the index value may be 3.
[0085] A timestamp indicates the time when an electronic device abnormally restarts. For example, the timestamp can be the moment when the electronic device records abnormal restart data during the kernel phase; another example can be the moment when the electronic device triggers a kernel panic. For example, if an electronic device records abnormal restart data at xx:xx:xx:xx / xxxx / xx / xxxx, then "xx:xx:xx:xx / xxxx / xx / xxxx" can be recorded as the timestamp of the abnormal restart data.
[0086] Kernel time is used to represent the duration of an electronic device after it starts up, that is, the time the electronic device remains in the powered-on state before switching from the powered-on state to the powered-off state. For example, if an electronic device restarts abnormally after running for 900 seconds after startup, the kernel time is recorded as 900 seconds.
[0087] The process name is used to indicate the name of the problematic process (which can be called the problem process) running when the electronic device abnormally restarts. A process refers to an execution instance of a program, and each process has a corresponding name. For example, the electronic device includes Program 1 and Program 2. After the electronic device is started, Process 1 is created to execute Program 1 once, Process 2 is created to execute Program 2 once, and Process 3 is created to execute Program 1 once. During the execution of Process 3, the electronic device abnormally restarts, and the recorded process name is Process 3.
[0088] The problem CPU core is used to indicate the CPU core that provides the operating environment when the electronic device runs the problem process. For example, the electronic device includes CPU cores 1-8. When CPU core 1 executes process 1 and an error occurs in process 1, CPU core 1 is recorded as the problem CPU core.
[0089] The high-order jump flag is used to indicate that when the electronic device is running a process, the high-order part of the virtual address of the allocated DDR memory jumps. The high-order part is usually a bit with a fixed value in the virtual address, that is, if one or more bits of the bit on the high-order part of the virtual address jump, it is recorded, for example, from 0 to 1, or from 1 to 0.
[0090] The cache memory jump interruption number is used to indicate the number of interruptions triggered by the cache memory jump after the electronic device is started. Each cache memory jump triggers an interruption, so the electronic device can directly obtain the interruption number when recording data.
[0091] The physical address is used to represent the actual address of the memory and is used to directly access the actual location of the memory (such as DDR memory and cache memory, etc.). For example, the physical address that the electronic device needs to access when running the problem process can be recorded.
[0092] Virtual addresses are used to represent the addresses used by electronic devices to run processes. For example, the virtual addresses required to run the problematic process after the electronic device is started can be recorded and mapped to physical addresses through an address translation mechanism, enabling access to the actual memory address.
[0093] The DDR memory frequency is used to indicate the frequency of the DDR memory of an electronic device in the kernel stage. That is, when a kernel panic is triggered, the operating frequency of the DDR memory at that time is recorded.
[0094] The problem scenario is used to represent the scenario in which the electronic device triggers a kernel panic, that is, the scenario in which the problem occurs. For example, if a user operation triggers the electronic device to compress a file, or the electronic device automatically compresses a file, triggering a kernel panic, the problem scenario is recorded as the compressed file scenario.
[0095] Function call data is used to represent the function called when the electronic device runs the problem process. In some embodiments, the recorded function call data can be a function name or a function identifier. In some embodiments, the recorded function call data can also be the function content itself.
[0096] For example, taking the recording of function names as an example, if an electronic device abnormally restarts when running process 1, process 1 includes function a, function b is called during the execution of function a, function c is called during the execution of function b, and function c does not call other functions, then function c that does not call other functions can be recorded as a 0-layer function, and function c is recorded as symbol0; function b that calls the 0-layer function symbol0 is recorded as a 1-layer function, and function b is recorded as symbol1; function a that calls the 1-layer function symbol0 is recorded as a 2-layer function, and function a is recorded as symbol2. In the case of more complex calling relationships, the recording can be done in this way. It can also be called recording functions called by multiple function layers, where the 0-layer function, the 1-layer function, and the 2-layer function are the functions called by these three function layers respectively.
[0097] It should be noted that in the following embodiments, the case where an electronic device undergoes multiple abnormal restarts, and the abnormal restart data obtained includes the latest abnormal restart data and historical abnormal restart data, and the abnormal restart data corresponding to each abnormal restart includes the content contained in the above example, is taken as an example to introduce the subsequent steps in detail.
[0098] S102: Determine whether an abnormal restart analysis condition is met based on the abnormal restart data. If yes, execute S103; otherwise, execute S104.
[0099] It should be noted that S102 is an optional execution step, and the electronic device may also directly execute S103 after obtaining the abnormal restart data, that is, directly make a judgment based on the abnormal restart data.
[0100] In this way, the speed of determining the cause of the abnormal restart of the electronic device can be improved, avoiding affecting the subsequent use of the user.
[0101] It should be understood that after the electronic device obtains the abnormal restart data, it takes some time to analyze the cause of the abnormal restart of the electronic device based on the abnormal restart data, that is, to execute the method for determining the cause of the abnormal restart provided in the embodiment of the present application. Assuming that the cause of the abnormal restart is determined after each abnormal restart of the electronic device, it is easy to increase the time for the electronic device to switch from the off state to the on state, thereby affecting the user experience.
[0102] Therefore, when the abnormal restart of the electronic device affects user use, for example, the electronic device abnormally restarts a large number of times, or the frequency of abnormal restarts of the electronic device is relatively frequent, the cause of the abnormal restart of the electronic device can be analyzed based on the abnormal restart data.
[0103] The abnormal restart analysis condition may be set based on the principle that the electronic device frequently restarts, which means that the electronic device has a fault that cannot be resolved by restarting itself, and therefore requires further analysis.
[0104] In some embodiments, based on this setting principle, the abnormal restart analysis condition may be: the number of abnormal restarts of the electronic device exceeds a number threshold (which may be referred to as a fifth threshold).
[0105] For example, based on the above description, the number of abnormal restarts can be determined based on the index value included in the latest abnormal restart data obtained. For example, if the number threshold is 3 and the index value included in the latest abnormal restart data is 3, it means that the electronic device has experienced four abnormal restarts, meeting the abnormal restart analysis condition. It should be noted that this application does not limit the number threshold, and the number threshold can also be 2 or 4.
[0106] In some embodiments, the abnormal restart analysis condition may be: the time interval between the latest abnormal restart of the electronic device and the last abnormal restart is less than a time interval threshold (which may be referred to as a sixth threshold).
[0107] For example, the time interval can be calculated by subtracting the timestamp t1 included in the most recent abnormal restart data from the timestamp t2 included in the previous abnormal restart data. For example, if the time interval threshold is 3 days, t1 is 0:00 on March 15th, and t2 is 0:00 on March 9th, then t1 minus t2 can be used to obtain a time interval of 6 days, which is greater than 3 days and does not meet the abnormal restart analysis criteria.
[0108] In some embodiments, the abnormal restart analysis condition may be: an average time interval between multiple abnormal restarts of the electronic device is less than an average time interval threshold (which may be referred to as a seventh threshold).
[0109] For example, multiple time intervals can be obtained by subtracting the timestamps corresponding to two adjacent abnormal restarts among multiple abnormal restarts, and then the average of these time intervals can be calculated to obtain the average time interval. Assuming that the electronic device has a total of three abnormal restarts, corresponding to timestamps t0, t1, and t2, the average of the two time intervals t2-t1 and t1-t0 is calculated. For example, if the average time interval threshold is 5 days, assuming t0 is 0:00 on March 7, t1 is 0:00 on March 9, and t2 is 0:00 on March 15, then the average time interval can be calculated to be 4 days, which is less than 5 days and meets the abnormal restart data.
[0110] It should be noted that the present application does not limit the number of abnormal restart analysis conditions, and may include one or more of the above examples. When the abnormal restart analysis conditions include multiple conditions, S103 is executed only after all conditions are met.
[0111] In this way, when the abnormal restart of the electronic device affects the user's use, the cause of the abnormal restart of the electronic device is determined based on the abnormal restart data, thereby avoiding affecting the startup time of the electronic device and improving the user's use experience.
[0112] S103: Based on the abnormal restart data, determine whether there is a significant bit inversion, if yes, execute S105, otherwise execute S106.
[0113] It should be understood that there are many reasons that may cause an electronic device to abnormally restart. Different abnormal restart reasons may cause the electronic device to exhibit certain characteristics (also referred to as abnormal characteristics). Therefore, it can be determined whether the electronic device exhibits these characteristics. If these characteristics are exhibited, it indicates that the electronic device may have abnormally restarted due to the abnormal restart reason corresponding to the characteristic. If these characteristics are not exhibited, it indicates that the electronic device may have abnormally restarted due to other abnormal restart reasons.
[0114] In some embodiments, the abnormal characteristics of the electronic device may include a bit reversal (i.e., a value jump) of a specific bit in a virtual address related to the DDR memory, i.e., a significant bit reversal (also known as a bit reversal at a preset position of the address).
[0115] In some embodiments, the specific bit may refer to a fixed bit in the upper portion of the virtual address that is bit-inverted. Based on the above example, the upper transition flag included in the abnormal restart data can be used to determine whether there is a significant bit inversion.
[0116] For example, assuming that the high-bit transition flag is 0, it indicates that there is no significant bit inversion, and the high-bit transition flag is 1, it indicates that there is a significant bit inversion.
[0117] For example, if the virtual address is "0xffffffxxxxxxx", the third through eighth positions of the virtual address are fixed high-order bits, which normally need to be six fs. Assume that the virtual address of the electronic device during the most recent abnormal restart was "0xfffaffxxxxxxx", and the "f" in the sixth position was changed to "a", indicating a bit flip. The high-order transition flag is 1.
[0118] In some embodiments, fixed bits in other parts of the virtual address may also be bit-reversed, which is not limited in this application.
[0119] In one possible implementation, a judgment can be made based on the latest abnormal restart data first, and if it is determined that a significant bit reversal occurred in the latest abnormal restart, then S105 can be continued to be executed; if it is determined that no significant bit reversal occurred in the latest abnormal restart, then a judgment can be made based on the historical abnormal restart data of the last abnormal restart, and if it is determined that a significant bit reversal occurred in the last abnormal restart, then S105 can be continued to be executed, and so on, until no significant bit reversal occurs in the subsequent abnormal restarts, then a judgment can be made based on the historical abnormal restart data of the first abnormal restart, and if it is determined that a significant bit reversal occurred in the first abnormal restart, then S105 can be continued to be executed, otherwise S106 can be continued to be executed.
[0120] For example, assuming that the electronic device has been abnormally restarted 5 times, the judgment can be made based on the latest abnormal restart data of the 5th abnormal restart. When it is determined that no significant bit reversal has occurred in the 5th abnormal restart, the judgment can be made based on the historical abnormal restart data of the 4th abnormal restart. And so on, the judgment is made in sequence from the back to the front based on time until it is determined that one of the historical abnormal restarts has undergone a significant bit reversal, then S105 is executed, or until it is determined that no significant bit reversal has occurred in the 1st abnormal restart, then S106 is executed.
[0121] In this way, when it is determined that a significant bit reversal has occurred in an abnormal restart, the previous abnormal restart is no longer analyzed, which can reduce computing resources, save time for abnormal restart analysis, and improve the speed of determining the cause of the abnormal restart.
[0122] In another possible implementation, a judgment may be made based on the abnormal restart data corresponding to each abnormal restart to determine whether a significant bit inversion occurs in each abnormal restart. If so, continue to execute S105; otherwise, continue to execute S106.
[0123] For example, assuming that the electronic device has been abnormally restarted five times, a judgment can be made based on the abnormal restart data corresponding to the five abnormal restarts. If it is determined that no bit inversion occurs in the five abnormal restarts, S106 is continued to be executed; otherwise, S105 is continued to be executed.
[0124] In this way, each abnormal restart is analyzed, which is conducive to determining a more accurate cause of the abnormal restart.
[0125] S104: Exit the abnormal restart analysis processing flow.
[0126] In some embodiments, if it is determined based on the latest abnormal restart data and the historical restart data that the abnormal restart analysis condition is not met, the abnormal restart analysis processing flow can be exited, and the electronic device continues to boot to the power-on state.
[0127] S105: Increase the weight value of the DDR memory jump problem by N1.
[0128] In some embodiments, multiple abnormal restart reasons (also referred to as preset abnormal restart reasons) can be pre-set, and each abnormal restart reason may cause the electronic device to exhibit one or more characteristics. The weight value corresponding to each abnormal restart reason can be initialized to 0. Subsequently, when abnormal restart data is analyzed and it is determined that the electronic device exhibits the corresponding characteristic, the weight value of the corresponding abnormal restart reason can be increased.
[0129] In some embodiments, the preset abnormal restart reasons may include: DDR memory jump problem, DDR memory fixed frequency problem and cache memory jump problem. It should be noted that this application does not limit the number of preset abnormal restart reasons, and may include fewer or more problems than the above.
[0130] The DDR memory jump problem may cause a significant bit reversal problem in the virtual address when the electronic device runs a process. In the above steps, it is determined that there is a significant bit reversal, so the possibility that the DDR memory jump problem is the cause of the abnormal restart is greatly increased, and its weight value can be increased.
[0131] It should be understood that the most recent abnormal restart data of an electronic device can reflect the electronic device's behavior at the most recent point in time and may contain the latest information that caused the electronic device's abnormal restart. Therefore, if the electronic device experienced a significant bit flip during its most recent abnormal restart, the likelihood that a DDR memory jump issue was the cause of the abnormal restart is greatly increased. If the most recent abnormal restart did not experience a significant bit flip, the likelihood of this being the cause is reduced. Similarly, the earlier the significant bit flip occurred, the lower the likelihood.
[0132] Therefore, in some embodiments, N1 (also referred to as the first threshold) can be set according to the time (also referred to as the moment) when a significant bit inversion occurs in the electronic device. The later the time, the larger the first threshold.
[0133] In some embodiments, in order to prevent the weight value of the preset abnormal restart reason from being too large, thereby affecting the final determination of the abnormal restart reason, a maximum weight value may be set.
[0134] For example, if an electronic device abnormally restarts three times and a significant bit flip is determined, then no further abnormal restarts will be evaluated. Assuming a maximum weighted value of 60, N1 can be 60 when a significant bit flip is determined for the third abnormal restart, 40 when a significant bit flip is determined for the second abnormal restart, and 20 when a significant bit flip is determined for the first abnormal restart.
[0135] S106: Based on the abnormal restart data, determine whether the number of cache memory jump interrupts is greater than 0. If so, execute S107; otherwise, execute S108.
[0136] In some embodiments, the abnormal characteristics of the electronic device may include the number of cache memory jump interrupts being greater than zero.
[0137] In one possible implementation, the electronic device may employ error detection and correction (EDAC) technology or error checking and correcting code (ECC) mechanism. When the EDAC technology or the ECC mechanism detects an error in the cache memory, an interrupt may be generated.
[0138] Therefore, if the number of cache memory transition interruptions is greater than 0, it indicates that an error has occurred in the cache memory. On the contrary, if the number of cache memory transition interruptions is 0, it indicates that no error has occurred in the cache memory.
[0139] Based on the above description, the latest abnormal restart of the electronic device can better reflect the latest state of the cache memory. Therefore, in some embodiments, the judgment can be made based on the latest abnormal restart data in the abnormal restart data, that is, the number of cache memory jump interrupts recorded in the latest abnormal restart.
[0140] In one possible implementation, a judgment can be made based on the latest abnormal restart data first, and it can be determined that the number of cache memory jump interruptions recorded in the latest abnormal restart is greater than 0, then S107 can be continued to be executed; if it is determined that the number of cache memory jump interruptions recorded in the latest abnormal restart is 0, a judgment can be made based on a set of historical abnormal restart data of the last abnormal restart, and it can be determined that the number of cache memory jump interruptions in the last abnormal restart is greater than 0, then S107 can be continued to be executed, and so on, until no significant bit reversal occurs in the subsequent abnormal restarts, then a judgment can be made based on a set of historical abnormal restart data of the first abnormal restart, and it can be determined that the number of cache memory jump interruptions recorded in the first abnormal restart is greater than 0, then S107 can be continued to be executed, otherwise S108 can be continued to be executed.
[0141] In this way, when it is determined that the number of cache memory jump interrupts in an abnormal restart is greater than 0, there is no need to analyze the previous abnormal restart, which greatly reduces computing resources, saves time for abnormal restart analysis, and thus speeds up the determination of the cause of the abnormal restart.
[0142] In another possible implementation, a judgment may be made based on the abnormal restart data corresponding to each abnormal restart to determine whether the number of cache memory jump interrupts in each abnormal restart is greater than 0. If so, continue to execute S107; otherwise, continue to execute S108.
[0143] In this way, each abnormal restart is analyzed, which is conducive to determining a more accurate cause of the abnormal restart.
[0144] S107: Based on the number of cache memory jump interruptions, increase the weight value of the cache memory jump problem by N2.
[0145] Based on the above introduction, the cache memory jump problem may cause errors in the cache memory, which in turn causes interrupts to be generated in methods such as EDAC technology or ECC mechanism for detecting and correcting memory errors.
[0146] It should be understood that the greater the number of cache memory jump interruptions (which may be simply referred to as the jump interruption number or interruption number), the greater the possibility of a cache memory jump problem, and thus the greater the possibility of causing an abnormal restart of the electronic device.
[0147] In some embodiments, N2 can be set based on the number of cache memory jump interrupts. At the same time, considering the uncertainty of the number of interrupts, a maximum weight value can be set to avoid causing the weight value of the preset abnormal restart cause to be too large, thereby affecting the final abnormal restart cause determination.
[0148] For example, the maximum weighted value may be 60, and the number of abnormal restarts is 10, then N2=min(number of interruptions×10, 60). For example, when the number of interruptions is 8, N2 is 60, and when the number of interruptions is 4, N2=40.
[0149] In some embodiments, the maximum weighted value may be set according to the time (also referred to as the moment) when the number of cache memory jump interruptions of the electronic device is greater than 0. The later the time, the greater the maximum weighted value.
[0150] For example, if an electronic device abnormally restarts three times and the number of jump interrupts is determined to be greater than 0, the previous abnormal restarts are no longer judged. When the number of jump interrupts for the third abnormal restart is determined to be greater than 0, the maximum weighted value may be 60; when the number of jump interrupts for the second abnormal restart is determined to be greater than 0, the maximum weighted value may be 40; and when the number of jump interrupts for the first abnormal restart is determined to be greater than 0, the maximum weighted value may be 20.
[0151] S108: Based on the abnormal restart data, determine whether the CPU cores that have problems during multiple abnormal restarts of the electronic device are the same. If so, execute S109; otherwise, execute S110.
[0152] In some embodiments, the abnormal characteristics of the electronic device may include the same situation of the CPU core having problems during multiple restarts.
[0153] Based on the above example, the abnormal restart data may include a problematic CPU core. Accordingly, in some embodiments, the problematic CPU cores that have been abnormally restarted multiple times may be determined from the latest abnormal restart data and historical abnormal restart data included in the abnormal restart data, and then it may be determined whether these problematic CPU cores are the same CPU core.
[0154] For example, the electronic device includes 8 CPU cores, which have been abnormally restarted 5 times. The problematic CPU cores are CPU core 3, CPU core 3, CPU core 1, CPU core 2 and CPU core 3. It can be determined that the CPU cores that have problems in multiple abnormal restarts of the electronic device have the same situation.
[0155] S109: Based on the same number of times the problematic CPU core occurs during multiple abnormal restarts, the weight value of the cache memory jump problem is increased by N3.
[0156] Cache memory jump issues can cause CPU core issues, such as affecting the accuracy of data read from the cache memory. This can lead to errors when running processes on that CPU core. Therefore, the more times the problematic CPU core appears the same during multiple abnormal restarts, the greater the likelihood of a CPU core issue, and thus, a cache memory jump.
[0157] In some embodiments, one or more problematic CPU cores may have the same situation in multiple abnormal restarts. In this case, the value of N3 may be determined based on the problematic CPU core with the greatest number of similar situations.
[0158] For example, an electronic device includes eight CPU cores and has experienced five abnormal restarts. The problematic CPU cores are CPU core 3, CPU core 3, CPU core 2, CPU core 2, and CPU core 2. The number of identical restarts for CPU core 3 is two, and the number of identical restarts for CPU core 2 is three. The value of N3 can be determined based on the number of identical restarts for CPU core 2 (i.e., the maximum number of identical restarts for identical CPU cores).
[0159] In some embodiments, assuming the maximum weight is 60 and the number of abnormal restarts is 10, N3 = maximum number of identical times / 10 × 60. For example, when the maximum number of identical times is 4, N3 is 24, and when the number of interruptions is 6, N3 = 36.
[0160] S110: Calculating weighted values of function calls resulting from multiple abnormal restarts based on the abnormal restart data.
[0161] The function call weight value (also referred to as the same degree value) is used to indicate the same degree of function call situations in multiple abnormal restarts.
[0162] Exemplarily, the function call stack can be used to store temporary data during the function call process. When the electronic device runs a process, the program pushes the parameters and return address of the called function into the stack, and then jumps to the entry address of the function to execute the function code.
[0163] In some embodiments, the function call weighted value can be calculated based on the function call data in the latest abnormal restart data and the function call data in the historical abnormal restart data. Figure 3 , the method of calculating the weighted value of function calls is introduced in detail, which will not be explained here.
[0164] Based on the above example, function call data includes the calling relationship of multiple layers of functions. Taking the three-layer function calling relationship as an example, each time the electronic device restarts abnormally, the functions corresponding to layer 0 function symbol0, layer 1 function symbol1, and layer 2 function symbol2 can be recorded as function call data.
[0165] In some embodiments, abnormal characteristics of an electronic device may include different function calls during multiple abnormal restarts. That is, the functions called or the order of function calls during the multiple abnormal restarts are different, for example, the first abnormal restart calls functions 1-3, and the second abnormal restart calls functions 4-6.
[0166] S111: adding the function call weight value to the weight value of the DDR memory jump problem.
[0167] The lower the degree of similarity of the function call situations, the more likely it is that the abnormal restart of the electronic device is caused by a hardware problem. For example, the hardware problem may include a DDR memory jump problem.
[0168] In some embodiments, a larger function call weighted value indicates a lower degree of similarity in the function call scenarios across multiple abnormal reboots, i.e., greater differences in the function call scenarios across multiple reboots of the electronic device. DDR memory transitions may result in a lower degree of similarity in the function call scenarios across multiple abnormal reboots, i.e., the likelihood of a DDR memory transition is positively correlated with the function call weighted value; a larger function call weighted value indicates a greater likelihood of a DDR memory transition. Therefore, the calculated function call weighted value can be added to the weighting value for the DDR memory transition issue.
[0169] S112: Based on the abnormal restart data, determine whether the function calls in multiple abnormal restarts of the electronic device are all the same. If so, execute S113; otherwise, execute S114.
[0170] It should be noted that S112 is an optional execution step and can be executed when the calculated function call weight value is 0. When the function call weight value is greater than 0, S116 can be executed directly after executing S111.
[0171] In some embodiments, the abnormal characteristics of the electronic device may include that the function calls in multiple abnormal restarts are all the same (also known as multiple groups of function call data are the same), that is, the functions called during multiple abnormal restarts are all the same, and the function calling order is also all the same.
[0172] For example, the electronic device restarts abnormally 10 times, and the function call data included in the abnormal restart data corresponding to each abnormal restart are: function a calls function b, function b calls function c, then it can be judged that the function calls in the multiple abnormal restarts of the electronic device are all the same, otherwise, it can be judged that the function calls in the multiple abnormal restarts of the electronic device are not all the same.
[0173] S113: Based on the abnormal restart data, determine whether the function calls in the multiple abnormal restarts of the electronic device include typical function calls, if so, execute S114, otherwise execute S115.
[0174] A typical function (also called a preset function) refers to a function that is used frequently on the CPU core when a hardware failure occurs in an electronic device. If the function calls in multiple abnormal restarts are all the same, and the called functions include typical functions, the possibility of the electronic device restarting abnormally due to a DDR memory jump is greatly increased.
[0175] S114: Based on the hardware problem weight value corresponding to the typical function, increase the weight value of the DDR memory jump problem by N5, and execute S116.
[0176] In some embodiments, the electronic device may include a typical function call list and a hardware problem weight value (also referred to as a problem weight value) for each typical function that may cause a DDR memory jump problem.
[0177] Exemplarily, typical functions include typical function 1, typical function 2 and typical function 3. Assuming that the maximum weighted value is 60, the possibility of typical function 1-typical function 3 causing DDR memory jump decreases successively. Then the hardware problem weight value corresponding to typical function 1 can be 30, the hardware problem weight value corresponding to typical function 2 can be 20, and the hardware problem weight value corresponding to typical function 3 can be 10.
[0178] Assuming that the function calls in multiple abnormal restarts of the electronic device include the call of typical function 1, the hardware problem weight value 30 corresponding to typical function 1 can be used as N5 and added to the weight value of the DDR memory jump problem.
[0179] Assuming that the function calls in multiple abnormal restarts of the electronic device include calls to typical function 1 and typical function 2, the sum of the hardware problem weights corresponding to typical function 1 and typical function 2, 50, can be used as N5 and added to the weight value of the DDR memory jump problem.
[0180] S115: Determine that a non-hardware problem is the cause of the abnormal restart of the electronic device, and exit the abnormal restart analysis and processing flow.
[0181] A typical function is the function called when an electronic device's abnormal restart is caused by a hardware issue. If the function calls in multiple abnormal restarts are all identical and do not contain a typical function (that is, the abnormal restart data exhibits specific abnormal characteristics), the likelihood that the abnormal restart of the electronic device is caused by a non-hardware issue is greatly increased. Therefore, a non-hardware issue can be determined as the cause of the abnormal restart of the electronic device.
[0182] In some embodiments, the non-hardware problem is a software problem of the electronic device.
[0183] In some embodiments, the hardware problem may include a DDR memory jump problem, a DDR memory fixed frequency problem, and a cache memory jump problem.
[0184] S116: Based on the abnormal restart data, determine whether the frequency points of the DDR memories in multiple abnormal restarts of the electronic device are the same. If yes, execute S117; otherwise, execute S118.
[0185] The frequency of DDR memory refers to the frequency at which the DDR memory operates.
[0186] In some embodiments, the abnormal feature may include a situation where the frequency of the DDR memory appears the same in multiple abnormal restarts.
[0187] In some embodiments, when an electronic device restarts abnormally multiple times, the higher the frequency of the DDR memory with the same frequency point, the greater the possibility that the electronic device may have a problem at the frequency point.
[0188] S117: Based on the number of DDR memory frequencies that are the same, increase the weight value of the DDR memory fixed frequency problem by N6.
[0189] In some embodiments, N6 can be min (number of fixed frequency points, maximum weighted value), where the number of fixed frequency points refers to the number of the same frequency points of the DDR memory in multiple abnormal restarts, and the maximum weighted value refers to the maximum weighted value set for the abnormal restart cause of the fixed frequency point problem of the DDR memory.
[0190] For example, the electronic device restarts abnormally 10 times, and the DDR memory frequencies of the abnormal restart data are frequency 1, frequency 2, frequency 1, frequency 1, frequency 1, frequency 1, frequency 1, frequency 1, frequency 1, frequency 3 and frequency 1 respectively, then the number of fixed frequency points is 8.
[0191] In some embodiments, different preset abnormal restart reasons may have different likelihoods of causing an abnormal restart of the electronic device, and thus the maximum weighted values set for each preset abnormal restart reason may also be different. For example, a DDR memory fixed frequency problem is less likely to cause an abnormal restart of the electronic device than a DDR memory jump problem or a cache memory jump problem, and thus the maximum weighted value corresponding to the DDR memory fixed frequency problem is smaller.
[0192] For example, when the maximum weights of the DDR memory jump problem and the cache memory jump problem are both 60, the maximum weight of the DDR memory fixed frequency problem can be set to 10. Then, when the number of fixed frequencies is 8, N6=8, and when the number of fixed frequencies is 12, N6=10.
[0193] S118: Compare the weight values corresponding to the DDR memory jump problem, the cache memory jump problem, and the DDR memory fixed frequency point problem.
[0194] Compare the weight values corresponding to the three preset abnormal restart reasons: DDR memory jump problem, cache memory jump problem and DDR memory fixed frequency problem.
[0195] S119: Determine the problem with the largest weight value among the DDR memory jump problem, the cache memory jump problem, and the DDR memory fixed frequency problem as the cause of the abnormal restart of the electronic device.
[0196] The problem with the largest weight value is output as the cause of the abnormal restart of the electronic device.
[0197] In some embodiments, as Figure 2 As shown, based on judgment point 1, judgment point 2, ..., judgment point x, the abnormal restart data is analyzed, and problem types 1 to 3 are weighted respectively based on the judgment results. For example, judgment point 1 can be weighted n1 for problem type 1, judgment point 2 can be weighted n2 for problem type 2, judgment point x can be weighted n5 for problem type 3, other judgment points can be weighted n3 for problem type 1, and other judgment points can be weighted n4 for problem type 3. Finally, the problem type with the largest weighted value (also called weight value) among the three problem types is output as the cause of the abnormal restart.
[0198] Exemplarily, the above-mentioned judgment points 1 to x correspond one-to-one to some steps in the embodiment (for example, S103, S106, S108, S110, S112, S113, and S116 each correspond to one judgment point). Problem types 1 to 3 are DDR memory jump problems, cache memory jump problems, and DDR memory fixed frequency point problems, respectively.
[0199] In this way, in the embodiment of the present application, an electronic device that has an abnormal restart can analyze the reason for its own abnormal restart, solve the problem of lag in the analysis of the reason for the abnormal restart in the related art, and improve the efficiency of determining the reason for the abnormal restart; at the same time, it is judged whether the electronic device exhibits some abnormal characteristics. If the abnormal characteristics exhibited may be caused by non-hardware problems, the non-hardware problem is directly determined as the reason for the abnormal restart; if the abnormal characteristics exhibited may be caused by a hardware problem, the weight value of the hardware problem is increased accordingly, and finally the hardware problem with the largest weight value among multiple hardware problems is determined as the reason for the abnormal restart of the electronic device. In this way, the reason for the abnormal restart of the electronic device can be comprehensively analyzed through multiple abnormal characteristics, and the problem of limitations in the determination of the reason for the abnormal restart in the related art is solved, and the accuracy of the determined reason for the abnormal restart is improved.
[0200] In addition, in some embodiments, the method for determining the cause of an abnormal restart provided in the embodiments of the present application can be applied to electronic devices that have not experienced an abnormal restart, that is, an electronic device can analyze the cause of an abnormal restart of another electronic device. For example, if an abnormal restart occurs in electronic device 1, electronic device 1 can record the abnormal restart data in the kernel phase and send the abnormal restart data to electronic device 2; electronic device 2 then analyzes the abnormal restart data of electronic device 1 and determines the cause of the abnormal restart, and finally can send the abnormal restart cause to electronic device 1. This application does not limit this.
[0201] Next, combine Figure 3 The calculation method of the function call weighted value is described in detail, that is, the calculation process of S110 in the above embodiment.
[0202] like Figure 3 As shown, the method for calculating the function call weighted value may include the following steps:
[0203] It should be noted that the function call data may include call data for a single layer of functions or multiple layers of functions, i.e., it may indicate functions called by at least one function layer. When the function call data includes call data for multiple layers of functions (i.e., indicating functions called by multiple function layers), the function call weighted value needs to be calculated based on the function call weighted value corresponding to each layer of these multiple layers of functions (which may be referred to as the function call base weighted value). The following embodiments will use the calculation of the function call base weighted value corresponding to a layer 0 function call as an example.
[0204] S1101: Initialize multiple flags to -1.
[0205] In an embodiment of the present application, multiple flags are uniformly initialized to the same value to facilitate distinguishing whether the function corresponding to each flag is compared with the function corresponding to other flags when executing subsequent steps (the flag will be set to other values when compared). The value of the flag can be called a tag value.
[0206] In addition, it should be noted that initializing multiple flags to -1 is only an example, and multiple flags can also be initialized to other values. For example, referring to the steps below, in order to distinguish them, multiple flags can be initialized to any negative number.
[0207] The multiple flags are respectively used to represent the tag values of the layer-0 functions (sometimes referred to as functions in S1101-S1113) corresponding to the layer-0 function calls in multiple abnormal restarts.
[0208] For example, assuming that the electronic device is abnormally restarted 10 times, combined with Figure 4 As shown, the acquired abnormal restart data includes records 0 through 9, i.e., record 0 through record 9 represent abnormal restart data from the first abnormal restart to the tenth abnormal restart, respectively. Symbol 0 represents the called layer 0 function, and ten flags can be used to label each of the ten symbol 0s.
[0209] In some embodiments, it is assumed that all 10 symbol0s are different, that is, all 10 0-layer functions are different, and they can be marked as -1. Therefore, 10 flags can be initialized to -1. Figure 5 , the initial values of the 10 flags are all -1.
[0210] In some embodiments, multiple flags may be arranged in the order of when the abnormal restart occurred. For example, the first flag is used to indicate the first abnormal restart, the second flag is used to indicate the second abnormal restart, and so on.
[0211] S1102: Initialize the outer loop count to 0.
[0212] In some embodiments, an outer loop (also called outer loop comparison) is used to represent the process of comparing the function corresponding to one flag among multiple flags with the functions corresponding to the remaining flags after the flag (that is, the abnormal restart after the abnormal restart).
[0213] Exemplarily, the first outer loop indicates whether the 0-layer function corresponding to the first flag among multiple flags is compared with the 0-layer function corresponding to the subsequent flags to see whether they are the same; the second outer loop indicates whether the 0-layer function corresponding to the second flag among multiple flags is compared with the 0-layer function corresponding to the subsequent flags (excluding the first flag that was abnormally restarted before) to see whether they are the same, and whether the 0-layer function corresponding to the third flag among multiple flags is compared with the 0-layer function corresponding to the subsequent flags (excluding the first and second flags that were abnormally restarted before) to see whether they are the same, and so on. The outer loop comparison can be performed multiple times.
[0214] In some embodiments, the value of the outer loop count may be used to indicate the number of outer loop comparisons performed.
[0215] In some embodiments, assuming that the outer loop count is 0, it is necessary to compare the level 0 function corresponding to the first flag among multiple flags with the level 0 function corresponding to the subsequent flags. Therefore, when the comparison starts, the outer loop count needs to be initialized to 0.
[0216] It should be noted that initializing the outer loop count to 0 is only an example. In some embodiments, assuming that the outer loop count is 1, it means that the 0-layer function corresponding to the first flag among multiple flags needs to be compared with the 0-layer function corresponding to the subsequent flags, then the outer loop count can also be initialized to 1, which can represent the initial state. Therefore, this application does not limit this.
[0217] S1103: Determine whether the outer loop count reaches the upper limit, if yes, execute S1113, otherwise execute S1104.
[0218] Based on the subsequent S1105, it can be seen that the outer loop count may need to be accumulated multiple times. Therefore, after the value of the outer loop count is updated once, it is necessary to determine whether the upper limit is reached. Reaching the upper limit indicates that the 0-level function comparison is completed, otherwise it is necessary to continue to the next outer loop comparison.
[0219] In some embodiments, based on the above description, the upper limit of the outer loop count is related to the number of flags. The outer loop count starts at 0, and the upper limit of the outer loop count is the number of flags minus 1. That is, when the outer loop count indicates the last flag among multiple flags, it indicates that all outer loop comparisons have been completed.
[0220] For example, if there are 10 flags, the upper limit of the outer loop count is 9. That is, when the outer loop count reaches 9, the 10 flags no longer include the flags arranged later, and no function comparison is required. If the outer loop count does not reach 9, function comparison needs to be continued.
[0221] S1104: Determine whether the outer loop flag is 0, if so, execute S1105, otherwise execute S1106.
[0222] The outer loop flag refers to the flag indicated by the outer loop count (also referred to as the flag corresponding to the outer loop count). For example, if the outer loop count is 0, the outer loop flag refers to the first flag among the multiple flags, and if the outer loop count is 1, the outer loop flag refers to the second flag among the multiple flags.
[0223] Based on the above S1101, it can be seen that multiple flags are initialized to -1 at the beginning, but S1104 is a step that needs to be executed in multiple cycles. When judging for the first time, the outer loop flag is initialized to -1, which is not 0. However, when executing subsequent steps, referring to the subsequent S1111 and S1112, it can be seen that when the functions corresponding to the two flags are compared and determined to be the same, the flag with the later time sequence will be set to 0. Therefore, when the subsequent cycle executes S1104, in the case of a change in the outer loop count, the outer loop flag indicated by it may be 0. It should be noted that in the subsequent steps, the flag with the same function and the later time sequence can also be set to other values for easy distinction. At this time, the 0 value in step S1104 also needs to be replaced with other values accordingly.
[0224] S1105: Increase the outer loop count by 1, and return to execute S1103.
[0225] Based on the subsequent steps, it can be seen that in an outer loop comparison, the functions corresponding to the outer loop flag and the flag that follows it in time sequence are compared. When it is determined that the two are the same, the flag that follows in time sequence will be set to 0. In this outer loop comparison, the outer loop flag will be compared with the flags that follow it, that is, the function corresponding to the outer loop flag has been compared with the subsequent flags. Therefore, the flag corresponding to the same function and sorted later in time sequence (the value is already 0) does not need to be compared with the subsequent flag again, that is, there is no need to perform an outer loop comparison based on the outer loop flag with a value of 0. Therefore, the outer loop count can be directly increased by 1 to continue to determine whether the next outer loop comparison needs to be performed.
[0226] In this way, repeated comparisons based on the same function are avoided, which can save computing resources.
[0227] For example, assume there are 5 flags, corresponding to function 1, function 1, function 2, function 1, and function 2, respectively. During the first outer loop comparison, the first flag is used as the outer loop flag. It can be determined that the function corresponding to the first flag is the same as the functions corresponding to the second flag and the fourth flag, respectively. Then, the second flag and the fourth flag are both set to 0. Therefore, during the second outer loop comparison, the second flag is used as the outer loop flag, and its corresponding function needs to be compared with the functions corresponding to the subsequent three flags. However, the function corresponding to the second flag is the same as the function corresponding to the first flag, and the function 1 corresponding to the first flag has been compared with the functions corresponding to the subsequent flags. Therefore, there is no need to use function 1 for repeated comparison, that is, there is no need to perform the second outer loop comparison. Therefore, the outer loop count can be directly increased by 1, and it is determined whether the third outer loop comparison needs to be performed.
[0228] S1106: Set the outer loop flag to 1.
[0229] Based on the above introduction and subsequent steps, it can be seen that when the outer loop flag is set to 0, its corresponding function is the same as the function corresponding to the flag arranged in front (also called before). Therefore, when the outer loop flag is not set to 0, it indicates that its corresponding function is different from the function corresponding to the previous flag. Therefore, it is necessary to use the function corresponding to the outer loop flag to compare with the function corresponding to the flag arranged in the back (also called after).
[0230] In some embodiments, the flag that needs to be compared in an outer loop can be set to 1, or it can be set to a value other than the flag's initialization value (-1 in the embodiment of the present application) and the value to which the flag is set when the function is the same (0 in the embodiment of the present application) for easy distinction. This application does not impose any restrictions on this.
[0231] In this way, it is easy to distinguish flags that need to be compared in an outer loop from flags that do not need to be compared in an outer loop, thereby avoiding repeated comparisons or comparison errors.
[0232] S1107: Initialize the inner loop count to the outer loop count plus 1.
[0233] In some embodiments, one inner loop (also referred to as an inner loop comparison) is used to represent a process of comparing an outer loop flag with a flag arranged later in each outer loop comparison.
[0234] For example, in the first outer loop comparison, the first inner loop indicates whether the 0-layer function corresponding to the first flag is the same as the 0-layer function corresponding to the second flag; the second inner loop indicates whether the 0-layer function corresponding to the first flag is the same as the 0-layer function corresponding to the third flag; and so on. One or more inner loop comparisons can be performed in each outer loop comparison.
[0235] In some embodiments, the value of the inner loop count is used to indicate the number of inner loop comparisons performed in an outer loop comparison.
[0236] In some embodiments, in each outer loop comparison, the function corresponding to the outer loop flag can be compared with the function corresponding to the flag arranged later from front to back. Therefore, the inner loop count needs to be initialized to the outer loop count plus 1.
[0237] For example, based on the above example, in the first outer loop comparison, the outer loop count is 0, indicating that the 0-level function corresponding to the first flag among the multiple flags needs to be compared with the 0-level function corresponding to the subsequent flag. Multiple inner loop comparisons can be performed in this outer loop comparison, and initially, the function corresponding to the first flag among the multiple flags needs to be compared with the function corresponding to the second flag. In this way, the inner loop count can be initialized to 1, indicating the first inner loop comparison in the first outer loop comparison.
[0238] S1108: Determine whether the inner loop count has reached the upper limit. If so, return to execute S1105; otherwise, execute S1109.
[0239] Based on the subsequent S1110, it can be seen that the inner loop count may need to be accumulated multiple times. Therefore, after the value of the inner loop count is updated once, it is necessary to determine whether the upper limit is reached. Reaching the upper limit indicates that the outer loop comparison is completed, otherwise the outer loop comparison needs to continue.
[0240] In some embodiments, similarly to the above, the upper limit of the inner loop count is related to the number of flags. Starting from 0, the upper limit of the inner loop count is the number of flags. For example, if there are 10 flags, corresponding to inner loop counts 0-9, the upper limit of the inner loop count can be 10, that is, when the inner loop count is 10, all inner loop comparisons in this outer loop comparison are completed.
[0241] S1109: Determine whether the inner loop flag is 0, if so, execute S1110, otherwise execute S1111.
[0242] Similarly, based on subsequent S1111 and S1112, when the function corresponding to the outer loop flag is the same as the function corresponding to the inner loop flag, the outer loop flag is incremented by 1 and the inner loop flag is set to 0. Whether the inner loop flag is 0 indicates whether its corresponding function needs to be compared with the function corresponding to the subsequent flag.
[0243] S1110: Increase the inner loop count by 1, and return to execute S1108.
[0244] The inner loop flag is 0, indicating that the function corresponding to this flag is the same as the function corresponding to the previous flag, so there is no need to perform this inner loop comparison again.
[0245] In this way, repeated comparisons are avoided and computing resources can be saved.
[0246] S1111: Determine whether the function corresponding to the outer loop flag is the same as the function corresponding to the inner loop flag. If so, execute S1112; otherwise, execute S1110.
[0247] Based on the above steps, at this time, both the outer loop flag and the inner loop flag are not 0, indicating that the outer loop flag and the inner loop flag were not determined to have the same function in the previous comparison, and the functions corresponding to the two can be compared.
[0248] S1112: Add 1 to the outer loop flag, set the inner loop flag to 0, and execute S1110.
[0249] In some embodiments, if the function corresponding to the outer loop flag is the same as the function corresponding to the inner loop flag, the outer loop flag can be increased by 1 and the inner loop flag can be set to 0. Therefore, the higher the final flag value, the higher the number of identical functions. A flag value of 0 indicates that no subsequent comparison is required, and a flag value of 1 indicates that there are no identical functions.
[0250] In this way, repeated comparisons can be avoided and computing resources can be saved.
[0251] It should be noted that the outer loop flag may be increased to other values and the inner loop flag may be set to other values for easy distinction.
[0252] For example, multiple flags may be initialized to 0 in S1101, the outer loop flag may be set to 2 in S1106, the outer loop flag may be increased by 2 and the inner loop flag may be set to 1 in S1112, and this application does not impose any limitation on this.
[0253] by Figure 4 Taking the content shown as an example, based on the above introduction, the outer loop flag is initialized to 1. In the first outer loop comparison, that is, the outer loop flag is the flag corresponding to record0. Assuming that the symbol0 recorded in the subsequent records 1 to 9 is the same as the symbol0 of record0, the outer loop flag can be increased by 1, and the flags corresponding to the subsequent records with the same symbol0 can be set from -1 to 0.
[0254] For example, we can continue to refer to Figure 5 As shown, assuming that the symbol0 recorded in record0 to record3 are the same, after the first outer loop comparison, the flag value corresponding to record0 changes from -1 to 1, and then to 4, and the flag values corresponding to record1 to record3 change from -1 to 0, and the values of the remaining flags remain -1.
[0255] Combine Figure 5As shown, based on the above steps, the first outer loop comparison sets the second to fourth flags to 0. Then, S1103-S1105 can be executed three times in a loop. After that, the outer loop count reaches 4, indicating that the outer loop comparison starts from the fifth flag. Assuming that the symbol0 recorded in record4 and record9 are the same, after the fifth outer loop comparison, the flag value corresponding to record4 changes from -1 to 1 and then to 2. The flag value corresponding to record9 changes from -1 to 0. The flag values corresponding to records5 to 8 remain -1.
[0256] Assuming that the symbol0 recorded in record5 to record8 are all different, the values of the corresponding flags of record5 to record8 change from -1 to 1, and the values of the remaining flags remain unchanged.
[0257] S1113: Obtain a function call basic weighted value based on the values of multiple flags.
[0258] When the outer loop count reaches the upper limit, it indicates that the function comparisons corresponding to multiple flags are completed, that is, multiple outer loop comparisons are completed. At this time, the function call basic weight value can be determined according to the values corresponding to the multiple flags.
[0259] Based on the above steps, it can be seen that the value of flag is finally 1, indicating that its corresponding function (that is, the first function) is different from other functions. Therefore, the more 1s there are in the values of multiple flags, the lower the degree of similarity of the function calls of multiple abnormal restarts (that is, negative correlation).
[0260] In some embodiments, a higher function call weight value indicates a lower similarity among function calls restarted multiple times abnormally, that is, a higher function call base weight value indicates a lower similarity among function calls restarted multiple times abnormally.
[0261] In some embodiments, each layer of function calls has a corresponding weight value.
[0262] For example, the number of 1s in the values of multiple flags can be multiplied by the weight value corresponding to the 0-layer function call (also called the weight value of the 0-layer function layer) to obtain the basic weighted value of the function call corresponding to the 0-layer function.
[0263] Based on the above description, S1101-S1113 is the process of calculating the basic weighted value of the function call corresponding to the level 0 function. Assuming that the function call data includes three levels of function call relationships, S1101-S1113 needs to be executed twice more to calculate the basic weighted value of the function call corresponding to the level 1 function and the basic weighted value of the function call corresponding to the level 2 function, respectively.
[0264] Finally, based on the number of flags with a value of 1 corresponding to the three layers of functions and their corresponding three weight values, the weighted value of the function call with multiple abnormal restarts can be calculated.
[0265] In some embodiments, the function call weight value = (the number of layer 0 function calls with a flag set to 1) × A1 + (the number of layer 1 function calls with a flag set to 1) × A2 + (the number of layer 2 function calls with a flag set to 1) × A3.
[0266] For example, A1 may be 3, A2 may be 2, and A3 may be 1, which is not limited in this application.
[0267] Based on the content described in S1101-S1113, the call data of the same layer function that has been abnormally restarted multiple times indicates the function corresponding to each of these abnormal restarts at that layer. In other words, the abnormal restarts correspond one-to-one to multiple functions at that layer. When calculating the function call base weight corresponding to the call data of the function at that layer, multiple flags can be first used as the tag values of these multiple functions. Then, based on the same situation of the functions at that layer, the values of these flags are updated. Finally, the function call base weight of the function at that layer is calculated based on the final values of these multiple flags.
[0268] In multiple functions, all flags can be updated to a value of 1 (for example, the value 1 can be -1), which can also be called the fourth value. Then, for each function, comparison is started. Before the comparison, the flag corresponding to the function is updated to a value of 2 (for example, the value 2 can be 1), which can also be called the first value. During the comparison process, the flags corresponding to at least two functions that are the same function are updated separately, and the flag corresponding to the function that is the earliest in the time order of the at least two functions is updated to a value of 3, which can also be called the second value. The value 3 is determined based on the number of at least two functions (for example, for a function corresponding to a certain flag, there are several functions that are the same as it, then the number of these functions is added). Then, for the remaining functions in at least these two functions, the flags corresponding to the remaining functions can be updated to a value of 4 (for example, the value 4 can be 0), which can also be called the third value. When the function call base weighted value indicates the difference in function calls, it can be determined based on the number of flags with a value of 1. The specific process can be seen in the above example.
[0269] In addition, based on a flag having a value of 3 among multiple flags, the number of functions that are the same as the function corresponding to the flag can be determined.
[0270] In this way, the final values of the updated multiple flag values represent the same degree of function calls at the same layer, which facilitates the calculation of the function call weighted value indicating the same degree of function calls, and then accurately indicates the possibility of the corresponding DDR memory jump problem, which is conducive to improving the accuracy of the cause of the abnormal restart.
[0271] In addition, in some embodiments, after determining the cause of the abnormal restart of the electronic device, it can be stored in a specific storage area of the memory of the electronic device (such as RAM, ROM, etc.), and then the abnormal restart cause can be obtained from the specific storage area, packaged into a file, and finally uploaded to the cloud server, so as to provide clusterable data support for commercial analysis of the electronic device, thereby improving the efficiency of repairing the abnormal restart cause.
[0272] In some embodiments, assuming that the determined cause of the abnormal restart of the electronic device is a DDR memory jump problem, a DDR memory repair strategy may be triggered.
[0273] In a possible implementation, the DDR memory repair strategy may include inspecting the DDR memory to check whether each storage unit of the DDR memory is normal.
[0274] For example, assuming that a storage unit 1 among the multiple storage units has a problem (also referred to as a faulty storage unit), it can be isolated and the electronic device no longer uses the storage unit 1 with the problem.
[0275] In a possible implementation, the DDR memory repair strategy may also include modifying parameters of the DDR memory, for example, modifying the parameters of the DDR memory according to the environment in which the electronic device is located.
[0276] For example, the parameters of the DDR memory can be modified based on the ambient temperature of the electronic device so that the parameters are more adapted to the current environment.
[0277] Next, the software structure of the electronic device is described by taking an electronic device running an Android system having a layered architecture as an example.
[0278] like Figure 6 As shown, the layered architecture divides the software structure into several layers, each with clear roles and divisions of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into the application layer and the kernel layer from top to bottom.
[0279] The application layer can include a series of application packages. Figure 6 As shown, the application package may include applications such as camera, gallery, etc.
[0280] In some embodiments, as Figure 6 As shown, the application layer may also include a file generation program and a file upload program. The file generation program detects the abnormal restart cause from the memory in the hardware layer, and may package the abnormal restart cause into a file and send it to the file upload program. The file upload program may upload the file packaged by the file generation program to a cloud server. The cloud server may then collect statistics on the abnormal restart causes of the electronic device based on the received files, thereby providing clusterable data support for commercial analysis of the electronic device and improving the efficiency of repairing the abnormal restart cause.
[0281] Exemplarily, the file generation program can be a maintenance program xmaintain (abbreviated as xmntn) that provides multiple functions or an Android Engine Exception program (Android Engine Exception, aee), the file upload program can be a cross-platform terminal device maintenance service set hiview, and the cloud server can be an Apache Portable Runtime (APR).
[0282] The kernel layer is the layer between hardware and software.
[0283] In some embodiments, the kernel layer may include a kernel panic detection module and an abnormal restart data recording module. When the electronic device is powered on and the kernel panic detection module detects a kernel panic, it triggers the abnormal restart data recording module to record data related to the kernel panic as abnormal restart data.
[0284] Exemplarily, the abnormal restart data recording module may include a small dump file microdump, which can be used to record abnormal restart data. The abnormal restart data recording module may also include a small memory dump file minidump, which is also used to record relevant abnormal restart data when the electronic device causes kernel panic.
[0285] In some embodiments, a checking algorithm module and a repair strategy module are included between the kernel layer and the hardware layer.
[0286] In some embodiments, the inspection algorithm module includes a reading record unit and a feature library.
[0287] In some embodiments, the read record unit of the inspection algorithm module may execute Figure 1 S101 shown; Check the feature library of the algorithm module to execute Figure 1 S102-S119 shown; the feature library of the check algorithm module can also be executed Figure 3 S1101-S1113 shown.
[0288] In some embodiments, the reading and recording unit is configured to obtain abnormal restart data from a memory in the hardware layer of the electronic device, and the feature library is configured to analyze the abnormal restart data to determine whether the abnormal restart data exhibits certain characteristics, thereby determining the cause of the abnormal restart of the electronic device. During the small system stage, the electronic device can obtain the abnormal restart data recorded during the kernel stage by checking the algorithm module, so as to determine the cause of the abnormal restart of the electronic device during the small system stage.
[0289] Exemplarily, the abnormal characteristics may include the bit inversion of the fixed bits of the virtual address mentioned in the above embodiments, the number of cache memory jump interrupts, the same proportion of problematic CPU cores (that is, the same number of problematic CPU cores in multiple abnormal restarts), the same degree of function calls, typical function calls and fixed frequency points of DDR memory, etc.
[0290] In some embodiments, the repair strategy module is used to repair the electronic device based on the abnormal restart cause determined by the algorithm module.
[0291] Exemplarily, if the inspection algorithm module determines that the cause of the abnormal restart is a DDR memory jump problem, the repair strategy module can be triggered to repair the DDR memory.
[0292] In some embodiments, the repair strategy module may include a DDR memory inspection unit and a DDR memory parameter modification unit.
[0293] The DDR memory inspection unit is used to inspect whether each storage unit of the DDR memory is normal and isolate the storage unit with problems so that the electronic device will no longer use the storage unit.
[0294] The DDR memory parameter modification unit is used to modify the parameters of the DDR memory.
[0295] The hardware layer includes memory.
[0296] In some embodiments, a storage area of the memory can be used to store abnormal restart data recorded by the abnormal restart data recording module and abnormal restart causes determined by the feature library of the inspection algorithm module. For example, the memory may include storage area 1 and storage area 2. Storage area 1 can be used to store abnormal restart data, and storage area 2 can be used to store abnormal restart causes. Both can also be stored in the same storage area, which is not limited in this application.
[0297] In some embodiments, the memory may be RAM, ROM, etc., which is not limited in this application.
[0298] It should be noted that the electronic device in the above embodiment is a mobile phone for illustrative purposes only. In some embodiments, the electronic device may be a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), or other terminal device. This application does not impose any particular restrictions on the specific form of the above electronic devices.
[0299] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a computer, can implement one or more steps in any of the above-mentioned methods for determining the cause of an abnormal restart.
[0300] The computer readable storage medium may be a non-transitory computer readable storage medium, for example, a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0301] Another embodiment of the present application further provides a computer program product comprising instructions, which, when executed by a computer, can implement one or more steps in any of the above-mentioned methods for determining the cause of an abnormal restart.
[0302] The electronic device, computer-readable storage medium, and computer program product provided in this embodiment are all used to execute the corresponding method for determining the cause of abnormal restart provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the method for determining the cause of abnormal restart provided above, and will not be repeated here.
[0303] The terms "first", "second" and "third" in the specification, claims and drawings of this application are used to distinguish different objects rather than to limit a specific order.
[0304] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0305] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for determining the cause of an abnormal restart, characterized in that: The method comprises: Obtain abnormal restart data of electronic devices; determining that the abnormal restart data exhibits at least one abnormal characteristic among a plurality of abnormal characteristics; determining that the at least one abnormal feature includes a specific abnormal feature, and determining a non-hardware problem as a cause of the abnormal restart of the electronic device; Determine that the at least one abnormal feature does not include the specific abnormal feature, increase the weight value of the preset abnormal restart cause corresponding to the at least one abnormal feature, and determine the preset abnormal restart cause with the largest weight value among multiple preset abnormal restart causes as the abnormal restart cause of the electronic device; the multiple preset abnormal restart causes are all used to indicate hardware problems.
2. The method according to claim 1, characterized in that The abnormal restart data includes multiple sets of abnormal restart data of the electronic device during multiple abnormal restart processes; the preset abnormal restart cause includes a DDR memory jump problem; and the increasing the weight value of the preset abnormal restart cause corresponding to the at least one abnormal feature includes: Calculating the same degree values of the multiple groups of function call data corresponding one to one to the multiple groups of abnormal restart data; The same degree value is added to the weight value of the DDR memory jump problem.
3. The method according to claim 2, characterized in that Each set of function call data is used to indicate a function called by at least one function layer; and calculating the sameness values of the multiple sets of function call data corresponding to the multiple sets of abnormal restart data comprises: For each function layer of the plurality of sets of function call data, determining a first function from a plurality of functions indicated by the plurality of sets of function call data at the function layer; the first function is different from all other functions in the plurality of functions except the first function; Based on the number of first functions of each function layer of the multiple groups of function call data, the sameness value of the multiple groups of function call data is calculated; the sameness value is negatively correlated with the sameness of the multiple groups of function call data.
4. The method according to claim 3, characterized in that The plurality of functions respectively have corresponding tag values, and determining the first function from the plurality of functions indicated at the function layer from the plurality of sets of function call data comprises: Updating the tag values corresponding to the multiple functions to the first value; Determining at least two label values corresponding to the same function from a plurality of label values, and updating the at least two label values to values different from the first value; A function whose tag value is the first numerical value among the multiple functions is determined as the first function.
5. The method according to claim 4, characterized in that The multiple tag values are arranged in chronological order according to the abnormal restart; and the updating of the at least two tag values to values different from the first value includes: The first tag value in the at least two tag values is updated to a second value, and the remaining tag values in the at least two tag values are updated to a third value; the second value is obtained based on the number of the remaining tag values.
6. The method according to claim 4 or 5, characterized in that Before updating the tag values corresponding to the multiple functions to the first value, the method further includes: Initializing the tag values corresponding to the multiple functions to a fourth value; Updating the tag values corresponding to the multiple functions to the first value includes: For each function, before comparing the function with other functions in the plurality of functions, the function is updated to the first value.
7. The method according to any one of claims 1 to 6, characterized in that The abnormal restart data includes multiple sets of abnormal restart data of the electronic device during multiple abnormal restart processes; the preset abnormal restart cause includes a DDR memory jump problem; and determining that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features includes: Determining that the multiple sets of function call data corresponding one-to-one to the multiple sets of abnormal restart data are all the same, and determining that a preset function exists in the multiple sets of function call data; the preset function has a corresponding problem weight value; The increasing the weight value of the preset abnormal restart reason corresponding to the at least one abnormal feature includes: The problem weight value corresponding to the preset function is added to the weight value of the DDR memory jump problem.
8. The method according to any one of claims 1 to 6, characterized in that Determining that the at least one abnormal feature includes a specific abnormal feature, and determining that a non-hardware problem is the cause of the abnormal restart of the electronic device, includes: Determining that the at least one abnormal feature includes that the multiple sets of function call data corresponding one-to-one to the multiple sets of abnormal restart data are all the same, and determining that the multiple sets of function call data do not have a preset function, and determining that a non-hardware problem is the cause of the abnormal restart of the electronic device.
9. The method according to any one of claims 1 to 8, characterized in that The abnormal restart data includes multiple sets of abnormal restart data of the electronic device during multiple abnormal restart processes; the preset abnormal restart cause includes a DDR memory jump problem; and determining that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features includes: Determine whether there is a bit inversion at a preset position of the address of each set of abnormal restart data in order from the back to the front, and stop after determining that a bit inversion exists at the preset position of the address of a set of abnormal restart data; The increasing the weight value of the preset abnormal restart reason corresponding to the at least one abnormal feature includes: The first threshold is increased to the weight value of the DDR memory jump problem; the first threshold increases as the corresponding time of the determined set of abnormal restart data is shifted back.
10. The method according to any one of claims 1 to 9, characterized in that The abnormal restart data includes multiple sets of abnormal restart data of the electronic device during multiple abnormal restart processes; the preset abnormal restart cause includes a DDR memory frequency problem; and determining that the abnormal restart data exhibits at least one abnormal feature among multiple abnormal features includes: determining that the DDR memory frequencies respectively included in the plurality of groups of abnormal restart data have the same DDR memory frequency; The increasing the weight value of the preset abnormal restart reason corresponding to the at least one abnormal feature includes: Based on the number of the same DDR memory frequencies, the weight value of the DDR memory frequency point problem is increased.
11. The method according to any one of claims 1 to 10, characterized in that Also includes: When the electronic device switches from a power-on state to a power-off state, recording abnormal restart data of the electronic device; The obtaining of abnormal restart data of the electronic device includes: When the electronic device is switched from the shutdown state to the startup state again, abnormal restart data of the electronic device is read.
12. The method according to any one of claims 1 to 11, characterized in that Before determining that the abnormal restart data exhibits at least one abnormal feature among a plurality of abnormal features, the method further includes: It is determined that the abnormal restart data meets an abnormal restart analysis condition.
13. The method according to claim 12, characterized in that The abnormal restart analysis conditions include one or more of the following: the number of abnormal restarts of the electronic device exceeds the fifth threshold; the time interval between the most recent abnormal restart of the electronic device and the previous abnormal restart is less than the sixth threshold; the average time interval between multiple abnormal restarts of the electronic device is less than the seventh threshold.
14. The method according to any one of claims 1 to 13, characterized in that The method further comprises: If it is determined that the abnormal restart of the electronic device is caused by a DDR memory jump problem, a faulty storage unit of the DDR memory is determined and the faulty storage unit is isolated; If it is determined that the abnormal restart cause of the electronic device is a DDR memory jump problem, the parameters of the DDR memory are modified based on the environment in which the electronic device is located.
15. An electronic device, characterized in that: including memory and processor; The memory is coupled to the processor, and the memory is used to store computer program code, where the computer program code includes computer instructions. One or more of the processors call the computer instructions to enable the electronic device to execute the method for determining the cause of an abnormal restart as described in any one of claims 1 to 14.
16. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for determining the cause of an abnormal restart according to any one of claims 1 to 14 is implemented.
17. A computer program product, characterized in that The invention comprises computer program codes, which, when executed by an electronic device, implement the steps of the method for determining the cause of abnormal restart according to any one of claims 1 to 14.
Citation Information
Patent Citations
Method and device for positioning startup abnormity problem, storage medium and terminal
CN109491825A
Processing method, processing device and electronic equipment
CN111782430A
Problem positioning method and device and storage medium
CN114647574A
Bit inversion detection method and device, electronic equipment and storage medium
CN117573207A
Quick start method
US20230333935A1