IO anomaly checking method, system and device of controller simulation system and medium
By numbering and address checking the IO requests of the NVMe controller simulation system, the virtual machine downtime caused by core configuration exceptions is solved, fast positioning and error interception are achieved, and the stability of the simulation system and problem positioning efficiency are improved.
Patent Information
- Application Number
- CN202411007643.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-12
AI Technical Summary
In the NVMe controller simulation system, IO request errors caused by core configuration exceptions often cause abnormal downtime in the virtual machine operating system, affecting the continuity of simulation tests and the difficulty of problem location.
By numbering IO requests, parsing and recording the IO PRP address list, checking the host address during IO processing, intercepting exception access and reporting errors, and assisting in problem location.
Effectively detect and intercept the virtual host's wrong address request, prevent the virtual host from crashing, and quickly locate the wrong requests in the simulation system, solving the problem of abnormal crash of the virtual host.
Smart Images

Figure CN118938863A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more particularly to an IO abnormality detection method, system, device and medium for a controller simulation system. Background Art
[0002] With the rapid development of computer technology, the performance and stability of NVMe controllers, as high-speed interfaces connecting non-volatile storage devices and host systems, are crucial to the performance of the entire storage system. In order to fully verify the functions and performance of NVMe controllers in the design phase, it is critical to build an efficient and accurate simulation environment. SystemC-TLM, as a simulation framework based on transaction-level modeling, is widely used in the simulation of complex systems due to its efficiency and flexibility. Figure 1 As shown in the figure, currently, when building an NVMe controller simulation system based on SystemC-TLM, the simulation system is usually placed in a process, and a virtual machine environment is built as a virtual host through virtual machine software such as Qemu to communicate with the simulation system. In this architecture, the virtual machine environment sends IO requests to the NVMe controller simulation system, and the simulation system returns the results to the virtual machine environment after processing, thereby realizing data interaction.
[0003] However, in actual applications, due to abnormal configuration of the NVMe controller simulation system core, such as parameter setting errors, algorithm implementation defects, etc., IO requests issued in the virtual machine environment often cause errors when processed by the simulation system core. These errors may manifest as data inconsistency, processing timeouts, or system resource exhaustion, which in turn cause abnormal downtime of the virtual machine operating system in the virtual machine environment. The abnormal downtime of the virtual machine operating system not only affects the continuity and accuracy of the simulation test, but also increases the difficulty of problem location and resolution. Since the virtual machine operating system itself does not directly participate in the internal processing of the simulation system, it is difficult to directly locate the specific cause of the error in the simulation system core through the virtual machine operating system itself after a problem occurs. Summary of the invention
[0004] In view of the above problems, the purpose of the present invention is to provide an IO exception checking method, system, device and medium for a controller simulation system. By numbering and marking the IO, parsing and recording the PRP address list of the SQE of the IO when the IO is requested, and checking the address sent to the host during the IO processing, it is possible to intercept abnormal access to the host after discovering the abnormality, and report the error to facilitate problem location.
[0005] In order to achieve the above object, the present invention is implemented through the following technical solutions:
[0006] In a first aspect, the present invention discloses an IO anomaly checking method for a controller simulation system, comprising: obtaining the status of an IO submission queue entry in real time;
[0007] When the IO submission queue entry starts processing an IO request, the controller identifier, submission queue identifier, and IO number identifier of the current IO request are obtained, and the state of the corresponding IO address record is marked as the start state;
[0008] Obtain the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request, and use a list to record the PRP address list and data length of the corresponding address of the IO request;
[0009] When the controller emulates the system core to process an IO request, it obtains the access address and data length through the host bus;
[0010] By comparing the rules, it is determined whether the accessed address exists in the address list information of all unfinished IOs saved locally;
[0011] If it exists, the current IO request is considered a legitimate request, and the status information of the IO request is output;
[0012] If it does not exist, the current IO request is deemed to be an illegal request, the current IO request is intercepted, and the exception is reported.
[0013] Furthermore, the method further comprises:
[0014] Get the status of the IO completion queue entry in real time;
[0015] When the IO completion queue entry finishes processing the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the status of the corresponding IO address record is marked as the end status.
[0016] Further, when the IO submission queue entry starts to process the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, including:
[0017] By reading the information of the delivery queue doorbell register, determine the IO delivery queue entry to start processing the IO request; read the controller identifier of the current IO request from the controller;
[0018] Calculate the delivery queue identifier based on the location of the delivery queue doorbell;
[0019] According to the storage order of the IO requests in the submission queue, the serial number of the current IO request is determined.
[0020] Further, the obtaining of the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request, and recording the PRP address list and data length of the corresponding address of the IO request in a list includes:
[0021] Determine whether the state of the IO address record of the current IO request is the start state according to the IO number identifier;
[0022] If not, exit directly;
[0023] If yes, obtain the controller ID, submission queue ID, IO number ID, PRP address list and data length of the corresponding address of the current IO request;
[0024] The PRP address list of the IO request and the data length of the corresponding address are recorded in a list with the controller identifier, submission queue identifier, and IO number identifier of the current IO request as indexes.
[0025] Further, when the controller emulates the system core to process the IO request, the access address and data length are obtained through the host bus, including:
[0026] When the controller emulation system core processes the IO request, it sends the IO request to the host bus interface;
[0027] When the host bus interface receives an IO request, it automatically obtains the access address and access data length of the IO request.
[0028] Further, the comparison rule is used to determine whether the accessed address exists in the address list information of all unfinished IOs stored locally, including:
[0029] Obtain the corresponding recorded address and the data length of the recorded address according to the PRP address list of the IO request and the data length of the corresponding address;
[0030] Determine the access start address and access end address according to the access address and the access data length;
[0031] Determine whether the recorded address, the data length of the recorded address, the access start address, the access end address and the access data length meet the comparison rules;
[0032] If so, the IO request is a legitimate request;
[0033] If not, the IO request is an illegal request;
[0034] The comparison rules are as follows:
[0035] FBD ≥ JD;
[0036] FBD≤JD+JDL;
[0037] FED+FL≥JD;
[0038] FED+FL≤JD+JDL;
[0039] Among them, FBD is the access start address, JD is the recorded address, JDL is the data length of the recorded address, FED is the access end address, and FL is the data length of the access.
[0040] Furthermore, the status information of the IO request includes: a controller identifier, a submission queue identifier, an IO number identifier and a PRP address list of the IO request.
[0041] In a second aspect, the present invention also discloses an IO exception checking system for a controller simulation system, wherein the IO exception checking system is arranged in the NVMe controller simulation system, and the IO exception checking system interacts with a host bus interface, an IO submission queue and an IO completion queue respectively.
[0042] Further, the IO anomaly checking system of the controller simulation system includes: an IO address status recording module, an IO address recording module and an IO address checking module;
[0043] The IO address status recording module is used for:
[0044] Obtain the status of the IO submission queue entry in real time; when the IO submission queue entry starts processing an IO request, obtain the controller identifier, submission queue identifier, and IO number identifier of the current IO request, and mark the status of the corresponding IO address record as the start state;
[0045] Obtain the status of the IO completion queue entry in real time; when the IO completion queue entry finishes processing the IO request, obtain the controller identifier, submission queue identifier and IO number identifier of the current IO request, and mark the status of the corresponding IO address record as the end status;
[0046] The IO address recording module is used for:
[0047] Obtain the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request, and use a list to record the PRP address list and data length of the corresponding address of the IO request;
[0048] The IO address checking module is used for:
[0049] When the controller emulates the system core to process an IO request, it obtains the access address and data length through the host bus;
[0050] By comparing the rules, it is determined whether the accessed address exists in the address list information of all unfinished IOs saved locally;
[0051] If it exists, the current IO request is considered a legitimate request, and the status information of the IO request is output;
[0052] If it does not exist, the current IO request is deemed to be an illegal request, the current IO request is intercepted, and the exception is reported.
[0053] In a third aspect, the present invention further discloses an IO anomaly detection device for a controller simulation system, comprising:
[0054] A memory, used for storing an IO abnormality checking program of a controller simulation system;
[0055] The processor is used to implement the steps of the IO anomaly checking method for the controller simulation system as described in any one of the above items when executing the IO anomaly checking program of the controller simulation system.
[0056] In a fourth aspect, the present invention further discloses a readable storage medium, on which is stored an IO exception check program for a controller simulation system. When the IO exception check program for the controller simulation system is executed by a processor, the steps of the IO exception check method for the controller simulation system as described in any one of the above items are implemented.
[0057] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention discloses an IO anomaly checking method, system, device and medium for a controller simulation system, which realizes recording of key information according to the IO situation, checks the address of the access host during the IO processing, intercepts the access to the host when an anomaly is found, and reports an error when an anomaly is detected to assist developers in problem location. The present invention can effectively detect and intercept the host's erroneous address request by checking and processing the IO request to access the host, and reports an error when an error is detected, thereby preventing the abnormal crash of the virtual host due to the simulation model's erroneous access to the virtual host's memory address.
[0058] The present invention adopts the design of "parsing the NVMe controller command request address based on the SystemC TLM model, and checking the host's request address during the command execution process", and supports the simulation system of the transaction-level model of the SystemC NVMe controller to promptly detect and intercept erroneous access to the virtual host when an exception occurs during the IO process, thereby preventing damage to the virtual host system. After adopting the above scheme, the simulation system can quickly locate the erroneous request, and also solve the problem of abnormal crash of the virtual host connected to the simulation system after an error occurs.
[0059] It can be seen that compared with the prior art, the present invention has outstanding substantive features and significant progress, and the beneficial effects of its implementation are also obvious. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0061] Figure 1 It is a schematic diagram of an NVME controller simulation system based on SystemC-TLM according to the background technology of the present invention.
[0062] Figure 2 It is a method flow chart of a specific implementation mode of the present invention.
[0063] Figure 3 It is a schematic diagram of the IO address record start state processing flow of a specific implementation mode of the present invention.
[0064] Figure 4 It is a schematic diagram of the IO address record processing flow of a specific implementation method of the present invention.
[0065] Figure 5 It is a flowchart of address legitimacy checking according to a specific implementation mode of the present invention.
[0066] Figure 6 It is a schematic diagram of the IO address record end state processing flow of a specific implementation mode of the present invention.
[0067] Figure 7 It is a system structure diagram of a specific implementation mode of the present invention.
[0068] Figure 8 It is a structural diagram of a device in a specific implementation manner of the present invention.
[0069] In the figure, 1. IO address status recording module; 2. IO address recording module; 3. IO address checking module; 101. processor; 102. memory; 103. input interface; 104. output interface; 105. communication unit; 106. keyboard; 107. display; 108. mouse. DETAILED DESCRIPTION
[0070] The core of the present invention is to provide an IO anomaly detection method for a controller simulation system. In the related art, due to the abnormal configuration of the NVMe controller simulation system core, such as parameter setting errors, algorithm implementation defects, etc., the IO requests issued in the virtual machine environment often cause errors when the simulation system core processes them. These errors may manifest as inconsistent data, processing timeouts, or system resource exhaustion, which in turn cause abnormal downtime of the virtual machine operating system in the virtual machine environment.
[0071] The IO anomaly checking method of the controller simulation system provided by the present invention, first, when the IO submission queue entry starts to process the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the state of the corresponding IO address record is marked as the start state. Then, the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request are obtained, and the PRP address list and data length of the corresponding address of the IO request are recorded in a list. At this time, when the core of the controller simulation system processes the IO request, the accessed address and data length are obtained through the host bus; and the comparison rule is used to determine whether the accessed address exists in the address list information of all unfinished IOs stored locally; if it exists, the current IO request is determined to be a legal request, and the status information of the IO request is output; if it does not exist, the current IO request is determined to be an illegal request, the current IO request is intercepted, and the exception is reported. Finally, when the IO completion queue entry finishes processing the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the state of the corresponding IO address record is marked as the end state. It can be seen that the present invention marks the IOs by numbers, parses and records the PRP address list of the SQE of the IO when the IO is requested, and checks the address sent to the host during the IO processing. After the abnormality is found, the abnormal access to the host can be intercepted, and the error can be reported to facilitate problem location.
[0072] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0073] The key terms appearing in the present invention are explained below.
[0074] CQ:Completion Queue completion queue.
[0075] CQE: Completion Queue Entry.
[0076] NVMe: Non Volatile Memory Express, a non-volatile memory interface specification, is a logical device interface specification, a bus transmission protocol specification based on the device logical interface (equivalent to the application layer in the communication protocol).
[0077] PRP: Physical Region Page, a memory page used to store data in the NVMe protocol.
[0078] PRP1: The address of the first data block pointer of the memory page used to store data in the NVMe protocol.
[0079] PRP2: The address of the second data block pointer of the memory page used to store data in the NVMe protocol.
[0080] PRP Entry: The address of the data pointer beyond the second data block of the memory page used to store data in the NVMe protocol.
[0081] SQ: Submission Queue.
[0082] SQE: Submission Queue Entry.
[0083] SystemC: A library written in C++, commonly used for simulation modeling.
[0084] TLM: Transaction-Level Modeling.
[0085] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0086] This embodiment provides an IO anomaly detection method for a controller simulation system, wherein the controller simulation system is a simulation system of a transaction-level model of an NVMe controller based on SystemC. Figure 2 As shown, the IO abnormality checking method of the controller simulation system comprises the following steps:
[0087] S1: Get the status of the IO submission queue entry in real time.
[0088] In a specific implementation, the state of the IO submission queue entry is determined by reading the information of the submission queue doorbell (SQ Doorbell for short) register in real time.
[0089] It should be noted that the delivery queue doorbell is a special register or memory location that is used to notify the storage device that a new command has been placed in the SQ and is ready to be executed. When the host writes a command to the SQ, it will "knock on the door" by writing to the SQ doorbell register to tell the storage device that the delivery queue entry has stored a new IO command and can start processing the IO request.
[0090] S2: When the IO submission queue entry starts to process the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the state of the corresponding IO address record is marked as the start state.
[0091] In a specific implementation, first, by reading the information of the delivery queue doorbell register, determine the IO delivery queue entry to start processing the IO request. Then, read the controller identifier of the current IO request from the controller; calculate the delivery queue identifier according to the position of the delivery queue doorbell; and determine the number identifier of the current IO request according to the storage order of the IO requests in the delivery queue. Finally, the corresponding IO address can be determined based on the number identifier of the IO request, and the state of the IO address record is marked as the start state.
[0092] As an example, this step implements the IO address record start state processing, such as Figure 3 As shown, the IO address record start state processing flow is as follows:
[0093] S201: Obtain the controller identifier, SQ queue identifier, and IO number identifier of the current IO request.
[0094] Among them, the controller identifier is provided by the controller of the simulation model; the SQ queue identifier is obtained by calculating the position of the SQ doorbell submitted by NVMe; the IO number identifier is an internal identifier, which is numbered according to the arrival order of IO after the SQ is established.
[0095] S202: Mark the state of the IO address record as the start state.
[0096] Specifically, when the IO SQE processes an IO request, it obtains the controller identifier, SQ queue identifier, and IO number identifier of the current request. After parsing the above identifier information, the corresponding IO address can be obtained, and the state recorded by the IO address is marked as the start state.
[0097] S3: Obtain the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request, and use a list to record the PRP address list and data length of the corresponding address of the IO request.
[0098] In a specific implementation, this step implements an IO address record processing flow. Figure 4 As shown, the IO address record processing flow is as follows:
[0099] S301: judging whether the state of the IO address record of the current IO request is the start state according to the IO number identifier, if yes, executing step S302; if no, executing step S304.
[0100] S302: Obtain the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request.
[0101] Specifically, when the IO SQE processes an IO request, it obtains the controller ID, SQ queue ID, IO number ID, and PRP address list of the current IO request, wherein the PRP address list of the IO request includes: PRP1, PRP2, and the Entry address of the PRP inside PRP2.
[0102] Then, the IO address and corresponding data length of the IO request can be determined based on the size of the host memory page supported by the current controller and the total number of bytes of the IO request. The detailed process is as follows:
[0103] First, obtain that the current controller supports host memory pages of 4096 bytes.
[0104] Then, the total number of bytes requested by the IO is divided by 4096 and the result is rounded up to get the number of memory pages requested by the IO.
[0105] At this time, it is determined whether the address of PRP1 is 4096-byte aligned.
[0106] 1. When the address of PRP1 is 4096 bytes aligned:
[0107] If the number of memory pages requested by the IO is 1, the address of PRP1 is recorded and the data length is recorded as 4096;
[0108] If the number of memory pages requested by the IO is 2, the addresses of PRP1 and PRP2 are recorded, and the data length is recorded as 4096;
[0109] If the total number of bytes requested by the IO is greater than 8192 bytes, that is, the number of memory pages requested by the IO is multiple, then the address of PRP1 is recorded, and the data length is recorded as 4096. The address of PRP2 is also recorded, and the data length is recorded as the length of the logical block requested by IO × 8 bytes. And according to the length of the logical block requested by IO, the content of the address of PRP2 is read in increments of 8 bytes. Each 8 bytes read is the address of a data block, and the data length is recorded as 4096 and saved.
[0110] 2. When the address of PRP1 is not 4096-byte aligned:
[0111] If the total number of bytes requested by the IO is 4096 bytes, the address of PRP1 is recorded, and the data length is recorded as 4096–the address of PRP1 & (4096–1); the address of PRP2 is recorded, and the data length is the address of PRP1 & (4096–1).
[0112] If the total number of bytes in the IO request is greater than 4096 bytes, the address of PRP1 is recorded, and the data length is recorded as 4096-the address of PRP1 & (4096-1), and the address of PRP2 is recorded, and the data length is recorded as (the length of the logical block of the IO request + 1) × 8 bytes. According to the length of the logical block of the IO request, the content of the address of PRP2 is read in 8-byte increments, and each 8 bytes read is the address of a data block; if it is not the last block of data, the data length is recorded as 4096 and saved to the address recording submodule; if it is the last block of data, the data length is recorded as 4096 and saved to the address recording submodule as the address of PRP1 & (4096-1).
[0113] It should be noted that the symbol “&” represents the data “bitwise AND” operation in the programming language.
[0114] S303: Record the PRP address list of the IO request and the data length of the corresponding address into a list indexed by the controller identifier, submission queue identifier, and IO number identifier of the current IO request.
[0115] Specifically, the PRP address and data length information of the IO request are saved in the information list according to the controller identifier, SQ queue identifier, and IO number identifier parameters as indexes for use in subsequent IO address checks.
[0116] S304: Determine that the status of the IO address record of the current IO request is the end status, and return directly without further processing.
[0117] S4: When the controller emulates the system core to process the IO request, it obtains the access address and data length through the host bus.
[0118] In a specific implementation, when the NVMe controller simulates the system core to process an IO request, it sends the IO request to the host bus interface; when the host bus interface receives the IO request, it automatically obtains the access address and access data length of the IO request.
[0119] It can be seen that the address and data length accessed by the IO request can be obtained at the host interface of the simulation system.
[0120] S5: Determine whether the accessed address exists in the address list information of all unfinished IOs stored locally through comparison rules, so as to identify the abnormality of the IO request.
[0121] If the accessed address exists in the address list information of all unfinished IOs stored locally, the current IO request is deemed to be a legitimate request, and the status information of the IO request is output. The status information of the IO request includes: the controller identifier, submission queue identifier, IO number identifier and PRP address list of the IO request.
[0122] If the accessed address does not exist in the address list information of all unfinished IOs saved locally, the current IO request is deemed to be an illegal request, the current IO request is intercepted, and the exception is reported.
[0123] In a specific implementation, this step implements an address validity check process, the purpose of which is to perform a validity check on the address accessing the host bus interface. Figure 5 As shown, the address legitimacy check process is as follows:
[0124] S501: Acquire the corresponding recorded address and the data length of the recorded address according to the PRP address list of the IO request and the data length of the corresponding address.
[0125] S502: Determine the access start address and the access end address according to the accessed address and the accessed data length.
[0126] S503: Determine whether the recorded address, the data length of the recorded address, the access start address, the access end address and the access data length meet the comparison rules; if so, the IO request is a legal request; if not, the IO request is an illegal request.
[0127] The comparison rules used in the above process are as follows:
[0128] FBD ≥ JD;
[0129] FBD≤JD+JDL;
[0130] FED+FL≥JD;
[0131] FED+FL≤JD+JDL;
[0132] Among them, FBD is the access start address, JD is the recorded address, JDL is the data length of the recorded address, FED is the access end address, and FL is the data length of the access.
[0133] From the above comparison rules, we can see that for each record's address and data length list, the following conditions must be met at the same time:
[0134] The access start address >= recorded address, and the access start address <= recorded address + data length of the recorded address, and the access end address + access data length >= recorded address, and the access end address + access data length <= recorded address + data length of the recorded address, can be considered to meet the comparison rules. If the comparison rules are met, the access is considered normal; otherwise, the access is considered abnormal.
[0135] S6: Get the status of the IO completion queue entry in real time.
[0136] In a specific implementation, the status of the IO completion queue entry (IO CQE) is determined by reading the information of the delivery queue doorbell register in real time.
[0137] S7: When the IO completion queue entry finishes processing the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the status of the corresponding IO address record is marked as the end status.
[0138] In a specific implementation, this step implements the IO address record end state processing, such as Figure 6 As shown, the IO address record end state processing flow is as follows:
[0139] S701: Obtain the controller identifier, SQ queue identifier, and IO number identifier of the current IO request completed.
[0140] Among them, the controller identifier is provided by the controller of the simulation model; the SQ queue identifier is obtained by calculating the position of the SQ doorbell submitted by NVMe and is passed to the preset IO CQE processing module at the end of IO processing using the reserved field of CQE during the processing; the IO number identifier is an internal identifier, which is numbered according to the arrival order of IO after SQ is established and is passed to the preset IO CQE processing module at the end of IO processing using the reserved field of CQE during the processing.
[0141] S702: Mark the status of the IO address record as the end status.
[0142] Specifically, when the IO SQE processes an IO request, it obtains the controller identifier, SQ queue identifier, and IO number identifier of the current request. After parsing the above identifier information, the corresponding IO address can be obtained, and the state recorded by the IO address is marked as the start state.
[0143] When the IO CQE completes processing the IO request, it obtains the controller identifier, SQ queue identifier, and IO number identifier of the current request, parses the corresponding IO address based on the above identifiers, and marks the state of the IO address record as the end state.
[0144] The present invention provides an IO exception checking method for a controller simulation system, which adopts a simulation design of "parsing an NVMe command request address based on a SystemC TLM model, and checking the request address of a host during command execution", and supports a simulation system of a transaction-level model of an NVMe controller based on SystemC. When an exception occurs during the IO process, the simulation system can promptly discover and intercept erroneous access to a virtual host, thereby preventing damage to the virtual host system and solving the problem of abnormal crash of the virtual host system after an exception occurs.
[0145] The present invention also discloses an IO abnormality checking system for a controller simulation system, wherein the IO abnormality checking system is arranged in the NVMe controller simulation system, and the IO abnormality checking system interacts with the host bus interface, the IO submission queue and the IO completion queue respectively. Figure 7 As shown, the IO abnormality checking system includes: an IO address status recording module 1, an IO address recording module 2 and an IO address checking module 3.
[0146] IO address status recording module 1 is used for:
[0147] The status of the IO submission queue entry is obtained in real time; when the IO submission queue entry starts to process an IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the status of the corresponding IO address record is marked as the start state.
[0148] Obtain the status of the IO completion queue entry in real time; when the IO completion queue entry finishes processing the IO request, obtain the controller identifier, submission queue identifier and IO number identifier of the current IO request, and mark the status of the corresponding IO address record as the end status;
[0149] IO address recording module 2 is used for:
[0150] The controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request are obtained, and the PRP address list and data length of the corresponding address of the IO request are recorded in a list.
[0151] IO address check module 3 is used to:
[0152] When the controller emulates the system core to process an IO request, it obtains the access address and data length through the host bus.
[0153] By comparing the rules, it is determined whether the accessed address exists in the address list information of all unfinished IOs saved locally; if it exists, the current IO request is considered to be a legal request, and the status information of the IO request is output; if it does not exist, the current IO request is considered to be an illegal request, the current IO request is intercepted, and the exception is reported.
[0154] In a specific implementation, the IO address status recording module 1 is specifically used for:
[0155] By reading the information of the delivery queue doorbell register, determine the IO delivery queue entry to start processing IO requests;
[0156] Read the controller ID of the current IO request from the controller;
[0157] Calculate the delivery queue identifier based on the location of the delivery queue doorbell;
[0158] According to the storage order of the IO requests in the submission queue, the serial number of the current IO request is determined.
[0159] In a specific implementation, the IO address recording module 2 is specifically used for:
[0160] Determine whether the status of the IO address record of the current IO request is the start status according to the IO number identifier; if not, exit directly; if so, obtain the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request.
[0161] The PRP address list of the IO request and the data length of the corresponding address are recorded in a list with the controller identifier, submission queue identifier, and IO number identifier of the current IO request as indexes.
[0162] In a specific implementation, the IO address checking module 3 is specifically used for:
[0163] When the controller emulates the system core to process the IO request, it sends the IO request to the host bus interface.
[0164] When the host bus interface receives an IO request, it automatically obtains the access address and access data length of the IO request.
[0165] The corresponding recorded address and the data length of the recorded address are obtained according to the PRP address list of the IO request and the data length of the corresponding address.
[0166] The access start address and access end address are determined according to the accessed address and the accessed data length.
[0167] Determine whether the recorded address, the data length of the recorded address, the access start address, the access end address and the access data length meet the comparison rules; if so, the IO request is a legal request; if not, the IO request is an illegal request.
[0168] The specific implementation of the IO anomaly checking system of the controller simulation system of this embodiment is basically the same as the specific implementation of the IO anomaly checking method of the controller simulation system described above, and will not be repeated here.
[0169] In addition, based on the functions of the IO anomaly checking system of the above-mentioned controller simulation system, and in combination with the above-mentioned IO anomaly checking method of the controller simulation system, the specific operation process of the IO anomaly checking system of the controller simulation system provided by the present application is as follows:
[0170] 1. When IO SQE processes an IO request, it obtains the controller ID, SQ queue ID, and IO number ID of the current request, calls the interface of IO address status recording module 1, and passes the controller ID, SQ queue ID, and IO number ID parameters of the current request on the interface. The IO address status recording module is used to record and mark the state of the IO address record as the start state.
[0171] 2. When IO SQE processes an IO request, it obtains the controller ID, SQ queue ID, IO number ID, IO PRP address list, and data length of the corresponding address of the current request. According to the length of the IO request, the address list includes PRP1, PRP2, and the Entry address of the PRP inside PRP2.
[0172] The interface of IO address recording module 2 is called, and the controller identification, SQ queue identification, IO number identification parameter, and IO PRP address list parameter of the current request are passed on the interface. IO address recording module 2 uses controller identification, SQ queue identification, and IO number identification parameters as indexes to save the parsed address and data length information into a list for subsequent use by IO address checking module 3.
[0173] 3. When the NVMe controller simulation system core processes an IO request, it sends a request to the host bus interface. When the host bus interface receives the request, it obtains the access address and data length information, calls the IO address check module 3, and passes the access address and data length information. The IO address check submodule searches and compares all unfinished IO address list information stored locally. If the corresponding address information is found, the current request is considered to be a legal request, and the corresponding IO request status information is output, including the controller identifier of the IO request, the SQ queue identifier, the IO number identifier, and the IO PRP address list. If the corresponding address information is not found, the current request is considered to be an illegal request, the current request to the host is intercepted, the address and length information of the current request is output, and the exception is reported.
[0174] 4. When the IO CQE finishes processing the IO request, it obtains the controller ID, SQ queue ID, and IO number ID of the current request, and calls the interface of the IO address status recording module 1, passing the controller ID, SQ queue ID, and IO number ID parameters of the current request on the interface. The IO address status recording module 1 records the status of the IO address record as the end status.
[0175] See also Figure 8 As shown, the present invention also discloses an IO abnormality checking device for a controller simulation system, comprising a processor 101 and a memory 102; wherein, when the processor 101 executes the IO abnormality checking program of the controller simulation system stored in the memory, the following steps are implemented:
[0176] 1. Get the status of the IO submission queue entry in real time.
[0177] 2. When the IO submission queue entry starts processing the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the status of the corresponding IO address record is marked as the start status.
[0178] 3. Obtain the controller ID, submission queue ID, IO number ID, PRP address list and data length of the corresponding address of the current IO request, and use a list to record the PRP address list and data length of the corresponding address of the IO request.
[0179] 4. When the controller emulates the system core to process an IO request, it obtains the access address and data length through the host bus.
[0180] 5. By comparing the rules, determine whether the accessed address exists in the address list information of all unfinished IOs saved locally, so as to identify the abnormality of the IO request.
[0181] 6. Get the status of the IO completion queue entry in real time.
[0182] 7. When the IO completion queue entry finishes processing the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the status of the corresponding IO address record is marked as the end status.
[0183] The IO anomaly detection device of the controller simulation system provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.
[0184] Among them, the processor 101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 101 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 101 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 101 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 101 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0185] The memory 102 may include one or more computer-readable storage media, which may be non-transitory. The memory 102 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 102 is at least used to store the following computer program, wherein, after the computer program is loaded and executed by the processor 101, the relevant steps of the IO anomaly detection method of the controller simulation system disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 102 may also include an operating system and data, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system may include Windows, Unix, Linux, etc. The data may include but is not limited to the data involved in the IO anomaly detection method of the controller simulation system mentioned above.
[0186] Furthermore, the IO anomaly detection device of the controller simulation system in this embodiment may also include:
[0187] The input interface 103 is used to obtain the IO abnormality check program of the controller simulation system imported from the outside, and save the obtained IO abnormality check program of the controller simulation system to the memory 102. It can also be used to obtain various instructions and parameters transmitted by the external terminal device, and transmit them to the processor 101, so that the processor 101 can use the above various instructions and parameters to carry out corresponding processing. In this embodiment, the input interface 103 can specifically include but is not limited to a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, etc.
[0188] The output interface 104 is used to output various data generated by the processor 101 to a terminal device connected thereto, so that other terminal devices connected to the output interface can obtain various data generated by the processor 101. In this embodiment, the output interface 104 may specifically include but is not limited to a USB interface, a serial interface, and the like.
[0189] The communication unit 105 is used to establish a remote communication connection between the server operation service optimization configuration device and the external server, so that the IO abnormality inspection device of the controller simulation system can mount the image file to the external server. In this embodiment, the communication unit 105 may specifically include but is not limited to a remote communication unit based on wireless communication technology or wired communication technology.
[0190] The keyboard 106 is used to obtain various parameter data or instructions input by the user by tapping the keycaps in real time.
[0191] The display 107 is used to display relevant information of the IO abnormality check process of the running controller simulation system in real time.
[0192] The mouse 108 can be used to assist the user in inputting data and simplify the user's operation.
[0193] The present invention also discloses a readable storage medium, wherein the readable storage medium includes 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 hard disk, a CD-ROM or any other form of storage medium known in the technical field. The readable storage medium stores an IO abnormality check program of a controller simulation system, and when the IO abnormality check program of the controller simulation system is executed by a processor, the following steps are implemented:
[0194] 1. Get the status of the IO submission queue entry in real time.
[0195] 2. When the IO submission queue entry starts processing the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the status of the corresponding IO address record is marked as the start status.
[0196] 3. Obtain the controller ID, submission queue ID, IO number ID, PRP address list and data length of the corresponding address of the current IO request, and use a list to record the PRP address list and data length of the corresponding address of the IO request.
[0197] 4. When the controller emulates the system core to process an IO request, it obtains the access address and data length through the host bus.
[0198] 5. By comparing the rules, determine whether the accessed address exists in the address list information of all unfinished IOs saved locally, so as to identify the abnormality of the IO request.
[0199] 6. Get the status of the IO completion queue entry in real time.
[0200] 7. When the IO completion queue entry finishes processing the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the status of the corresponding IO address record is marked as the end status.
[0201] In summary, the present invention marks IOs by numbers, parses and records the PRP address list of the SQE of the IO when the IO is requested, and checks the address sent to the host during the IO processing. After an abnormality is found, the abnormal access to the host can be intercepted, and the error can be reported to facilitate problem location.
[0202] 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. As for the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0203] 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.
[0204] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0205] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0206] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit.
[0207] Similarly, each processing unit in each embodiment of the present invention may be integrated into one functional module, or each processing unit may exist physically, or two or more processing units may be integrated into one functional module.
[0208] 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.
[0209] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0210] The above is a detailed introduction to the IO anomaly checking method, system, device and readable storage medium of the controller simulation system provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A method for checking IO anomalies of a controller simulation system, characterized in that: include: Get the status of IO submission queue entry in real time; When the IO submission queue entry starts processing an IO request, the controller identifier, submission queue identifier, and IO number identifier of the current IO request are obtained, and the state of the corresponding IO address record is marked as the start state; Obtain the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request, and use a list to record the PRP address list and data length of the corresponding address of the IO request; When the controller emulates the system core to process an IO request, it obtains the access address and data length through the host bus; By comparing the rules, it is determined whether the accessed address exists in the address list information of all unfinished IOs saved locally; If it exists, the current IO request is considered a legitimate request, and the status information of the IO request is output; If it does not exist, the current IO request is deemed to be an illegal request, the current IO request is intercepted, and the exception is reported.
2. The IO abnormality checking method of the controller simulation system according to claim 1, characterized in that: The method further comprises: Get the status of the IO completion queue entry in real time; When the IO completion queue entry finishes processing the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, and the status of the corresponding IO address record is marked as the end status.
3. The IO abnormality checking method of the controller simulation system according to claim 1, characterized in that: When the IO submission queue entry starts to process the IO request, the controller identifier, submission queue identifier and IO number identifier of the current IO request are obtained, including: By reading the information of the delivery queue doorbell register, determine the IO delivery queue entry to start processing the IO request; read the controller identifier of the current IO request from the controller; Calculate the delivery queue identifier based on the location of the delivery queue doorbell; According to the storage order of the IO requests in the submission queue, the serial number of the current IO request is determined.
4. The IO abnormality checking method of the controller simulation system according to claim 1, characterized in that: The obtaining of the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request, and recording the PRP address list and data length of the corresponding address of the IO request in a list includes: Determine whether the state of the IO address record of the current IO request is the start state according to the IO number identifier; If not, exit directly; If yes, obtain the controller ID, submission queue ID, IO number ID, PRP address list and data length of the corresponding address of the current IO request; The PRP address list of the IO request and the data length of the corresponding address are recorded in a list with the controller identifier, submission queue identifier, and IO number identifier of the current IO request as indexes.
5. The IO abnormality checking method of the controller simulation system according to claim 1, characterized in that: When the controller emulates the system core to process the IO request, the access address and data length are obtained through the host bus, including: When the controller emulation system core processes the IO request, it sends the IO request to the host bus interface; When the host bus interface receives an IO request, it automatically obtains the access address and access data length of the IO request.
6. The IO abnormality checking method of the controller simulation system according to claim 5, characterized in that: The step of judging whether the accessed address exists in the address list information of all unfinished IOs stored locally by comparing the rules includes: Obtain the corresponding recorded address and the data length of the recorded address according to the PRP address list of the IO request and the data length of the corresponding address; Determine the access start address and access end address according to the access address and the access data length; Determine whether the recorded address, the data length of the recorded address, the access start address, the access end address and the access data length meet the comparison rules; If so, the IO request is a legitimate request; If not, the IO request is an illegal request; The comparison rules are as follows: FBD ≥ JD; FBD≤JD+JDL; FED+FL≥JD; FED+FL≤JD+JDL; Among them, FBD is the access start address, JD is the recorded address, JDL is the data length of the recorded address, FED is the access end address, and FL is the data length of the access.
7. The IO anomaly checking method of the controller simulation system according to claim 1, characterized in that: The status information of the IO request includes: a controller identifier, a submission queue identifier, an IO number identifier and a PRP address list of the IO request.
8. An IO anomaly detection system for a controller simulation system, characterized in that: The IO exception checking system is arranged in the NVMe controller simulation system, the IO exception checking system interacts with the host bus interface, the IO submission queue and the IO completion queue respectively, and the IO exception checking system adopts the IO exception checking method of the controller simulation system according to any one of claims 1 to 7; The IO anomaly checking system comprises: an IO address status recording module, an IO address recording module and an IO address checking module; The IO address status recording module is used for: Obtain the status of the IO submission queue entry in real time; when the IO submission queue entry starts processing an IO request, obtain the controller identifier, submission queue identifier, and IO number identifier of the current IO request, and mark the status of the corresponding IO address record as the start state; Get the status of the IO completion queue entry in real time; when the IO completion queue entry finishes processing the IO request, get the controller ID, submission queue ID and IO number ID of the current IO request, and mark the status of the corresponding IO address record as the end state; The IO address recording module is used for: Obtain the controller identifier, submission queue identifier, IO number identifier, PRP address list and data length of the corresponding address of the current IO request, and use a list to record the PRP address list and data length of the corresponding address of the IO request; The IO address checking module is used for: When the controller emulates the system core to process an IO request, it obtains the access address and data length through the host bus; By comparing the rules, it is determined whether the accessed address exists in the address list information of all unfinished IOs saved locally; If it exists, the current IO request is considered a legitimate request, and the status information of the IO request is output; If it does not exist, the current IO request is deemed to be an illegal request, the current IO request is intercepted, and the exception is reported.
9. An IO anomaly detection device for a controller simulation system, characterized in that: include: A memory, used for storing an IO abnormality checking program of a controller simulation system; A processor is used to implement the steps of the IO anomaly checking method for the controller simulation system as described in any one of claims 1 to 7 when executing the IO anomaly checking program of the controller simulation system.
10. A readable storage medium, characterized in that: The readable storage medium stores an IO anomaly checking program of the controller simulation system, and when the IO anomaly checking program of the controller simulation system is executed by the processor, the steps of the IO anomaly checking method of the controller simulation system according to any one of claims 1 to 7 are implemented.
