Simulation check point construction method and device based on event driving, equipment and medium
Through the event-driven simulation checkpoint construction method, the problem of the time-consuming creation of checkpoints in Gem5 simulation system under large workloads is solved. The event-driven simulation system and disk mirroring technology are used to generate efficient checkpoints, which improves the simulation efficiency and reliability.
Patent Information
- Application Number
- CN202411302659.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2024-12-24
AI Technical Summary
When the Gem5 simulation system runs large workloads, it takes a long time to create checkpoints, resulting in long wait times for simulation, affecting the simulation efficiency and effect.
Using the event-driven simulation checkpoint construction method, by configuring the event-driven simulation system and disk image, pausing the simulation system operation in the preset target area of interest, saving disk information and incorporating it into the disk image, reading and identifying the simulation of physical device components Fill in the checkpoint template to generate efficient checkpoints.
It significantly reduces the waiting time for obtaining target checkpoints, improves simulation efficiency, ensures the reliability and continuity of simulation data, and is suitable for complex scenarios and long-running simulation tasks.
Smart Images

Figure CN119180147A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer system simulation and emulation, and in particular relates to a method, device, equipment and medium for constructing simulation checkpoints based on event-driven. Background Art
[0002] At present, among all kinds of simulation systems, Gem5 simulation system is generally used more. Gem5 simulation system can simulate the whole system, that is, simulate the whole computer system including processor, memory, equipment, etc. It can simulate different processor architectures and operating system environments for software development and debugging.
[0003] Generally, when using the Gem5 simulation system, you need to configure CheckPoint, which is triggered by the mark point inside the simulation system or manually sent by the user to create a checkpoint to continue running or interrupt the simulation system, so that the computer system can be simulated in a targeted manner. However, when the Gem5 simulation system runs complex and large workloads, it takes a long time to create and run each checkpoint, resulting in a long simulation waiting time, which leads to a long time to create a single checkpoint, resulting in poor effect of accelerating the overall simulation process based on checkpoints, and cannot meet the simulation requirements. Summary of the invention
[0004] The present invention provides an event-driven simulation checkpoint construction method to at least solve the problem in the prior art that when the Gem5 simulation system runs a large workload, the simulation waiting time is long, resulting in a long time consumption in creating a single checkpoint, resulting in poor effect of accelerating the overall simulation process based on checkpoints and failure to meet simulation requirements.
[0005] Methods include:
[0006] S101: In the simulation system, configure physical device components and disk images consistent with the event-driven simulation system;
[0007] S102: Open the disk snapshot, define a simulation control component to the disk image, enable the monitoring port, and start the simulation system at the same time;
[0008] S103: running a preset workload in the simulation system, and when the simulation process of the preset workload runs to a preset target area of interest, pausing the simulation system based on a monitoring port and freezing the simulation state;
[0009] S104: merging the disk information generated by running the simulation process to the preset target area of interest into the disk image;
[0010] S105: respectively reading and saving the simulation data information of each physical unit in the physical device component, and marking the simulation data information of each physical unit;
[0011] S106: Retrieve the checkpoint currently selected by the simulation system for the physical device component, and obtain corresponding physical unit simulation data information according to the checkpoint, and fill in the checkpoint template;
[0012] S107: Based on the simulation running conditions, continue or end the current running of the simulation system.
[0013] It should be further explained that the physical units in the physical device components in step S101 include but are not limited to: CPU, memory, PCI device, serial port device and disk;
[0014] The information of the physical unit in the physical device component includes but is not limited to: CPU architecture, memory area, PCI device type, disk interface information, serial port type, voltage domain, clock frequency, and interrupt instructions.
[0015] It should be further explained that in the method, the simulation system pause operation instruction, the acquisition instruction and export instruction based on the simulation data information of each physical unit in the physical device component, the remote debugging instruction based on the simulation system, and the instruction to check the address of each physical unit in the physical device component are defined respectively.
[0016] It should be further explained that S102 also includes: constructing a disk image in RAW format in the simulation system;
[0017] Adding the disk image in the RAW format to be used to the simulation system through the simulation control component;
[0018] After the disk snapshot is enabled, the disk image copy process is executed based on the preset disk image copy instruction.
[0019] It should be further explained that step S106 also includes: matching each physical unit information in the physical device component with the identifier, and filling in the checkpoint template of the event-driven simulation system;
[0020] Retrieving a preset target region of interest in the checkpoint template as a target region of interest for the event-driven simulation system;
[0021] The target region of interest includes a plurality of checkpoints.
[0022] It should be further explained that in the method, based on the preset simulation drive control instructions, the event-driven simulation system is started, so that the event-driven simulation system generates disk images corresponding to multiple checkpoints based on the target area of interest, and the checkpoint corresponding to the event-driven simulation system runs the recovery process.
[0023] It should be further explained that the method also includes:
[0024] Configure physical device components and disk images consistent with the simulation system in the event-driven simulation system;
[0025] Configuring a boot loader process for starting and running a physical device component in the event-driven simulation system;
[0026] The event-driven simulation system is started to run and run to the target area of interest to perform the simulation process.
[0027] The present application also provides an event-driven simulation checkpoint construction device, which includes: an event-driven simulation system, a simulation system, a device configuration module, a simulation monitoring module, a simulation operation monitoring module, an information processing module, an information reading and storage module, an information detection processing module, and a simulation operation control module;
[0028] The device configuration module is used to configure the physical device components and disk images consistent with the event-driven simulation system in the simulation system;
[0029] A simulation monitoring module is used to open a disk snapshot, define a simulation control component to the disk image, enable a listening port, and start a simulation system;
[0030] A simulation operation monitoring module is used to run a preset workload in the simulation system, and when the simulation process of the preset workload runs to a preset target area of interest, based on a monitoring port, suspend the operation of the simulation system and freeze the simulation state;
[0031] An information processing module, used for incorporating disk information generated by running the simulation process to a preset target area of interest into the disk image;
[0032] The information reading and storing module is used to read and store the simulation data information of each physical unit in the physical device component respectively, and to identify the simulation data information of each physical unit;
[0033] An information detection processing module, used to retrieve the checkpoint currently selected by the simulation system for the physical device component, and obtain the corresponding physical unit simulation data information according to the checkpoint, and fill it into the checkpoint template;
[0034] The simulation operation control module continues or ends the current operation of the simulation system based on the simulation operation conditions.
[0035] According to another embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the event-driven simulation checkpoint construction method when executing the program.
[0036] According to another embodiment of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the event-driven simulation checkpoint construction method are implemented.
[0037] It can be seen from the above technical solutions that the present invention has the following advantages:
[0038] The event-driven simulation checkpoint construction method provided by the present invention is to configure physical device components and disk images in the QEMU simulation system; open the disk snapshot and open the QEMU simulation system at the same time; when the simulation process of the preset workload runs to the preset target interest area, suspend the operation of the QEMU simulation system; merge the disk information into the disk image; read and save the simulation data information; call the checkpoint currently selected by the QEMU simulation system for the physical device component, and according to the checkpoint, obtain the corresponding physical unit simulation data information, and fill it into the checkpoint template that meets the use of the Gem5 simulation system. This method uses the QEMU simulation system with higher simulation efficiency than the Gem5 simulation system to construct the target Gem5 simulation system checkpoint.
[0039] On the basis of ensuring the adaptation of various Gem5 simulation scenarios and simulation workloads, the present invention uses the QEMU simulation system with higher basic simulation performance and wider hardware acceleration coverage to efficiently generate checkpoints. In some scenarios, the QEMU simulation system can build checkpoints with a local operating efficiency close to that of the physical host, which greatly reduces the waiting time for obtaining the target checkpoint and indirectly improves the acceleration effect of the checkpoint-based Gem5 simulation system.
[0040] The method of the present invention can pause and save the state when the simulation process runs to a preset target area of interest by creating a checkpoint, and then resume the simulation from the checkpoint, avoiding repeating the entire simulation process from the beginning, thereby significantly improving the simulation efficiency. During the simulation process, the reliability of the simulation data can be ensured by creating checkpoints regularly or on demand. In simulation tasks that need to simulate complex scenarios or run for a long time, the checkpoint function can ensure the continuity and reliability of the simulation and avoid unpredictable problems caused by a single simulation time that is too long. By saving checkpoints at different stages, the system behavior and performance in different simulation scenarios can be easily compared, providing strong support for system optimization and performance evaluation. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the description 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 these drawings without paying creative work.
[0042] Figure 1 Construct a method flow chart for event-driven simulation checkpointing;
[0043] Figure 2 A flow chart of an embodiment of a method for constructing a simulation checkpoint based on event-driven;
[0044] Figure 3 A detailed flowchart for Gem5 simulation system recovery from checkpoints;
[0045] Figure 4 Schematic diagram of the device construction for event-driven simulation checkpoints;
[0046] Figure 5 Schematic diagram of the hardware structure of the electronic device. DETAILED DESCRIPTION
[0047] The specific steps of the event-driven simulation checkpoint construction method are described in detail below. For the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are provided to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details.
[0048] It should be understood that when used in the present specification, the term "includes" indicates the presence of the described features, integral bodies, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integral bodies, steps, operations, elements, components and / or their collections. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0049] It should be understood that the "one or more" mentioned in this application refers to one, two or more than two, and the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B. The "and / or" in this article is just a way to describe the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0050] In order to clearly describe the technical solution of the present application, the words "first", "second" and the like are used to distinguish the same or similar items with substantially the same functions and effects. Those skilled in the art can understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit the difference.
[0051] The phrases such as "one embodiment" or "some embodiments" described in the present application mean that the specific features, structures or characteristics described in the embodiment are included in one or more embodiments of the present application. Therefore, the phrases such as "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments" etc. that appear in different places in the present application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.
[0052] 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.
[0053] For this application, the event-driven simulation checkpoint construction method involves a simulation system and an event-driven simulation system. In order to fully illustrate the event-driven simulation checkpoint construction method of this application, the simulation system involved in this embodiment can be a QEMU simulation system. The event-driven simulation system can be a Gem5 simulation system.
[0054] It should be noted that the QEMU emulation system (Quick EMUlator) is an open source virtualization software and hardware emulator that can realize complete system emulation or process-level emulation.
[0055] The event-driven simulation checkpoint construction method involved in this application mainly uses the QEMU simulation system to simulate various virtual devices, including but not limited to processors, network interfaces, storage devices, storage devices, etc. During the simulation operation, the virtual machine state can be saved and restored without modifying the original disk image based on the snapshot function.
[0056] In the QEMU emulation system, when the same environment and the same devices as the Gem5 emulation system are configured, users can customize the configuration of the virtual machine as needed to meet the emulation requirements.
[0057] In this embodiment, the use of the QEMU simulation system can be based on Ubuntu configuration disk image. Use the qemu-img command to create a virtual hard disk file. After the QEMU simulation system is started, the disk image is loaded and the operating system is installed and used.
[0058] It can be seen that the device configuration and simulation workload in the QEMU simulation system are consistent with the target Gem5 simulation system. After the QEMU simulation system runs to the target area of interest, its operation is paused and the relevant information is extracted. The relevant information of the device is processed according to the Gem5 checkpoint template. In this way, a checkpoint file applied to the target Gem5 simulation system can be generated.
[0059] The specific method steps of this embodiment are described in detail below. Figure 1 FIG. 1 is a flowchart of a method for constructing a simulation checkpoint based on event-driven in a specific embodiment, the method comprising:
[0060] S101: In the QEMU simulation system, configure physical device components and disk images that are consistent with those of the Gem5 simulation system.
[0061] In some embodiments, a physical device component is configured consistent with the Gem5 simulation system, and the physical units in the physical device component include but are not limited to: CPU, memory, PCI device, serial port device, and disk.
[0062] The information of the physical unit in the physical device component may include but is not limited to: CPU architecture, memory area, PCI device type, disk interface information, serial port type, voltage domain, clock frequency, interrupt instructions, etc.
[0063] Optionally, prepare a disk image file, which can contain necessary data such as the operating system and application programs, and is used to simulate the disk state of the actual system in the simulation. In this way, the simulation environment of the QEMU simulation system can be ensured to be consistent with the Gem5 simulation system, thereby improving the accuracy of the simulation results. The introduction of disk images simplifies the complexity of system configuration and facilitates quick startup and restoration of simulation states.
[0064] S102: In the QEMU simulation system, a disk snapshot is opened, a simulation control component is defined to the disk image, a listening port is enabled, and the simulation system is opened at the same time.
[0065] It should be noted that the simulation control component is a VirtIO block. The VirtIO block is an I / O virtualization framework that can abstract a set of general simulation device IOs in a virtualization hypervisor.
[0066] In some embodiments, the drive parameter can be used in conjunction with device virtio-blk-pci to specify a physical device component corresponding to a VirtIO block, and the physical device component can be mapped to a disk image file.
[0067] In some specific embodiments, the QEMU emulation system can create a snapshot of the disk, and the snapshot can be dynamically created during the emulation process by the QEMU management server of the QEMU emulation system. In order to prepare for the creation of the snapshot at startup, the QEMU management server can be configured to be interactively enabled.
[0068] Exemplarily, a listening port can be configured in the QEMU simulation system to access the QEMU simulation system, and the listening port number can be set to run in a mode where the server continuously listens. After all simulation parameters are configured, the QEMU simulation system is started and kept running, by listing all parameters in the command line and running.
[0069] S103: In the QEMU simulation system, a preset workload is run, and when the simulation process of the preset workload runs to a preset target area of interest, based on a monitoring port, the QEMU simulation system is paused and the simulation state is frozen.
[0070] In some embodiments, in the QEMU simulation system, when the workload runs to an area of interest, it can be connected to the QEMU management server of the QEMU simulation system through a set listening port, such as setting the listening port to 1234 or 5678, as needed.
[0071] After connecting to the listening port 1234, you can send the stop command to pause the execution of the QEMU simulation system.
[0072] This embodiment does not completely stop the QEMU simulation system from running, but can also find or write a script to send a stop command through the QEMU management server interface of the QEMU simulation system as needed. The suspend command can also be used to suspend the virtual machine state.
[0073] In some specific embodiments, the QEMU simulation system has a QEMU management server, which allows the user to send commands to control the virtual machine when QEMU is running. If the simulation needs to be frozen, a stop or suspend command can be sent through the QEMU management server.
[0074] For this embodiment, the client can be connected to the QEMU management server, which can be achieved by using the QEMU management server port specified when QEMU is started, or by using the default console of QEMU.
[0075] Optionally, after the client is connected to the QEMU management server, a suspend command can be sent to freeze the simulation. The QEMU management server in this embodiment has a QEMU management protocol that can be used to interact with other clients. Richer functions and interfaces can be provided. A stop command, such as stopping the simulation execution or a suspend-vm command, can also be sent to freeze the simulation.
[0076] S104: The disk information generated by running the simulation process to the preset target area of interest is merged into the disk image.
[0077] In some embodiments, a "commit all" instruction may be sent to a QEMU management server in the QEMU simulation system to merge the disk changes generated during the simulation running to the Workload interest area into the disk image.
[0078] Here, the disk information (such as file modification, data writing, etc.) generated during the simulation process running to the preset target area of interest can be merged into the original disk image. In this way, the integrity and latest status of the disk image are maintained, providing an accurate data basis for subsequent simulation or analysis.
[0079] S105: respectively reading and saving the simulation data information of each physical unit in the physical device component, and marking the simulation data information of each physical unit.
[0080] In some embodiments, the simulation data information of each physical device component in the QEMU simulation system is read separately. The physical units in the physical device component include but are not limited to: CPU, memory, PCI device, serial port device and disk. The simulation data information of each physical unit is marked and saved for subsequent retrieval and use. In this way, the detailed status information of each physical device component in the simulation process is collected to meet the needs of simulation.
[0081] S106: Retrieve the checkpoint currently selected by the simulation system for the physical device component, and obtain corresponding physical unit simulation data information according to the checkpoint, and fill in the checkpoint template.
[0082] In some embodiments, the checkpoint template may include but is not limited to DiskInfo (disk information), MemInfo (memory information), RegInfo (register information), etc. Here, it can be determined based on the simulation requirements of the QEMU simulation system and the hardware configuration of the Gem5 simulation system.
[0083] In some embodiments, the configuration information of the current physical device component is obtained: the configuration information of the current physical device component, such as disk size, memory size, register configuration, etc., is obtained through QEMU simulation system commands.
[0084] The physical device component configuration information can be used to fill in the corresponding entries in the checkpoint template. According to the determined checkpoint template entry name and the obtained physical device component configuration information, a Gem5 checkpoint template is constructed.
[0085] Optionally, a Gem5 checkpoint template can contain all necessary entries, and each entry should have a corresponding placeholder or format requirement for subsequent filling.
[0086] This embodiment can traverse each entry in the Gem5 checkpoint template, retrieve corresponding hardware configuration information according to the entry name, and fill the retrieved information into the corresponding entry in the format required by the template.
[0087] After all entries are retrieved and updated, the constructed checkpoint template is saved as a CKPT file. The CKPT file here contains complete information about the current simulation state and can be used for subsequent recovery or analysis.
[0088] It can be seen that the event-driven simulation checkpoint construction method of this embodiment can process each entry in the Gem5 checkpoint template based on the QEMU simulation system to improve the simulation efficiency: by creating and restoring checkpoints, time-consuming simulation stages can be skipped, thereby improving the overall efficiency of the simulation. The checkpoint file of this embodiment contains complete information about the simulation status, which can assist subsequent debugging and analysis work and help developers better understand the system status. In simulation tasks that need to simulate complex scenarios or run for a long time, the checkpoint function can ensure the continuity and reliability of the simulation.
[0089] S107: Based on the simulation running conditions, continue or end the current running of the simulation system.
[0090] In some embodiments, considering that the QEMU simulation system is an open source machine simulator and virtualizer, it is possible to simulate a complete computer system. In the QEMU simulation system, the current simulation operation can be continued or terminated according to the simulation needs.
[0091] For example, if the QEMU simulation is paused or suspended, the simulation can be continued by sending a suspend command to the QEMU management server and a resume or cont command.
[0092] To end the QEMU simulation run, this can be achieved by sending an exit command to the QEMU management server.
[0093] In this embodiment, the QEMU simulation system provides commands and options that meet the event-driven simulation checkpoint construction method, allowing the user to flexibly control the state of the simulation operation as needed. The simulation environment based on the QEMU simulation system is stable and reliable, and can simulate the operation effect close to the real hardware. This implementation can improve the simulation efficiency and reliability based on the construction of the Gem5 checkpoint template and the control of the QEMU simulation system. By utilizing the functions of the QEMU simulation system, the simulation and testing of the computer system can be carried out more effectively.
[0094] On the basis of the above embodiment, in order to further improve the reliability of the event-driven simulation checkpoint construction method provided in the above embodiment, the following is a more specific implementation method. Figure 2 As shown, in one embodiment, the event-driven simulation checkpoint construction method includes the following specific steps:
[0095] Step 1: Define the physical device components in the QEMU simulation system, as well as the information of the physical units in the physical device components, including CPU architecture, memory size, CPU core type, number of CPU cores, and disk image. The above physical device components and information are consistent with the Gem5 simulation system.
[0096] More specifically, in order to ensure that the checkpoints generated by the QEMU simulation system can be correctly used by the target Gem5 simulation system, it is necessary to ensure that the main hardware device configurations of the two are consistent. This embodiment can configure the CPU architecture, memory area, PCI device, serial port, voltage domain, clock frequency, interrupt, etc. The information configured here can be implemented by modifying the relevant interface in QEMU, and when the target Gem5 simulation system is not sensitive to the configuration type of some devices, since modifying the configuration in Gem5 is more flexible and convenient than QEMU, the configuration of this part of the devices in the target Gem5 simulation system can be modified to be consistent with the QEMU simulation system, and at the same time, a reasonable Bootloader is used to ensure the correct loading of the above devices when the system starts.
[0097] Step 2: Enable disk snapshot in the QEMU emulation system startup command and add a VirtIO block device to connect to the disk image.
[0098] In some embodiments, the QEMU management server is enabled in the QEMU simulation system startup command, and the listening port can be set to 1234. After the setting is completed, the QEMU simulation system is started and kept running. The specific setting method is performed as in the above embodiment.
[0099] Step 3: Run the preset workload Workload in the QEMU simulation system. After the simulation of the Workload enters the target area of interest, send a "stop" command to the QEMU management server through port 1234 to suspend the operation of the QEMU simulation system and freeze its simulation state.
[0100] This embodiment does not completely stop the operation of the QEMU simulation system for pausing the QEMU simulation system. You can also find or write a script as needed to send a stop command through the QEMU management server interface of the QEMU simulation system. You can also use the suspend command to suspend the virtual machine state. There is a QEMU management server in the QEMU simulation system, and the QEMU management server allows users to send commands to control the virtual machine when QEMU is running. If you need to freeze the simulation, you can send a stop or suspend command through the QEMU management server.
[0101] Step 4: Send a commit all command to the QEMU management server to merge the disk changes generated when the QEMU simulation system runs to the Workload area of interest into the disk image, and copy the disk image to CopyDisk (RAW format).
[0102] In some embodiments, a disk image in RAW format is constructed in the simulation system; the disk image in RAW format to be used is added to the simulation system through a simulation control component; after the disk snapshot is opened, the disk image copy process is executed based on a preset disk image copy instruction.
[0103] Specifically, after the QEMU simulation system runs to the area of interest of the simulation workload, it is necessary to obtain relevant pre-information to build a checkpoint file, including: memory information, CPU register information, and disk interface information.
[0104] In the QEMU simulation system, you can send control commands to the QEMU management server through the QEMU control terminal in the QEMU simulation system. For example, the "stop" command can pause the operation of the simulation system; the "dump guest memory" command can export the memory status information in the current simulation system to the specified file; the "gdbserver" command can start the QEMU management server in the current simulation system. After connecting to the QEMU management server, the "info registers all" command can be used to obtain all register information in the simulation CPU; the "xp" command can view the contents of the specified memory address (including the memory address that stores disk device interface information).
[0105] In some embodiments, the target Gem5 emulation system can be restored from the checkpoint constructed by the QEMU emulation system, and when the operating system is loaded normally, the complete disk image generated when the checkpoint is generated can be generated.
[0106] For the method of the present application, the running Gem5 simulation system and QEMU simulation system can use a disk image in RAW format (.img or .raw extension).
[0107] According to an embodiment of the present application, when the QEMU simulation system performs pre-information acquisition, the disk image can be copied and can be used for subsequent checkpoint recovery.
[0108] In order to improve the running speed of the QEMU simulation system, this embodiment can also enable the snapshot function of the disk image to improve the storage efficiency during simulation. Considering that the disk image in RAW format cannot directly support the enabling of the snapshot function, this embodiment adds the disk image to be used as a VirtIO block device to the QEMU simulation system.
[0109] As a method of the present application, after the disk snapshot is enabled in the QEMU simulation system, all changes to the disk will be made in the temporary storage space. In order to merge the disk changes generated when running the simulation workload into the disk image, it is also necessary to enter the "commit all" command in the QEMU control terminal before copying the disk image.
[0110] For S105 of this embodiment, it is specifically limited to respectively reading and saving the simulation data information of each physical unit in the physical device component, and marking the simulation data information of each physical unit. The following steps 5, 6 and 7 are used as specific expansion instructions.
[0111] Step 5: Send the "xp" command to the QEMU management server, read the relevant content in the memory address storing the disk device interface information, and save the content as DiskInfo as an identifier.
[0112] Step 6: Send a "dump guest memory" command to the QEMU management server to export the memory status information in the current QEMU simulation system, and save the information as MemInfo as an identifier.
[0113] Step 7: Send the "gdbserver" command to the QEMU management server to start the GDB server in the current QEMU simulation system, connect to the GDB server and send the "info registers all" command to obtain all register information in the current simulation CPU, and save the information as RegInfo as an identifier.
[0114] Step 8: Get the Gem5 checkpoint template under the current hardware configuration. According to the names of each item in the template, get the corresponding content in DiskInfo, MemInfo, and RegInfo, and fill them into the checkpoint template. After all items are retrieved and updated, the checkpoint is built and saved as CKPT.
[0115] In some specific embodiments, after obtaining various pre-information contents, various memory information, various simulation CPU register information, and various disk interface information are filled into the Gem5 checkpoint template applicable to this simulation configuration, keeping the entry names corresponding one by one, so that a checkpoint file corresponding to the target area of interest in the simulation workload and adapted to the target Gem5 simulation system is obtained.
[0116] In this embodiment, if multiple checkpoints are to be obtained in a single region of interest, the QEMU simulation system only needs to be resumed from a suspended operation, and after continuing to run to a certain state, the above steps can be repeated to obtain another checkpoint.
[0117] In this embodiment, in order to further improve the operating efficiency of the QEMU simulation system, when the relevant conditions for enabling KVM or HVF are met, KVM or HVF can be used to accelerate the QEMU simulation process.
[0118] In other embodiments, after the checkpoint file of the target area of interest for the specified simulation workload is constructed using the QEMU simulation system, the target Gem5 simulation system can be based on the checkpoint file and the disk image copied in the checkpoint generation process of the QEMU simulation system. In this embodiment, the "restore" and "disk-image" options related content can be specified in the Gem5 simulation system startup command to realize the operation recovery of the target Gem5 simulation system from the above checkpoint.
[0119] Step 9: The QEMU simulation system continues or ends the current simulation run.
[0120] Based on the above-mentioned event-driven simulation checkpoint construction method, this embodiment can use the QEMU simulation system with high simulation performance and wide virtualization support, and perform simulation with the main hardware device configuration and simulation workload consistent with the target Gem5 simulation system. When the simulation runs to the target area of interest, the expected checkpoint can be generated according to the Gem5 checkpoint template by exporting the relevant status information in the QEMU simulation system at this time.
[0121] like Figure 3 A specific flow chart of Gem5 simulation system recovery from a checkpoint in this embodiment is shown.
[0122] Specifically, after the construction of the Gem5 simulation system checkpoint is completed based on the event-driven simulation checkpoint construction method, the method for resuming the operation of the target Gem5 simulation system from the checkpoint includes the following steps:
[0123] Step 301: Set the hardware configuration in the Gem5 simulation system including: memory area, PCI device, serial port, voltage domain, clock frequency, interrupt, and keep it consistent with QEMU.
[0124] Step 302: Specify a Bootloader that can normally run the above hardware configurations in the Gem5 simulation system startup command.
[0125] In this embodiment, the checkpoint to be restored can be specified as CKPT and the disk image can be specified as CopyDisk in the Gem5 simulation system startup command. After completing the above settings, the Gem5 simulation system is started.
[0126] Step 303: The Gem5 simulation system is restored to the expected area of interest of the workload and performs subsequent simulation processes.
[0127] Step 304: The Gem5 simulation system ends the current simulation run.
[0128] In the event-driven simulation checkpoint construction method, this embodiment takes into account that when the Gem5 simulation system faces a complex and large simulation workload, it only needs to modify the configuration of the Gem5 simulation system or the QEMU simulation system to build checkpoints at a rate higher than the Gem5 simulation system. When relevant hardware acceleration can be enabled, checkpoints can even be generated at a speed close to that of the physical host.
[0129] The method of this embodiment can be applied to various complex simulation loads and operating system calls during the simulation process, ensuring that the constructed checkpoints can be correctly identified by the target Gem5 simulation system and the simulation operation can be restored.
[0130] The following is an embodiment of an event-driven simulation checkpoint construction device provided in an embodiment of the present disclosure. The device and the event-driven simulation checkpoint construction method of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the event-driven simulation checkpoint construction device, please refer to the embodiment of the above-mentioned event-driven simulation checkpoint construction method.
[0131] A mobile terminal implementing various embodiments of the present invention will now be described with reference to the accompanying drawings. In the subsequent description, suffixes such as "module", "component" or "unit" used to represent elements are used only to facilitate the description of the embodiments of the present invention and have no specific meaning in themselves. Therefore, "module" and "component" can be used interchangeably.
[0132] like Figure 4 As shown, the device includes: an event-driven simulation system, a simulation system, a device configuration module, a simulation monitoring module, a simulation operation monitoring module, an information processing module, an information reading and storage module, an information detection processing module and a simulation operation control module;
[0133] The device configuration module is used to configure the physical device components and disk images consistent with the event-driven simulation system in the simulation system;
[0134] A simulation monitoring module is used to open a disk snapshot, define a simulation control component to the disk image, enable a listening port, and start a simulation system;
[0135] A simulation operation monitoring module is used to run a preset workload in the simulation system, and when the simulation process of the preset workload runs to a preset target area of interest, based on a monitoring port, suspend the operation of the simulation system and freeze the simulation state;
[0136] An information processing module, used for incorporating disk information generated by running the simulation process to a preset target area of interest into the disk image;
[0137] The information reading and storing module is used to read and store the simulation data information of each physical unit in the physical device component respectively, and to identify the simulation data information of each physical unit;
[0138] An information detection processing module, used to retrieve the checkpoint currently selected by the simulation system for the physical device component, and obtain the corresponding physical unit simulation data information according to the checkpoint, and fill it into the checkpoint template;
[0139] The simulation operation control module continues or ends the current operation of the simulation system based on the simulation operation conditions.
[0140] The event-driven simulation checkpoint construction device of this embodiment can build checkpoints for the Gem5 simulation system based on the same device configuration and the same workload by running the QEMU simulation system, extract the QEMU simulation system status information in the expected area of interest, and combine the Gem5 simulation system checkpoint template to quickly generate checkpoints suitable for the original target Gem5 simulation system.
[0141] The same device configuration, workload, and Gem5 checkpoint template in this embodiment ensure that the target Gem5 simulation system can normally identify and fast-forward to the expected area of interest based on the generated checkpoint. In the expected area of interest, a series of operation instructions of the QEMU management control server can conveniently and efficiently obtain the status information of the QEMU simulation system at this time.
[0142] Based on the above method, this embodiment also provides an electronic device, Figure 5 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0143] The electronic device 500 includes, but is not limited to, components such as a processor 501, a network module 502, an audio output unit 503, an input unit 504, a display unit 506, a user input unit 507, an interface unit 508, and a memory 509. Those skilled in the art will appreciate that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0144] In embodiments of the present invention, electronic devices include, but are not limited to, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described and / or required herein.
[0145] In the embodiment of the present application, the processor 501 can be implemented by using at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a processor, a controller, a microcontroller, a microprocessor, and an electronic unit designed to perform the functions described herein. In some cases, such an implementation can be implemented in a controller. For software implementation, implementations such as processes or functions can be implemented with separate software modules that allow execution of at least one function or operation. The software code can be implemented by a software application (or program) written in any appropriate programming language, and the software code can be stored in a memory and executed by a controller.
[0146] The processor 501 provides the user with wireless Internet access through the network module 502, thereby realizing the transmission and communication of data information in this application.
[0147] The audio output unit 503 may provide audio output related to a specific function executed by the processor 501. The audio output unit 503 includes a speaker, a buzzer, a receiver, and the like.
[0148] The input unit 504 may include a graphics processing unit (GPU) and a microphone. The graphics processing unit processes image data of a still picture or a video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode.
[0149] The display unit 506 is used to display information input by the user or information provided to the user. The display unit 506 may include a display panel, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
[0150] The user input unit 507 may include, but is not limited to, a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0151] The interface unit 508 is an interface for connecting an external device to the electronic device 500. The memory 509 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0152] In addition, the electronic device 500 includes some functional modules not shown, which will not be described in detail here.
[0153] Those of ordinary skill 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, 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 terms of function in the above description. 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.
[0154] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the equipment, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. Exemplarily, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0155] This embodiment also provides a storage medium, in which a program product capable of implementing an event-driven simulation checkpoint construction method is stored.
[0156] The specific contents that can be stored include:
[0157] In the simulation system, configure the physical device components and disk images consistent with the event-driven simulation system;
[0158] Open the disk snapshot, define a simulation control component to the disk image, enable the listening port, and start the simulation system;
[0159] In the simulation system, a preset workload is run, and when the simulation process of the preset workload runs to a preset target area of interest, the simulation system is paused based on a monitoring port, and the simulation state is frozen;
[0160] The disk information generated by running the simulation process to the preset target area of interest is merged into the disk image;
[0161] Respectively read and save the simulation data information of each physical unit in the physical device component, and identify the simulation data information of each physical unit;
[0162] Retrieving the checkpoint currently selected by the simulation system for the physical device component, and obtaining the corresponding physical unit simulation data information according to the checkpoint, and filling it into the checkpoint template;
[0163] Based on the simulation running conditions, continue or end the current running of the simulation system.
[0164] In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present disclosure described in the above “Exemplary Method” section of this specification.
[0165] The storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0166] 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 spirit 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 constructing simulation checkpoints based on event-driven, characterized in that: Methods include: S101: In the simulation system, configure physical device components and disk images consistent with the event-driven simulation system; S102: Open the disk snapshot, define a simulation control component to the disk image, enable the monitoring port, and start the simulation system at the same time; S103: running a preset workload in the simulation system, and when the simulation process of the preset workload runs to a preset target area of interest, pausing the simulation system based on a monitoring port and freezing the simulation state; S104: merging the disk information generated by running the simulation process to the preset target area of interest into the disk image; S105: respectively reading and saving the simulation data information of each physical unit in the physical device component, and marking the simulation data information of each physical unit; S106: Retrieve the checkpoint currently selected by the simulation system for the physical device component, and obtain corresponding physical unit simulation data information according to the checkpoint, and fill in the checkpoint template; S107: Based on the simulation running conditions, continue or end the current running of the simulation system.
2. The event-driven simulation checkpoint construction method according to claim 1, characterized in that: The physical units in the physical device component in step S101 include but are not limited to: CPU, memory, PCI device, serial port device and disk; The information of the physical unit in the physical device component includes but is not limited to: CPU architecture, memory area, PCI device type, disk interface information, serial port type, voltage domain, clock frequency, and interrupt instructions.
3. The event-driven simulation checkpoint construction method according to claim 1, characterized in that: In the method, the simulation system pause operation instruction, the acquisition instruction and export instruction based on the simulation data information of each physical unit in the physical device component, the remote debugging instruction based on the simulation system, and the address instruction of each physical unit in the physical device component are defined respectively.
4. The event-driven simulation checkpoint construction method according to claim 1, characterized in that: S102 also includes: constructing a disk image in a RAW format in the simulation system; Adding the disk image in the RAW format to be used to the simulation system through the simulation control component; After the disk snapshot is enabled, the disk image copy process is executed based on the preset disk image copy instruction.
5. The event-driven simulation checkpoint construction method according to claim 1, characterized in that: Step S106 also includes: matching each physical unit information in the physical device component with the identifier, and filling in the checkpoint template of the event-driven simulation system; Retrieving a preset target region of interest in the checkpoint template as a target region of interest for the event-driven simulation system; The target region of interest includes a plurality of checkpoints.
6. The event-driven simulation checkpoint construction method according to claim 5, characterized in that: In the method, based on preset simulation drive control instructions, an event-driven simulation system is started, so that the event-driven simulation system generates disk images corresponding to multiple checkpoints based on a target area of interest, and the checkpoints corresponding to the event-driven simulation system run a recovery process.
7. The event-driven simulation checkpoint construction method according to claim 1, characterized in that: The method also includes: Configure physical device components and disk images consistent with the simulation system in the event-driven simulation system; Configuring a boot loader process for starting and running a physical device component in the event-driven simulation system; The event-driven simulation system is started to run and run to the target area of interest to perform the simulation process.
8. An event-driven simulation checkpoint construction device, characterized in that: The device is used to implement the event-driven simulation checkpoint construction method according to any one of claims 1 to 7; The device includes: an event-driven simulation system, a simulation system, an equipment configuration module, a simulation monitoring module, a simulation operation monitoring module, an information processing module, an information reading and storage module, an information detection processing module and a simulation operation control module; The device configuration module is used to configure the physical device components and disk images consistent with the event-driven simulation system in the simulation system; A simulation monitoring module is used to open a disk snapshot, define a simulation control component to the disk image, enable a listening port, and start a simulation system; A simulation operation monitoring module is used to run a preset workload in the simulation system, and when the simulation process of the preset workload runs to a preset target area of interest, based on a monitoring port, suspend the operation of the simulation system and freeze the simulation state; An information processing module, used for incorporating disk information generated by running the simulation process to a preset target area of interest into the disk image; The information reading and storing module is used to read and store the simulation data information of each physical unit in the physical device component respectively, and to identify the simulation data information of each physical unit; An information detection processing module, used to retrieve the checkpoint currently selected by the simulation system for the physical device component, and obtain the corresponding physical unit simulation data information according to the checkpoint, and fill it into the checkpoint template; The simulation operation control module continues or ends the current operation of the simulation system based on the simulation operation conditions.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the event-driven simulation checkpoint construction method according to any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the event-driven simulation checkpoint construction method according to any one of claims 1 to 7 are implemented.
