A method, device, medium and product for debugging a client under virtualization
By using xen Hypervisor to collect memory and CPU information of embedded systems in a virtualized environment, the problem of embedded system debugging in virtualized environment is solved, and the collection and debugging of early crash logs is realized, the debugging cost is reduced, and the debugging capability is expanded. .
Patent Information
- Application Number
- CN202411177921.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-08-27
AI Technical Summary
In a virtualized environment, debugging of embedded system clients is difficult, especially during the startup phase, it may crash without log output, resulting in difficulty in debugging.
By running the debugging process in the xen Hypervisor virtual machine monitor, parsing user commands, collecting the memory information and CPU information of the virtual client, using the hvc instruction to get into the hypervisor layer, obtaining kernel logs and CPU register information, realizing log collection and early crashes debug.
It reduces the cost of system debugging, increases debugging application scenarios, can collect system information without the need for additional hardware equipment, supports debugging of molded products or JTAG-free hardware, and expands the debugging module function.
Smart Images

Figure CN118708498B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information technology, and in particular relates to a method, device, medium and product for debugging a client under virtualization. Background Art
[0002] The emergence of virtualization technology solves the problems of low resource utilization, lack of flexibility, and high maintenance costs of traditional hardware. Through virtualization, a single hardware can be divided into multiple virtual clients, each with its own operating system, application, and resources. This virtualization technology makes it possible to run multiple workloads on the same physical hardware, thereby improving resource utilization, reducing costs, and simplifying management and deployment. Virtualization technology is also increasingly used in the fields of embedded systems and the Internet of Things. This is because as the functions of embedded systems become more and more complex and more tasks and data need to be processed, the design of embedded systems becomes more and more complex. Embedded virtualization can help solve this complexity by running multiple virtualization instances on a single embedded system to effectively manage and isolate system resources.
[0003] However, embedded systems are different from general desktop or server systems (Ubuntu, CentOS, etc.), and they have more tailoring and customization requirements. Traditional operating systems use general hardware (servers) and general software, and have good compatibility and stability. Embedded operating systems are significantly different in terms of resource limitations, real-time requirements, tailoring and customization, power saving, and real-time performance. When designing and implementing embedded operating systems, they need to be optimized and customized according to specific application scenarios to meet specific needs and requirements. This results in the fact that the operation of embedded systems in virtualized environments may not be smooth sailing. For example, general operating systems can generally run directly without modification, while embedded systems may crash for various reasons during system loading and startup initialization.
[0004] In general, it is difficult to debug the embedded system client in virtualization. The general method is to debug the modified system without virtualization. After debugging all functions normally, run it in the virtualized environment. However, the virtualized operating environment is still different from the real hardware environment. In the virtualized environment, all hardware resources are virtualized by virtualization software, and the number of virtualized hardware may also be different from the real environment, which brings about the problem of system compatibility. Of course, at this time, you can also use the device pass-through method to pass serial ports, network ports and other devices to the client, so that the client operating system can directly use these hardware as debugging ports. For example, an actual serial port on the hardware is passed to the operating system as the system console, and the user can use the serial port as a debugging serial port to print log debugging. In virtualization software such as xen, there are also virtual serial port tools that can provide users with log and other functions. However, this debugging method must be effective after the client is started to a certain stage. Many clients will crash during the initialization stage of the onboard system, and there is no log output at this time, which brings great difficulty to debugging. For example, when the Linux system is in the memory initialization stage, the serial port has not been initialized yet. If it crashes at this time, there is no output, which brings great difficulties to users. Summary of the invention
[0005] The purpose of the present invention is to provide a method, device, medium and product for debugging a client under virtualization, so as to solve the problem that it is difficult to debug a client of an embedded system in virtualization, especially the bugs and crashes of the client during the startup phase. By adding debugging means, the user can locate the key to the problem and provide a solution.
[0006] In order to achieve the above object, the technical solution of the present invention is as follows:
[0007] A virtualized client debugging method, comprising:
[0008] Based on the xen Hypervisor virtual machine monitor, a debugging process is run in dom0. The debugging process parses the user's debugging command and falls into the hypervisor layer through the hvc instruction; the hypervisor layer collects the memory information and CPU information of the key data structure of the virtual client domu and returns it to the debugging process.
[0009] Furthermore, when the debugging process parses the debugging command of the user, it loads the kernel symbol table of the virtual client, obtains the location and purpose of each function and variable in the kernel, and passes it to the hypervisor layer.
[0010] Furthermore, the method for the hypervisor layer to collect memory information of key data structures of the virtual client domu includes:
[0011] S10, obtaining the logical address of the client, and converting the logical address into an actual physical address;
[0012] S11, mapping the converted physical address into the hypervisor layer page table, and establishing the address mapping inside the hypervisor layer;
[0013] S12, the hypervisor layer accesses through the address mapping, copies the kernel log in the ringbuffer of the client operating system, and then returns it to the debugging process of dom0.
[0014] Furthermore, the method of converting the logical address into the physical address in step S10 includes:
[0015] S101, using the AT S12E1R / AT S12E1W instruction of the memory management unit MMU, write the virtual address into the address translation of the MMU for address translation, and then read the physical address from the physical address register par_el1; if the translation fails, go to step S102;
[0016] S102, converting the logical address into an intermediate physical address through the stage1 page table conversion inside the Linux operating system memory; the conversion process includes: using the AT S1E1R / AT S1E1W instruction of the memory management unit MMU to write the virtual address into the address translation of the MMU, and then reading the intermediate physical address from the physical address register par_el1; if the direct use of hardware translation fails, the page table traversal is performed in software, firstly the stage1 page table base address is read from the TTBRn_EL1 register, and then the 39th to 47th bits of the virtual address are used as the index, and the first-level page table quantity is obtained by adding the L0 base address and the index value, and so on for the four-level page table addressing, and finally the L3 page table containing the 47th to 12th bits of the physical address is obtained, and then the 11th to 0th bits of the logical address are added, and finally the 48-bit intermediate physical address is obtained; then the process goes to step S103;
[0017] S103, converting the intermediate physical address into the actual physical address through the stage2 page table inside the hypervisor layer; the conversion process includes: performing page table traversal, after finding the base address of the page table, taking the corresponding bit from the intermediate physical address as an index, and then performing four-level page table addressing; adding the L0 base address to the index value to obtain the first-level page table quantity, and so on to perform four-level page table addressing, and finally obtaining the L3 page table containing 47 to 12 bits of the physical address, plus 11 to 0 bits of the intermediate physical address, and finally obtaining a 48-bit physical address.
[0018] Furthermore, the method for collecting CPU information at the hypervisor layer includes:
[0019] S201, for the physical CPU where the client runs, the hypervisor layer collects the registers of the MMU / cache through the current CPU, and other registers of the current CPU are saved in the stack before an exception occurs, and are passed to the collection function of the hypervisor layer in the form of parameters; the current CPU is the CPU running the debugging process;
[0020] S202, for other CPUs in the multi-core, the current CPU sends an sgi interrupt to the other CPUs, and the other CPUs fall into the sgi interrupt processing function in turn, and determine whether to collect CPU information in the function. If yes, the collection process is the same as step S201;
[0021] S203: For the virtual CPU of the client, the hypervisor layer finds the information of the virtual CPU by traversing the physical CPU.
[0022] Another aspect of the present invention further provides a virtualized client debugging device, comprising:
[0023] Debug module: Based on the Xen Hypervisor virtual machine monitor, it runs in dom0, parses the user's debugging commands, and falls into the hypervisor layer through the hvc instruction;
[0024] Memory collection module: The hypervisor layer collects memory information of key data structures of virtual client domu;
[0025] CPU collection module: The hypervisor layer collects CPU information;
[0026] Interaction module: returns the information collected by the memory acquisition module and the CPU acquisition module to the debugging module.
[0027] Furthermore, the memory acquisition module includes:
[0028] Conversion submodule: obtains the logical address of the client and converts the logical address into the actual physical address;
[0029] Mapping submodule: maps the converted physical address into the hypervisor layer page table and establishes the address mapping inside the hypervisor layer;
[0030] Copy submodule: The hypervisor layer accesses through the address mapping, copies the kernel log in the ring buffer of the client operating system, and then returns it to the debugging process of dom0.
[0031] Furthermore, the conversion submodule includes:
[0032] Direct translation unit: Use the AT S12E1R / AT S12E1W instruction of the memory management unit MMU to write the virtual address into the MMU's Address translation for address translation, and then read the physical address from the physical address register par_el1; if the translation fails, enter the stage1 translation unit;
[0033] Stage 1 translation unit: The logical address is translated into an intermediate physical address through the stage 1 page table translation inside the Linux operating system memory. The translation process includes: using the AT S1E1R / AT S1E1W instruction of the memory management unit MMU to write the virtual address into the address translation of the MMU, and then reading the intermediate physical address from the physical address register par_el1. If the direct use of hardware translation fails, the page table traversal is performed in software. First, the stage 1 page table base address is read from the TTBRn_EL1 register, and then the 39 to 47 bits of the virtual address are used as the index, and the first-level page table quantity is obtained by adding the L0 base address and the index value. The four-level page table addressing is performed in this way, and finally the L3 page table containing the 47 to 12 bits of the physical address is obtained, and then the 11 to 0 bits of the logical address are added, and finally the 48-bit intermediate physical address is obtained. Enter the stage 2 translation unit.
[0034] Stage2 conversion unit: converts the intermediate physical address into the actual physical address through the stage2 page table inside the hypervisor layer; the conversion process includes: traversing the page table, finding the base address of the page table, taking the corresponding bit from the intermediate physical address as an index, and then performing four-level page table addressing; adding the L0 base address to the index value to obtain the first-level page table quantity, and so on for four-level page table addressing, and finally obtaining the L3 page table containing 47 to 12 bits of the physical address, plus 11 to 0 bits of the intermediate physical address, and finally obtaining a 48-bit physical address.
[0035] Furthermore, the debugging module includes a loading unit, which loads the kernel symbol table of the virtual client when parsing the user's debugging command, obtains the location and purpose of each function and variable in the kernel, and passes it to the hypervisor layer.
[0036] Furthermore, the CPU acquisition module includes:
[0037] Physical CPU acquisition unit: For the physical CPU where the client runs, the hypervisor layer acquires the registers of the MMU / cache through the current CPU. The other registers of the current CPU are saved in the stack before an exception occurs and are passed to the acquisition function of the hypervisor layer in the form of parameters. The current CPU is the CPU running the debugging module.
[0038] Multi-core CPU collection unit: For other CPUs in the multi-core, the current CPU sends an sgi interrupt to the other CPUs, and the other CPUs fall into the sgi interrupt processing function in turn, and determine whether to collect CPU information in the function. If so, the collection process is the same as that of the physical CPU collection unit;
[0039] Virtual CPU collection unit: For the virtual CPU of the client, the hypervisor layer finds the information of the virtual CPU by traversing the physical CPU.
[0040] The present invention also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the above-mentioned virtualized client debugging method.
[0041] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the above-mentioned method for debugging a client under virtualization.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] The solution of the present invention greatly reduces the cost of system debugging, and system information can be collected without adding additional hardware equipment. At the same time, the application scenarios of system debugging are increased. For finished products or hardware without JTAG debugging ports, system debugging can be performed. Based on the idea of the present invention, the function of the debugging module can be expanded, and more information can be collected to meet the needs of developers. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a comparison of the hardware and software system debugging principle diagrams of the embodiments of the present invention.
[0045] Figure 2 It is a schematic diagram of conversion from client address to physical address under virtualization in an embodiment of the present invention.
[0046] Figure 3 It is a principle diagram of performing page table traversal in software mode in an embodiment of the present invention.
[0047] Figure 4It is a flow chart of client address to physical address conversion under virtualization. DETAILED DESCRIPTION
[0048] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0049] The Jlink or trace32 debugging simulator in chip debugging can directly access the chip internal bus and CPU internal registers through the JTAG interface instead of the serial port. The debugger is independent of the chip and collects information inside the chip from a supervisory and control perspective to provide it to the developer. The design concept of the present invention is similar to that of the debugger, but the difference is that software is used to implement these tasks, such as Figure 1 As shown in the figure. Because such debuggers are usually expensive, most users may not have such equipment. In addition, not all hardware debugged by developers has a JTAG interface, which is usually only used in the early stages of chip development. Most products are designed without a JTAG interface after they are formed.
[0050] The present invention uses the hypervisor to play the role of trace32. The debugging target is the client, and the client runs on the hypervisor layer. The hypervisor layer has more permissions for the client and is independent of the client. It can collect information inside the chip from a supervisory and control perspective. This chip internal information is of great value to developers.
[0051] The present invention is based on the ARMv8 architecture, and the virtualization software Hypervisor uses the Xen 4.17.0 version.
[0052] The xen Hypervisor software consists of three parts:
[0053] (1) The hypervisor layer above the hardware layer: It is responsible for directly driving the basic hardware such as CPU and Memory, providing CPU, memory, and interrupt management for all other virtual machines, and also providing HyperCall calls;
[0054] (2) dom0: a privileged virtual machine that has access to the entire virtualization environment and is responsible for creating user-level virtual machines and allocating I / O device resources to them;
[0055] (3) domu: a user-level virtual machine, which is a virtual machine actually provided to users for use and is also the virtual client in the present invention.
[0056] Specifically, the debugging target is the Linux kernel program of the virtual client, because the most difficult problem to solve when a virtual client crashes occurs in the kernel layer, especially during early system initialization. After the system enters the file system from the kernel, users have many means to debug user-level programs. When the system crashes, there is no log output. The most important things to pay attention to are the current CPU status (including the location of the PC pointer, stack frame calls, and related registers), memory information (key data structures in memory), etc. This embodiment mainly collects internal information of the client after the crash from the above two aspects. Figure 1 As shown in the figure, all the hardware resources of the virtual client domu are provided by the hypervisor layer, some of which are simulated through virtualization (such as VCPU, interrupts, some peripherals, etc.), and some are directly provided by the hypervisor layer through page table mapping (such as memory, some peripherals, etc.). Therefore, all this information can be tracked by the hypervisor layer, which is the basic principle of using the hypervisor layer to simulate the emulator for debugging.
[0057] 1. Use dom0 as the debugging host:
[0058] In the Xen architecture, dom0 is a special virtual machine. It is the first virtual machine started after Xen is started. It has the highest authority and is responsible for managing other clients. Therefore, it can also be called a management domain. So here we use dom0 as the debugging host and start a debugging process in dom0 ( Figure 1 The debugging process is the user's front-end interface, responsible for parsing the user's debugging commands, and finally falling into the hypervisor layer through the hvc instruction. The hypervisor layer collects the client's hardware and software resources, and after calculation and processing, obtains the data the user wants and returns it to the debugging software. The user finally views the debugging results in the debugging software.
[0059] 2. Load the client's kernel symbol table in the debugging software:
[0060] The kernel symbol table is a database that stores various functions, variables, and other symbolic information in the kernel, providing indexing and access to the kernel code. The symbol table is usually stored in the compiled kernel image and can be viewed and manipulated through debugging tools or special commands. The debugging software uses gdb and objdump tools to obtain the location and purpose of each function and variable in the kernel, making it easier to debug, optimize, and expand.
[0061] 3. Memory information collection of key data structures:
[0062] Since the symbol table contains important information for system debugging, the next task is to read this information from the client's memory. This embodiment is described by taking the collection of kernel logs as an example.
[0063] Kernel log is an important means of system debugging, but if the system crashes in the early stage of startup, or the system does not have effective serial port hardware, the system will have no output. Developers cannot determine where the kernel crashed. The core of the kernel log is a ring buffer called log buffer. Printk, as a producer, stores messages in the buffer, and the log service module, as a consumer, can read messages from the log buffer. The so-called log service module can be an output port such as a serial port or dmesg. Before the memory information is parsed, the system only maps the virtual address of the memory where the kernel image is located. Neither memblock nor buddy are initialized, so memory cannot be allocated dynamically at this time. In order to support printk, the kernel can define a static array of __log_buf[__LOG_BUF_LEN] in the form of global variables, and assign the array address to log_buf (ring buffer pointer). After the memory initialization is completed, the system calls the memblock memory manager to reallocate dynamic memory for the ring buffer.
[0064] First, through "objdump -t vmlinux | grep log_buf", we can get the address of log_buf as ffff000008fe1c48, which is a logical address (gva) of the client. Figure 2 As shown. The conversion from gva to the actual physical address needs to go through two stages. The first stage, stage1, is the conversion of the stage1 page table inside the Linux operating system memory (the page table base address is stored in the TTBRn_EL1 register), which converts gva to the intermediate physical address IPA. The second stage, stage2, is converted by the stage2 page table inside the hypervisor layer (the page table base address is stored in VTTBR0_EL2), which converts IPA to the final physical address PA. Different from the client's memory mapping, the hypervisor layer also needs to go through the hypervisor layer page table (the page table base address is stored in TTBR0_EL2) to access the physical address.
[0065] like Figure 4As shown, the most direct way to convert the client virtual address to the physical address is to use the MMU's ATS12E1R / AT S12E1W instructions to write the virtual address into the MMU's Address translation, and then read the physical address from par_el1. Since the MMU has turned on the EL2 mode, this instruction translation directly converts gva to PA. However, due to reasons such as invalid page table entries, instruction execution errors may occur. At this time, we have to settle for the next best thing and convert stage1 and stage2 separately. First, convert gva to IPA. Similarly, you can use the MMU's AT S1E1R / AT S1E1W instructions to write the virtual address into the MMU's Address translation, and then read the physical address from par_el1. At this time, the IPA address is read. If direct hardware translation fails, you need to consider using software to traverse the page table. As Figure 3 As shown, first read the stage1 page table base address from the TTBRn_EL1 register, which points to the L0 page table. Then use bits 39 to 47 of the virtual address as the index, and add the L0 base address to the index value to get the first-level page table volume. Similarly, four-level page table addressing is performed, and finally the L3 page table contains bits 47 to 12 of the physical address, plus bits 11 to 0 of VA, and finally a 48-bit physical address is obtained, which is the stage1 conversion address IPA. Then stage2 conversion is performed. The difference between stage2 conversion and stage1 is that, first of all, it cannot use hardware translation, because there is no hardware instruction for stage2 conversion only. So the page table traversal can only be performed in software. Xen simulates a memory space for each client, in which the base address of the page table is stored in the p2m_domain structure. After finding the base address, take the corresponding bit from the address of IPA as an index, and then perform four-level page table addressing. The process is the same as the above stage1 page table traversal, so it will not be repeated here. After obtaining PA, it is also necessary to map the address into the hypervisor layer page table and establish the address mapping inside the hypervisor layer (such as Figure 2 As shown in Figure 2. ...
[0066] Through the above method, the kernel log in the ring buffer of the client operating system is finally copied out and then returned to the debugging software of dom0. In this way, even if the client kernel crashes at an early stage, the log can be retrieved to locate the crash location. In addition, the same method can be used to retrieve the client page table, interrupt, memory information, etc. The retrieved content can be controlled by the debugging software for input and output.
[0067] 4. CPU information collection:
[0068] The collection of CPU registers is divided into two categories, one is the physical CPU where the client runs, and the other is the virtual CPU (VCPU) of the client. After the debugging software sends a CPU query command to the hypervisor layer, the CPU information collection program is executed. The current CPU (the CPU running the debugging software) first collects the registers of related hardware such as MMU cache through arm64 assembly instructions. The other registers of the CPU are saved in the stack before an exception occurs, and are passed to the collection function of the hypervisor layer in the form of parameters. The hypervisor layer can read from the stack and save the output to the debugging software. For other CPUs in the multi-core, the CPU running the debugging software needs to send them an sgi interrupt. Other CPUs fall into the interrupt processing function of sgi in turn, and determine whether to collect CPU information in the function. If so, the CPU information collection program is executed, and its process is the same as the above process. The difference between VCPU information collection and physical CPU is that VCPU is simulated by software, so there is no need to operate actual hardware. The VCPU information is stored in the VCPU data structure, and the VCPU data structure is hung on the physical CPU in the form of a queue, so the VCPU information can be found by traversing the CPU and output to the debugging software.
[0069] The above-mentioned embodiments are only preferred implementations of the present invention, and are only used to help understand the method and core ideas of the present application. The protection scope of the present invention is not limited to the above-mentioned embodiments. All technical solutions under the idea of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A virtualized client debugging method, characterized in that: include: Based on the Xen Hypervisor virtual machine monitor, a debugging process runs in dom0. The debugging process parses the user's debugging commands and traps into the hypervisor layer through the hvc instruction. The hypervisor layer collects memory and CPU information of key data structures of the virtual client domu and returns it to the debugging process. When the debugging process parses the user's debugging command, it loads the kernel symbol table of the virtual client, obtains the location and purpose of each function and variable in the kernel, and passes it to the hypervisor layer; The method for the hypervisor layer to collect memory information of key data structures of the virtual client domu includes: S10. Obtain the logical address of the client and convert the logical address into an actual physical address; S11. Map the converted physical address into the hypervisor layer page table to establish an address mapping within the hypervisor layer. S12, the hypervisor layer accesses the client operating system through the address mapping, copies the kernel log in the ringbuffer, and returns it to the debugging process of dom0; The method for converting the logical address into the physical address in step S10 includes: S101. Use the AT S12E1R / AT S12E1W instructions of the memory management unit (MMU) to write the virtual address into the MMU's address translation register for address translation. Then, read the physical address from the physical address register par_el1. If the translation fails, proceed to step S102. S102. The logical address is converted to an intermediate physical address through the stage 1 page table translation within the Linux operating system's memory. The translation process includes: using the memory management unit (MMU)'s AT S1E1R / AT S1E1W instructions to write the virtual address to the MMU's address translation register, and then reading the intermediate physical address from the physical address register par_el1. If direct hardware translation fails, a software page table traversal is performed. First, the stage 1 page table base address is read from the TTBRn_EL1 register. Then, using bits 39 to 47 of the virtual address as an index, the L0 base address is added to the index value to obtain the first-level page table. This is repeated for four levels of page table addressing, ultimately obtaining the L3 page table containing bits 47 to 12 of the physical address, which are then added to bits 11 to 0 of the logical address, resulting in a 48-bit intermediate physical address. The process then proceeds to step S103. S103, converting the intermediate physical address into an actual physical address through the stage 2 page table inside the hypervisor layer; the conversion process includes: performing a page table traversal, finding the base address of the page table, extracting the corresponding bit from the intermediate physical address as an index, and then performing a four-level page table addressing; adding the L0 base address and the index value to obtain the first-level page table volume, and so on for the four-level page table addressing, and finally obtaining the L3 page table containing bits 47 to 12 of the physical address, and adding bits 11 to 0 of the intermediate physical address, to finally obtain a 48-bit physical address; The hypervisor layer collects CPU information by: S201. For the physical CPU where the client is running, the hypervisor layer collects MMU / cache registers through the current CPU. Other registers of the current CPU are saved on the stack before an exception occurs and passed to the collection function of the hypervisor layer as parameters. The current CPU is the CPU running the debugging process. S202: For other CPUs in the multi-core system, the current CPU sends an SGI interrupt to the other CPUs. The other CPUs sequentially fall into the SGI interrupt processing function and determine whether to collect CPU information in the function. If so, the collection process is the same as step S201. S203 : For the virtual CPU of the client, the hypervisor layer finds the information of the virtual CPU by traversing the physical CPU.
2. A virtualized client debugging device, characterized in that: include: Debug module: Based on the Xen Hypervisor virtual machine monitor, it runs in dom0, parses user debugging commands, and traps into the hypervisor layer through the hvc instruction. When parsing the user's debugging commands, it loads the virtual client's kernel symbol table, obtains the location and purpose of each function and variable in the kernel, and passes it to the hypervisor layer. Memory collection module: The hypervisor layer collects memory information of key data structures of the virtual client domu; CPU collection module: The hypervisor layer collects CPU information. This includes: for the physical CPU where the client is running, the hypervisor layer collects MMU / cache registers through the current CPU. Other registers of the current CPU are saved in the stack before an exception occurs and passed to the collection function of the hypervisor layer as parameters. The current CPU is the CPU running the debugging process. For other CPUs in the multi-core system, the current CPU sends an SGI interrupt to the other CPUs. The other CPUs fall into the SGI interrupt handling function in turn and determine whether to collect CPU information in the function. If so, the collection process is the same. For the virtual CPU of the client, the hypervisor layer finds the virtual CPU information by traversing the physical CPUs. Interaction module: returns the information collected by the memory acquisition module and the CPU acquisition module to the debugging module; The memory acquisition module includes: Conversion submodule: obtains the client's logical address and converts the logical address into the actual physical address; Mapping submodule: maps the converted physical address into the hypervisor layer page table and establishes the address mapping within the hypervisor layer; Copy submodule: The hypervisor layer accesses the address mapping, copies the kernel log in the ring buffer of the client operating system, and returns it to the debugging process of dom0; The conversion submodule includes: Direct translation unit: Uses the AT S12E1R / AT S12E1W instructions of the memory management unit (MMU) to write the virtual address to the MMU's address translation register for address translation. The physical address is then read from the physical address register par_el1. If the translation fails, the translation unit enters the stage 1 translation unit. The stage 1 translation unit converts the logical address into an intermediate physical address through the stage 1 page table translation within the Linux operating system's memory. This translation process involves writing the virtual address into the MMU's address translation register using the AT S1E1R / AT S1E1W instructions, and then reading the intermediate physical address from the physical address register par_el1. If direct hardware translation fails, a software page table walk is performed, first reading the stage 1 page table base address from the TTBRn_EL1 register. Using bits 39 to 47 of the virtual address as an index, the L0 base address plus the index value is used to obtain the first-level page table. This is repeated through four levels of page tables, ultimately obtaining the L3 page table containing bits 47 to 12 of the physical address, which are then added to bits 11 to 0 of the logical address, resulting in a 48-bit intermediate physical address. The stage 2 translation unit then proceeds. Stage 2 translation unit: converts the intermediate physical address into the actual physical address through the stage 2 page table inside the hypervisor layer. The translation process includes: performing a page table traversal, finding the base address of the page table, extracting the corresponding bit from the intermediate physical address as an index, and then performing four-level page table addressing; adding the L0 base address to the index value to obtain the first-level page table quantity, and so on for four-level page table addressing, and finally obtaining the L3 page table containing bits 47 to 12 of the physical address, plus bits 11 to 0 of the intermediate physical address, to finally obtain a 48-bit physical address.
3. A computer-readable storage medium storing a computer program, characterized in that: The computer program is used to execute the client debugging method under virtualization as claimed in claim 1.
4. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for debugging a client under virtualization according to claim 1 is implemented.
