Data storage method and related device
By creating large files in the NVM data partition and storing the address of the faulty data, the problem of insufficient storage space for electronic equipment failure data is solved, the utilization rate and user experience of NVM are improved, and the function of dynamically adjusting the storage space is realized.
Patent Information
- Application Number
- CN202311732937.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-15
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2043-12-15
AI Technical Summary
In the prior art, after the electronic device fails, the bare partition occupies a large NVM space, resulting in a smaller size of the data partition that users can use, and it is impossible to effectively store and extract the faulty data, affecting the user experience.
Create large files in the NVM data partition through the file system, and save the address of the large files in the NVM bare partition. When an electronic device fails, store the faulty data in the RAM into the large file. After normal operation, Hiview Collect and process failure data through the file system.
It improves the utilization rate of NVM, adapts to electronic devices of different specifications, dynamically adjusts storage space, avoids additional operating burden, ensures the integrity and availability of fault data, and enhances user storage space.
Smart Images

Figure CN118445114B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminals, and in particular to a data storage method and related devices. Background Art
[0002] After an electronic device fails, the failure data in the RAM is usually saved through a raw partition, and the failure data is retrieved after the electronic device is restarted. However, the raw partition occupies a large NVM space, reducing the size of the data partition available to the user.
[0003] Therefore, how to increase the available data space for users when storing and retrieving fault data in electronic devices is an urgent problem to be solved. Summary of the invention
[0004] The present application provides a data storage method and related device. Specifically, a large file is created in a data partition of NVM through a file system, and the address of the large file is saved in a raw partition of NVM. When an electronic device fails, a fault processing subsystem of the electronic device obtains the address of the large file from the raw partition of NVM, and stores the fault data in RAM into the large file based on the address. After the electronic device runs normally, Hiview of the electronic device collects fault data from the large file through the file system to further process the fault data.
[0005] In a first aspect, the present application provides a data storage method, which is applied to an electronic device including a first system, a file system, a non-volatile memory NVM, and a volatile memory RAM. The method includes: creating a first file in the NVM through the file system, the size of the first file being larger than the size of the RAM; saving the address of the first file in a raw partition of the NVM; in the event of a failure of a program running on the RAM, obtaining the address of the first file in the raw partition through the first system, and storing the data in the RAM to the first file based on the address of the first file.
[0006] By implementing the method provided in the first aspect, fault data can be stored in a file-saving manner instead of a raw partition-saving manner, thereby eliminating the need to reserve a large raw partition in the NVM, providing more space for data partitions in the NVM, and improving the utilization rate of the NVM.
[0007] In combination with the method provided in the first aspect, before creating the first file in the NVM through the file system, the method further includes: mounting the file system on the NVM.
[0008] In this way, as long as the electronic device mounts the file system on the NVM, a large file can be created through the file system later to implement the storage of fault data through file storage provided by the present application.
[0009] In combination with the method described in the first aspect, in some implementations of the first aspect, mounting the file system on the NVM specifically includes: determining an address in the NVM corresponding to the file system.
[0010] In this way, once the electronic device determines the association between the file system and the corresponding address in the NVM, various operations such as creating, modifying and reading files can be implemented through the file system, providing more management functions for large files storing fault data.
[0011] In combination with the method described in the first aspect, in some implementations of the first aspect, creating the first file in the NVM through the file system specifically includes: creating the first file in the data partition of the NVM through the file system.
[0012] In this way, compared with the raw partition of NVM, the data partition of NVM can be freely managed by the file system, which can provide more possibilities for the subsequent file system to manage large files. Specifically, it is more convenient to create, modify, read and recycle large files in the data partition through the file system.
[0013] In combination with the method described in the first aspect, the method further includes: updating the size of the first file through the file system.
[0014] In this way, the electronic device can dynamically adjust the size of large files through the file system to improve the utilization rate of the electronic device storage space. For example, when there is less user data stored in the data partition, the storage space for large files can be reserved to ensure that the fault data can be completely saved; when there is more user data in the data partition, the storage space for large files can be appropriately reduced to ensure that the user data can be stored normally.
[0015] In combination with the method described in the first aspect, the method further includes: updating the address of the updated first file to the raw partition of the NVM.
[0016] In this way, it can be ensured that the small system can obtain the address of the updated large file in time, and then the fault data can be successfully stored in the large file, thereby confirming the feasibility of the solution of the present application.
[0017] In combination with the method described in the first aspect, in certain implementations of the first aspect, the first system runs in the RAM.
[0018] In combination with the method described in the first aspect, in certain implementations of the first aspect, the electronic device also includes a maintenance detection service set Hiview, and after storing the data in the RAM into the first file based on the address of the first file, the method also includes: the electronic device obtains the data in the first file through the Hiview; and analyzes the cause of the fault through the obtained data.
[0019] In this way, the electronic device can be further modified according to the analyzed reasons, improve the operating logic therein, improve the development level of the electronic device, and solve the problem in the later released version.
[0020] In combination with the method described in the first aspect, in certain implementations of the first aspect, the electronic device obtains the data in the first file through the Hiview, specifically including: requesting the file system to obtain the data through the Hiview; obtaining the data in the first file through the file system; and returning the data in the first file to the Hiview through the file system.
[0021] In this way, Hiview can directly obtain fault data from large files through the file system, which improves the convenience of obtaining fault data.
[0022] In combination with the method described in the first aspect, in certain implementations of the first aspect, after the file system returns the data in the first file to the Hiview, the method further includes: deleting the data in the first file through the file system.
[0023] In this way, the storage space occupied by the faulty data can be released in time, which reduces the time that the faulty data occupies the data partition, and provides more storage space for subsequent users to write data.
[0024] In combination with the method described in the first aspect, in some implementations of the first aspect, the size of the first file is greater than the size of the RAM by a first value, and the first value is a preset value.
[0025] In this way, when all the data in the RAM fail, it can be ensured that the first file can store all the failure data without losing the failure data, thereby providing data support for subsequent comprehensive analysis of the cause of the failure.
[0026] In combination with the method described in the first aspect, in certain implementations of the first aspect, the electronic device also includes a fault storage mark, and before creating the first file in the NVM through the file system, the method also includes: determining that the value of the fault storage mark is a second value; the second value indicates that the fault storage function of the electronic device is turned on.
[0027] In this way, by providing a fault storage mark, whether to apply the fault data storage function provided by the present application can be controlled separately in different scenarios, thereby providing users with more operating space.
[0028] In combination with the method described in the first aspect, in certain implementations of the first aspect, after determining that the value of the fault storage mark is the second value, the method further includes: determining that the electronic device is in a testing phase.
[0029] In this way, when different users use electronic devices, different electronic device usage versions are distinguished. Different usage versions can meet different user needs. For example, in the testing phase, the electronic device uses the testing version to facilitate the tester to perform fault testing on the electronic device; in the release phase, the electronic device uses the official version to provide a better user experience for ordinary users to use the electronic device.
[0030] In combination with the method described in the first aspect, in certain implementations of the first aspect, the electronic device also includes a second tag, and before obtaining the address of the first file in the raw partition through the first system, the method also includes: determining that the value of the second tag is a third value; the third value indicates that the electronic device stores the data in the RAM into the NVM through the first system.
[0031] In this way, two states are distinguished: after the electronic device turns on the fault storage function, the electronic device fails and stores fault data; and the electronic device does not fail and does not store fault data. When the electronic device determines that no fault has occurred and no fault data has been stored, the electronic device does not need to read the fault data, saving the reading consumption of the electronic device.
[0032] In combination with the method described in the first aspect, in certain implementations of the first aspect, the electronic device also includes an operating system, and a failure occurs in the program running on the RAM, which specifically includes: detecting, through the operating system of the electronic device, that a failure occurs in the program running on the RAM, and notifying the first system that the RAM has failed.
[0033] In this way, the first system does not need to analyze the fault level of the electronic device, and can directly execute the corresponding fault handling program according to the acquired fault information, thereby improving the speed of the first system in handling the fault of the electronic device and reducing the fault handling time of the electronic device.
[0034] In a second aspect, the present application provides an electronic device, comprising one or more RAMs, one or more NVMs, and one or more processors; the memory is coupled to the one or more processors, the NVM is used to store computer program code, the RAM is used to calculate and execute the computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform a method as described in any one of the first aspects above.
[0035] In a third aspect, the present application provides a chip, which is applied to an electronic device, and the chip includes one or more processors, and the processor is used to call computer instructions to enable the electronic device to execute any method described in any one of the first aspects above.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium, comprising instructions, which, when executed on an electronic device, enable the electronic device to execute a method as described in any one of the first aspects above. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram of a fault data processing architecture provided in an embodiment of the present application;
[0038] Figure 2A A schematic diagram of another storage architecture for fault data provided in an embodiment of the present application;
[0039] Figure 2B A schematic diagram of another fault data collection architecture provided in an embodiment of the present application;
[0040] Figure 3 A schematic diagram of a method for creating a large file provided in an embodiment of the present application;
[0041] Figure 4 A flowchart of a method for storing fault data through a file system provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of a method for collecting fault data provided in an embodiment of the present application;
[0043] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of the associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0045] In the description of the embodiments of the present application, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more.
[0046] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0047] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device, and finally presented as content that can be recognized by the user. The commonly used form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0048] Currently, when an electronic device fails, the failure data can be stored to analyze the cause of the failure and avoid subsequent occurrences of the failure.
[0049] In order to clearly describe the technical solutions of the embodiments of the present application, some terms and related technologies involved in the embodiments of the present application are briefly introduced first:
[0050] 1. Random access memory (RAM): a memory that cannot save data when power is off, usually used to cache temporary data, such as processes running in the foreground. In the embodiment of the present application, RAM may include double data rate synchronous dynamic random access memory (DDRSDRAM), and may also include other types of RAM. Among them, DDRSDRAM is also called DDR.
[0051] 2. Non-volatile memory (NVM): a memory that can save data when power is off, usually used to store configuration information of electronic devices, user data, etc. In the embodiment of the present application, NVM may include Universal Flash Storage (UFS), and may also include other types of NVM.
[0052] 3. Raw partition refers to the area pre-divided from NVM before the electronic device leaves the factory. Raw partition is usually used to save the configuration information of the electronic device. In addition, after the electronic device leaves the factory, the electronic device does not support the recovery and modification of raw partition, and the data in the raw partition cannot be directly read by the file system.
[0053] 4. Data partition refers to the area in NVM other than the bare partition. The data partition can be used to mount the file system and store user data, etc. Among them, the data in the data partition supports direct reading of the file system. In the embodiment of the present application, the file system that can be mounted on the data partition includes but is not limited to the Flash Friendly File System-Data (F2FS-Data), and the mounting area of the file in the data partition is also called the F2FS data partition. In other words, mounting the file system in the data partition is equivalent to determining the correspondence between the file system and the address in the data partition.
[0054] 5. Fault data includes data in RAM that cannot run normally. When RAM cannot run data normally, the operating system and file system will be paralyzed. When this kind of fault occurs, the RAM in the electronic device will temporarily keep the data in the state when the fault occurred and will no longer run. However, the electronic device usually needs to clear the fault process in RAM or restart it before it can resume normal operation. Therefore, the fault data in RAM is very easy to be lost. Among them, fault data can also be called full dump data.
[0055] 6. Fulldump data storage refers to storing the fulldump data in the RAM of an electronic device into the NVM after a failure occurs in the data in the RAM. Currently, the fulldump data is stored in the raw partition of the NVM.
[0056] 7. The file system is a method used by the operating system to identify files on storage devices. The file system is also used to manage and schedule the storage space of files, provide the logical structure, physical structure and storage method of files, implement the mapping of files from identifiers to actual addresses, and implement file control operations and access operations (including services such as creating, opening, reading, writing, closing and revoking files). In the embodiments of the present application, the file system includes but is not limited to F2FS, the fourth extended file system (EXT4), the extended file allocation table file system (exFAT) and the new technology file system (NTFS).
[0057] 8. The fault handling subsystem is a system other than the electronic device operating system, which is coupled with the operating system and is used to receive fault notifications from the operating system and perform fault storage. Optionally, the fault handling subsystem can run in the same RAM as the operating system, or in a different RAM. Normally, the electronic device does not start the fault handling subsystem, and only starts the fault handling subsystem when the operating system fails.
[0058] 9. Hiview includes a service, component or application for maintaining and detecting equipment. Hiview can obtain fulldump data and analyze the fulldump data, or can also upload the fulldump data to the cloud for analysis. The present application embodiment does not limit the name Hiview, and its functions have been described in detail in the aforementioned article.
[0059] Next, combine Figure 1 A schematic diagram of a fulldump data processing architecture provided by this application is introduced.
[0060] 1. Fulldump data storage stage: The fault handling subsystem of the electronic device determines that a fault has occurred in the electronic device, and stores the fulldump data in the RAM into a reserved partition of the UFS raw partition.
[0061] After a failure occurs in the electronic device, the electronic device may notify the fault processing subsystem of the failure through the operating system, and then the fault processing subsystem may store the fulldump data in the RAM into the reserved partition of the raw partition of the NVM.
[0062] The definition of the raw partition of NVM can also be referred to the terminology introduction in the previous article, which will not be repeated here.
[0063] exist Figure 1 In the scheme shown, NVM is shown in the form of UFS, and RAM is shown in the form of DDR. Before the electronic device leaves the factory, the reserved partition in the raw partition of UFS is divided, and the division rule includes: the division size of the reserved partition is larger than the storage size of the largest specification DDR currently on the market. The reasons for the division include: when reserving the partition, the size of the DDR configured by the electronic device cannot be known in advance. In order to ensure that the fault data in the DDR is completely stored, the size of the reserved partition needs to be set larger than the storage size of the DDR.
[0064] 2. Fulldump data dumping stage: After the electronic device is operating normally, the fulldump data in the reserved partition is dumped from the raw partition to the data partition.
[0065] After the fulldump data is stored in the reserved partition, the electronic device can be powered off and shut down to clear the fault data in the RAM. Afterwards, if the electronic device is restarted, the fault processing subsystem can dump the fulldump data from the raw partition to the data partition for the corresponding module to obtain the fulldump data and analyze the cause of the fault.
[0066] The fulldump data dump may occur during the electronic device startup process or after the electronic device has completed startup. For the electronic device, dumping the fulldump data consumes the computing power of the electronic device. In particular, during the restart of the electronic device, the dumping of the fulldump data will affect the startup process of the electronic device.
[0067] Optionally, after the fulldump data is completely dumped from the reserved partition to the data partition, the reserved partition cannot be occupied by other data.
[0068] When performing a fulldump data dump, the UFS needs to have at least twice the storage space of the fulldump data size to execute the above dump scheme. Specifically, a fulldump data space is occupied in the data partition, and a reserved partition space is occupied in the raw partition. Among them, the raw partition will not be recycled to the data partition by the UFS, nor will it change dynamically with the size of user data, and the space utilization rate of the UFS is low. At the same time, the fulldump data transferred to the data partition will occupy the space used by the user data in the UFS, affecting the user experience.
[0069] 3. Fulldump data collection phase: After the electronic device operates normally, Hiview obtains the fulldump data in the data partition and further processes the fulldump data.
[0070] pass Figure 1 It can be seen from the schematic diagram of a processing architecture of fulldump data that when a serious fault occurs in an electronic device, such as a data transmission error in the kernel layer, fulldump data needs to be saved. When saving fulldump data, there are adaptation problems including fixed reserved partitions; the reserved partition cannot be recycled and the size cannot be adjusted. When the RAM of the electronic device is small, there are problems of low efficiency in using this solution, and the data in the reserved partition cannot be read by the file system, etc. This reduces the storage space available to users and affects the user experience.
[0071] Specifically, use Figure 1 The processing architecture of the fulldump data shown has the following problems:
[0072] (1) Fixed reserved partitions cannot adapt to electronic devices of different specifications. The reserved partition in the raw partition needs to be pre-configured before the device leaves the factory. To ensure that the fulldump data is completely stored, the size of the reserved partition is usually set to the storage size of the largest RAM. However, the RAM specifications of different devices are different. For electronic devices with smaller RAM specifications, the size of the reserved partition far exceeds the fulldump data size. An overly large reserved partition wastes the storage space of the NVM and reduces the space size of the data partition.
[0073] (2) Fixed reserved partitions cannot be reclaimed. The reserved partitions in the raw partition need to be pre-configured before the device leaves the factory, and the function of storing fulldump data is only enabled during the testing phase of the device, and is disabled during the official release phase of the device. For users in the official release phase of the device, the NVM storage space occupied by the raw partition cannot be reclaimed, resulting in a waste of space.
[0074] (3) The size of the fixed reserved partition cannot be adjusted. In the subsequent use process, the size of the reserved partition cannot be dynamically adjusted according to the size of the user data, resulting in a decrease in the utilization rate of the NVM.
[0075] (4) The data in the raw partition cannot be read by the file system. If you want to obtain the fulldump data, you must first dump the fulldump data from the raw partition in the NVM to the data partition. This dump operation not only increases the operating burden of the electronic device, but also causes the NVM to store redundant fulldump data, resulting in a decrease in the utilization rate of the NVM.
[0076] In order to solve the above technical problems, the present application provides a data storage method and related devices. The method includes: creating a large file in the data partition of NVM through the file system, and saving the address of the large file in the raw partition of NVM. When the electronic device fails, the fault processing subsystem of the electronic device obtains the address of the large file from the raw partition of NVM, and stores the fulldump data in RAM into the large file based on the address. After the electronic device is running normally, the Hiview of the electronic device collects the fulldump data from the large file through the file system to further process the fulldump data.
[0077] Implementing the data storage method provided by this application has the following beneficial effects:
[0078] (1) The created storage large file can be adapted to electronic devices of different specifications. For electronic devices of different NVM specifications, the file system can create a large file by obtaining the storage size of the NVM, so that the solution can be adapted to electronic devices of different specifications.
[0079] (2) The storage space of the large file can be reclaimed. After the fulldump data is transferred in the large file, the space of the large file can be released to the user's data space, thereby increasing the user's available data partition space. The method of reclaiming the storage space of the large file can be specifically referred to in S503 of the method flow later, which will not be described here.
[0080] (3) The storage size of large files can be adjusted dynamically. When the user data stored in the data partition is small, the storage space of large files can be reserved to ensure that the full dump data is completely saved; when the user data in the data partition is large, the storage space of large files can be appropriately reduced to ensure the storage of user data. The method of dynamically adjusting the storage size of large files can be referred to in the following text. Figure 3 The introduction of S306 will not be repeated here.
[0081] (4) The data stored in the large file can be obtained by the file system, avoiding the extra operation burden of dumping the fulldump data of the electronic device from the raw partition to the data partition, and improving the storage space utilization of the fulldump data. For details, please refer to the following Figure 5 In steps S501-S503, Hiview describes in detail how to obtain fulldump data.
[0082] In order to clearly describe the technical solutions of the embodiments of the present application, some terms and technologies involved in the embodiments of the present application are briefly introduced below:
[0083] 1. Bootloader: used to boot the loader. In the operating system, the bootloader runs before the operating system kernel runs. It can initialize the hardware devices and establish a RAM space map, thereby bringing the system's hardware and software environment to a suitable state, so as to prepare the correct environment for the final call to the operating system kernel.
[0084] 2. Initialization (init) process: It is one of the indispensable programs in system operation and is a user-level process started by the kernel.
[0085] 3. Data block: refers to one or several groups of address information corresponding to a file.
[0086] 4. Blocklist: It is information that one or more groups of data blocks are arranged together in a list. In this application, blocklist includes complete file address information.
[0087] 5. Panic: refers to a panic-level failure of an electronic device. A panic-level failure refers to a failure in the operation of the electronic device's kernel, and the operating system of the electronic device cannot continue to run.
[0088] Next, a data storage method involved in the present application is specifically introduced.
[0089] See also Figure 2A , Figure 2A Another schematic diagram of a storage architecture for fulldump data is shown as an example.
[0090] like Figure 2A As shown, another storage architecture of fulldump data involves software processes including processes executed by the Bootloader, the init process and the fault handling mini-system, and the hardware involved includes UFS. In the embodiment of the present application, NVM is shown in the form of UFS, and RAM is shown in the form of DDR. The present application does not limit the specific storage device type that meets the requirements, and will not be repeated in the following text.
[0091] The following methods can be performed using the fulldump data storage architecture.
[0092] 1. Start the bootloader service (Bootloader).
[0093] Specifically, when the boot loading service is started, the fault storage function module is run to update the fault storage flag. For example, the fault storage flag can be updated to an enabled state, and the enabled state is used to indicate the start of the subsequent fault storage function.
[0094] After the Bootloader is executed, the correct environment is prepared for calling the operating system kernel and preparing for starting the operating system in the subsequent init process.
[0095] 2. Turn on the computer.
[0096] Electronic devices run operating systems in RAM.
[0097] Specifically, after the electronic device successfully starts the Bootloader, it starts to run the operating system in the DDR, including starting the kernel, running the init process, etc., to realize the startup of the electronic device.
[0098] 3. Mount.
[0099] The operating system of the electronic device mounts a file system in the NVM, for example, mounts F2FS.
[0100] Specifically, mounting F2FS is equivalent to determining the storage address corresponding to F2FS in the data partition of NVM, also known as F2FS data partition. After successfully mounting F2FS, F2FS can create files in the partition, write data to the file, read data, delete data, etc.
[0101] Specifically, the NVM includes multiple storage devices such as UFS and ROM, and the file system also includes multiple file systems such as EXT4, exFAT and NTFS. The mounted NVM may include the above multiple storage devices, and the above multiple file systems may all be mounted on the same one of the above multiple NVMs, and this application does not limit this.
[0102] 4. Create a file.
[0103] The file system creates large files in the file system data partition divided in the NVM.
[0104] Specifically, F2FS creates a large file in the F2FS data partition divided in UFS. The creation of the large file includes determining a storage address of the large file in NVM.
[0105] Optionally, any of the above-mentioned file systems creates a large file in the data space corresponding to the NVM, for example, EXT4 creates a large file in the EXT4 data partition divided in UFS, and this application does not impose any restrictions on this.
[0106] 5. Return to the block.
[0107] After the file system creates a large file in the data partition, it obtains the block that records the creation of the large file.
[0108] Specifically, after F2FS creates a large file in the data partition, it obtains the block that records the creation of the large file and returns the block to the init process.
[0109] Optionally, the large file may be a continuous address in the file system area, and the corresponding block is also a continuous address. It may also be a plurality of discrete addresses in the file system, corresponding to a plurality of blocks, and the address of the large file is composed of a plurality of discrete address blocks, and the corresponding block is an address list blocklist arranged in sequence. This embodiment only takes a continuous address corresponding to a large file as an example, and does not limit this.
[0110] Optionally, the block returned for a large file can be received by F2FS and then passed to the init process. The init process can also receive the block, and this application does not impose any restrictions on this.
[0111] 6. Update.
[0112] The file address management module records the block of the large file in the file address mark of the NVM.
[0113] Specifically, the file address management module records the block of the large file in the file address mark of the UFS raw partition.
[0114] After the init process obtains the block of the large file, the file address management module sends update information to the file address mark of the raw partition in the UFS, so as to save the address of the large file in the raw partition. The update information includes the block of the large file, and the large file address mark includes one or more blocks, which constitute the blocklist of the large file. The blocklist contains all the sequentially arranged block addresses constituting the large file. Obtaining the blocklist can perform read and write operations on the large file, regardless of the file system status.
[0115] 7. Panic occurs.
[0116] Specifically, after detecting a fault, the electronic device executes the steps involved in the fault handling subsystem.
[0117] Among them, the fault handling subsystem is the first system.
[0118] 8. Get the block.
[0119] Specifically, the small system for troubleshooting obtains blocks of large files.
[0120] After the fault handling system confirms that a panic has occurred, it obtains the block of the large file from the file address mark of the raw partition in the UFS.
[0121] 9. Write fulldump.
[0122] Specifically, the fault processing subsystem stores the fulldump data in the DDR into a large file based on the blocks obtained above.
[0123] Based on the aforementioned Figure 2A Another fulldump data storage framework process shown below is combined with Figure 2B Let's introduce another fulldump data collection architecture process.
[0124] See also Figure 2B , Figure 2B Another schematic diagram of a fulldump data collection architecture is shown as an example.
[0125] like Figure 2B As shown, the process of the collection architecture involving fulldump data includes an initialization process and a Hiview process, and the hardware involved includes UFS.
[0126] 1.Hiview requests to obtain fulldump data.
[0127] Specifically, the acquisition module in Hiview sends a request to F2FS to obtain fulldump data.
[0128] Before obtaining the fulldump data, the electronic device is operating normally, wherein the normal operation stage includes the electronic device not shutting down and restoring normal operation after a failure, and also includes the electronic device restarting and restoring normal operation after shutting down, which will not be described in detail here.
[0129] 2. F2FS obtains fulldump data.
[0130] Specifically, F2FS obtains the fulldump data in the large file based on the storage address of the previously created large file.
[0131] Among them, F2FS can obtain the fulldump data in the large file without dumping the fulldump data from the raw partition to the data partition, which reduces the computing consumption of the electronic device and improves the efficiency of fulldump data acquisition.
[0132] 3.F2FS returns fulldump data to Hiview.
[0133] Specifically, F2FS transfers the acquired fulldump data to the acquisition module of Hiview, and Hiview further processes the acquired fulldump data and analyzes the cause of the failure of the electronic device.
[0134] pass Figure 2A to Figure 2B From the schematic diagram of another fulldump data storage and collection architecture shown, it can be seen that the method provided by the present application is: when an electronic device fails and F2FS fails, the fault handling subsystem obtains the file address, simulates the read and write operations of the file system, and stores the fulldump data from the failed RAM to the NVM. There is no need to store two copies of fulldump data in the NVM, which improves the utilization rate of NVM storage.
[0135] Based on the aforementioned Figure 2A to Figure 2B Another fulldump data storage architecture and collection architecture flow chart is shown below. Figures 3 to 5 This article introduces the specific steps and method flow of fulldump data processing in this solution.
[0136] See also Figure 3 , Figure 3 A schematic flow chart of a method for creating a large file is exemplified.
[0137] Figure 3 The method flow shown involves an operating system, a file system, a raw partition in UFS, and an F2FS data partition.
[0138] The operating system includes the init process, which is Figure 3 The solution shown provides initialization services and operations. The file systems include F2FS, EXT4 and exFAT, which provide file operation related services for electronic devices.
[0139] The definitions of init process, F2FS, UFS, raw partition and can refer to the description of related technical terms. The description of F2FS data partition can refer to the following. Figure 2A The relevant description in will not be repeated here.
[0140] like Figure 3As shown, a method for creating a large file specifically includes the following steps:
[0141] S301, Bootloader enables fault storage flag.
[0142] Specifically, the process of starting the electronic device involves starting the Bootloader, which includes updating the fault storage mark through the fault storage function module.
[0143] The fault storage mark is used to indicate whether the fault storage function is turned on. The fault storage mark is stored in the raw partition of the NVM of the electronic device (taking UFS as an example). For the introduction of the raw partition, please refer to the previous description, which will not be repeated here.
[0144] Updating the fault storage mark includes enabling the fault storage mark and disabling the fault storage mark. When the fault storage mark is the second value, the fault storage mark is in an enabled state, and the fault storage mark in the enabled state indicates that the fault storage function is turned on, that is, instructing the electronic device to execute the subsequent method flow; when the fault storage mark is the fourth value, the fault storage mark is in a disabled state, and the fault storage mark in the disabled state indicates that the fault storage function is turned off, that is, instructing the electronic device not to execute the subsequent method flow.
[0145] In one implementation, when the electronic device is powered on for the first time after leaving the factory, or when it is not powered on for the first time, the fault dump flag may be set to an enabled state to provide a fault dump function.
[0146] In another embodiment, when the electronic device is in the testing stage and the maintenance stage, the fault storage flag can be updated to an enabled state to turn on the fault storage function. When the electronic device is put into commercial use, the fault storage flag can be updated to a disabled state to turn off the fault storage function.
[0147] S302, obtaining a fault storage mark.
[0148] After the electronic device successfully starts the Bootloader, the init process in the operating system obtains the fault storage mark from the raw partition and determines whether to enable the fault storage function based on the fault storage mark. When the acquired fault storage mark is the second value, the electronic device confirms that the fault storage function is enabled, that is, starts to execute subsequent operations.
[0149] S303: When the fault storage flag is enabled, determine to create a large file.
[0150] When the init process obtains the fault storage flag as enabled, it indicates that the fault storage function is turned on. Therefore, it is necessary to create a large file in the F2FS data partition of the UFS.
[0151] S304: Calculate the allocation size of the large file based on the obtained DDR information.
[0152] After determining to create a large file, the init process determines the storage size of the large file, including obtaining the storage size of the DDR and calculating the specific storage size of the large file according to a preset calculation rule.
[0153] The calculation rule is used to calculate the storage size of the large file. Specifically, the result of adding the DDR storage size to the first value is calculated, and the result is determined as the storage size of the large file. The storage size of the large file allows the created large file to completely store the fulldump data in the DDR. The first value includes 0.5 gigabyte (GB), which is not limited in this embodiment.
[0154] S305, informing F2FS to create a large file.
[0155] In the operating system, the init process notifies F2FS of the creation of a large file. F2FS receives the notification of the creation of a large file and determines the creation address and size of the large file in the F2FS data partition. The message notifying the creation of the large file by the init process also includes the specific storage size of the large file.
[0156] S306, F2FS creates a large file.
[0157] Based on the storage size of the large file to be created in step S305 , F2FS creates the large file in the F2FS data partition.
[0158] Before step S306, F2FS completes the file system mounting with the UFS data partition and creates an F2FS data partition in the UFS data partition, so as to implement the operation of creating a large file after F2FS receives a request to notify the creation of a large file. Specifically, the specific location of the step of implementing the mounting is not limited in this application.
[0159] The large file is also called the first file. The embodiment of the present application does not impose any specific restrictions on its name, and the method for creating the large file and the function of the large file have been described in detail in the present application.
[0160] Optionally, during the process of creating a large file by F2FS, F2FS can dynamically adjust the storage location, storage size, etc. of the large file according to the occupancy of the F2FS data partition. For example, when F2FS creates a large file for the first time, it can create the large file according to the size of the large file calculated at S304. After the electronic device is put into use, if the F2FS data partition is occupied by a large amount of user data, F2FS can reduce the size of the large file; or, if the data in the subsequent large file is cleared, F2FS can also reduce the size of the large file. In addition, the size of the large file can be dynamically adjusted according to other factors, which will not be described in detail in the embodiments of the present application. By dynamically adjusting the size of the large file, the utilization rate of the data partition can be improved.
[0161] S307, returning the block of the large file.
[0162] After F2FS successfully creates the large file in the F2FS data partition, F2FS can obtain the block of the created large file. The block of the large file indicates the address of the large file. By reading the block, the address of the large file can be known, so that the subsequent fault processing system can read the data in the large file based on the address.
[0163] S308, returning the block of the large file.
[0164] F2FS returns the block of the large file obtained above to the init process.
[0165] S309, updating the block of the large file in the raw partition.
[0166] The init process writes the block address of the large file in the raw partition of the UFS based on the obtained block. The file address management module in the init process writes the block to the raw partition.
[0167] Optionally, each time the size of a large file is adjusted after F2FS creates it, it involves updating the address corresponding to the large file. Therefore, F2FS can also notify the init process of the address of the updated large file, and then update the block of the large file in the raw partition.
[0168] After the electronic device successfully creates a large file, if the operating system of the electronic device fails, the failure storage can be implemented through the failure processing subsystem. Figure 3 A schematic diagram of a method for creating a large file is shown below. Figure 4 Here is a flowchart of the method of storing fulldump data in large files.
[0169] See also Figure 4 , Figure 4 A flowchart of a method for storing fulldump data through a file system is exemplified.
[0170] Figure 4 The method flow shown involves a fault handling subsystem, an operating system, a raw partition in UFS, and an F2FS data partition.
[0171] The definitions of the troubleshooting subsystem, operating system, UFS, raw partition, and can refer to the description of the relevant technical terms. The description of the F2FS data partition can refer to the following. Figure 2A The relevant description in will not be repeated here.
[0172] like Figure 4 As shown, a method for storing fulldump data through a file system specifically includes the following steps:
[0173] S401: A process failure is detected.
[0174] Specifically, the electronic device continuously detects faults existing in the running process, including a stage during the startup process of the electronic device and a stage after the startup of the electronic device is completed.
[0175] When an electronic system fails, the data in the DDR remains at a fixed value, the affected processes in the DDR stop running, such as F2FS, and the affected data becomes fulldump data. The fulldump data retains the value at the time of the failure, waiting to be stored in a specified file.
[0176] S402, sending a fault signal.
[0177] After detecting the fault signal, the operating system will send a fault signal to the fault processing subsystem. The fault signal is used to indicate the fault that has occurred. Among them, the fault processing subsystem is located in another storage space. When the electronic system fails, the fault processing subsystem can maintain normal operation.
[0178] Optionally, the fault signal generated by the operating system includes process serious error information and process runaway information, which is not limited in this application.
[0179] S403, obtaining the panic status.
[0180] Specifically, after receiving the fault signal sent by the operating system, the fault handling subsystem determines that a panic fault has occurred and executes subsequent operation procedures.
[0181] Optionally, the fault handling subsystem includes the operating system acquiring the Panic fault and notifying the fault handling subsystem of the Panic fault; and also includes detecting a fault signal sent by the operating system, determining that a Panic has occurred, and performing subsequent fault handling operations.
[0182] Optionally, the fault signal obtained by the fault handling subsystem includes process serious error information and process runaway information, which is not limited in this application.
[0183] S404, obtaining a fault storage mark.
[0184] The fault handling subsystem obtains the fault storage mark from the NVM.
[0185] In an achievable manner, the fault storage mark involved in S404 may be the same as the fault storage mark involved in S301 above. That is, the same mark indicates different things at different stages. In the above-mentioned part, the fault storage mark is in the enabled state, which specifically indicates that the fault storage function is turned on to start creating a large file. In the current stage, the fault storage mark is in the enabled state, which specifically indicates that the fault data can be stored in the large file.
[0186] In another achievable manner, the fault storage flag involved in S404 may be different from the fault storage flag involved in S301 above. That is, the two are two independent flags, and the fault storage flag involved in S404 may also be referred to as a second flag. When the second flag is a third value, the second flag is in an enabled state, and the second flag in the enabled state specifically indicates that the fault data can be stored in a large file.
[0187] S405: When the fault storage flag is enabled, obtain the block.
[0188] After confirming that the fault storage flag is enabled, the fault handling system obtains the large file block stored in the raw partition in the UFS to determine the address to write to the large file. The fault handling system confirms that the fault storage flag is enabled, that is, the fault handling system obtains the fault storage flag value as the second value, and turns on the fault storage function.
[0189] The raw partition allows the fault handling system to read data. After a process failure occurs in the DDR, the file system of the electronic device cannot operate normally and cannot obtain data in the raw partition. The fault handling system obtains the block or blocklist of the large file, and the block or blocklist can obtain the storage address of the large file.
[0190] S406, obtaining fulldump data.
[0191] After obtaining the fault storage mark and confirming that the fault storage function is enabled, the fault handling subsystem obtains fulldump data from the operating system. Specifically, the operating system is located in the part of the DDR affected by the fault, and obtaining fulldump data from the operating system is to obtain fulldump data from the DDR.
[0192] Optionally, after the fault handling subsystem obtains and determines that a Panic fault has occurred in step S403, steps S404-S406 may be performed simultaneously, or steps S404-S406 may be performed sequentially. The present application does not impose any restrictions on the sequence of steps S404-S406.
[0193] S407, writing the fulldump data into the large file according to the block.
[0194] The fault handling subsystem obtains the block address of the large file in F2FS and writes the obtained fulldump data to the large file. The fault handling subsystem obtains the address of the large file and writes the fulldump data to the large file. This method simulates the file operation of the file system and allows the electronic device to write the large file in the data partition when the file system fails.
[0195] Optionally, after the fault processing small system stores the fulldump data in the large file, it can continue to write prompt information without exceeding the storage space of the large file. The prompt information is used for Hiview to process and analyze the fault, and there is no restriction on this.
[0196] Optionally, after the fault handling subsystem implements fulldump data storage, the operations that the electronic device can perform include power-off startup operations and solid-state hardware update and re-burning firmware program operations, which are not restricted in this application.
[0197] After performing the above operations, the fulldump data stored in the UFS is saved after power failure, the fulldump data in the DDR is lost after power failure, and the electronic device allows the operating system to restart.
[0198] Based on the aforementioned Figure 4 The flowchart of the method for storing fulldump data is shown below. Figure 5 Here is a flowchart of the method for collecting fulldump data in this solution.
[0199] See also Figure 5 , Figure 5 A flowchart of a method for collecting fulldump data is shown as an example.
[0200] Figure 5The method flow shown involves Hiview, file system (F2FS), and F2FS data partition in UFS.
[0201] Among them, F2FS provides file operation services for electronic devices. For Hiview and UFS, please refer to the description of related technical terms. For the description of F2FS data partition, please refer to Figure 2A The relevant description in will not be repeated here.
[0202] like Figure 5 As shown, a method for collecting fulldump data specifically includes the following steps:
[0203] S501, obtaining fulldump data.
[0204] Before the electronic device is shut down after a fault occurs, or after the electronic device is operating normally after the fault is resolved, the Hiview of the electronic device can apply to F2FS to obtain fulldump data.
[0205] Optionally, after Hiview detects that a large file in the F2FS data partition in the UFS has fulldump data, the acquisition module in Hiview may submit a request to obtain the fulldump data to the F2FS.
[0206] Optionally, the operation of the Hiview process to obtain fulldump data may be performed during or after the electronic device operating system is started, and this application does not impose any restrictions on this.
[0207] S502, obtain fulldump data from the large file.
[0208] F2FS gets fulldump data from large files in F2FS data partition in UFS.
[0209] Optionally, before step S502, if the electronic device undergoes a firmware update and the program is re-burned, the F2FS is mounted again in the F2FS data partition in the UFS. If the electronic device is not burned with a program and the operating system is restored to normal, the F2FS can obtain fulldump data through the mounted F2FS data partition. The re-mounting of the F2FS can be included after the electronic device is started, and can also be included in the process of starting the electronic device, which is not limited by the present application.
[0210] S503, return fulldump data.
[0211] After obtaining the fulldump data, F2FS passes the fulldump data to Hiview.
[0212] Optionally, after F2FS passes the fulldump data to Hiview, the fulldump data in the large file can be cleared through F2FS. Among them, after clearing the large file, the space occupied by the large file can continue to be retained for the subsequent storage of new fault data; or the large file can be recycled, that is, the space occupied by the large file is released, so that the space originally occupied by the large file can be occupied by other user data of F2FS. Preferably, the execution of recycling large files can be specifically after the electronic equipment has completed the testing phase, the maintenance phase, and is put into commercial use. This is because the possibility of subsequent failures is extremely small, so recycling large files can improve the utilization rate of UFS.
[0213] S504, processing fulldump data.
[0214] Hiview processes the acquired fulldump data and analyzes the cause of electronic equipment failure.
[0215] Among them, Hiview analyzes fault information at the electronic device terminal according to a pre-set analysis mode, or further uploads the fulldump data to the cloud server through the remote reporting module, and the cloud server performs fault analysis. This application does not impose any restrictions on this.
[0216] The foregoing Figure 3-Figure 5 The method flow shown only takes the method of creating a large file, saving fulldump data through the large file, and obtaining fulldump data through F2FS as an example. The data storage method provided in this application can also be used in one or more other file systems. Figure 3-Figure 5 The method shown is similar, and the details can be referred to the previous description.
[0217] Next, the form and software and hardware architecture of the electronic device involved in this application are introduced.
[0218] Electronic equipment can be equipped Or portable terminal devices with other operating systems, such as mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPC), netbooks, as well as cellular phones, personal digital assistants (PDA), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, vehicle-mounted devices, smart home devices and / or smart city devices, etc.
[0219] Figure 6 A schematic structural diagram of an electronic device 100 is shown.
[0220] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, and a display screen 194, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a fingerprint sensor 180H, a touch sensor 180K, etc.
[0221] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0222] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0223] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0224] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0225] In the embodiment of the present application, the processor 110 calls the corresponding software and hardware modules to execute the following Figure 1-Figure 5 For a detailed description of the method, please refer to the previous Figure 1-Figure 5 The introduction of will not be elaborated here.
[0226] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0227] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0228] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0229] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0230] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0231] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0232] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0233] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. The electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0234] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display screen panel can also be made of an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), miniled, microled, micro-oled, quantum dot light emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0235] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0236] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0237] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0238] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0239] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0240] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0241] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0242] Random access memory may include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory DDR SDRAM, such as the fifth generation DDR SDRAM, generally referred to as DDR5 SDRAM, etc.;
[0243] Non-volatile memory may include disk storage devices and flash memory.
[0244] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; can be divided into single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; can be divided into universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.
[0245] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0246] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0247] The RAM and NVM both include Figure 1-Figure 5 The programs and data shown are used to support Figure 1-Figure 5 The method shown is implemented.
[0248] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.
[0249] The external memory may have the function of executing Figure 1-Figure 5 The method procedure shown is used to support Figure 1-Figure 5 The method shown is implemented.
[0250] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0251] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0252] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0253] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0254] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
[0255] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0256] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
[0257] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0258] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0259] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0260] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0261] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0262] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0263] It should be understood that each step in the above method embodiment provided by the present application can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0264] The present application also provides an electronic device, which may include: a memory and a processor, wherein the memory may be used to store a computer program; and the processor may be used to call the computer program in the memory so that the electronic device executes the method in any one of the above embodiments.
[0265] The present application also provides a chip system, which includes at least one processor for implementing the functions involved in the method executed by the electronic device in any of the above embodiments.
[0266] In one possible design, the chip system also includes a memory, which is used to store program instructions and data, and the memory is located inside or outside the processor.
[0267] The chip system may be composed of the chip, or may include the chip and other discrete devices.
[0268] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0269] Optionally, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately arranged with the processor, which is not limited in the embodiments of the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be arranged on different chips respectively. The embodiments of the present application do not specifically limit the type of memory and the arrangement of the memory and the processor.
[0270] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0271] The present application also provides a computer program product, which includes: a computer program (also referred to as code, or instruction), which enables a computer to execute the method executed by the electronic device in any of the above embodiments when the computer program is executed.
[0272] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program (also referred to as code or instruction). When the computer program is executed, the computer executes the method executed by the electronic device in any of the above embodiments.
[0273] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.
[0274] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidStateDisk), etc.
[0275] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0276] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data storage method, It is characterized in that Applied to an electronic device including a first system, an operating system, a file system, a non-volatile memory NVM, and a volatile memory RAM, wherein the first system is a system for processing fault data in the event of a fault in the operating system; the method comprising: Creating a first file in the data partition of the NVM by using the file system, wherein the size of the first file is larger than the size of the RAM; Saving the address of the first file in a raw partition of the NVM; Detecting, by the operating system of the electronic device, that a program running on the RAM fails, and notifying the first system that the RAM fails; The address of the first file in the raw partition is obtained through the first system, and the data in the RAM is stored in the first file based on the address of the first file.
2. The method according to claim 1, It is characterized in that Before creating the first file in the NVM by the file system, the method further includes: The file system is mounted on the NVM.
3. The method according to claim 2, It is characterized in that Mounting the file system on the NVM specifically includes: An address in the NVM corresponding to the file system is determined.
4. The method according to any one of claims 1 to 3, It is characterized in that The method further comprises: The size of the first file is updated through the file system.
5. The method according to claim 4, It is characterized in that The method further comprises: The updated address of the first file is updated into the raw partition of the NVM.
6. The method according to claim 1, It is characterized in that The first system runs in the RAM.
7. The method according to claim 1, It is characterized in that The electronic device further includes a maintenance detection service set Hiview. After storing the data in the RAM into the first file based on the address of the first file, the method further includes: Acquire the data in the first file through the Hiview; The cause of the failure is analyzed by using the acquired data.
8. The method according to claim 7, It is characterized in that Acquiring the data in the first file through the Hiview specifically includes: Requesting the file system to obtain the data through the Hiview; Acquire the data in the first file through the file system; The data in the first file is returned to the Hiview through the file system.
9. The method according to claim 8, It is characterized in that After the file system returns the data in the first file to the Hiview, the method further includes: The data in the first file is deleted through the file system.
10. The method according to claim 1, It is characterized in that The size of the first file is larger than the size of the RAM by a first value, and the first value is a preset value.
11. The method according to claim 1, It is characterized in that The electronic device further includes a fault storage flag, and before creating the first file in the NVM by the file system, the method further includes: Determining that the value of the fault storage flag is a second value; The second value indicates that a fault storage function of the electronic device is turned on.
12. The method according to claim 11, It is characterized in that After determining that the value of the fault storage flag is a second value, the method further includes: It is determined that the electronic device is in a testing phase.
13. The method according to claim 1, It is characterized in that The electronic device further includes a second tag. Before acquiring the address of the first file in the raw partition through the first system, the method further includes: Determine that the value of the second mark is a third value; The third value instructs the electronic device to store the data in the RAM into the NVM through the first system.
14. An electronic device, It is characterized in that The electronic device includes one or more RAMs, one or more NVMs, and one or more processors; the memory is coupled to the one or more processors, the NVM is used to store computer program code, the RAM is used to calculate and execute the computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform the method described in any one of claims 1-13.
15. A chip, wherein the chip is applied to an electronic device. It is characterized in that The chip includes one or more processors, and the processor is used to call computer instructions to enable the electronic device to execute the method as described in any one of claims 1-13.
16. A computer-readable storage medium comprising instructions, It is characterized in that When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 13.
