WO2017148271A1 - Linux system reset processing method and device, and computer storage medium - Google Patents

Linux system reset processing method and device, and computer storage medium Download PDF

Info

Publication number
WO2017148271A1
WO2017148271A1 PCT/CN2017/073826 CN2017073826W WO2017148271A1 WO 2017148271 A1 WO2017148271 A1 WO 2017148271A1 CN 2017073826 W CN2017073826 W CN 2017073826W WO 2017148271 A1 WO2017148271 A1 WO 2017148271A1
Authority
WO
WIPO (PCT)
Prior art keywords
reset
information
reset operation
kernel
reserved memory
Prior art date
Application number
PCT/CN2017/073826
Other languages
French (fr)
Chinese (zh)
Inventor
文洋
谈虎
田永江
隆春
史中兵
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017148271A1 publication Critical patent/WO2017148271A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/24Resetting means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1417Boot up procedures

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a Linux system reset processing method and apparatus, and a computer storage medium.
  • the Linux system often resets during the running process.
  • the reset scenario usually includes: reset caused by system call, reset caused by keyboard operation (keyboard combination key), reset caused by power button, and reset caused by kernel error.
  • the current technology usually stores the current memory image into the vmcore file through the kdump service, and the vmcore file can be parsed by a tool such as crash to obtain the corresponding reset information; however, tools such as kdump save the current system.
  • the entire memory image takes up a lot of storage space and takes a long time.
  • an embodiment of the present invention provides a Linux system reset processing method, apparatus, and computer storage medium.
  • An embodiment of the present invention provides a Linux system reset processing method, including:
  • the reset information of the reset operation is obtained, and the reset information is cached in a preset reserved memory, where the reset information includes scene information of the reset operation, initiator information, and status information of the current system;
  • Memory is the memory space in system memory;
  • the preset kernel is started, and the reset information is stored in the hard disk in the preset kernel that is started.
  • the step of acquiring reset information of the reset operation comprises:
  • Identifying scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
  • the initiator information includes at least: a process identifier of the current process of the initiator, a first user-level INIT process initiated by the kernel corresponding to the process identifier, a terminal, The user, startup time, and executed commands;
  • the current system status information includes at least the central processing unit (CPU) status, memory status, and input/output (I/O) status before the system performs the reset operation.
  • CPU central processing unit
  • I/O input/output
  • the step of identifying scene information of the reset operation comprises:
  • the step of acquiring initiator information of the reset operation comprises:
  • the process identifier of the parent process is obtained according to the INIT process corresponding to the process identifier of the current process and the process identifier, and the parent process is a process between the current process of the initiator and the INIT process.
  • the method further includes:
  • the flag reset operation is a kernel error
  • the reset operation and the tag information are correspondingly stored in the hard disk and a reset operation is performed.
  • the method further includes:
  • Establish reserved memory configure the capacity of the reserved memory, and the starting address and record.
  • the step of buffering the reset information in the preset reserved memory comprises:
  • the reserved memory is cached in the reserved memory according to the reserved memory capacity and the starting address.
  • the method further includes:
  • An embodiment of the present invention further provides a Linux system reset processing apparatus, including:
  • a detection module configured to monitor a reset scenario of the Linux system
  • the obtaining module is configured to: when the Linux system startup reset process is monitored, obtain reset information of the reset operation, and cache the reset information in a preset reserved memory, where the reset information includes scene information of the reset operation, initiator information, and current system. Status information; reserved memory is the memory space in system memory;
  • the execution module is configured to start the preset kernel when the Linux system is monitored to perform the reset operation, and store the reset information in the hard disk in the preset kernel that is started.
  • the obtaining module comprises:
  • the identification sub-module is configured to identify scene information of the reset operation; wherein the scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
  • the information acquisition submodule is configured to obtain the initiator information of the reset operation and the status information of the current system, and the initiator information includes at least: a process identifier of the current process of the initiator, and a first user initiated by the kernel corresponding to the process identifier.
  • Level INIT process its own terminal, its own users, Start time and executed commands; current system status information includes at least: CPU status, memory status, and I/O status before the system performs a reset operation.
  • the identification submodule comprises:
  • a first determining unit configured to: when detecting a user mode program calling the REBOOT command in a processing flow invoked by the system kernel, determining that the scene information of the reset operation is a reset caused by the system call;
  • a second determining unit configured to: when detecting that the ACPI reports a power key event corresponding to the system reset to the system, determining that the scenario information of the reset operation is a reset caused by the power button;
  • the third determining unit is configured to determine that the scene information of the reset operation is a reset caused by the keyboard combination key when the keyboard processing function corresponding to the system reset is detected in the keyboard processing function.
  • the information acquisition submodule comprises:
  • the first obtaining unit is configured to acquire a process identifier of the parent process according to the INIT process corresponding to the process identifier of the current process and the process identifier, where the parent process is a process between the current process of the initiator and the INIT process.
  • the method further comprises:
  • a kernel error handling module configured to acquire a reset information of a reset operation after the module acquires
  • the flag reset operation is a kernel error
  • the reset operation and the tag information are correspondingly stored in the hard disk and a reset operation is performed.
  • the device further comprises:
  • a memory creation module configured to be in the acquisition module before monitoring the Linux system startup reset process
  • Establish reserved memory configure the capacity of the reserved memory, and the starting address and record.
  • the obtaining module is further configured to:
  • the reserved memory is cached in the reserved memory according to the reserved memory capacity and the starting address.
  • the device further comprises:
  • the kernel build module is configured to execute the module before monitoring the Linux system to perform a reset operation.
  • Embodiments of the present invention also provide a computer storage medium comprising a set of instructions that, when executed, cause at least one processor to perform a Linux system reset processing method of an embodiment of the present invention.
  • the Linux system reset processing method and device and the computer storage medium provided by the embodiment of the present invention can collect reset information in time, trace the process call information, and find a reset by monitoring the reset information of the reset operation when the Linux system starts the reset process.
  • the original initiator of the operation; and writes the reset information to the hard disk in the preset kernel stores only the reset information, takes up less storage space, and takes less time to implement reset information, facilitates fault location or other Service to enhance the maintainability of the system.
  • the embodiment of the invention solves the problem that the reset information is difficult to collect when the system is reset in the Linux system, which brings trouble to the fault location.
  • FIG. 1 is a flow chart showing the basic steps of a Linux system reset processing method according to a first embodiment of the present invention
  • FIG. 2 is a schematic diagram of a scenario of a second embodiment of the present invention.
  • 3 is a flow chart showing the steps performed by the kernel mode control module of the second embodiment of the present invention.
  • FIG. 4 is a flowchart of steps performed by a user state reset information collecting module according to a second embodiment of the present invention.
  • FIG. 5 is a flowchart of steps performed by a reset information cache module according to a second embodiment of the present invention.
  • FIG. 6 is a flowchart of steps performed by a reset information persistence module according to a second embodiment of the present invention.
  • Figure 7 is a flow chart showing the steps performed by the quick start kernel module of the second embodiment of the present invention.
  • FIG. 8 is a block diagram of a Linux system reset processing apparatus according to a third embodiment of the present invention.
  • the embodiment of the present invention provides a Linux system reset processing method and apparatus for the existing problems.
  • monitoring a reset scenario of the Linux system when monitoring the Linux system startup reset process, acquiring reset information of the reset operation, and buffering the reset information in a preset reserved memory, where
  • the reset information includes scene information of the reset operation, initiator information, and status information of the current system;
  • the reserved memory is a memory space in the system memory;
  • the preset kernel is started, In the preset kernel that is started, the reset information is stored in the hard disk.
  • a first embodiment of the present invention provides a Linux system reset processing method, including:
  • Step 101 Monitor a reset scenario of the Linux system.
  • the reset scene usually includes: reset caused by system call, reset caused by keyboard operation (keyboard combination key, such as Ctrl+Alt+Delete key combination), reset caused by power button, and reset caused by kernel error.
  • Step 102 When the Linux system startup reset process is detected, the reset information of the reset operation is obtained, and the reset information is cached in the preset reserved memory.
  • the reset information includes scene information of the reset operation, initiator information, and status information of the current system; the reserved memory is a memory space in the system memory.
  • the reserved memory is the memory space in the preset system memory, and is configured to cache the reset information. Take the reset caused by the system call as an example. When the system reset process starts, the hard disk may be inaccessible. Therefore, a space area needs to be reserved in the memory and configured to cache the reset information.
  • the Linux system startup reset process is detected, that is, at the entry of the reset process, the corresponding processing logic is inserted, the reset information is obtained, the reset information is cached in the reserved memory, and the readout is provided. And the address of the interface written to facilitate writing to the hard disk.
  • Step 103 When it is detected that the Linux system performs a reset operation, the preset kernel is started, and in the preset kernel that is started, the reset information is stored in the hard disk.
  • the default kernel is a kernel outside the system kernel and configured to perform a system reset.
  • the process of writing reset information to the hard disk by an embodiment of the present invention is also performed in a preset kernel.
  • step 102 includes:
  • the scene information of the reset operation is identified; wherein the scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
  • the second step is to obtain the initiator information of the reset operation and the status information of the current system.
  • the initiator information includes at least: a process identifier of the current process of the initiator, and a first user-level INIT process initiated by the kernel corresponding to the process identifier.
  • the associated terminal, the user, the startup time, and the executed command; the current system state information includes at least the CPU state, memory state, and I/O state before the system performs the reset operation.
  • the first step mentioned above comprises:
  • the scene information of the reset operation is a reset caused by the system call; specifically, when the user kernel calls the processing flow, the user state program is detected.
  • the program language corresponding to the REBOOT command is used, the scene information of the reset operation can be confirmed as a system call.
  • the scene information of the reset operation is a reset caused by the power key; normally, when the system hardware reports the power key event to the system through the ACPI, for example, short press the power key Usually it is a restart (ie system reset), then when the user presses the power button shortly, ACPI will report to the system, then when receiving the short press of the power button reported by ACPI, it can be confirmed that the scene information of the reset operation is caused by the power button. Reset.
  • the keyboard processing function corresponding to the system reset When the keyboard processing function corresponding to the system reset is detected in the keyboard processing function, it is determined that the scene information of the reset operation is a reset caused by the keyboard combination key; specifically, when the user presses the "Ctrl+Alt+Del" key combination
  • the system responds to the interrupt event by calling the driver layer interrupt handler function, then enters the kernel input subsystem for subsystem classification, and finally calls the keyboard handler function corresponding to the system reset to start the reset process.
  • the first step mentioned above comprises:
  • the parent process is a process between the initiator's current process and the INIT process; wherein the INIT process is kernel-initiated
  • the first user-level process the parent process is the process between the current process and the INTI process.
  • each parent process can be obtained by backtracking forward by the current process. The above information is obtained in order to collect information related to the reset operation and enhance the maintainability of the system.
  • step 102 the method further includes:
  • the reset operation and the tag information are correspondingly stored in the hard disk and a reset operation is performed.
  • kernel panic refers to the fact that the operating system detects internal fatal errors and cannot handle this error safely; the kernel may not work properly when the kernel is wrong, so the reset scenario can only be done in the default kernel. Mark and perform the reset process.
  • the method further includes:
  • Establish reserved memory configure the capacity of the reserved memory, and the starting address and record.
  • step 102 the step of buffering the reset information in the preset reserved memory includes:
  • the reserved memory is cached in the reserved memory according to the reserved memory capacity and the starting address.
  • the reserved memory is configured to cache reset information; the reserved memory is established before the reset information is acquired, and the capacity and the start address are configured, so that the system caches the reset information in the reserved memory according to the start address.
  • the method further includes:
  • the preset kernel is created and the capacity and the starting address are configured, and the generated image file is stored in the hard disk for persistence.
  • the reset information of the reset operation when the reset information of the reset operation is acquired when the Linux system starts the reset process, the reset information can be collected in time, the process call information is traced, and the original initiator of the reset operation is found;
  • the reset information In the default kernel, the reset information is written to the hard disk, only the reset information is stored, the occupied storage space is small, and the time is short, the reset information is persistent, the fault location or other services are facilitated, and the maintainability of the system is enhanced.
  • the real-time example of the present invention solves the problem that the reset information is difficult to collect when the system is reset in the Linux system, which brings trouble to the fault location.
  • FIG. 2 is a schematic diagram of a scenario of a second embodiment of the present invention.
  • the Linux system shown in FIG. 2 includes: a kernel state control module 201, a user state reset information collection module 202, and a reset information cache module 203.
  • the kernel module 205 and the reset information persistence module 204 are included in the Linux system shown in FIG. 2 in FIG. 2 .
  • the kernel state control module 201 is configured to provide a general mechanism for collecting system reset information: when the reset operation starts, the user state reset information collection module 202 is started;
  • the fast boot kernel module 205 is started prior to executing the processor architecture related code and performing a system reset operation.
  • the user state reset information collection module 202 is configured to provide various policies for collecting system reset information, so that the system can write the collected information into the reset information cache module 203.
  • the reset information cache module 203 is configured to provide a read and write interface, and is called by the user state reset information collection module 202 to cache the reset information in the reset information cache module 203, which is called by the reset information persistence module 204.
  • the reset information buffered in the information buffer module 203 is reset.
  • the fast boot kernel module 205 is configured to quickly launch a tailored, usable kernel, and in the context of the kernel, execute a reset information persistence module 204.
  • the reset information persistence module 204 reads the reset information from the reset information cache module 203 and saves it to the specified file on the hard disk.
  • the kernel mode control module 201 performs the following steps:
  • Step 301 at the entry of the system reset, insert processing logic: call the user state reset information collection module 202. Among them, the reset caused by the reboot system call:
  • the user state reset information collection module 202 is started (can be by a method such as call_usermodehelper).
  • the user state reset information collection module 202 is started (can be by a method such as call_usermodehelper).
  • the user state reset information collection module 202 is started (can be by a method such as call_usermodehelper).
  • step 302 is directly executed.
  • Step 302 insert logic before calling the processor architecture related code to actually perform the system reset operation: invoke the fast boot kernel module 205.
  • the user state reset information collecting module 202 performs the following steps:
  • Step 401 Write description information of the current reset scenario to the reset information cache module 203.
  • the description information such as "reset caused by reboot system call”, “reset by pressing the power button”, and “reset by pressing the keyboard combination key” are respectively written into the reset information buffer.
  • the description information such as "reset caused by reboot system call”, “reset by pressing the power button”, and “reset by pressing the keyboard combination key” are respectively written into the reset information buffer.
  • step 402 it is determined whether the process traceback information needs to be recorded, if necessary, step 403 is performed, otherwise step 404 is performed.
  • the process traces back information processing.
  • the process backtracking process includes: acquiring information such as the ID number of the current process; recording the collected information into the reset information cache module; determining the parent process information of the current process, and if it is already an INIT process, it is not required to continue upward. The first level is backtracked. Otherwise, the current process identifier (ID) is assigned to the parent process ID of the current process, and the loopback is continued;
  • step 404 it is determined whether the system status statistics need to be recorded. If necessary, step 405 is executed to obtain statistics of CPU, memory, I/O, etc., otherwise the process ends.
  • the reset information cache module 203 performs the following steps:
  • Step 501 Write the reset information buffered in the user state reset information collection module 202 into the reserved memory.
  • Step 502 Record related information (capacity and address range, etc.) of the reserved memory.
  • the reset information persistence module 204 performs the following steps:
  • Step 601 Determine whether the reset scenario is a kernel error (whether or not a kernel error flag is transmitted). If not, execute step 602 to persist the data in the reset information cache module to the hard disk; otherwise, execute step 603 to mark the kernel error. Persist to the hard disk.
  • the kernel module 205 is quickly started, and the following steps are performed:
  • Step 701 When it is detected that the kernel control module initiates a quick start, step 702 is executed to start quickly.
  • Step 703 the reset information persistence module 204 is started, and the reset information persistence module 204 persists the data in the reset information cache module to the hard disk or persists the kernel error flag to the hard disk.
  • the processing logic when the Linux system startup reset process is monitored by the kernel mode control module 201, at the entry of the system reset, the processing logic is inserted: the user state reset information collection module 202 is called to obtain the reset information of the reset operation and trace back. Process call information, find reset The original initiator of the operation; and the reset information is written to the hard disk by the reset information persistence module 204, so that the reset information is persistent, facilitating fault location or other services, and enhancing the maintainability of the system.
  • the embodiment of the invention solves the problem that the reset information is difficult to collect when the system is reset in the Linux system, which brings trouble to the fault location.
  • a third embodiment of the present invention provides a Linux system reset processing apparatus, including:
  • the detecting module 801 is configured to monitor a reset scenario of the Linux system
  • the obtaining module 802 is configured to: when the Linux system startup reset process is monitored, obtain reset information of the reset operation, and cache the reset information in a preset reserved memory, where the reset information includes scene information of the reset operation, initiator information, and current State information of the system; reserved memory is the memory space in the system memory;
  • the execution module 803 is configured to start the preset kernel when the Linux system is monitored to perform the reset operation, and store the reset information in the hard disk in the preset kernel that is started.
  • the obtaining module 802 includes:
  • the identification sub-module is configured to identify scene information of the reset operation; wherein the scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
  • the information acquisition submodule is configured to obtain the initiator information of the reset operation and the status information of the current system, and the initiator information includes at least: a process identifier of the current process of the initiator, and a first user initiated by the kernel corresponding to the process identifier.
  • the level of the INIT process, the associated terminal, the user, the startup time, and the executed command; the current system state information includes at least the CPU state, memory state, and I/O state before the system performs the reset operation.
  • the identification submodule comprises:
  • a first determining unit configured to: when detecting a user mode program calling the REBOOT command in a processing flow invoked by the system kernel, determining that the scene information of the reset operation is a reset caused by the system call;
  • a second determining unit configured to detect, when the ACPI detects the power supply corresponding to the system reset to the system When the key event occurs, it is determined that the scene information of the reset operation is a reset caused by the power key;
  • the third determining unit is configured to determine that the scene information of the reset operation is a reset caused by the keyboard combination key when the keyboard processing function corresponding to the system reset is detected in the keyboard processing function.
  • the information acquisition submodule comprises:
  • a first acquiring unit configured to acquire a process identifier of a current process of the initiator, a terminal to which the terminal belongs, a user to belong, a startup time, and an executed command;
  • the process identifier of the parent process is obtained according to the INIT process corresponding to the process identifier of the current process and the process identifier, and the parent process is a process between the current process of the initiator and the INIT process.
  • the device further comprises:
  • a kernel error processing module configured to, after the obtaining module 802 obtains reset information of the reset operation
  • the flag reset operation is a kernel error
  • the reset operation and the tag information are correspondingly stored in the hard disk and a reset operation is performed.
  • the device further comprises:
  • a memory creation module configured to be in the acquisition module 802 before monitoring the Linux system startup reset process
  • Establish reserved memory configure the capacity of the reserved memory, and the starting address and record.
  • the obtaining module 802 is further configured to:
  • the reserved memory is cached in the reserved memory according to the reserved memory capacity and the starting address.
  • the device further comprises:
  • a kernel setup module configured to execute the module 803 before monitoring the Linux system to perform a reset operation
  • the reset information of the reset operation when the reset information of the reset operation is acquired when the Linux system starts the reset process, the reset information can be collected in time, the process call information is traced, and the original initiator of the reset operation is found;
  • the reset information In the default kernel, the reset information is written to the hard disk, only the reset information is stored, the occupied storage space is small, and the time is short, the reset information is persistent, the fault location or other services are facilitated, and the maintainability of the system is enhanced.
  • the embodiment of the invention solves the problem that the reset information is difficult to collect when the system is reset in the Linux system, which brings trouble to the fault location.
  • the Linux system reset processing device provided by the embodiment of the present invention is a device applying the foregoing method, that is, all the embodiments of the foregoing method are applicable to the device, and all of the same or similar beneficial effects can be achieved.
  • the kernel error processing module, the memory creation module, and the kernel creation module may be implemented by a processor in a Linux system reset processing device.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
  • These computer program instructions can also be stored in a bootable computer or other programmable data processing
  • the apparatus is readable in a computer readable memory in a particular manner such that instructions stored in the computer readable memory produce an article of manufacture comprising instruction means implemented in one or more flows and/or block diagrams of the flowchart The function specified in the box or in multiple boxes.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • an embodiment of the present invention further provides a computer storage medium, where the computer storage medium includes a set of instructions, when executed, causing at least one processor to execute the Linux system reset processing method of the embodiment of the present invention.
  • the solution provided by the embodiment of the present invention can obtain the reset information of the reset operation when the Linux system starts the reset process, and can collect the reset information in time, trace the process call information, and find the original initiator of the reset operation;
  • the reset information is written to the hard disk, only the reset information is stored, the occupied storage space is small, and the time is short, the reset information is persistent, the fault location or other services are facilitated, and the maintainability of the system is enhanced.

Abstract

A Linux system reset processing method and device, and a computer storage medium. The method comprises: monitoring a reset scenario of a Linux system (101); when it is monitored that the Linux system starts a reset flow, acquiring reset information about a reset operation, and caching the reset information into a pre-set reserved memory (102), wherein the reset information comprises scenario information and initiator information about the reset operation, and state information about a current system, and the reserved memory is a memory space in a system memory; and when it is monitored that the Linux system performs a reset operation, starting a preset core, and storing, in the started preset core, the reset information into a hard disk (103).

Description

一种Linux系统复位处理方法、装置及计算机存储介质Linux system reset processing method, device and computer storage medium 技术领域Technical field
本发明涉及计算机技术领域,特别涉及一种Linux系统复位处理方法、装置及计算机存储介质。The present invention relates to the field of computer technologies, and in particular, to a Linux system reset processing method and apparatus, and a computer storage medium.
背景技术Background technique
Linux系统在运行的过程中经常会发生复位,复位场景通常包括:系统调用引起的复位、键盘操作引起的复位(键盘组合键)、电源按键引起的复位以及内核错误引起的复位等。The Linux system often resets during the running process. The reset scenario usually includes: reset caused by system call, reset caused by keyboard operation (keyboard combination key), reset caused by power button, and reset caused by kernel error.
对于系统调用引起的复位,通常只有部分命令行程序(关机程序shutdown、重启程序reboot、停止程序halt等)在调用系统调用之前会记录复位信息到相应的日志文件中(比如wtmp文件)中,而如果直接调用系统调用,则没有记录;然而,wtmp文件中记录的复位信息较少,无法追溯进程调用信息,无法找到复位操作的最原始的发起者。For the reset caused by the system call, usually only some of the command line programs (shutdown program shutdown, restart program reboot, stop program halt, etc.) will record the reset information to the corresponding log file (such as wtmp file) before calling the system call, and If the system call is called directly, there is no record; however, there is less reset information recorded in the wtmp file, the process call information cannot be traced, and the original initiator of the reset operation cannot be found.
对于内核错误引起的复位,现有技术通常通过kdump服务把当前的内存镜像存储到vmcore文件中,可以通过crash等工具来解析vmcore文件,进而获得相应的复位信息;然而kdump等工具会保存当前系统的整个内存镜像,占用存储空间大、耗费时间长。For the reset caused by the kernel error, the current technology usually stores the current memory image into the vmcore file through the kdump service, and the vmcore file can be parsed by a tool such as crash to obtain the corresponding reset information; however, tools such as kdump save the current system. The entire memory image takes up a lot of storage space and takes a long time.
而对于键盘操作引起的复位和电源按键引起的复位,现有技术难以收集相应的复位信息。For the reset caused by keyboard operation and the reset caused by the power button, it is difficult for the prior art to collect corresponding reset information.
因此,在Linux系统进行系统复位时,复位信息难以收集,给故障定位带来困扰。Therefore, when the Linux system performs a system reset, the reset information is difficult to collect, which causes trouble for fault location.
发明内容Summary of the invention
为解决现有存在的技术问题,本发明实施例提供一种Linux系统复位处理方法、装置及计算机存储介质。 To solve the existing technical problems, an embodiment of the present invention provides a Linux system reset processing method, apparatus, and computer storage medium.
本发明实施例的技术方案是这样实现的:The technical solution of the embodiment of the present invention is implemented as follows:
本发明的实施例提供了一种Linux系统复位处理方法,包括:An embodiment of the present invention provides a Linux system reset processing method, including:
监测Linux系统的复位场景;Monitor the reset scenario of the Linux system;
当监测到Linux系统启动复位流程时,获取复位操作的复位信息,将复位信息缓存在预设的保留内存中,其中复位信息包括复位操作的场景信息、发起者信息以及当前系统的状态信息;保留内存为系统内存中的内存空间;When the Linux system startup reset process is detected, the reset information of the reset operation is obtained, and the reset information is cached in a preset reserved memory, where the reset information includes scene information of the reset operation, initiator information, and status information of the current system; Memory is the memory space in system memory;
当监测到Linux系统执行复位操作时,启动预设内核,在所启动的预设内核中,将复位信息存储在硬盘中。When it is detected that the Linux system performs a reset operation, the preset kernel is started, and the reset information is stored in the hard disk in the preset kernel that is started.
优选地,获取复位操作的复位信息的步骤,包括:Preferably, the step of acquiring reset information of the reset operation comprises:
识别复位操作的场景信息;其中,复位操作的场景信息包括:系统调用引起的复位、电源键引起的复位以及键盘组合键引起的复位中的一种;Identifying scene information of the reset operation; wherein the scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
获取复位操作的发起者信息以及当前系统的状态信息,发起者信息至少包括:发起者的当前进程的进程标识符、与进程标识符对应的内核启动的第一个用户级INIT进程、所属终端、所属用户、启动时间以及执行的命令;当前系统的状态信息至少包括:系统执行复位操作前的中央处理器(CPU)状态、内存状态、输入/输出(I/O)状态。Obtaining the initiator information of the reset operation and the status information of the current system, the initiator information includes at least: a process identifier of the current process of the initiator, a first user-level INIT process initiated by the kernel corresponding to the process identifier, a terminal, The user, startup time, and executed commands; the current system status information includes at least the central processing unit (CPU) status, memory status, and input/output (I/O) status before the system performs the reset operation.
优选地,识别复位操作的场景信息的步骤包括:Preferably, the step of identifying scene information of the reset operation comprises:
当在系统内核调用的处理流程中检测到用户态程序调用重新启动系统(REBOOT)命令时,确定复位操作的场景信息为系统调用引起的复位;When the user state program restart system (REBOOT) command is detected in the processing flow of the system kernel call, it is determined that the scene information of the reset operation is a reset caused by the system call;
当检测到高级配置和电源管理接口(ACPI)向系统上报系统复位对应的电源键事件时,确定复位操作的场景信息为电源键引起的复位;When it is detected that the advanced configuration and the power management interface (ACPI) report the power key event corresponding to the system reset to the system, it is determined that the scene information of the reset operation is a reset caused by the power button;
当在键盘处理函数中检测到与系统复位对应的键盘处理函数时,确定复位操作的场景信息为键盘组合键引起的复位。When the keyboard processing function corresponding to the system reset is detected in the keyboard processing function, it is determined that the scene information of the reset operation is a reset caused by the keyboard combination key.
优选地,获取复位操作的发起者信息的步骤,包括:Preferably, the step of acquiring initiator information of the reset operation comprises:
获取发起者的当前进程的进程标识符、所属终端、所属用户、启动时间以及执行的命令;Obtain the process identifier of the current process of the initiator, the terminal to which it belongs, the user to belong, the startup time, and the executed command;
根据当前进程的进程标识符与进程标识符对应的INIT进程,获取父进程的进程标识符,所述父进程为发起者的当前进程与INIT进程之间的进程。The process identifier of the parent process is obtained according to the INIT process corresponding to the process identifier of the current process and the process identifier, and the parent process is a process between the current process of the initiator and the INIT process.
优选地,获取复位操作的复位信息的步骤之后,方法还包括: Preferably, after the step of acquiring the reset information of the reset operation, the method further includes:
根据复位信息判断复位操作的场景信息是否为内核错误引起的系统复位;Determining, according to the reset information, whether the scene information of the reset operation is a system reset caused by a kernel error;
当判断结果为是时,标记复位操作为内核错误;When the judgment result is YES, the flag reset operation is a kernel error;
其中,当监测到Linux系统执行复位操作时,启动预设内核的步骤之后,Wherein, when the step of starting the preset kernel is detected when the Linux system performs the reset operation,
在预设内核中,将复位操作以及标记信息对应存储在硬盘中并执行复位操作。In the preset kernel, the reset operation and the tag information are correspondingly stored in the hard disk and a reset operation is performed.
优选地,当监测到Linux系统启动复位流程时的步骤之前,方法还包括:Preferably, before the step of the Linux system startup reset process is monitored, the method further includes:
建立保留内存,并配置保留内存的容量以及起始地址并记录。Establish reserved memory, configure the capacity of the reserved memory, and the starting address and record.
优选地,将复位信息缓存在预设的保留内存中的步骤,包括:Preferably, the step of buffering the reset information in the preset reserved memory comprises:
根据保留内存的容量以及起始地址查找保留内存,将复位信息缓存在保留内存中。The reserved memory is cached in the reserved memory according to the reserved memory capacity and the starting address.
优选地,当监测到Linux系统执行复位操作时的步骤之前,方法还包括:Preferably, before the step of performing a reset operation by the Linux system is detected, the method further includes:
建立预设内核,配置预设内核的容量以及起始地址并生成镜像文件,将镜像文件存储在硬盘中。Create a default kernel, configure the default kernel capacity and starting address and generate an image file to store the image file on the hard disk.
本发明的实施例还提供了一种Linux系统复位处理装置,包括:An embodiment of the present invention further provides a Linux system reset processing apparatus, including:
检测模块,配置为监测Linux系统的复位场景;a detection module configured to monitor a reset scenario of the Linux system;
获取模块,配置为当监测到Linux系统启动复位流程时,获取复位操作的复位信息,将复位信息缓存在预设的保留内存中,其中复位信息包括复位操作的场景信息、发起者信息以及当前系统的状态信息;保留内存为系统内存中的内存空间;The obtaining module is configured to: when the Linux system startup reset process is monitored, obtain reset information of the reset operation, and cache the reset information in a preset reserved memory, where the reset information includes scene information of the reset operation, initiator information, and current system. Status information; reserved memory is the memory space in system memory;
执行模块,配置为当监测到Linux系统执行复位操作时,启动预设内核,在所启动的预设内核中,将复位信息存储在硬盘中。The execution module is configured to start the preset kernel when the Linux system is monitored to perform the reset operation, and store the reset information in the hard disk in the preset kernel that is started.
优选地,获取模块包括:Preferably, the obtaining module comprises:
识别子模块,配置为识别复位操作的场景信息;其中,复位操作的场景信息包括:系统调用引起的复位、电源键引起的复位以及键盘组合键引起的复位中的一种;The identification sub-module is configured to identify scene information of the reset operation; wherein the scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
信息获取子模块,配置为获取复位操作的发起者信息以及当前系统的状态信息,发起者信息至少包括:发起者的当前进程的进程标识符、与进程标识符对应的内核启动的第一个用户级INIT进程、所属终端、所属用户、 启动时间以及执行的命令;当前系统的状态信息至少包括:系统执行复位操作前的CPU状态、内存状态、I/O状态。The information acquisition submodule is configured to obtain the initiator information of the reset operation and the status information of the current system, and the initiator information includes at least: a process identifier of the current process of the initiator, and a first user initiated by the kernel corresponding to the process identifier. Level INIT process, its own terminal, its own users, Start time and executed commands; current system status information includes at least: CPU status, memory status, and I/O status before the system performs a reset operation.
优选地,识别子模块包括:Preferably, the identification submodule comprises:
第一确定单元,配置为当在系统内核调用的处理流程中检测到用户态程序调用REBOOT命令时,确定复位操作的场景信息为系统调用引起的复位;a first determining unit, configured to: when detecting a user mode program calling the REBOOT command in a processing flow invoked by the system kernel, determining that the scene information of the reset operation is a reset caused by the system call;
第二确定单元,配置为当检测到ACPI向系统上报系统复位对应的电源键事件时,确定复位操作的场景信息为电源键引起的复位;a second determining unit, configured to: when detecting that the ACPI reports a power key event corresponding to the system reset to the system, determining that the scenario information of the reset operation is a reset caused by the power button;
第三确定单元,配置为当在键盘处理函数中检测到与系统复位对应的键盘处理函数时,确定复位操作的场景信息为键盘组合键引起的复位。The third determining unit is configured to determine that the scene information of the reset operation is a reset caused by the keyboard combination key when the keyboard processing function corresponding to the system reset is detected in the keyboard processing function.
优选地,信息获取子模块包括:Preferably, the information acquisition submodule comprises:
第一获取单元,配置为根据当前进程的进程标识符与进程标识符对应的INIT进程,获取父进程的进程标识符,所述父进程为发起者的当前进程与INIT进程之间的进程。The first obtaining unit is configured to acquire a process identifier of the parent process according to the INIT process corresponding to the process identifier of the current process and the process identifier, where the parent process is a process between the current process of the initiator and the INIT process.
优选地,还包括:Preferably, the method further comprises:
内核错误处理模块,配置为在获取模块获取复位操作的复位信息之后,a kernel error handling module configured to acquire a reset information of a reset operation after the module acquires
根据复位信息判断复位操作的场景信息是否为内核错误引起的系统复位;Determining, according to the reset information, whether the scene information of the reset operation is a system reset caused by a kernel error;
当判断结果为是时,标记复位操作为内核错误;When the judgment result is YES, the flag reset operation is a kernel error;
其中,当监测到Linux系统执行复位操作时,启动预设内核的步骤之后,Wherein, when the step of starting the preset kernel is detected when the Linux system performs the reset operation,
在预设内核中,将复位操作以及标记信息对应存储在硬盘中并执行复位操作。In the preset kernel, the reset operation and the tag information are correspondingly stored in the hard disk and a reset operation is performed.
优选地,该装置还包括:Preferably, the device further comprises:
内存建立模块,配置为在获取模块当监测到Linux系统启动复位流程时之前,a memory creation module configured to be in the acquisition module before monitoring the Linux system startup reset process
建立保留内存,并配置保留内存的容量以及起始地址并记录。Establish reserved memory, configure the capacity of the reserved memory, and the starting address and record.
优选地,获取模块还配置为:Preferably, the obtaining module is further configured to:
根据保留内存的容量以及起始地址查找保留内存,将复位信息缓存在保留内存中。 The reserved memory is cached in the reserved memory according to the reserved memory capacity and the starting address.
优选地,该装置还包括:Preferably, the device further comprises:
内核建立模块,配置为在执行模块当监测到Linux系统执行复位操作时之前,The kernel build module is configured to execute the module before monitoring the Linux system to perform a reset operation.
建立预设内核,配置预设内核的容量以及起始地址并生成镜像文件,将镜像文件存储在硬盘中。Create a default kernel, configure the default kernel capacity and starting address and generate an image file to store the image file on the hard disk.
本发明的实施例还提供了一种计算机存储介质,所述计算机存储介质包括一组指令,当执行所述指令时,引起至少一个处理器执行本发明实施例的Linux系统复位处理方法。Embodiments of the present invention also provide a computer storage medium comprising a set of instructions that, when executed, cause at least one processor to perform a Linux system reset processing method of an embodiment of the present invention.
本发明实施例的上述方案至少包括以下有益效果:The above solution of the embodiment of the present invention at least includes the following beneficial effects:
本发明实施例提供的Linux系统复位处理方法、装置及计算机存储介质,通过当监测到Linux系统启动复位流程时,获取复位操作的复位信息,可及时地收集复位信息,追溯进程调用信息,找到复位操作的最原始的发起者;并在预设内核中将复位信息写入硬盘,仅存储复位信息,占用的存储空间小,且耗费时间较短,实现复位信息持久化,便于进行故障定位或者其他服务,增强系统的可维护性。本发明实施例解决了Linux系统进行系统复位时,复位信息难以收集,给故障定位带来困扰的问题。The Linux system reset processing method and device and the computer storage medium provided by the embodiment of the present invention can collect reset information in time, trace the process call information, and find a reset by monitoring the reset information of the reset operation when the Linux system starts the reset process. The original initiator of the operation; and writes the reset information to the hard disk in the preset kernel, stores only the reset information, takes up less storage space, and takes less time to implement reset information, facilitates fault location or other Service to enhance the maintainability of the system. The embodiment of the invention solves the problem that the reset information is difficult to collect when the system is reset in the Linux system, which brings trouble to the fault location.
附图说明DRAWINGS
图1表示本发明的第一实施例提供的Linux系统复位处理方法的基本步骤流程图;1 is a flow chart showing the basic steps of a Linux system reset processing method according to a first embodiment of the present invention;
图2为本发明的第二实施例的场景示意图;2 is a schematic diagram of a scenario of a second embodiment of the present invention;
图3为本发明的第二实施例的内核态控制模块执行的步骤的流程图;3 is a flow chart showing the steps performed by the kernel mode control module of the second embodiment of the present invention;
图4为本发明的第二实施例的用户态复位信息收集模块执行的步骤的流程图;4 is a flowchart of steps performed by a user state reset information collecting module according to a second embodiment of the present invention;
图5为本发明的第二实施例的复位信息缓存模块执行的步骤的流程图;FIG. 5 is a flowchart of steps performed by a reset information cache module according to a second embodiment of the present invention; FIG.
图6为本发明的第二实施例的复位信息持久化模块执行的步骤的流程图;6 is a flowchart of steps performed by a reset information persistence module according to a second embodiment of the present invention;
图7为本发明的第二实施例的快速启动内核模块执行的步骤的流程图;Figure 7 is a flow chart showing the steps performed by the quick start kernel module of the second embodiment of the present invention;
图8为本发明的第三实施例提供的Linux系统复位处理装置的框图。 FIG. 8 is a block diagram of a Linux system reset processing apparatus according to a third embodiment of the present invention.
具体实施方式detailed description
为使本发明要解决的技术问题、技术方案和优点更加清楚,下面将结合附图及具体实施例进行详细描述。The technical problems, the technical solutions, and the advantages of the present invention will be more clearly described in the following description.
本发明实施例针对现有的问题,提供了一种Linux系统复位处理方法及装置。The embodiment of the present invention provides a Linux system reset processing method and apparatus for the existing problems.
在本发明的各种实施例中:监测Linux系统的复位场景;当监测到Linux系统启动复位流程时,获取复位操作的复位信息,将所述复位信息缓存在预设的保留内存中,其中所述复位信息包括所述复位操作的场景信息、发起者信息以及当前系统的状态信息;所述保留内存为系统内存中的内存空间;当监测到Linux系统执行复位操作时,启动预设内核,在所启动的预设内核中,将所述复位信息存储在硬盘中。In various embodiments of the present invention, monitoring a reset scenario of the Linux system; when monitoring the Linux system startup reset process, acquiring reset information of the reset operation, and buffering the reset information in a preset reserved memory, where The reset information includes scene information of the reset operation, initiator information, and status information of the current system; the reserved memory is a memory space in the system memory; when the Linux system is monitored to perform a reset operation, the preset kernel is started, In the preset kernel that is started, the reset information is stored in the hard disk.
第一实施例First embodiment
参见图1,本发明的第一实施例提供了一种Linux系统复位处理方法,包括:Referring to FIG. 1, a first embodiment of the present invention provides a Linux system reset processing method, including:
步骤101,监测Linux系统的复位场景。Step 101: Monitor a reset scenario of the Linux system.
其中,复位场景通常包括:系统调用引起的复位、键盘操作引起的复位(键盘组合键,比如Ctrl+Alt+Delete组合键)、电源按键引起的复位以及内核错误引起的复位等。Among them, the reset scene usually includes: reset caused by system call, reset caused by keyboard operation (keyboard combination key, such as Ctrl+Alt+Delete key combination), reset caused by power button, and reset caused by kernel error.
步骤102,当监测到Linux系统启动复位流程时,获取复位操作的复位信息,将复位信息缓存在预设的保留内存中。Step 102: When the Linux system startup reset process is detected, the reset information of the reset operation is obtained, and the reset information is cached in the preset reserved memory.
其中,复位信息包括复位操作的场景信息、发起者信息以及当前系统的状态信息;保留内存为系统内存中的内存空间。The reset information includes scene information of the reset operation, initiator information, and status information of the current system; the reserved memory is a memory space in the system memory.
其中,保留内存为预设的系统内存中的内存空间,配置为缓存复位信息。以系统调用引起的复位为例,当系统复位流程启动时,可能硬盘已经无法访问,因此需要在内存中保留一段空间区域,配置为缓存复位信息。当监测到Linux系统启动复位流程时,也就是在复位流程的入口,插入相应的处理逻辑,获取复位信息,将复位信息缓存在保留内存中,并提供读出 和写入的接口地址,以便于写入硬盘。The reserved memory is the memory space in the preset system memory, and is configured to cache the reset information. Take the reset caused by the system call as an example. When the system reset process starts, the hard disk may be inaccessible. Therefore, a space area needs to be reserved in the memory and configured to cache the reset information. When the Linux system startup reset process is detected, that is, at the entry of the reset process, the corresponding processing logic is inserted, the reset information is obtained, the reset information is cached in the reserved memory, and the readout is provided. And the address of the interface written to facilitate writing to the hard disk.
步骤103,当监测到Linux系统执行复位操作时,启动预设内核,在所启动的预设内核中,将复位信息存储在硬盘中。Step 103: When it is detected that the Linux system performs a reset operation, the preset kernel is started, and in the preset kernel that is started, the reset information is stored in the hard disk.
其中,预设内核为脱离系统内核以外的内核,配置为执行系统复位。本发明的实施例将复位信息写入硬盘的过程也在预设内核中执行。The default kernel is a kernel outside the system kernel and configured to perform a system reset. The process of writing reset information to the hard disk by an embodiment of the present invention is also performed in a preset kernel.
本发明的上述实施例中,步骤102包括:In the above embodiment of the present invention, step 102 includes:
第一步,识别复位操作的场景信息;其中,复位操作的场景信息包括:系统调用引起的复位、电源键引起的复位以及键盘组合键引起的复位中的一种;In the first step, the scene information of the reset operation is identified; wherein the scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
第二步,获取复位操作的发起者信息以及当前系统的状态信息,发起者信息至少包括:发起者的当前进程的进程标识符、与进程标识符对应的内核启动的第一个用户级INIT进程、所属终端、所属用户、启动时间以及执行的命令;当前系统的状态信息至少包括:系统执行复位操作前的CPU状态、内存状态、I/O状态。The second step is to obtain the initiator information of the reset operation and the status information of the current system. The initiator information includes at least: a process identifier of the current process of the initiator, and a first user-level INIT process initiated by the kernel corresponding to the process identifier. The associated terminal, the user, the startup time, and the executed command; the current system state information includes at least the CPU state, memory state, and I/O state before the system performs the reset operation.
优选地,上述第一步包括:Preferably, the first step mentioned above comprises:
当在系统内核调用的处理流程中检测到用户态程序调用REBOOT命令时,确定复位操作的场景信息为系统调用引起的复位;具体地,当系统内核调用的处理流程中检测到由用户态程序调用REBOOT命令对应的程序语言时,可确认复位操作的场景信息为系统调用。When the user mode program calls the REBOOT command in the processing flow of the system kernel call, it is determined that the scene information of the reset operation is a reset caused by the system call; specifically, when the user kernel calls the processing flow, the user state program is detected. When the program language corresponding to the REBOOT command is used, the scene information of the reset operation can be confirmed as a system call.
当检测到ACPI向系统上报系统复位对应的电源键事件时,确定复位操作的场景信息为电源键引起的复位;通常情况下,系统硬件通过ACPI向系统上报电源键事件时,比如短按电源键通常为重启(即系统复位),那么当用户短按电源键时,ACPI会向系统上报,那么接收到ACPI所上报的短按电源键的事件时,可确认复位操作的场景信息为电源键引起的复位。When it is detected that the ACPI reports the power key event corresponding to the system reset to the system, it is determined that the scene information of the reset operation is a reset caused by the power key; normally, when the system hardware reports the power key event to the system through the ACPI, for example, short press the power key Usually it is a restart (ie system reset), then when the user presses the power button shortly, ACPI will report to the system, then when receiving the short press of the power button reported by ACPI, it can be confirmed that the scene information of the reset operation is caused by the power button. Reset.
当在键盘处理函数中检测到与系统复位对应的键盘处理函数时,确定复位操作的场景信息为键盘组合键引起的复位;具体地,当用户在按下“Ctrl+Alt+Del”组合键以后,系统响应中断事件会调用驱动层中断处理函数,然后进入内核输入子系统进行子系统分类,最后调用与系统复位对应的键盘处理函数,启动复位流程。 When the keyboard processing function corresponding to the system reset is detected in the keyboard processing function, it is determined that the scene information of the reset operation is a reset caused by the keyboard combination key; specifically, when the user presses the "Ctrl+Alt+Del" key combination The system responds to the interrupt event by calling the driver layer interrupt handler function, then enters the kernel input subsystem for subsystem classification, and finally calls the keyboard handler function corresponding to the system reset to start the reset process.
优选地,上述第一步包括:Preferably, the first step mentioned above comprises:
获取发起者的当前进程的进程标识符、所属终端、所属用户、启动时间以及执行的命令;Obtain the process identifier of the current process of the initiator, the terminal to which it belongs, the user to belong, the startup time, and the executed command;
根据当前进程的进程标识符与进程标识符对应的INIT进程,获取父进程的进程标识符,所述父进程为发起者的当前进程与INIT进程之间的进程;其中,INIT进程是内核启动的第一个用户级进程,父进程为当前进程与INTI进程之间的进程,通常情况下,父进程会存在多个,通过当前进程逐级向前回溯便可获得各个父进程。获取上述信息是为了收集与复位操作有关的信息,增强系统的可维护性。Obtaining the process identifier of the parent process according to the INIT process corresponding to the process identifier of the current process and the process identifier, where the parent process is a process between the initiator's current process and the INIT process; wherein the INIT process is kernel-initiated The first user-level process, the parent process is the process between the current process and the INTI process. Usually, there are multiple parent processes, and each parent process can be obtained by backtracking forward by the current process. The above information is obtained in order to collect information related to the reset operation and enhance the maintainability of the system.
本发明的上述实施例中,步骤102之后还包括:In the above embodiment of the present invention, after step 102, the method further includes:
根据复位信息判断复位操作的场景信息是否为内核错误引起的系统复位,当判断结果为是时,标记复位操作为内核错误;Determining, according to the reset information, whether the scene information of the reset operation is a system reset caused by a kernel error, and when the determination result is YES, the flag reset operation is a kernel error;
其中,当监测到Linux系统执行复位操作时,启动预设内核的步骤之后,Wherein, when the step of starting the preset kernel is detected when the Linux system performs the reset operation,
在预设内核中,将复位操作以及标记信息对应存储在硬盘中并执行复位操作。In the preset kernel, the reset operation and the tag information are correspondingly stored in the hard disk and a reset operation is performed.
具体地,内核错误(Kernel panic)指操作系统监测到内部的致命错误,并且无法安全处理此错误的情况;内核错误时可能系统无法正常运行,因此只能在预设内核中,将复位场景做标记,并执行复位流程。Specifically, kernel panic refers to the fact that the operating system detects internal fatal errors and cannot handle this error safely; the kernel may not work properly when the kernel is wrong, so the reset scenario can only be done in the default kernel. Mark and perform the reset process.
本发明的上述实施例中,步骤102之前,还包括:In the above embodiment of the present invention, before step 102, the method further includes:
建立保留内存,并配置保留内存的容量以及起始地址并记录。Establish reserved memory, configure the capacity of the reserved memory, and the starting address and record.
相应地,步骤102中,将复位信息缓存在预设的保留内存中的步骤,包括:Correspondingly, in step 102, the step of buffering the reset information in the preset reserved memory includes:
根据保留内存的容量以及起始地址查找保留内存,将复位信息缓存在保留内存中。The reserved memory is cached in the reserved memory according to the reserved memory capacity and the starting address.
其中,保留内存配置为缓存复位信息;在获取复位信息之前建立保留内存,并配置容量以及起始地址,以便系统根据起始地址,将复位信息缓存在保留内存中。The reserved memory is configured to cache reset information; the reserved memory is established before the reset information is acquired, and the capacity and the start address are configured, so that the system caches the reset information in the reserved memory according to the start address.
本发明的上述实施例中,步骤102之前,还包括:In the above embodiment of the present invention, before step 102, the method further includes:
建立预设内核,配置预设内核的容量以及起始地址并生成镜像文件, 将镜像文件存储在硬盘中。Create a default kernel, configure the capacity of the default kernel and the starting address and generate an image file. Store the image file on your hard drive.
具体地,建立预设内核并配置容量以及起始地址,生成镜像文件存储在硬盘中,实现持久化。Specifically, the preset kernel is created and the capacity and the starting address are configured, and the generated image file is stored in the hard disk for persistence.
本发明的上述实施例中,通过当监测到Linux系统启动复位流程时,获取复位操作的复位信息,可及时地收集复位信息,追溯进程调用信息,找到复位操作的最原始的发起者;并在预设内核中将复位信息写入硬盘,仅存储复位信息,占用的存储空间小,且耗费时间较短,实现复位信息持久化,便于进行故障定位或者其他服务,增强系统的可维护性。本发明实时例解决了Linux系统进行系统复位时,复位信息难以收集,给故障定位带来困扰的问题。In the above embodiment of the present invention, when the reset information of the reset operation is acquired when the Linux system starts the reset process, the reset information can be collected in time, the process call information is traced, and the original initiator of the reset operation is found; In the default kernel, the reset information is written to the hard disk, only the reset information is stored, the occupied storage space is small, and the time is short, the reset information is persistent, the fault location or other services are facilitated, and the maintainability of the system is enhanced. The real-time example of the present invention solves the problem that the reset information is difficult to collect when the system is reset in the Linux system, which brings trouble to the fault location.
第二实施例Second embodiment
本发明的第二实施例以一个具体实施例,介绍本发明提供的Linux系统复位处理方法。参见图2,图2为本发明的第二实施例的场景示意图,图2中所示的Linux系统包括:内核态控制模块201,用户态复位信息收集模块202,复位信息缓存模块203,快速启动内核模块205以及复位信息持久化模块204。A second embodiment of the present invention introduces a Linux system reset processing method provided by the present invention in a specific embodiment. Referring to FIG. 2, FIG. 2 is a schematic diagram of a scenario of a second embodiment of the present invention. The Linux system shown in FIG. 2 includes: a kernel state control module 201, a user state reset information collection module 202, and a reset information cache module 203. The kernel module 205 and the reset information persistence module 204.
其中,内核态控制模块201,配置为提供收集系统复位信息的通用机制:在复位操作开始的时候,启动用户态复位信息收集模块202;The kernel state control module 201 is configured to provide a general mechanism for collecting system reset information: when the reset operation starts, the user state reset information collection module 202 is started;
在执行处理器架构相关代码、执行系统复位操作之前,启动快速启动内核模块205。The fast boot kernel module 205 is started prior to executing the processor architecture related code and performing a system reset operation.
用户态复位信息收集模块202,配置为提供收集系统复位信息的各种策略,便于系统把收集到的信息写入复位信息缓存模块203。The user state reset information collection module 202 is configured to provide various policies for collecting system reset information, so that the system can write the collected information into the reset information cache module 203.
复位信息缓存模块203,配置为提供读出、写入接口,并被用户态复位信息收集模块202调用,将复位信息缓存在复位信息缓存模块203中,被复位信息持久化模块204所调用,获取复位信息缓存模块203中所缓存的复位信息。The reset information cache module 203 is configured to provide a read and write interface, and is called by the user state reset information collection module 202 to cache the reset information in the reset information cache module 203, which is called by the reset information persistence module 204. The reset information buffered in the information buffer module 203 is reset.
快速启动内核模块205,配置为快速启动一个裁剪的、可用的内核,在内核的环境中,执行复位信息持久化模块204。 The fast boot kernel module 205 is configured to quickly launch a tailored, usable kernel, and in the context of the kernel, execute a reset information persistence module 204.
复位信息持久化模块204,从复位信息缓存模块203中读出复位信息,保存到硬盘上指定的文件中。The reset information persistence module 204 reads the reset information from the reset information cache module 203 and saves it to the specified file on the hard disk.
如图3所示,内核态控制模块201执行如下步骤:As shown in FIG. 3, the kernel mode control module 201 performs the following steps:
步骤301,在系统复位的入口,插入处理逻辑:调用用户态复位信息收集模块202。其中,对于reboot系统调用引起的复位: Step 301, at the entry of the system reset, insert processing logic: call the user state reset information collection module 202. Among them, the reset caused by the reboot system call:
在reboot系统调用的流程中,插入处理逻辑:In the process of the reboot system call, insert the processing logic:
启动用户态复位信息收集模块202(可以通过call_usermodehelper等方法)。The user state reset information collection module 202 is started (can be by a method such as call_usermodehelper).
对于键盘组合键引起的复位:For the reset caused by the keyboard combination key:
在键盘驱动的下半部处理中,插入处理逻辑:In the lower half of the keyboard driver, insert processing logic:
启动用户态复位信息收集模块202(可以通过call_usermodehelper等方法)。The user state reset information collection module 202 is started (can be by a method such as call_usermodehelper).
对于电源按键引起的复位:For the reset caused by the power button:
在ACPI电源按键驱动程序的处理中,插入处理逻辑:In the processing of the ACPI power button driver, insert processing logic:
启动用户态复位信息收集模块202(可以通过call_usermodehelper等方法)。The user state reset information collection module 202 is started (can be by a method such as call_usermodehelper).
需要说明的时,对于内核错误引起的复位,由于内核已经无法正常工作了,所以不能启动用户态复位信息收集模块202,直接执行步骤302。In the case of the reset caused by the kernel error, since the kernel has not been able to work normally, the user state reset information collecting module 202 cannot be started, and step 302 is directly executed.
步骤302,在执行处理器架构相关代码、真正执行系统复位操作之前,插入逻辑:调用快速启动内核模块205。 Step 302, insert logic before calling the processor architecture related code to actually perform the system reset operation: invoke the fast boot kernel module 205.
对于reboot系统调用引起的复位、键盘组合键引起的复位以及电源按键引起的复位,在执行系统复位操作之前,插入处理逻辑:For the reset caused by the reboot system call, the reset caused by the keyboard combination key, and the reset caused by the power button, insert the processing logic before performing the system reset operation:
在内核态快速启动内核(可以通过kernel_kexec等方法)。Quickly boot the kernel in kernel mode (can be done via kernel_kexec, etc.).
而对于内核错误引起的复位,在内核错误的处理流程中,插入处理逻辑:For the reset caused by the kernel error, in the processing flow of the kernel error, insert the processing logic:
设置内核错误的标志,并快速启动内核(可以通过kernel_kexec等方法),并且在参数中传内核错误的标志。Set the kernel error flag, and quickly start the kernel (can be done by kernel_kexec, etc.), and pass the kernel error flag in the parameter.
如图4所示,用户态复位信息收集模块202,执行如下步骤:As shown in FIG. 4, the user state reset information collecting module 202 performs the following steps:
步骤401,把当前复位场景的描述信息写入复位信息缓存模块203。 Step 401: Write description information of the current reset scenario to the reset information cache module 203.
根据内核态控制模块传入的参数,分别把“reboot系统调用引起的复位”、“按下电源按键引起的复位”、“按下键盘组合键引起的复位”等描述信息,写入复位信息缓存模块203中。According to the parameters passed in the kernel state control module, the description information such as "reset caused by reboot system call", "reset by pressing the power button", and "reset by pressing the keyboard combination key" are respectively written into the reset information buffer. In module 203.
步骤402,判断是否需要记录进程回溯信息,如果需要则执行步骤403,否则执行步骤404。In step 402, it is determined whether the process traceback information needs to be recorded, if necessary, step 403 is performed, otherwise step 404 is performed.
步骤403,进程回溯信息处理。具体地,进程回溯处理包括:获取当前进程的ID号等信息;把收集到信息记录到复位信息缓存模块中;判断当前进程的父进程信息,如果已经是INIT进程了,则不需要继续往上一级回溯了,否则,把当前进程标识(ID)赋值为当前进程的父进程ID,继续循环回溯;In step 403, the process traces back information processing. Specifically, the process backtracking process includes: acquiring information such as the ID number of the current process; recording the collected information into the reset information cache module; determining the parent process information of the current process, and if it is already an INIT process, it is not required to continue upward. The first level is backtracked. Otherwise, the current process identifier (ID) is assigned to the parent process ID of the current process, and the loopback is continued;
步骤404,判断是否需要记录系统状态统计信息,如果需要则执行步骤405,获取CPU、内存、I/O等的统计信息,否则结束流程。In step 404, it is determined whether the system status statistics need to be recorded. If necessary, step 405 is executed to obtain statistics of CPU, memory, I/O, etc., otherwise the process ends.
如图5所示,复位信息缓存模块203,执行如下步骤:As shown in FIG. 5, the reset information cache module 203 performs the following steps:
步骤501,将用户态复位信息收集模块202中缓存的复位信息写入保留内存;Step 501: Write the reset information buffered in the user state reset information collection module 202 into the reserved memory.
步骤502,记录保留内存的相关信息(容量和地址范围等)。Step 502: Record related information (capacity and address range, etc.) of the reserved memory.
如图6所示,复位信息持久化模块204,执行如下步骤:As shown in FIG. 6, the reset information persistence module 204 performs the following steps:
步骤601,判断复位场景是否为内核错误(是否传入内核错误标记),如果不是,则执行步骤602,把复位信息缓存模块中的数据持久化到硬盘上;否则执行步骤603,将内核错误标记持久化到硬盘上。Step 601: Determine whether the reset scenario is a kernel error (whether or not a kernel error flag is transmitted). If not, execute step 602 to persist the data in the reset information cache module to the hard disk; otherwise, execute step 603 to mark the kernel error. Persist to the hard disk.
如图7所示,快速启动内核模块205,执行如下步骤:As shown in FIG. 7, the kernel module 205 is quickly started, and the following steps are performed:
步骤701,检测到内核控制模块发起快速启动时,执行步骤702,快速启动。Step 701: When it is detected that the kernel control module initiates a quick start, step 702 is executed to start quickly.
步骤703,启动复位信息持久化模块204,复位信息持久化模块204将复位信息缓存模块中的数据持久化到硬盘上或将内核错误标记持久化到硬盘上。 Step 703, the reset information persistence module 204 is started, and the reset information persistence module 204 persists the data in the reset information cache module to the hard disk or persists the kernel error flag to the hard disk.
本发明的上述实施例中,通过内核态控制模块201当监测到Linux系统启动复位流程时,在系统复位的入口,插入处理逻辑:调用用户态复位信息收集模块202获取复位操作的复位信息并追溯进程调用信息,找到复位 操作的最原始的发起者;并通过复位信息持久化模块204将复位信息写入硬盘,实现复位信息持久化,便于进行故障定位或者其他服务,增强系统的可维护性。本发明实施例解决了Linux系统进行系统复位时,复位信息难以收集,给故障定位带来困扰的问题。In the above embodiment of the present invention, when the Linux system startup reset process is monitored by the kernel mode control module 201, at the entry of the system reset, the processing logic is inserted: the user state reset information collection module 202 is called to obtain the reset information of the reset operation and trace back. Process call information, find reset The original initiator of the operation; and the reset information is written to the hard disk by the reset information persistence module 204, so that the reset information is persistent, facilitating fault location or other services, and enhancing the maintainability of the system. The embodiment of the invention solves the problem that the reset information is difficult to collect when the system is reset in the Linux system, which brings trouble to the fault location.
第三实施例Third embodiment
参见图8,本发明的第三实施例提供了一种Linux系统复位处理装置,包括:Referring to FIG. 8, a third embodiment of the present invention provides a Linux system reset processing apparatus, including:
检测模块801,配置为监测Linux系统的复位场景;The detecting module 801 is configured to monitor a reset scenario of the Linux system;
获取模块802,配置为当监测到Linux系统启动复位流程时,获取复位操作的复位信息,将复位信息缓存在预设的保留内存中,其中复位信息包括复位操作的场景信息、发起者信息以及当前系统的状态信息;保留内存为系统内存中的内存空间;The obtaining module 802 is configured to: when the Linux system startup reset process is monitored, obtain reset information of the reset operation, and cache the reset information in a preset reserved memory, where the reset information includes scene information of the reset operation, initiator information, and current State information of the system; reserved memory is the memory space in the system memory;
执行模块803,配置为当监测到Linux系统执行复位操作时,启动预设内核,在所启动的预设内核中,将复位信息存储在硬盘中。The execution module 803 is configured to start the preset kernel when the Linux system is monitored to perform the reset operation, and store the reset information in the hard disk in the preset kernel that is started.
优选地,获取模块802包括:Preferably, the obtaining module 802 includes:
识别子模块,配置为识别复位操作的场景信息;其中,复位操作的场景信息包括:系统调用引起的复位、电源键引起的复位以及键盘组合键引起的复位中的一种;The identification sub-module is configured to identify scene information of the reset operation; wherein the scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
信息获取子模块,配置为获取复位操作的发起者信息以及当前系统的状态信息,发起者信息至少包括:发起者的当前进程的进程标识符、与进程标识符对应的内核启动的第一个用户级INIT进程、所属终端、所属用户、启动时间以及执行的命令;当前系统的状态信息至少包括:系统执行复位操作前的CPU状态、内存状态、I/O状态。The information acquisition submodule is configured to obtain the initiator information of the reset operation and the status information of the current system, and the initiator information includes at least: a process identifier of the current process of the initiator, and a first user initiated by the kernel corresponding to the process identifier. The level of the INIT process, the associated terminal, the user, the startup time, and the executed command; the current system state information includes at least the CPU state, memory state, and I/O state before the system performs the reset operation.
优选地,识别子模块包括:Preferably, the identification submodule comprises:
第一确定单元,配置为当在系统内核调用的处理流程中检测到用户态程序调用REBOOT命令时,确定复位操作的场景信息为系统调用引起的复位;a first determining unit, configured to: when detecting a user mode program calling the REBOOT command in a processing flow invoked by the system kernel, determining that the scene information of the reset operation is a reset caused by the system call;
第二确定单元,配置为当检测到ACPI向系统上报系统复位对应的电源 键事件时,确定复位操作的场景信息为电源键引起的复位;a second determining unit configured to detect, when the ACPI detects the power supply corresponding to the system reset to the system When the key event occurs, it is determined that the scene information of the reset operation is a reset caused by the power key;
第三确定单元,配置为当在键盘处理函数中检测到与系统复位对应的键盘处理函数时,确定复位操作的场景信息为键盘组合键引起的复位。The third determining unit is configured to determine that the scene information of the reset operation is a reset caused by the keyboard combination key when the keyboard processing function corresponding to the system reset is detected in the keyboard processing function.
优选地,信息获取子模块包括:Preferably, the information acquisition submodule comprises:
第一获取单元,配置为获取发起者的当前进程的进程标识符、所属终端、所属用户、启动时间以及执行的命令;a first acquiring unit, configured to acquire a process identifier of a current process of the initiator, a terminal to which the terminal belongs, a user to belong, a startup time, and an executed command;
根据当前进程的进程标识符与进程标识符对应的INIT进程,获取父进程的进程标识符,所述父进程为发起者的当前进程与INIT进程之间的进程。The process identifier of the parent process is obtained according to the INIT process corresponding to the process identifier of the current process and the process identifier, and the parent process is a process between the current process of the initiator and the INIT process.
优选地,该装置还包括:Preferably, the device further comprises:
内核错误处理模块,配置为在获取模块802获取复位操作的复位信息之后,a kernel error processing module configured to, after the obtaining module 802 obtains reset information of the reset operation,
根据复位信息判断复位操作的场景信息是否为内核错误引起的系统复位,当判断结果为是时,Determining, according to the reset information, whether the scene information of the reset operation is a system reset caused by a kernel error, and when the determination result is yes,
标记复位操作为内核错误;The flag reset operation is a kernel error;
其中,当监测到Linux系统执行复位操作时,启动预设内核的步骤之后,Wherein, when the step of starting the preset kernel is detected when the Linux system performs the reset operation,
在预设内核中,将复位操作以及标记信息对应存储在硬盘中并执行复位操作。In the preset kernel, the reset operation and the tag information are correspondingly stored in the hard disk and a reset operation is performed.
优选地,该装置还包括:Preferably, the device further comprises:
内存建立模块,配置为在获取模块802当监测到Linux系统启动复位流程时之前,a memory creation module configured to be in the acquisition module 802 before monitoring the Linux system startup reset process
建立保留内存,并配置保留内存的容量以及起始地址并记录。Establish reserved memory, configure the capacity of the reserved memory, and the starting address and record.
优选地,获取模块802还配置为:Preferably, the obtaining module 802 is further configured to:
根据保留内存的容量以及起始地址查找保留内存,将复位信息缓存在保留内存中。The reserved memory is cached in the reserved memory according to the reserved memory capacity and the starting address.
优选地,该装置还包括:Preferably, the device further comprises:
内核建立模块,配置为在执行模块803当监测到Linux系统执行复位操作时之前,a kernel setup module configured to execute the module 803 before monitoring the Linux system to perform a reset operation,
建立预设内核,配置预设内核的容量以及起始地址并生成镜像文件,将镜像文件存储在硬盘中。 Create a default kernel, configure the default kernel capacity and starting address and generate an image file to store the image file on the hard disk.
本发明的上述实施例中,通过当监测到Linux系统启动复位流程时,获取复位操作的复位信息,可及时地收集复位信息,追溯进程调用信息,找到复位操作的最原始的发起者;并在预设内核中将复位信息写入硬盘,仅存储复位信息,占用的存储空间小,且耗费时间较短,实现复位信息持久化,便于进行故障定位或者其他服务,增强系统的可维护性。本发明实施例解决了Linux系统进行系统复位时,复位信息难以收集,给故障定位带来困扰的问题。In the above embodiment of the present invention, when the reset information of the reset operation is acquired when the Linux system starts the reset process, the reset information can be collected in time, the process call information is traced, and the original initiator of the reset operation is found; In the default kernel, the reset information is written to the hard disk, only the reset information is stored, the occupied storage space is small, and the time is short, the reset information is persistent, the fault location or other services are facilitated, and the maintainability of the system is enhanced. The embodiment of the invention solves the problem that the reset information is difficult to collect when the system is reset in the Linux system, which brings trouble to the fault location.
需要说明的是,本发明实施例提供的Linux系统复位处理装置是应用上述方法的装置,即上述方法的所有实施例均适用于该装置,且均能达到相同或相似的有益效果。It should be noted that the Linux system reset processing device provided by the embodiment of the present invention is a device applying the foregoing method, that is, all the embodiments of the foregoing method are applicable to the device, and all of the same or similar beneficial effects can be achieved.
实际应用时,检测模块801、获取模块802、执行模块803、识别子模块、信息获取子模块、第一确定单元、第二确定单元、第三确定单元、第三确定单元、第一获取单元、内核错误处理模块、内存建立模块、内核建立模块可由Linux系统复位处理装置中的处理器实现。In actual application, the detecting module 801, the obtaining module 802, the executing module 803, the identifying submodule, the information acquiring submodule, the first determining unit, the second determining unit, the third determining unit, the third determining unit, the first obtaining unit, The kernel error processing module, the memory creation module, and the kernel creation module may be implemented by a processor in a Linux system reset processing device.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理 设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a bootable computer or other programmable data processing The apparatus is readable in a computer readable memory in a particular manner such that instructions stored in the computer readable memory produce an article of manufacture comprising instruction means implemented in one or more flows and/or block diagrams of the flowchart The function specified in the box or in multiple boxes.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
基于此,本发明实施例还提供了一种计算机存储介质,所述计算机存储介质包括一组指令,当执行所述指令时,引起至少一个处理器执行本发明实施例的Linux系统复位处理方法。Based on this, an embodiment of the present invention further provides a computer storage medium, where the computer storage medium includes a set of instructions, when executed, causing at least one processor to execute the Linux system reset processing method of the embodiment of the present invention.
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明所述原理的前提下,还可以作出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above is a preferred embodiment of the present invention, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present invention. It should be considered as the scope of protection of the present invention.
工业实用性Industrial applicability
本发明实施例提供的方案,通过当监测到Linux系统启动复位流程时,获取复位操作的复位信息,可及时地收集复位信息,追溯进程调用信息,找到复位操作的最原始的发起者;并在预设内核中将复位信息写入硬盘,仅存储复位信息,占用的存储空间小,且耗费时间较短,实现复位信息持久化,便于进行故障定位或者其他服务,增强系统的可维护性。 The solution provided by the embodiment of the present invention can obtain the reset information of the reset operation when the Linux system starts the reset process, and can collect the reset information in time, trace the process call information, and find the original initiator of the reset operation; In the default kernel, the reset information is written to the hard disk, only the reset information is stored, the occupied storage space is small, and the time is short, the reset information is persistent, the fault location or other services are facilitated, and the maintainability of the system is enhanced.

Claims (17)

  1. 一种Linux系统复位处理方法,包括:A Linux system reset processing method includes:
    监测Linux系统的复位场景;Monitor the reset scenario of the Linux system;
    当监测到Linux系统启动复位流程时,获取复位操作的复位信息,将所述复位信息缓存在预设的保留内存中,其中所述复位信息包括所述复位操作的场景信息、发起者信息以及当前系统的状态信息;所述保留内存为系统内存中的内存空间;When the Linux system startup reset process is detected, the reset information of the reset operation is obtained, and the reset information is cached in a preset reserved memory, where the reset information includes scenario information of the reset operation, initiator information, and current Status information of the system; the reserved memory is a memory space in the system memory;
    当监测到Linux系统执行复位操作时,启动预设内核,在所启动的预设内核中,将所述复位信息存储在硬盘中。When it is detected that the Linux system performs a reset operation, the preset kernel is started, and the reset information is stored in the hard disk in the preset kernel that is started.
  2. 根据权利要求1所述的方法,其中,所述获取复位操作的复位信息的步骤,包括:The method of claim 1, wherein the step of acquiring reset information of the reset operation comprises:
    识别所述复位操作的场景信息;其中,所述复位操作的场景信息包括:系统调用引起的复位、电源键引起的复位以及键盘组合键引起的复位中的一种;Identifying scene information of the reset operation; wherein the scene information of the reset operation includes: one of a reset caused by a system call, a reset caused by a power key, and a reset caused by a keyboard combination key;
    获取所述复位操作的发起者信息以及当前系统的状态信息,所述发起者信息至少包括:所述发起者的当前进程的进程标识符、与所述进程标识符对应的内核启动的第一个用户级INIT进程、所属终端、所属用户、启动时间以及执行的命令;所述当前系统的状态信息至少包括:系统执行所述复位操作前的中央处理器CPU状态、内存状态、输入/输出I/O状态。Obtaining the initiator information of the reset operation and status information of the current system, where the initiator information at least includes: a process identifier of a current process of the initiator, and a first kernel initiated corresponding to the process identifier The user-level INIT process, the associated terminal, the user, the startup time, and the executed command; the status information of the current system includes at least the CPU state, memory state, and input/output I/ before the system performs the reset operation. O state.
  3. 根据权利要求2所述的方法,其中,所述识别所述复位操作的场景信息的步骤包括:The method of claim 2, wherein the step of identifying scene information of the reset operation comprises:
    当在系统内核调用的处理流程中检测到用户态程序调用重新启动系统REBOOT命令时,确定所述复位操作的场景信息为系统调用引起的复位;When it is detected in the processing flow of the system kernel call that the user mode program calls to restart the system REBOOT command, determining that the scene information of the reset operation is a reset caused by the system call;
    当检测到高级配置和电源管理接口ACPI向系统上报系统复位对应的电源键事件时,确定所述复位操作的场景信息为电源键引起的复位;When it is detected that the advanced configuration and the power management interface ACPI report the power key event corresponding to the system reset to the system, determining that the scenario information of the reset operation is a reset caused by the power button;
    当在键盘处理函数中检测到与系统复位对应的键盘处理函数时,确定所述复位操作的场景信息为键盘组合键引起的复位。When the keyboard processing function corresponding to the system reset is detected in the keyboard processing function, it is determined that the scene information of the reset operation is a reset caused by the keyboard combination key.
  4. 根据权利要求2所述的方法,其中,所述获取所述复位操作的发起 者信息的步骤,包括:The method of claim 2 wherein said initiating said initiation of said reset operation Steps for information, including:
    获取所述发起者的当前进程的进程标识符、所属终端、所属用户、启动时间以及执行的命令;Obtaining a process identifier of the current process of the initiator, a terminal to which it belongs, a user to belong, a startup time, and a command to be executed;
    根据所述当前进程的进程标识符与所述进程标识符对应的INIT进程,获取父进程的进程标识符,所述父进程为所述发起者的当前进程与所述INIT进程之间的进程。Obtaining a process identifier of the parent process according to the INIT process corresponding to the process identifier of the current process and the process identifier, where the parent process is a process between the current process of the initiator and the INIT process.
  5. 根据权利要求1所述的方法,其中,所述获取复位操作的复位信息的步骤之后,所述方法还包括:The method of claim 1, wherein after the step of acquiring reset information of the reset operation, the method further comprises:
    根据所述复位信息判断所述复位操作的场景信息是否为内核错误引起的系统复位;Determining, according to the reset information, whether the scene information of the reset operation is a system reset caused by a kernel error;
    当判断结果为是时,标记所述复位操作为内核错误;When the judgment result is YES, the reset operation is marked as a kernel error;
    其中,当监测到Linux系统执行复位操作时,启动预设内核的步骤之后,Wherein, when the step of starting the preset kernel is detected when the Linux system performs the reset operation,
    在所述预设内核中,将所述复位操作以及标记信息对应存储在硬盘中并执行所述复位操作。In the preset kernel, the reset operation and the flag information are correspondingly stored in the hard disk and the reset operation is performed.
  6. 根据权利要求1所述的方法,其中,所述当监测到Linux系统启动复位流程时的步骤之前,所述方法还包括:The method of claim 1, wherein the method further comprises: when the step of the Linux system initiating the reset process is monitored, the method further comprising:
    建立保留内存,并配置所述保留内存的容量以及起始地址并记录。Establish reserved memory, configure the capacity of the reserved memory, and the starting address and record.
  7. 根据权利要求6所述的方法,其中,所述将所述复位信息缓存在预设的保留内存中的步骤,包括:The method of claim 6, wherein the step of buffering the reset information in a preset reserved memory comprises:
    根据所述保留内存的容量以及起始地址查找所述保留内存,将所述复位信息缓存在所述保留内存中。The reserved memory is searched according to the reserved memory capacity and the starting address, and the reset information is cached in the reserved memory.
  8. 根据权利要求1所述的方法,其中,所述当监测到Linux系统执行复位操作时的步骤之前,所述方法还包括:The method of claim 1, wherein the method further comprises: when the step of performing a reset operation by the Linux system is detected, the method further comprising:
    建立预设内核,配置所述预设内核的容量以及起始地址并生成镜像文件,将所述镜像文件存储在硬盘中。Establishing a preset kernel, configuring a capacity of the preset kernel and a starting address, and generating an image file, and storing the image file on the hard disk.
  9. 一种Linux系统复位处理装置,包括:A Linux system reset processing device includes:
    检测模块,配置为监测Linux系统的复位场景;a detection module configured to monitor a reset scenario of the Linux system;
    获取模块,配置为当监测到Linux系统启动复位流程时,获取复位操作的复位信息,将所述复位信息缓存在预设的保留内存中,其中所述复位信 息包括所述复位操作的场景信息、发起者信息以及当前系统的状态信息;所述保留内存为系统内存中的内存空间;The obtaining module is configured to: when the Linux system startup reset process is monitored, obtain reset information of the reset operation, and cache the reset information in a preset reserved memory, where the reset signal The information includes the scenario information of the reset operation, the initiator information, and status information of the current system; the reserved memory is a memory space in the system memory;
    执行模块,配置为当监测到Linux系统执行复位操作时,启动预设内核,在所启动的预设内核中,将所述复位信息存储在硬盘中。The execution module is configured to start the preset kernel when the Linux system is monitored to perform the reset operation, and store the reset information in the hard disk in the preset kernel that is started.
  10. 根据权利要求9所述的装置,其中,所述获取模块包括:The apparatus of claim 9, wherein the obtaining module comprises:
    识别子模块,配置为识别所述复位操作的场景信息;其中,所述复位操作的场景信息包括:系统调用引起的复位、电源键引起的复位以及键盘组合键引起的复位中的一种;The identification sub-module is configured to identify scene information of the reset operation; wherein the scenario information of the reset operation includes: a reset caused by a system call, a reset caused by a power button, and a reset caused by a keyboard combination key;
    信息获取子模块,配置为获取所述复位操作的发起者信息以及当前系统的状态信息,所述发起者信息至少包括:所述发起者的当前进程的进程标识符、与所述进程标识符对应的内核启动的第一个用户级INIT进程、所属终端、所属用户、启动时间以及执行的命令;所述当前系统的状态信息至少包括:系统执行所述复位操作前的中央处理器CPU状态、内存状态、输入/输出I/O状态。An information acquisition sub-module configured to acquire the initiator information of the reset operation and status information of the current system, where the initiator information at least includes: a process identifier of the current process of the initiator, corresponding to the process identifier The kernel-initiated first user-level INIT process, the associated terminal, the user, the startup time, and the executed command; the current system state information includes at least: the CPU state of the CPU before the system performs the reset operation, and the memory Status, input/output I/O status.
  11. 根据权利要求10所述的装置,其中,所述识别子模块包括:The apparatus of claim 10 wherein said identifying sub-module comprises:
    第一确定单元,配置为当在系统内核调用的处理流程中检测到用户态程序调用重新启动系统REBOOT命令时,确定所述复位操作的场景信息为系统调用引起的复位;a first determining unit, configured to determine that the scenario information of the reset operation is a reset caused by a system call when detecting a user mode program call to restart the system REBOOT command in a processing flow invoked by the system kernel;
    第二确定单元,配置为当检测到高级配置和电源管理接口ACPI向系统上报系统复位对应的电源键事件时,确定所述复位操作的场景信息为电源键引起的复位;a second determining unit, configured to determine that the scenario information of the reset operation is a reset caused by a power button when detecting that the advanced configuration and the power management interface ACPI report a power key event corresponding to the system reset to the system;
    第三确定单元,配置为当在键盘处理函数中检测到与系统复位对应的键盘处理函数时,确定所述复位操作的场景信息为键盘组合键引起的复位。The third determining unit is configured to determine that the scene information of the reset operation is a reset caused by a keyboard combination key when a keyboard processing function corresponding to the system reset is detected in the keyboard processing function.
  12. 根据权利要求10所述的装置,其中,所述信息获取子模块包括:The apparatus of claim 10, wherein the information acquisition sub-module comprises:
    第一获取单元,配置为获取所述发起者的当前进程的进程标识符、所属终端、所属用户、启动时间以及执行的命令;a first acquiring unit, configured to acquire a process identifier of the current process of the initiator, an associated terminal, a user, a startup time, and an executed command;
    根据所述当前进程的进程标识符与所述进程标识符对应的INIT进程,获取父进程的进程标识符,所述父进程为所述发起者的当前进程与所述INIT进程之间的进程。 Obtaining a process identifier of the parent process according to the INIT process corresponding to the process identifier of the current process and the process identifier, where the parent process is a process between the current process of the initiator and the INIT process.
  13. 根据权利要求9所述的装置,其中,还包括:The apparatus according to claim 9, further comprising:
    内核错误处理模块,配置为在所述获取模块获取复位操作的复位信息之后,a kernel error processing module configured to: after the obtaining module acquires reset information of the reset operation,
    根据所述复位信息判断所述复位操作的场景信息是否为内核错误引起的系统复位;Determining, according to the reset information, whether the scene information of the reset operation is a system reset caused by a kernel error;
    当判断结果为是时,标记所述复位操作为内核错误;When the judgment result is YES, the reset operation is marked as a kernel error;
    其中,当监测到Linux系统执行复位操作时,启动预设内核的步骤之后,Wherein, when the step of starting the preset kernel is detected when the Linux system performs the reset operation,
    在所述预设内核中,将所述复位操作以及标记信息对应存储在硬盘中并执行所述复位操作。In the preset kernel, the reset operation and the flag information are correspondingly stored in the hard disk and the reset operation is performed.
  14. 根据权利要求9所述的装置,其中,还包括:The apparatus according to claim 9, further comprising:
    内存建立模块,配置为在所述获取模块当监测到Linux系统启动复位流程时之前,a memory establishing module configured to: before the acquiring module detects a Linux system startup reset process,
    建立保留内存,并配置所述保留内存的容量以及起始地址并记录。Establish reserved memory, configure the capacity of the reserved memory, and the starting address and record.
  15. 根据权利要求14所述的装置,其中,所述获取模块还配置为:The apparatus of claim 14, wherein the obtaining module is further configured to:
    根据所述保留内存的容量以及起始地址查找所述保留内存,将所述复位信息缓存在所述保留内存中。The reserved memory is searched according to the reserved memory capacity and the starting address, and the reset information is cached in the reserved memory.
  16. 根据权利要求9所述的装置,其中,还包括:The apparatus according to claim 9, further comprising:
    内核建立模块,配置为在所述执行模块当监测到Linux系统执行复位操作时之前,a kernel creation module configured to: before the execution module detects that the Linux system performs a reset operation,
    建立预设内核,配置所述预设内核的容量以及起始地址并生成镜像文件,将所述镜像文件存储在硬盘中。Establishing a preset kernel, configuring a capacity of the preset kernel and a starting address, and generating an image file, and storing the image file on the hard disk.
  17. 一种计算机存储介质,所述计算机存储介质包括一组指令,当执行所述指令时,引起至少一个处理器执行如权利要求1至8任一项所述的Linux系统复位处理方法。 A computer storage medium comprising a set of instructions that, when executed, cause at least one processor to perform the Linux system reset processing method of any one of claims 1-8.
PCT/CN2017/073826 2016-03-04 2017-02-16 Linux system reset processing method and device, and computer storage medium WO2017148271A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610123998.3A CN107153453A (en) 2016-03-04 2016-03-04 A kind of linux system reset processing method and device
CN201610123998.3 2016-03-04

Publications (1)

Publication Number Publication Date
WO2017148271A1 true WO2017148271A1 (en) 2017-09-08

Family

ID=59743480

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/073826 WO2017148271A1 (en) 2016-03-04 2017-02-16 Linux system reset processing method and device, and computer storage medium

Country Status (2)

Country Link
CN (1) CN107153453A (en)
WO (1) WO2017148271A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111158945A (en) * 2019-12-31 2020-05-15 奇安信科技集团股份有限公司 Kernel fault processing method and device, network security equipment and readable storage medium
CN116796308A (en) * 2023-02-03 2023-09-22 安芯网盾(北京)科技有限公司 Method and device for detecting executable program of camouflage process based on Linux kernel

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109725990A (en) * 2017-10-31 2019-05-07 北京国双科技有限公司 Course control method and device
CN113407020B (en) * 2021-06-09 2024-03-22 北京集创北方科技股份有限公司 Component starting method and device, touch chip and electronic equipment
CN116701041B (en) * 2023-07-27 2023-11-10 飞腾信息技术有限公司 Memory data retention method, retention device and related equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080104441A1 (en) * 2006-10-31 2008-05-01 Hewlett-Packard Development Company, L.P. Data processing system and method
CN102929747A (en) * 2012-11-05 2013-02-13 中标软件有限公司 Method for treating crash dump of Linux operation system based on loongson server
CN103809989A (en) * 2012-11-08 2014-05-21 英华达(南京)科技有限公司 Method for reading complete core log under situation of core collapse of operating system
CN104714863A (en) * 2015-02-06 2015-06-17 浪潮电子信息产业股份有限公司 Method for completely storing Raid card logs on basis of Linux operation system after system crashes
CN105204977A (en) * 2014-06-30 2015-12-30 中兴通讯股份有限公司 System exception capturing method, main system, shadow system and intelligent equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101149699A (en) * 2006-09-21 2008-03-26 中兴通讯股份有限公司 Method for reliably acquiring abnormal and repositioning information
US8127179B2 (en) * 2008-02-29 2012-02-28 Arris Group, Inc. Providing system reset information to service provider
JP6007642B2 (en) * 2012-01-26 2016-10-12 株式会社リコー Information processing apparatus, power saving control method, power saving control program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080104441A1 (en) * 2006-10-31 2008-05-01 Hewlett-Packard Development Company, L.P. Data processing system and method
CN102929747A (en) * 2012-11-05 2013-02-13 中标软件有限公司 Method for treating crash dump of Linux operation system based on loongson server
CN103809989A (en) * 2012-11-08 2014-05-21 英华达(南京)科技有限公司 Method for reading complete core log under situation of core collapse of operating system
CN105204977A (en) * 2014-06-30 2015-12-30 中兴通讯股份有限公司 System exception capturing method, main system, shadow system and intelligent equipment
CN104714863A (en) * 2015-02-06 2015-06-17 浪潮电子信息产业股份有限公司 Method for completely storing Raid card logs on basis of Linux operation system after system crashes

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111158945A (en) * 2019-12-31 2020-05-15 奇安信科技集团股份有限公司 Kernel fault processing method and device, network security equipment and readable storage medium
CN111158945B (en) * 2019-12-31 2023-12-22 奇安信科技集团股份有限公司 Kernel fault processing method, device, network security equipment and readable storage medium
CN116796308A (en) * 2023-02-03 2023-09-22 安芯网盾(北京)科技有限公司 Method and device for detecting executable program of camouflage process based on Linux kernel
CN116796308B (en) * 2023-02-03 2024-04-12 安芯网盾(北京)科技有限公司 Method and device for detecting executable program of camouflage process based on Linux kernel

Also Published As

Publication number Publication date
CN107153453A (en) 2017-09-12

Similar Documents

Publication Publication Date Title
WO2017148271A1 (en) Linux system reset processing method and device, and computer storage medium
US11360842B2 (en) Fault processing method, related apparatus, and computer
CN107515808B (en) Log recording method, apparatus, computer device and computer readable storage medium
US10545807B2 (en) Method and system for acquiring parameter sets at a preset time interval and matching parameters to obtain a fault scenario type
CN100432949C (en) Method and device for storing user data on computer when software crashing
CN108363659B (en) Method and device for processing abnormity of electronic equipment
US10121004B2 (en) Apparatus and method for monitoring virtual machine based on hypervisor
WO2016123908A1 (en) Memory overflow detection method and apparatus
WO2017045436A1 (en) Virtual machine fault processing method and device
EP3274839B1 (en) Technologies for root cause identification of use-after-free memory corruption bugs
JP6238221B2 (en) Apparatus, method and program for monitoring execution of software
CN110704228B (en) Solid state disk exception handling method and system
TW201516665A (en) System and method for detecting system error of server
JP2018180982A (en) Information processing device and log recording method
CN112988503A (en) Analysis method, analysis device, electronic device, and storage medium
WO2013104964A1 (en) Thread based dynamic data collection
JP2007207213A (en) Diagnostic information collecting method applied to real-time diagnosis of wireless device
CN111061621B (en) Method, device and equipment for verifying program performance and storage medium
WO2014201939A1 (en) Memory monitoring and processing method and device
CN114184885A (en) Fault detection method, device and storage medium
KR101310070B1 (en) Method for preventing collision between each programs and recording-medium recorded program thereof
JP4795388B2 (en) Electronic computer apparatus and data storage method when detecting software processing delay
WO2018036318A1 (en) Method and device for collecting abnormality information during startup of operating system
CN113742299B (en) File compression and decompression method and file compression and decompression device
CN111625336B (en) Thread data processing method and device

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17759122

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17759122

Country of ref document: EP

Kind code of ref document: A1