A method and device for enhancing virtualization software debugging based on memory

By setting the log space in the initialization page table of the embedded system and recording the logs in different memory address spaces, the problem of inability to debug during crashes is solved, and the full process debugging of Jailhouse and the stability of the embedded system is guaranteed.

CN118964179BActive Publication Date: 2025-03-25粤港澳大湾区(广东)国创中心
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410956770.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2025-03-25
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

In the prior art, when an embedded system crashes during the execution period, the cause of the crash cannot be analyzed and debugged, which makes it difficult to guarantee the system stability.

Method used

By presetting the log space in the initialization page table and recording logs in different memory address spaces, including Linux kernel space, EL2 environment and Hypervisor address space, ensure that these logs can be called for debugging during crashes.

Benefits of technology

The full process debugging of Jailhouse is realized, the cause of the crash of the embedded system is determined, and the stability of the embedded system is ensured, while no additional configuration is required, and the log space is allocated zero configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964179B_ABST
    Figure CN118964179B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for virtualization software debugging enhancement based on memory. The method pre-sets a log space in an initialization page table and constructs a page table entry of the log space; in a Linux system, the log space is mapped to a Linux kernel space based on a Jailhouse driver file, and a first log is recorded based on a virtual address of the Linux kernel space; a Hypercall is called to fall into an EL2 environment, and a second log is recorded using a physical address of the log space; an MMU is started in the EL2 environment, and the log space is mapped to a Hypervisor address space through a page table entry of the log space, and a third log is recorded based on a virtual address of the Hypervisor address space; when an embedded system crashes, the first log, the second log and the third log are called based on an open source tool, and Jailhouse debugging is performed to obtain a debugging result, and debugging of the Jailhouse is implemented by calling the log in the log space in the entire Jailhouse process, so as to determine the crash cause of the embedded system and ensure the stability of the embedded system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of embedded technology, and in particular relates to a method and a device for virtualization software debugging enhancement based on memory. Background Art

[0002] Jailhouse is a virtualization tool for embedded systems, specifically a Type 1 partition management program. To run Jailhouse on different hardware platforms, you need to write a dedicated configuration file that is strongly related to the hardware platform. The dedicated configuration file is specifically config.c, which is compiled into config.cell when used.

[0003] Jailhouse loads the execution code to the specified memory location through Linux, and calls the "enter_hypervisor" function in each core to complete the switch to EL2, which is completed by Jailhouse.ko. Jailhouse runs in an EL2 environment independent of Linux, and it is necessary to enable the necessary devices (MMU, serial port, etc.) for the EL2 environment. There is an execution period without debugging means between calling "enter_hypervisor" and Jailhouse initializing and enabling the serial port device. This execution period is composed of assembly code. Once the configuration file (config.c) is written incorrectly, it is likely to cause the system to crash directly during this execution period, and it is impossible to collect the root cause of the crash. Summary of the invention

[0004] In order to overcome the deficiencies of the prior art, the present invention provides a method and device for virtualization software debugging enhancement based on memory to solve the problem in the prior art that when an embedded system crashes during execution, the cause of the crash cannot be analyzed and debugged.

[0005] One embodiment of the present invention provides a method for enhancing virtualization software debugging based on memory, comprising the following steps:

[0006] Presetting a log space in an initialization page table, constructing a page table entry of the log space, and determining a physical address and size of the log space;

[0007] In the Linux system, mapping the log space to the Linux kernel space based on the Jailhouse driver file, and recording the first log based on the virtual address of the Linux kernel space;

[0008] Call Hypercall to fall into the EL2 environment and use the physical address of the log space to record the second log;

[0009] Starting the MMU in the EL2 environment, mapping the log space to the Hypervisor address space through the page table entry of the log space, and recording a third log based on the virtual address of the Hypervisor address space;

[0010] When the embedded system crashes, the first log, the second log and the third log are called based on the open source tool, and jailhouse debugging is performed based on the first log, the second log and the third log to obtain a debugging result.

[0011] In this embodiment, the present invention sets up the log space in advance, and in the execution period between calling "enter_hypervisor" and Jailhouse initialization and enabling the serial port device, the log is saved in the storage location of the corresponding log space through the mapping of the log space. When the embedded system crashes, the Jailhouse is debugged by calling the log in the log space, the cause of the crash of the embedded system is determined, and the stability of the embedded system is ensured. At the same time, the address of the log space is sealed in a predetermined function. When using the log space to record logs, it is only necessary to call the provided "l_log, p_log, h_log" functions. The reservation of the log space is all internally implemented, and the developer does not need to configure it. The log space allocation has zero configuration.

[0012] In one embodiment, determining the physical address and size of the log space includes:

[0013] The sum of the hypervisor memory address of the jailhouse and the hypervisor memory size is used as the first address of the physical address of the log space, and the size of the log space is set to 2MB.

[0014] In one of the embodiments, in a Linux system, mapping the log space to a Linux kernel space based on a Jailhouse driver file, and recording a first log based on a virtual address of the Linux kernel space includes:

[0015] In a Linux system, triggering the operation of the jailhouse through a command line tool;

[0016] Parsing configuration files based on the Jailhouse driver files;

[0017] Based on the parsed configuration file, the log space is mapped to the Linux kernel space through IOREMAP, and the first log is recorded through the virtual address of the Linux kernel space.

[0018] In one of the embodiments, starting the MMU in the EL2 environment, mapping the log space to the Hypervisor address space through the page table entry of the log space, and recording a third log based on the virtual address of the Hypervisor address space, includes:

[0019] Starting the MMU in the EL2 environment and determining a mapping relationship between the physical address and the virtual address of the Hypervisor;

[0020] Adding a log space mapping to the Hypervisor address space through the page table entry of the log space and the mapping relationship to obtain a virtual address of the Hypervisor address space;

[0021] The third log is recorded through a virtual address of the Hypervisor address space.

[0022] In one embodiment, the recording of the first log, the second log and the third log is implemented by a predetermined function, and the establishment process of the predetermined function includes:

[0023] Encapsulate the virtual address of the Linux kernel space into the l_log function;

[0024] Encapsulate the physical address of the log space into the p_log function;

[0025] Encapsulate the virtual address of the Hypervisor address space into the h_log function;

[0026] The l_log function, the p_log function and the h_log function are used as the predetermined functions.

[0027] In one embodiment, the recording process of the first log, the second log, and the third log includes:

[0028] Saving a first log in a virtual address of the Linux kernel space by calling the l_log function;

[0029] Saving the second log in the physical address of the log space by calling the p_log function;

[0030] The third log is saved in the virtual address of the Hypervisor address space by calling the h_log function.

[0031] In one embodiment, the method further comprises:

[0032] After calling enter_hypervisor to Jailhouse to initialize and enable the serial port device, the log space is reclaimed through the runtime page table.

[0033] One embodiment of the present invention further provides a memory-based jailhouse debugging device, comprising:

[0034] A log space setting module, used to pre-set the log space in the initialization page table, construct the page table entry of the log space, and determine the physical address and size of the log space;

[0035] A first log recording module is used to map the log space to the Linux kernel space based on the Jailhouse driver file in the Linux system, and record a first log based on the virtual address of the Linux kernel space;

[0036] The second log recording module is used to call Hypercall to fall into the EL2 environment and use the physical address of the log space to record the second log;

[0037] A third log recording module, configured to start the MMU in the EL2 environment, map the log space to a Hypervisor address space through a page table entry of the log space, and record a third log based on a virtual address of the Hypervisor address space;

[0038] The debugging module is used to call the first log, the second log and the third log based on the open source tool when the embedded system crashes, and perform jailhouse debugging based on the first log, the second log and the third log to obtain the debugging result.

[0039] In this embodiment, the advantages and beneficial effects of the memory-based virtualization software debugging enhancement method have been described above and will not be repeated here. Moreover, since the memory-based jailhouse debugging device uses the memory-based virtualization software debugging enhancement method, the memory-based jailhouse debugging device also has the same advantages and beneficial effects.

[0040] One of the embodiments of the present invention further provides a readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the steps of any one of the memory-based virtualization software debugging enhancement methods described above.

[0041] One of the embodiments of the present invention also provides an electronic device, including: a processor and a memory, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor executes the computer instructions, the electronic device executes the steps of any one of the above-described memory-based virtualization software debugging enhancement methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0043] Figure 1 A flowchart of a method for enhancing virtualization software debugging based on memory provided by one embodiment of the present invention;

[0044] Figure 2 A schematic diagram of the structure of a jailhouse debugging device based on memory provided by one embodiment of the present invention;

[0045] Figure 3 A schematic diagram of the working principle of an electronic device provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly.

[0048] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features limited to "first" and "second" may explicitly or implicitly include at least one of the features. In addition, if "and / or" or "and / or" appears in the full text, its meaning includes three parallel solutions. Taking "A and / or B" as an example, it includes solution A, solution B, or solutions that satisfy both A and B. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in this field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0049] Jailhouse loads the execution code to the specified memory location through Linux, and calls the "enter_hypervisor" function in each core to complete the switch to EL2, which is completed by Jailhouse.ko. Jailhouse runs in an EL2 environment independent of Linux, and it is necessary to enable the necessary devices (MMU, serial port, etc.) for the EL2 environment. There is an execution period without debugging means between calling "enter_hypervisor" and Jailhouse initializing and enabling the serial port device. This execution period is composed of assembly code. Once the configuration file (config.c) is written incorrectly, it is likely to cause the system to crash directly during this execution period, and it is impossible to collect the root cause of the crash.

[0050] The present invention sets a predetermined function to seal the physical address or virtual address of the log space at different stages of the execution period before the Jailhouse enables the serial port device in the predetermined function, so that when the user uses the log space for log recording, it only needs to call the predetermined function without additional configuration, and the log space allocation is realized with zero configuration. At the same time, the log recorded in the log space can be extracted to debug the whole process of the Jailhouse, determine the crash cause in the embedded system, and ensure the stability of the embedded system. At the same time, the log space can be recovered in the runtime page table after the execution period without debugging means, and the memory use of the Jailhouse is lossless.

[0051] See also Figure 1-Figure 3 One embodiment of the present invention provides a method for enhancing virtualization software debugging based on memory, comprising the following steps:

[0052] S100, pre-setting a log space in an initialization page table, constructing a page table entry of the log space, and determining a physical address and size of the log space.

[0053] In this embodiment, the log space is used to store logs generated between execution periods before the Jailhouse enables the serial port device. The log space is set in the initialization page table. When constructing the initialization page table, the page table entries of the log space are also constructed. The page table entries of the log space are used for subsequent log space mapping. The process of pre-setting the log space in the initialization page table mainly includes setting the physical address of the log space and the size of the log space.

[0054] In one embodiment, determining the physical address and size of the log space includes:

[0055] The sum of the hypervisor memory address of the jailhouse and the hypervisor memory size is used as the first address of the physical address of the log space, and the size of the log space is set to 2MB.

[0056] S200. In a Linux system, the log space is mapped to a Linux kernel space based on a Jailhouse driver file, and a first log is recorded based on a virtual address of the Linux kernel space.

[0057] In this embodiment, the user executes a command line tool in the Linux system, wherein the command line tool is specifically Jailhouse enable. Jailhouse enable triggers the running of Jailhouse. After Jailhouse is running, the Linux is called a root cell. The root cell, as a management cell, is responsible for starting and managing other non-root cells. Specifically, Jailhouse is started by the first Linux running on the bare board. After starting, the Linux role becomes a root cell, which is responsible for starting and managing other non-root cells, thereby completing the single-board multi-OS hybrid deployment.

[0058] In this embodiment, the driver file Jailhouse.ko maps the log space to the Linux kernel space through "IOREMAP" to make the Linux kernel visible, so that the user can record logs to the log space.

[0059] In one of the embodiments, in a Linux system, mapping the log space to a Linux kernel space based on a Jailhouse driver file, and recording a first log based on a virtual address of the Linux kernel space includes:

[0060] S210, in the Linux system, triggering the operation of the Jailhouse through a command line tool;

[0061] S220, parsing a configuration file based on the Jailhouse driver file;

[0062] S230, based on the parsed configuration file, map the log space to the Linux kernel space through IOREMAP, and record the first log through the virtual address of the Linux kernel space.

[0063] In this embodiment, the command line tool specifically refers to Jailhouse enable. After the operation of Jailhouse is triggered, the driver file Jailhouse.ko of Jailhouse will parse the configuration file and map the reserved log space to the Linux kernel space through IOREMAP. Logs are recorded through the virtual address after being mapped to the Linux address space. The logs recorded at this stage are used as the first logs.

[0064] In this embodiment, the main function of steps S210-S230 is to call enter_hypervisor to initiate Hypercall, which is still the Linux kernel address space. This section of the assembly environment records the log to the log space planned in step S100. The log space needs to be mapped to the Linux kernel address space through IOREMAP before the planned log space can be accessed.

[0065] S300, calling Hypercall to fall into the EL2 environment, and using the physical address of the log space to record the second log.

[0066] In this embodiment, the Jailhouse driver calls Hypercall to fall into the EL2 environment. Before the MMU is enabled, the physical address is used to access the memory. At this stage, the physical address of the log space is directly used to record the log.

[0067] S400, starting the MMU in the EL2 environment, mapping the log space to the Hypervisor address space through the page table entry of the log space, and recording a third log based on the virtual address of the Hypervisor address space.

[0068] In this embodiment, the Jailhouse initialization will complete the EL2 environment configuration. After the MMU is enabled in EL2, the MMU converts the physical address into a virtual address for the EL2 environment through the page table. When constructing the initialization page table, it is necessary to construct the page table entry of the log space. The purpose is to add the log space mapping in the Hypervisor address space. In this way, the Jailhouse can access the log space only after the MMU is turned on in the EL2 environment. Among them, the Hypervisor address space described here refers to the EL2 address space. The arm architecture virtualization code runs in EL2, which is the running address space of the Jailhouse code. The log space page table entry is to convert the log space in step 1 into a virtual address available to the hypervisor. The arm architecture designs MMU for memory protection and isolation, and uses the virtual address converted by the MMU to access the memory.

[0069] In one of the embodiments, starting the MMU in the EL2 environment, mapping the log space to the Hypervisor address space through the page table entry of the log space, and recording a third log based on the virtual address of the Hypervisor address space, includes:

[0070] S410, starting the MMU in the EL2 environment, and determining a mapping relationship between the physical address and the virtual address of the Hypervisor;

[0071] S420, adding a log space mapping to the hypervisor address space through the page table entry of the log space and the mapping relationship, to obtain a virtual address of the hypervisor address space;

[0072] S430: Record the third log through the virtual address of the Hypervisor address space.

[0073] In this embodiment, the mapping relationship is to add a fixed offset to the virtual address to get the corresponding physical address, and the offset value is defined by the Jailhouse project. Assuming that the page table built by Jailhouse maps 32M of physical space to EL2, then the log space mapping needs to add a page table entry for the log space in the page table, so that the physical space that EL2 can access is 32M+2M of log space.

[0074] In this embodiment, the page table entry of the log space converts the log space of step S100 into a virtual address available to the hypervisor. The arm architecture designs MMU for memory protection and isolation, and uses the virtual address converted by the MMU to access the memory. At this time, after the jail turns on the MMU, the log can be recorded by mapping it to the virtual address of the log space in the hypervisor address space.

[0075] In one embodiment, the recording of the first log, the second log and the third log is implemented by a predetermined function, and the establishment process of the predetermined function includes:

[0076] Encapsulate the virtual address of the Linux kernel space into the l_log function;

[0077] Encapsulate the physical address of the log space into the p_log function;

[0078] Encapsulate the virtual address of the Hypervisor address space into the h_log function;

[0079] The l_log function, the p_log function and the h_log function are used as the predetermined functions.

[0080] In this embodiment, in order to further improve the user's usage efficiency and lower the usage threshold, the physical address or virtual address mapped corresponding to each of the above stages is encapsulated. Specifically, the virtual address of the Linux kernel space is encapsulated into the l_log function, the physical address of the log space is encapsulated into the p_log function, and the virtual address of the Hypervisor address space is encapsulated into the h_log function. It should be noted that in a specific application scenario, those skilled in the art may encapsulate the above addresses into other functions, which does not affect the protection scope of this application.

[0081] In one embodiment, the recording process of the first log, the second log, and the third log includes:

[0082] Saving a first log in a virtual address of the Linux kernel space by calling the l_log function;

[0083] Saving the second log in the physical address of the log space by calling the p_log function;

[0084] The third log is saved in the virtual address of the Hypervisor address space by calling the h_log function.

[0085] In this embodiment, by encapsulating the virtual address of the Linux kernel space into the l_log function, the physical address of the log space into the p_log function, and the virtual address of the Hypervisor address space into the h_log function, developers only need to call the provided "l_log, p_log, h_log" functions to use the log space to record logs. The reservation of log space is all internally implemented, and developers do not need to configure it. Log space allocation has zero configuration. That is, in step S200, "recording the first log based on the virtual address of the Linux kernel space", in step S300, "recording the second log using the physical address of the log space", and in step S400, "recording the third log based on the virtual address of the Hypervisor address space" only need to call the provided "

[0086] l_log, p_log, h_log" functions can be used.

[0087] In one embodiment, the method further comprises:

[0088] After calling enter_hypervisor to Jailhouse to initialize and enable the serial port device, the log space is reclaimed through the runtime page table.

[0089] In this embodiment, the log space is allocated in the initialization page table, and can be reclaimed in the runtime page table after the execution period without debugging means, without loss to the memory usage of the jailhouse.

[0090] Step S500, when the embedded system crashes, the first log, the second log and the third log are called based on the open source tool, and jailhouse debugging is performed based on the first log, the second log and the third log to obtain a debugging result.

[0091] In this embodiment, the embedded platform is restarted without power failure. For example, the "watchdog" mechanism is used to automatically restart after the system crashes. The memory is powered off and the memory data still resides in the memory. Because the memory is segmented and used in the jailhouse scenario, the planned log space will not be overwritten. After the platform is restarted, the open source tool devmem2 is used to read the log space data in the Linux space. Devmem2 is a tool that can be run on the Linux command line. The principle is to map a piece of physical memory to the user space of Linux. Through this tool, users can access the data in the specified memory. Therefore, the devmem2 tool can be used in the Linux user space to read the data written to the log space through the physical address of the log space. For example: Assuming that the physical address of the log space is 0x68000000, the way to read the log data is: devmem20x68000000, the default is to read 4 bytes at a time, and the parameter "b" can be passed to read 1 byte at a time. Devmem2 is polled to read the log of the specified size.

[0092] In this embodiment, the embedded platform maintains power supply. If the system crashes, the watchdog will reset the system. The data in the memory is still in the log space without power failure. There is only one physical log space, but the process from step S200 to step S400 needs to use a different mapping address to access this physical log space because the operating environment changes.

[0093] In this embodiment, by retrieving the first log, the second log and the third log, the cause of the crash of the embedded system is determined, so that the whole process of Jailhouse can be debugged and the stability of the embedded system is guaranteed.

[0094] In summary, this solution has the following advantages:

[0095] 1. The log space is allocated in the initialization page table and can be recycled in the runtime page table after the execution period without debugging means, without loss of memory usage in the jailhouse.

[0096] 2. Developers only need to call the provided "l_log, p_log, h_log" functions to use the log space to record logs. The reservation of log space is internally implemented and developers do not need to configure it. Log space allocation has zero configuration.

[0097] The present invention sets the log space in advance, and in the execution period between calling "enter_hypervisor" and Jailhouse initialization and enabling the serial port device, saves the log in the storage position of the corresponding log space through the mapping of the log space. When the embedded system crashes, the Jailhouse is debugged by calling the log in the log space, the crash cause of the embedded system is determined, and the stability of the embedded system is guaranteed. At the same time, the address of the log space is sealed in a predetermined function, and when using the log space to record logs, it only needs to call the provided "l_log, p_log, h_log" functions. The reservation of the log space is all internally implemented, and the developer does not need to configure it, and the log space allocation is zero-configuration.

[0098] One embodiment of the present invention also provides a jailhouse debugging device based on memory, such as Figure 2 As shown, including:

[0099] The log space setting module 10 is used to pre-set the log space in the initialization page table, construct the page table entry of the log space, and determine the physical address and size of the log space;

[0100] A first log recording module 20 is used to map the log space to the Linux kernel space based on the Jailhouse driver file in the Linux system, and record a first log based on the virtual address of the Linux kernel space;

[0101] A second log recording module 30, used for calling Hypercall to fall into the EL2 environment, and recording a second log using the physical address of the log space;

[0102] A third log recording module 40, configured to start the MMU in the EL2 environment, map the log space to the Hypervisor address space through a page table entry of the log space, and record a third log based on a virtual address of the Hypervisor address space;

[0103] The debugging module 50 is used to call the first log, the second log and the third log based on the open source tool when the embedded system crashes, and perform jailhouse debugging based on the first log, the second log and the third log to obtain the debugging result.

[0104] One of the embodiments of the present invention further provides a readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the steps of any one of the memory-based virtualization software debugging enhancement methods described above.

[0105] One of the embodiments of the present invention also provides an electronic device, including: a processor and a memory, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor executes the computer instructions, the electronic device executes the steps of any one of the above-described memory-based virtualization software debugging enhancement methods.

[0106] See also Figure 3 , Figure 3 A schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention.

[0107] The electronic device 2 includes a processor 21, a memory 22, an input device 23, and an output device 24. The processor 21, the memory 22, the input device 23, and the output device 24 are coupled via a connector, and the connector includes various interfaces, transmission lines, or buses, etc., which are not limited in the embodiments of the present invention. It should be understood that in various embodiments of the present invention, coupling refers to mutual connection in a specific manner, including direct connection or indirect connection through other devices, for example, through various interfaces, transmission lines, buses, etc.

[0108] The processor 21 may be one or more graphics processing units (GPUs). When the processor 21 is a GPU, the GPU may be a single-core GPU or a multi-core GPU. Optionally, the processor 21 may be a processor group consisting of multiple GPUs, and the multiple processors are coupled to each other via one or more buses. Optionally, the processor may also be other types of processors, etc., which are not limited in the embodiments of the present invention.

[0109] The memory 22 can be used to store computer program instructions and various computer program codes including program codes for executing the scheme of the present invention. Optionally, the memory includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM), or portable read only memory (CD-ROM), which is used for related instructions and data.

[0110] The input device 23 is used to input data and / or signals, and the output device 24 is used to output data and / or signals. The output device 23 and the input device 24 can be independent devices or an integrated device.

[0111] It is understandable that in the embodiment of the present invention, the memory 22 is not only used to store related instructions, and the embodiment of the present invention does not limit the specific data stored in the memory.

[0112] Understandably, Figure 3 Only a simplified design of an electronic device is shown. In practical applications, the electronic device may also include other necessary components, including but not limited to any number of input / output devices, processors, memories, etc., and all video analysis devices that can implement the embodiments of the present invention are within the protection scope of the present invention.

[0113] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0114] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. Those skilled in the art can also clearly understand that the descriptions of the various embodiments of the present invention have different focuses. For the convenience and brevity of description, the same or similar parts may not be repeated in different embodiments. Therefore, for parts not described or not described in detail in a certain embodiment, refer to the records of other embodiments.

[0115] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0116] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0117] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0118] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program to be sealed. The computer program to be sealed includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0119] A person skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by a computer program to instruct the relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned method embodiments. The aforementioned storage medium includes: a read-only memory (ROM) or a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0120] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the inventive concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A method for enhancing virtualization software debugging based on memory, characterized in that: The following steps are involved: Presetting a log space in an initialization page table, constructing a page table entry of the log space, and determining a physical address and size of the log space; In the Linux system, mapping the log space to the Linux kernel space based on the Jailhouse driver file, and recording the first log based on the virtual address of the Linux kernel space; Call Hypercall to fall into the EL2 environment and use the physical address of the log space to record the second log; Starting the MMU in the EL2 environment, mapping the log space to the Hypervisor address space through the page table entry of the log space, and recording a third log based on the virtual address of the Hypervisor address space; When the embedded system crashes, calling the first log, the second log, and the third log based on the open source tool, and performing jailhouse debugging based on the first log, the second log, and the third log to obtain a debugging result; The recording of the first log, the second log and the third log is implemented by a predetermined function, and the establishment process of the predetermined function includes: Encapsulate the virtual address of the Linux kernel space into the l_log function; Encapsulate the physical address of the log space into the p_log function; Encapsulate the virtual address of the Hypervisor address space into the h_log function; Using the l_log function, the p_log function and the h_log function as the predetermined functions; The recording process of the first log, the second log and the third log includes: Saving a first log in a virtual address of the Linux kernel space by calling the l_log function; Saving the second log in the physical address of the log space by calling the p_log function; The third log is saved in the virtual address of the Hypervisor address space by calling the h_log function.

2. The method for enhancing virtualization software debugging based on memory according to claim 1, characterized in that: Determining the physical address and size of the log space includes: The sum of the hypervisor memory address of the jailhouse and the hypervisor memory size is used as the first address of the physical address of the log space, and the size of the log space is set to 2MB.

3. The method for enhancing virtualization software debugging based on memory as claimed in claim 2, characterized in that: In the Linux system, mapping the log space to the Linux kernel space based on the Jailhouse driver file, and recording the first log based on the virtual address of the Linux kernel space, including: In a Linux system, triggering the operation of the jailhouse through a command line tool; Parsing configuration files based on the Jailhouse driver files; Based on the parsed configuration file, the log space is mapped to the Linux kernel space through IOREMAP, and the first log is recorded through the virtual address of the Linux kernel space.

4. The method for enhancing virtualization software debugging based on memory as claimed in claim 3, characterized in that: Starting the MMU in the EL2 environment, mapping the log space to the Hypervisor address space through the page table entry of the log space, and recording a third log based on the virtual address of the Hypervisor address space, including: Starting the MMU in the EL2 environment and determining a mapping relationship between the physical address and the virtual address of the Hypervisor; Adding a log space mapping to the Hypervisor address space through the page table entry of the log space and the mapping relationship to obtain a virtual address of the Hypervisor address space; The third log is recorded through a virtual address of the Hypervisor address space.

5. The method for enhancing virtualization software debugging based on memory according to claim 1, characterized in that: The method further comprises: After calling enter_hypervisor to Jailhouse to initialize and enable the serial port device, the log space is reclaimed through the runtime page table.

6. A memory-based jailhouse debugging device, characterized in that: include: A log space setting module, used to pre-set the log space in the initialization page table, construct the page table entry of the log space, and determine the physical address and size of the log space; A first log recording module is used to map the log space to the Linux kernel space based on the Jailhouse driver file in the Linux system, and record a first log based on the virtual address of the Linux kernel space; The second log recording module is used to call Hypercall to fall into the EL2 environment and use the physical address of the log space to record the second log; A third log recording module, configured to start the MMU in the EL2 environment, map the log space to a Hypervisor address space through a page table entry of the log space, and record a third log based on a virtual address of the Hypervisor address space; A debugging module, used for calling the first log, the second log and the third log based on an open source tool when the embedded system crashes, and performing jailhouse debugging based on the first log, the second log and the third log to obtain a debugging result; The recording of the first log, the second log and the third log is implemented by a predetermined function, and the establishment process of the predetermined function includes: Encapsulate the virtual address of the Linux kernel space into the l_log function; Encapsulate the physical address of the log space into the p_log function; Encapsulate the virtual address of the Hypervisor address space into the h_log function; Using the l_log function, the p_log function and the h_log function as the predetermined functions; The recording process of the first log, the second log and the third log includes: Saving a first log in a virtual address of the Linux kernel space by calling the l_log function; Saving the second log in the physical address of the log space by calling the p_log function; The third log is saved in the virtual address of the Hypervisor address space by calling the h_log function.

7. An electronic device comprising: A processor and a memory, characterized in that the memory is used to store computer program code, the computer program code includes computer instructions, and when the processor executes the computer instructions, the electronic device executes the steps of the memory-based virtualization software debugging enhancement method as described in any one of claims 1-5.

8. A readable storage medium having a computer program stored therein, characterized in that: The computer program includes program instructions, and when the program instructions are executed by a processor of an electronic device, the processor is caused to execute the steps of the method for enhancing virtualization software debugging based on memory as described in any one of claims 1 to 5.