A method, device and system for obtaining system information
Through the combination of preset hard interrupt channel and shared memory area, the problem of network dependence in Guest OS debugging is solved, the acquisition and transmission of Guest OS system information is realized, and the continuity and effectiveness of the debugging process are ensured.
Patent Information
- Application Number
- CN201911330858.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-20
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2039-12-20
AI Technical Summary
Existing Guest OS debugging methods rely on network transmission, resulting in the inability to obtain system information and debugging when a system-level failure occurs in the Guest OS.
Send control information to the Guest OS through the preset hard interrupt channel, control the Guest OS to obtain system information and store it in the preset shared memory area, and the Host OS reads the information in the shared memory area, so that the Guest OS can obtain system information without relying on the network.
This ensures that when the Guest OS fails, its system information can still be obtained, ensures the effective development of the debugging process, and avoids debugging interruption caused by network communication failure.
Smart Images

Figure CN113010407B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a method, device and system for acquiring system information. Background Art
[0002] Hypervisor is an intermediate software layer that runs between the basic physical server and the operating system, allowing multiple operating systems to share hardware. The operating system used to execute one or more virtual machines in the hypervisor is called the Host OS, and the operating system corresponding to the corresponding one or more virtual machines is called the Guest OS.
[0003] In actual applications, it is often necessary to debug the Guest OS. Common debugging methods are basically based on ADB (Android Debug Bridge) or other debugging terminal programs, and these debugging methods are essentially based on virtual network transmission, that is, the system information of the Guest OS is obtained through a network connection to complete the debugging. Therefore, once a system-level failure occurs inside the Guest OS, such as a network driver failure, an interlocking of the operating system itself, etc., resulting in the network not working properly, the information exchange channel between the Guest OS and the debugging programs such as ADB is lost, and the existing debugging methods cannot obtain the system information of the Guest OS, and naturally cannot debug the Guest OS. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a system information acquisition method, device and server, so that the acquisition of Guest OS system information is no longer dependent on the network. The specific scheme is as follows:
[0005] In a first aspect, the present invention provides a method for obtaining system information, comprising:
[0006] Get the control information received by Host OS;
[0007] Sending the control information to the Guest OS via a preset hard interrupt channel;
[0008] Control the Guest OS to obtain target Guest OS system information according to the control information and store the target Guest OS system information in a preset shared memory area;
[0009] The Host OS is controlled to read the target Guest OS system information stored in the preset shared memory area.
[0010] Optionally, sending the control information to GuestOS through a preset hard interrupt channel includes:
[0011] After acquiring the control information, triggering a preset hard interrupt signal;
[0012] The preset hard interrupt information number is sent to the Guest OS through a preset hard interrupt channel, wherein the preset hard interrupt signal includes the control information.
[0013] Optionally, the controlling the Guest OS to obtain target Guest OS system information according to the control information includes:
[0014] Control the Guest OS to perform the following operations:
[0015] Determining a command control word corresponding to the control information;
[0016] Determine the Guest OS system information corresponding to the command control word, and obtain the target Guest OS system information;
[0017] Obtain the target Guest OS system information.
[0018] Optionally, the obtaining the target Guest OS system information includes:
[0019] Extracting field information of a target field in the command control word;
[0020] Determine a method for obtaining Guest OS system information according to the field information;
[0021] The target Guest OS system information in the Guest OS system is acquired according to the acquisition method.
[0022] Optionally, the acquisition method includes one of acquiring according to a hard interrupt context and acquiring according to a process context.
[0023] Optionally, the system information acquisition method provided by the first aspect of the present invention further includes:
[0024] The Guest OS is controlled to obtain specified Guest OS system information and store the information in the preset shared memory area.
[0025] Optionally, the process of setting the preset shared memory area includes:
[0026] After the Hypervisor system is started, the memory space is allocated according to a preset rule to obtain the preset shared memory area.
[0027] Optionally, the process of setting the preset shared memory area further includes:
[0028] After acquiring the control information received by the Host OS, memory space is allocated according to a preset rule to obtain the preset shared memory area.
[0029] In a second aspect, the present invention provides a system information acquisition device, comprising:
[0030] An acquisition unit, used for acquiring control information received by the Host OS;
[0031] A sending unit, used for sending the control information to the Guest OS through a preset hard interrupt channel;
[0032] A first control unit, configured to control the Guest OS to obtain target Guest OS system information according to the control information and store the target Guest OS system information in a preset shared memory area;
[0033] The second control unit is used to control the Host OS to read the target Guest OS system information stored in the preset shared memory area.
[0034] In a third aspect, the present invention provides a server, comprising: a memory and a processor; the memory stores a program suitable for execution by the processor to implement the system information acquisition method described in any one of the first aspects of the present invention.
[0035] Based on the above technical solution, the system information acquisition method provided by the present invention, after acquiring the control information received by the Host OS, sends the control information to the Guest OS through a preset hard interrupt channel, then controls the Guest OS to acquire the target Guest OS system information according to the control information and stores the target Guest OS system information in a preset shared memory area, and finally controls the Host OS to read the target Guest OS system information stored in the preset shared memory area. The system information acquisition method provided by the present invention transmits the control information through a preset hard interrupt channel, acquires the target Guest OS system information according to the control information, and at the same time, realizes the transmission of the target Guest OS system information through a preset shared memory area, so that the Host OS can acquire the Guest OS system information without relying on the network, and then other debugging programs can acquire the Guest OS system information through the Host OS, ensuring the effective development of the debugging process. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 is a flow chart of a method for obtaining system information provided by an embodiment of the present invention;
[0038] Figure 2 is a structural block diagram of a system information acquisition device provided by an embodiment of the present invention;
[0039] Figure 3 is a structural block diagram of another system information acquisition device provided by an embodiment of the present invention;
[0040] Figure 4 is a structural block diagram of another system information acquisition device provided by an embodiment of the present invention;
[0041] Figure 5 is a structural block diagram of another system information acquisition device provided by an embodiment of the present invention;
[0042] Figure 6 It is a structural block diagram of a server provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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.
[0044] See also Figure 1 , Figure 1 is a flowchart of a method for obtaining system information provided by an embodiment of the present invention. The method can be applied to an electronic device capable of performing data processing, and specifically, can be applied to a server running a Hypervisor system; Figure 1 The system information acquisition method provided by the embodiment of the present invention may include:
[0045] S100, obtaining control information received by the Host OS.
[0046] The control information described in the embodiment of the present invention may be sent by the debugger to the Host OS through the debugger program, or a control information input interface may be preset in the Host OS, and the debugger may input the control information through the input interface. Of course, other control information input methods may also be used. However, no matter which control information input method is used, the control information is received through the Host OS to avoid the control information being unable to be input when the Guest OS fails.
[0047] Optionally, the specific content of the control information may refer to the content input when debugging the Guest OS in the prior art. The embodiment of the present invention does not limit the content of the specific control information input by the debugger.
[0048] S110, sending control information to the Guest OS through a preset hard interrupt channel.
[0049] After acquiring the control information received by the Host OS, the control information can be sent to the Guest OS. The embodiment of the present invention implements this information transmission process by presetting a hard interrupt channel.
[0050] Specifically, after obtaining the control information input by the debugger, the preset hard interrupt signal can be triggered, and the preset hard interrupt signal also includes the corresponding control information. The preset hard interrupt signal after triggering can be sent to the Guest OS through the preset hard interrupt channel. The establishment of the preset hard interrupt channel can be implemented with reference to the methods in the prior art, and the present invention does not limit the establishment method of the preset hard interrupt channel.
[0051] Optionally, as a specific optional implementation method, in actual application, the operations corresponding to the steps of S100 and S110 can be integrated together as a module, a unit or a function in the program. For example, the two can be combined into a control information input module to simultaneously realize the acquisition of control information and the sending of a preset hard interrupt signal. Accordingly, the other steps described in the embodiment of the present invention can also be set as corresponding modules or units to facilitate the management and upgrading of program content, and the embodiment of the present invention will not repeat this.
[0052] S120, controlling the Guest OS to obtain target Guest OS system information according to the control information and storing the target Guest OS system information in a preset shared memory area.
[0053] Optionally, after the control information is transmitted to the Guest OS side, the Guest OS will perform the following operations to obtain the Guest OS system information according to the obtained control information. Specifically, after obtaining the control information in the preset hard interrupt signal, the control information is parsed to determine the command control word corresponding to the control information, that is, to obtain the specific control command to be executed.
[0054] Optionally, an embodiment of the present invention presets a first mapping relationship, in which the correspondence between control information and command control words is recorded. After obtaining the control information, the first mapping relationship is called, and the correspondence recorded in the first preset relationship is queried to directly determine the command control word corresponding to the obtained control information. It is conceivable that other methods can also be used to determine the command control word corresponding to the obtained control information, which also fall within the scope of protection of the present invention without exceeding the scope of the core idea of the present invention.
[0055] Optionally, the embodiment of the present invention further presets a second mapping relationship, in which the corresponding relationship between the command control word and the corresponding Guest OS system information to be obtained is recorded. Therefore, after determining the command control word, the second mapping relationship is called and inserted to determine the Guest OS system information corresponding to the obtained command control word, and the corresponding Guest OS system information is used as the target Guest OS system information.
[0056] Optionally, considering that the amount of data of Guest OS system information is relatively large, in the embodiment of the present invention, not only can the Guest OS be controlled to obtain target Guest OS system information according to the control information input by the debugger, but the Guest OS can also be controlled to obtain some specified Guest OS system information.
[0057] Specifically, a corresponding system information input interface is preset in the Guest OS, and each module or unit in the Guest OS can access its corresponding interface and feedback the system information of the module or unit through the corresponding interface, and finally the Guest OS summarizes the obtained information to obtain the final system operation log. Of course, the corresponding information acquisition module can also be preset to actively obtain the system information of the corresponding module or unit through each interface, and also generate the final system log after the summary is completed.
[0058] According to the above content, it can be known that on the Guest OS side, there are at least two ways to obtain Guest OS system information. One is to collect specified system information through a preset interface; the other is to obtain system target system information based on the obtained control information. It can be imagined that the target system information obtained by the second method may include the specified system information collected by the first method.
[0059] Furthermore, considering that the process of obtaining Guest OS system information may be in the normal working state of Guest OS or in the abnormal state of Guest OS system, the acquisition of Guest OS system information can be realized in two ways. For the acquisition of information in the normal working state of Guest OS, it can be obtained according to the hard interrupt context to avoid the impact on the original business of the system; and for the case where Guest OS is in an abnormal state, it can be obtained according to the process context.
[0060] Specifically, for which of the above methods is selected, corresponding field information can be added to the above command control word, and the method for obtaining the Guest OS system information can be directly determined according to the field information. After obtaining the command control word corresponding to the control information, the field information of the target field in the command control word is extracted, and then the method for obtaining the Guest OS system information is determined according to the field information, and the target Guest OS system information in the Guest OS system is obtained according to the finally determined method.
[0061] After obtaining the target Guest OS system information, the Guest OS can be controlled to store the target Guest OS system information in a preset shared memory area.
[0062] Optionally, considering that when a Guest OS fails, it may not be able to reliably interact with other programs, an embodiment of the present invention proposes a method based on a preset shared memory area to solve the problem of system information transmission. As the name suggests, the preset shared memory area provided by the embodiment of the present invention is visible to both the Guest OS and the Host OS, and both can access it to perform data read and write operations.
[0063] Optionally, the setting of the preset shared memory area may include at least two setting opportunities, one is to allocate memory space according to preset rules immediately after the Hypervisor system is started; the other is to allocate memory space according to preset rules after obtaining the control information received by the Host OS, that is, after the debugging process starts. As an optional implementation method, the aforementioned preset rule can be to determine a memory area with a fixed address as a preset shared memory area, and can temporarily designate an area in the memory as a preset shared memory area according to the system operation status. Any method that can display the designated memory area as a preset shared memory area is optional, and under the premise of not exceeding the core idea of the present invention, it also belongs to the scope of protection of the embodiments of the present invention.
[0064] Optionally, the setting of the preset shared memory area is performed by the Host OS, and after the setting is completed, the preset shared memory area is mapped to the Guest OS side. As long as the Guest OS and the Host OS can share the memory area, the embodiment of the present invention does not limit the specific mapping process.
[0065] S130, controlling the Host OS to read the target Guest OS system information stored in the preset shared memory area.
[0066] After controlling the Guest OS to store the target Guest OS system information in the preset shared memory area, the Host OS can be controlled to read the target Guest OS system information stored in the preset shared memory area, thereby completing the process of obtaining the Guest OS system information.
[0067] As mentioned above, the debugging process of GuestOS is mostly completed based on third-party debugging software. Therefore, after Host OS obtains the target Guest OS system information, it can send the obtained information to the third-party debugging software, and then use the third-party debugging software to complete the analysis and debugging of GuestOS based on the obtained system information.
[0068] Optionally, after the Guest OS completes writing the target Guest OS system information into the preset shared memory area, a notification message may be sent to the Host OS, so that the Host OS performs a read operation according to the obtained notification message.
[0069] In summary, through the system information acquisition method provided by the embodiment of the present invention, control information is transmitted through a preset hard interrupt channel, and the target Guest OS system information is obtained according to the control information. At the same time, the transmission of the target Guest OS system information is realized through a preset shared memory area, so that the Host OS can obtain the Guest OS system information without relying on the network, and then other debugging programs can obtain the Guest OS system information through the Host OS, ensuring the effective implementation of the debugging process.
[0070] The following is an introduction to the system information acquisition device provided in an embodiment of the present invention. The system information acquisition device described below can be considered as a functional module architecture that needs to be set in the central device to implement the system information acquisition method provided in an embodiment of the present invention; the content described below can be cross-referenced with the above.
[0071] Figure 2 A structural block diagram of a system information acquisition device provided by an embodiment of the present invention, referring to Figure 2 , the device may include:
[0072] An acquisition unit 10, configured to acquire control information received by the Host OS;
[0073] The sending unit 20 is used to send the control information to the Guest OS through a preset hard interrupt channel;
[0074] A first control unit 30, configured to control the Guest OS to obtain target Guest OS system information according to the control information and store the target Guest OS system information in a preset shared memory area;
[0075] The second control unit 40 is used to control the Host OS to read the target Guest OS system information stored in the preset shared memory area.
[0076] Optionally, the sending unit 20, when used to send the control information to the GuestOS through a preset hard interrupt channel, specifically includes:
[0077] After acquiring the control information, triggering a preset hard interrupt signal;
[0078] The preset hard interrupt information number is sent to the GuestOS through a preset hard interrupt channel, wherein the preset hard interrupt signal includes the control information.
[0079] Optionally, the first control unit 30 is used to control the Guest OS to obtain the target Guest OS system information according to the control information, specifically including:
[0080] Control the Guest OS to perform the following operations:
[0081] Determining a command control word corresponding to the control information;
[0082] Determine the Guest OS system information corresponding to the command control word, and obtain the target Guest OS system information;
[0083] Obtain the target Guest OS system information.
[0084] Optionally, the first control unit 30 is configured to obtain the target Guest OS system information by:
[0085] Extracting field information of a target field in the command control word;
[0086] Determine a method for obtaining Guest OS system information according to the field information;
[0087] The target Guest OS system information in the Guest OS system is acquired according to the acquisition method.
[0088] Optionally, the acquisition method includes one of acquiring according to a hard interrupt context and acquiring according to a process context.
[0089] Optional, see Figure 3 , Figure 3 Another system information acquisition device provided by an embodiment of the present invention is Figure 2 Based on the embodiment shown, it also includes:
[0090] The third control unit 50 is used to control the Guest OS to obtain the specified Guest OS system information and store it in the preset shared memory area.
[0091] Optional, see Figure 4 , Figure 4 Another system information acquisition device provided by an embodiment of the present invention is Figure 2 Based on the embodiment shown, it also includes:
[0092] The first setting unit 60 is used to allocate memory space according to a preset rule after the Hypervisor system is started to obtain the preset shared memory area.
[0093] Optional, see Figure 5 , Figure 5 Another system information acquisition device provided by an embodiment of the present invention is Figure 2 Based on the embodiment shown, it also includes:
[0094] The second setting unit 70 is used to allocate memory space according to a preset rule to obtain the preset shared memory area after obtaining the control information received by the Host OS.
[0095] Optional, Figure 6 For a structural block diagram of a server provided in an embodiment of the present invention, see Figure 6 As shown, it may include: at least one processor 100, at least one communication interface 200, at least one memory 300 and at least one communication bus 400;
[0096] In the embodiment of the present invention, the number of the processor 100, the communication interface 200, the memory 300, and the communication bus 400 is at least one, and the processor 100, the communication interface 200, and the memory 300 communicate with each other through the communication bus 400; obviously, Figure 6 The communication connections shown for the processor 100, the communication interface 200, the memory 300, and the communication bus 400 are merely optional;
[0097] Optionally, the communication interface 200 may be an interface of a communication module, such as an interface of a GSM module;
[0098] The processor 100 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0099] The memory 300 stores application programs and may include a high-speed RAM memory and may also include a non-volatile memory, such as at least one disk memory.
[0100] The processor 100 is specifically used to execute the application program in the memory to implement the steps of the system information acquisition method in any of the above embodiments.
[0101] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0102] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may 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.
[0103] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0104] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the core concept or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for obtaining system information, characterized in that: include: Acquire control information received by the Host OS; wherein the control information is sent to the Host OS through a debugging program, or a control information input interface is preset in the Host OS, and the control information is input through the input interface; the content of the control information is the content input when debugging the Guest OS; Sending the control information to the Guest OS via a preset hard interrupt channel; Controlling the Guest OS to obtain target Guest OS system information according to the control information and storing the target Guest OS system information in a preset shared memory area; Controlling the Host OS to read the target Guest OS system information stored in the preset shared memory area; The sending the control information to the Guest OS through a preset hard interrupt channel includes: After acquiring the control information, triggering a preset hard interrupt signal; Sending the preset hard interrupt signal to the Guest OS through a preset hard interrupt channel, wherein the preset hard interrupt signal includes the control information; It also includes controlling the Guest OS to obtain the specified Guest OS system information: A corresponding system information entry interface is preset in the Guest OS, and each module or unit in the Guest OS accesses its corresponding interface and feeds back the system information of the module or unit through the corresponding interface. The Guest OS finally summarizes the obtained information to obtain the final system operation log; or a corresponding information acquisition module is preset to actively obtain the system information of the corresponding module or unit through each interface, and also generates the final system log after the aggregation is completed.
2. The system information acquisition method according to claim 1, characterized in that: The controlling the Guest OS to obtain target Guest OS system information according to the control information includes: Control the Guest OS to perform the following operations: Determining a command control word corresponding to the control information; Determine the Guest OS system information corresponding to the command control word, and obtain the target Guest OS system information; Obtain the target Guest OS system information.
3. The system information acquisition method according to claim 2, characterized in that: The obtaining of the target Guest OS system information includes: Extracting field information of a target field in the command control word; Determine a method for obtaining Guest OS system information according to the field information; The target Guest OS system information in the Guest OS system is acquired according to the acquisition method.
4. The system information acquisition method according to claim 3, characterized in that: The acquisition method includes one of acquiring according to a hard interrupt context and acquiring according to a process context.
5. The system information acquisition method according to claim 1, characterized in that: Also includes: The Guest OS is controlled to obtain specified Guest OS system information and store the information in the preset shared memory area.
6. The method for obtaining system information according to any one of claims 1 to 5, characterized in that: The process of setting the preset shared memory area includes: After the Hypervisor system is started, the memory space is allocated according to a preset rule to obtain the preset shared memory area.
7. The system information acquisition method according to claim 6, characterized in that: The process of setting the preset shared memory area also includes: After acquiring the control information received by the Host OS, memory space is allocated according to a preset rule to obtain the preset shared memory area.
8. A system information acquisition device, characterized in that: include: an acquisition unit, configured to acquire control information received by the Host OS; wherein the control information is sent to the Host OS through a debugging program, or a control information input interface is preset in the Host OS, and the control information is input through the input interface; the content of the control information is the content input when debugging the Guest OS; A sending unit, used for sending the control information to the Guest OS through a preset hard interrupt channel; A first control unit, configured to control the Guest OS to obtain target Guest OS system information according to the control information and store the target Guest OS system information in a preset shared memory area; A second control unit, used for controlling the Host OS to read the target Guest OS system information stored in the preset shared memory area; The sending unit sends the control information to the Guest OS through a preset hard interrupt channel, including: After acquiring the control information, triggering a preset hard interrupt signal; Sending the preset hard interrupt signal to the Guest OS through a preset hard interrupt channel, wherein the preset hard interrupt signal includes the control information; It also includes controlling the Guest OS to obtain the specified Guest OS system information: A corresponding system information entry interface is preset in the Guest OS, and each module or unit in the Guest OS accesses its corresponding interface and feeds back the system information of the module or unit through the corresponding interface. The Guest OS finally summarizes the obtained information to obtain the final system operation log; or a corresponding information acquisition module is preset to actively obtain the system information of the corresponding module or unit through each interface, and also generates the final system log after the aggregation is completed.
9. A server, characterized in that: include: Memory and processor; The memory stores a program suitable for execution by the processor to implement the system information acquisition method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for realizing bare nucleus software debugging in multicore processor
CN101135991A
Code tracing method and code tracing system
CN103810099A
Method and apparatus for transmitting data in virtual environment
CN106354670A
Method and device for sharing file systems between multi-operating systems, and electronic device
CN108369604A
A method for managing multi-system shared memory based on hypervisor
CN109240800A
