Interrupt processing method, device, host and system

By reusing the NVMe protocol queue and target interrupt number, and decoupling the completion queue and interrupt number, the problem of insufficient interrupt resources of NVMe protocol hardware devices is solved, and the usage efficiency of interrupt resources and system adaptability are improved.

CN118672950APending Publication Date: 2024-09-20HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310305039.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-17
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

In the existing technology, NVMe protocol hardware devices have limited interrupt resources when processing commands, resulting in the inability to allocate corresponding interrupt resources to each completion queue, affecting the normal operation of the hardware device.

Method used

By reusing the queue specified by the NVMe protocol as the target queue, the target interrupt number and interrupt reason are used to decouple the completion queue from the interrupt number, allowing the host to read and process the execution results in multiple completion queues, reducing the need for hardware devices to Interrupt resource requirements.

Benefits of technology

It improves the usage efficiency of interrupt resources, relieves the pressure of hardware devices on interrupt resources, realizes the adaptation of hosts with limited interrupt resources and NVMe protocol hardware devices, and enhances the scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118672950A
    Figure CN118672950A
Patent Text Reader

Abstract

The invention discloses an interrupt processing method, equipment, a host and a system, and the method comprises the steps that the host firstly writes a command into a submission queue, and sends a command reading message to hardware equipment adopting an NVMe protocol; the hardware equipment adopting the NVMe protocol responds to the acquired command reading message, acquires the command from the submission queue, and executes the command to obtain an execution result; writing an execution result into a completion queue corresponding to the submission queue by adopting hardware equipment of an NVMe protocol, writing an interruption reason into a target queue and triggering host interruption by utilizing a target interruption number; and in response to receiving the interrupt triggered by the target interrupt number, the host reads an interrupt reason from the target queue and reads and processes an execution result. The interruption is triggered by adopting the target interruption number, and the interruption reason is read from the target queue, so that the number of applied interruption numbers can be reduced, interruption resources required by hardware equipment adopting the NVMe protocol are reduced, and the use efficiency of the interruption resources is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data transmission, and in particular to an interrupt processing method, device, host and system. Background Art

[0002] The high-speed Peripheral Component Interconnect Express (PCIe) standard is widely used in hardware devices such as computers, servers, and data centers to achieve connections between hardware devices. The Non-Volatile Memory express (NVMe) protocol is a bus transmission protocol specification based on the device interface, which can be used for various hardware devices connected based on the PCIe bus standard. Hardware devices using the NVMe protocol are connected to hosts that support the NVMe protocol through the PCIe interface.

[0003] The NVMe protocol defines the interactive flow of commands between hardware devices using the NVMe protocol and the host. In the process of processing commands, the host first transmits the command to the hardware device using the NVMe protocol through the Submission Queue (SQ). After the hardware device using the NVMe protocol completes the execution of the command, it transmits the execution result to the host through the Completion Queue (CQ) and triggers the host's interrupt. After receiving the interrupt, the host reads the execution result in the CQ and processes it.

[0004] At present, each CQ queue needs to apply for the corresponding interrupt resources from the host. In the case of limited interrupt resources of the host, it is impossible to allocate corresponding interrupt resources to each CQ queue, resulting in the hardware devices using the NVMe protocol being unable to use the CQ queues that are not allocated interrupt resources to transmit execution results, making it difficult to meet the operation requirements of hardware devices using the NVMe protocol. Summary of the invention

[0005] The present application provides an interrupt processing method, device, host and system, which can improve the utilization efficiency of interrupt resources and reduce the pressure on the demand for interrupt resources of hardware devices using the NVMe protocol.

[0006] In the first aspect, the present application provides an interrupt processing method. The method is applied to a hardware device using a non-volatile storage fast NVMe protocol. The hardware device using the NVMe protocol is connected to the host based on a high-speed peripheral component interconnect standard PCIe bus. In response to obtaining a command read message sent by the host, the hardware device using the NVMe protocol obtains a command from a submission queue and executes the command to obtain an execution result. The hardware device using the NVMe protocol writes the execution result to the completion queue corresponding to the submission queue, writes the interruption cause to the target queue, and triggers a host interrupt based on the target interrupt number. Among them, the submission queue and the completion queue are queues specified by the NVMe protocol. The target interrupt number is used to trigger a host interrupt and instruct the host to read the interruption cause from the target queue. The target queue reuses the queue specified by the NVMe protocol for transmitting interruption causes that identify different completion queues. The interruption cause is used to identify the completion queue corresponding to the submission queue. Based on the target interrupt number and the interruption cause, the completion queue to which the execution result is written can be determined, thereby realizing the decoupling of the completion queue and the interrupt number. In this way, the target interrupt number and the interrupt reason can be used to enable the host to read and process the execution results in multiple completion queues, reduce the interrupt resources required by hardware devices using the NVMe protocol, improve the efficiency of interrupt resource utilization, alleviate the pressure on hardware devices using the NVMe protocol to use interrupt resources, and achieve adaptation between hosts with limited interrupt resources and hardware devices using the NVMe protocol.

[0007] In some possible implementations, the interaction between the hardware device using the NVMe protocol and the host is a synchronous interaction method. The hardware device using the NVMe protocol first writes the execution result of the command to the completion queue corresponding to the submission queue, then writes the interruption cause to the target queue, and triggers the host interruption based on the target interruption number. The time when the hardware device using the NVMe protocol writes the execution result of the command to the completion queue corresponding to the submission queue is earlier than the time when the hardware device using the NVMe protocol writes the interruption cause to the target queue. In this way, it can be ensured that after the host interrupt is triggered using the target interruption number, the host can use the interruption cause obtained from the target queue to obtain the execution result from the completion queue identified by the interruption cause.

[0008] In some possible implementations, the interaction between the hardware device using the NVMe protocol and the host is in an asynchronous interaction mode. The hardware device using the NVMe protocol submits a first transmission request and a second transmission request to the controller respectively. Among them, the first transmission request includes the execution result of executing the command and the transmission identifier. The transmission identifier is used to indicate the completion of the transmission of the execution result. The second transmission request includes an interruption cause and a target interruption number. The controller writes the execution result to the completion queue corresponding to the submission queue based on the first transmission request, and transmits the transmission identifier to the host, writes the interruption cause to the target queue based on the second transmission request, and triggers the host interrupt based on the target interruption number. In the asynchronous interaction mode, the time order in which the controller processes the first transmission request and the second transmission request is not determined by the controller obtaining the time order of the first transmission request and the second transmission request. In this way, the host can determine the completion of the transmission of the execution result by detecting the transmission identifier, and process the execution result.

[0009] In some possible implementations, the first transmission request includes an invalid interrupt number, or the first transmission request includes an interrupt invalid flag. The invalid interrupt number cannot trigger the host interrupt. The interrupt invalid flag is used to indicate that the interrupt number included in the first transmission request cannot trigger the host interrupt. By using an invalid interrupt number or an interrupt invalid flag, it is possible to avoid the first transmission request triggering an interrupt, resulting in a failure of the host to process the interrupt.

[0010] In some possible implementations, the interruption reason is the queue number code of the completion queue. The queue number code of the completion queue can identify the completion queue. The host can confirm the completion queue that needs to read the execution result based on the obtained interruption reason, that is, the queue number code of the completion queue.

[0011] In some possible implementations, the hardware device and the host using the NVMe protocol determine the target queue during the initialization process. The hardware device using the NVMe protocol obtains a management command sent by the host including the first address of the target queue on the host side. The hardware device using the NVMe protocol constructs the target queue on the hardware device side using the NVMe protocol based on the first address. The target queue on the hardware device side using the NVMe protocol is associated with the target queue on the host side to enable data transmission. The target queue on the hardware device side using the NVMe protocol and the target queue on the host side constitute a complete target queue that can achieve data transmission.

[0012] In some possible implementations, the target queue is a queue whose idleness satisfies an idleness threshold, so that the data transmission resources occupied by the target queue for the transmission interruption reason can be reduced.

[0013] In the second aspect, the present application provides an interrupt processing method. The method is applied to a host. The host and a hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus. The host writes a command to a submission queue and sends a command read message to a hardware device using the NVMe protocol. In response to receiving an interrupt triggered by a target interrupt number, the host reads the interrupt cause from the target queue, reads the execution result from the completion queue corresponding to the submission queue based on the interrupt cause, and processes the execution result. Among them, the target queue reuses the queue specified by the NVMe protocol for transmitting the interrupt cause identifying different completion queues. The interrupt cause is used to identify the completion queue corresponding to the submission queue. Using the target interrupt number, the host can read and process the execution results in multiple completion queues, reduce the interrupt resources required for the hardware device using the NVMe protocol, improve the efficiency of the use of interrupt resources, alleviate the pressure of the demand for the use of interrupt resources by the hardware device using the NVMe protocol, and realize the adaptation of the host with limited interrupt resources to the hardware device using the NVMe protocol.

[0014] In some possible implementations, the interruption cause is a queue number code of a completion queue corresponding to the submission queue.

[0015] In some possible implementations, the interaction between the hardware device using the NVMe protocol and the host is in an asynchronous interaction mode. After obtaining the interruption cause, the host first detects the transmission identifier. The transmission identifier is used to indicate the completion of the transmission of the execution result. In response to detecting the transmission identifier, the host reads the execution result from the completion queue corresponding to the submission queue based on the interruption cause; in response to not detecting the transmission identifier, the host repeatedly detects the transmission identifier until the transmission identifier is detected.

[0016] In some possible implementations, the hardware device using the NVMe protocol and the host determine the target queue during the initialization process. The host selects a queue whose idleness meets the idleness threshold from the submission queue on the host side and the completion queue on the host side as the target queue on the host side; and then sends a management command including the first address of the target queue on the host side to the hardware device using the NVMe protocol.

[0017] In a third aspect, the present application provides a hardware device using the NVMe protocol, the device comprising:

[0018] A processing unit, configured to read a message in response to obtaining a command sent by a host, obtain a command from a submission queue, and execute the command, wherein the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus;

[0019] A sending unit is used to write the execution result of the command to the completion queue corresponding to the submission queue, write the interruption cause to the target queue, and trigger the host interruption based on the target interruption number, wherein the target interruption number is used to trigger the host interruption, and instruct the host to read the interruption cause from the target queue, wherein the interruption cause is used to identify the completion queue corresponding to the submission queue, and the target queue reuses the queue specified by the NVMe protocol, and is used to transmit the interruption causes identifying different completion queues.

[0020] In some possible implementations, the sending unit is used to write the execution result of executing the command to the completion queue corresponding to the submission queue, write the interruption cause to the target queue, and trigger a host interrupt based on the target interrupt number. The time when the execution result of executing the command is written to the completion queue corresponding to the submission queue is earlier than the time when the interruption cause is written to the target queue.

[0021] In some possible implementations, the sending unit is used to submit a first transmission request and a second transmission request to the controller respectively, the first transmission request includes an execution result of executing the command and a transmission identifier, the second transmission request includes an interruption cause and a target interruption number, the transmission identifier is used to indicate the completion of the transmission of the execution result, the controller is used to write the execution result to the completion queue corresponding to the submission queue based on the first transmission request, and transmit the transmission identifier to the host, write the interruption cause to the target queue based on the second transmission request, and trigger the host interrupt based on the target interruption number.

[0022] In some possible implementations, the first transmission request includes an invalid interrupt number, or the first transmission request includes an interrupt invalid flag, and the invalid interrupt number cannot trigger the host interrupt, and the interrupt invalid flag is used to indicate that the interrupt number included in the first transmission request cannot trigger the host interrupt.

[0023] In some possible implementations, the interruption reason is a queue number code of the completion queue.

[0024] In some possible implementations, the device further includes:

[0025] A receiving unit, configured to obtain a management command sent by the host, wherein the management command includes a first address of a target queue on the host side;

[0026] The processing unit is also used to construct a target queue on the hardware device side that adopts the NVMe protocol based on the first address, and the target queue on the hardware device side that adopts the NVMe protocol is associated with the target queue on the host side to constitute the target queue.

[0027] In some possible implementations, the target queue is a queue whose idleness satisfies an idleness threshold.

[0028] In a fourth aspect, the present application provides a host, characterized in that the host includes:

[0029] A sending unit, used for writing commands into a submission queue and sending command read messages to a hardware device using the NVMe protocol, wherein the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus;

[0030] A processing unit, configured to read an interruption cause from a target queue in response to receiving an interruption triggered by the target interruption number, wherein the target queue reuses a queue specified by the NVMe protocol for transmitting interruption causes identifying different completion queues;

[0031] The processing unit is further configured to read an execution result from a completion queue corresponding to the submission queue based on the interruption reason, and process the execution result, wherein the interruption reason is used to identify the completion queue corresponding to the submission queue.

[0032] In some possible implementations, the interruption reason is a queue number code of a completion queue corresponding to the submission queue.

[0033] In some possible implementations, the processing unit is configured to read the execution result from the completion queue corresponding to the submission queue based on the interruption cause, including:

[0034] The processing unit is used to respond to the detection of a transmission identifier, and the host reads the execution result from the completion queue corresponding to the submission queue based on the interruption cause, and the transmission identifier is used to indicate the completion of the transmission of the execution result; in response to the failure to detect the transmission identifier, the host repeatedly detects the transmission identifier until the transmission identifier is detected.

[0035] In some possible implementations, the processing unit is further configured for the host to select a queue whose idleness meets an idleness threshold from the submission queue on the host side and the completion queue on the host side as the target queue on the host side;

[0036] The sending unit is also used to send a management command to the hardware device using the NVMe protocol, and the management command includes the first address of the target queue on the host side.

[0037] In a fifth aspect, the present application provides a system, comprising a host and a hardware device using the NVMe protocol, wherein the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus, the hardware device using the NVMe protocol implements the interrupt handling method described in the first aspect, and the host implements the interrupt handling method described in the second aspect.

[0038] In a sixth aspect, the present application provides a computer-readable storage medium, including instructions, programs or codes, which, when executed on a computing device, enables the computing device to execute the interrupt handling method as described in the first aspect, or the interrupt handling method as described in the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of interaction between a hardware device and a host using the NVMe protocol provided in an embodiment of the present application;

[0040] Figure 2 A flowchart of an interrupt processing method provided in an embodiment of the present application;

[0041] Figure 3 A schematic diagram of a management message channel and a message channel provided in an embodiment of the present application;

[0042] Figure 4 A schematic diagram of a process flow of a host processing an interruption cause provided in an embodiment of the present application;

[0043] Figure 5 A schematic diagram of a process for constructing a target queue provided in an embodiment of the present application;

[0044] Figure 6 A schematic diagram of another method for constructing a target queue provided in an embodiment of the present application;

[0045] Figure 7 A schematic diagram of a process of synchronous transmission between a hardware device and a host using the NVMe protocol provided in an embodiment of the present application;

[0046] Figure 8 A schematic diagram of a process of asynchronous transmission between a hardware device and a host using the NVMe protocol provided in an embodiment of the present application;

[0047] Fig. 9 A schematic diagram of the structure of a hardware device using the NVMe protocol provided in an embodiment of the present application;

[0048] Fig.10 A schematic diagram of the structure of a host provided in an embodiment of the present application;

[0049] Fig.11A schematic diagram of the structure of a system provided in an embodiment of the present application;

[0050] Fig.12 A schematic diagram of the structure of a device provided in an embodiment of the present application;

[0051] Fig.13 A schematic diagram of the structure of the device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0052] The host and the hardware device using the NVMe protocol are connected through a PCIe interface, specifically, a PCIe card slot. The message control and transmission logic between the host and the hardware device using the NVMe protocol is transmitted through the SQ and CQ defined by the NVMe protocol. Each completion queue of the hardware device using the NVMe protocol needs to apply for corresponding interrupt resources from the host. The host assigns corresponding interrupt numbers to each completion queue based on the available interrupt resources. The hardware device using the NVMe protocol with more completion queues needs to apply for more interrupt resources from the host. When presetting interrupt resources, some hosts will allocate limited interrupt resources to the hardware device using the NVMe protocol based on factors such as the number of PCIe card slots and central processing units (CPUs). This will cause some completion queues of the hardware device using the NVMe protocol to fail to obtain interrupt resources. The hardware device using the NVMe protocol cannot use the completion queue that has not obtained interrupt resources to transmit data, affecting the normal use of the hardware device using the NVMe protocol. In this way, the host with limited interrupt resources is difficult to adapt to the hardware device using the NVMe protocol that requires more interrupt resources.

[0053] Based on this, the present application provides an interrupt processing method. Figure 1As shown, the figure is a schematic diagram of an interaction between a hardware device using the NVMe protocol and a host provided in an embodiment of the present application. Among them, the hardware device using the NVMe protocol is a PCIe device using the NVMe protocol. The embodiment of the present application does not limit the specific type of the hardware device using the NVMe protocol, for example, it can be a hardware device with an M.2 interface and supporting the NVMe protocol. The hardware device using the NVMe protocol is connected to the host through a PCIe bus. As an example, the hardware device using the NVMe protocol is connected to the PCIe card slot of the host. The hardware device using the NVMe protocol can receive the processing tasks sent by the host through the submission queue, and execute the processing tasks, and return the processing results through the completion queue. The hardware device using the NVMe protocol is, for example, a solid state drive (SSD), a smart network card, an artificial intelligence (AI) acceleration device or a heterogeneous acceleration card. The host is a device connected to the hardware device using the NVMe protocol through the PCIe bus. The host is, for example, a server.

[0054] The host first writes a command to the submission queue and sends a command read message to the hardware device using the NVMe protocol. In response to obtaining the command read message, the hardware device using the NVMe protocol obtains the command from the submission queue, executes the command, and obtains the execution result. The hardware device using the NVMe protocol writes the execution result to the completion queue corresponding to the submission queue, writes the interruption cause to the target queue, and triggers the host interruption using the target interruption number. In response to receiving an interruption triggered by the target interruption number, the host reads the interruption cause from the target queue. The interruption cause is used to identify the completion queue corresponding to the submission queue. The host reads the execution result from the completion queue corresponding to the submission queue identified by the interruption cause, and processes the execution result. Among them, the target queue is a queue predetermined by the host and the hardware device using the NVMe protocol for caching the interruption cause. The target queue reuses the queue specified by the NVMe protocol for transmitting the interruption cause that identifies different completion queues. Using the target interruption number and the interruption cause, the host can read the execution results transmitted by multiple completion queues. In this way, the completion queue can be decoupled from the requested interrupt resources, the interrupt resources required by hardware devices using the NVMe protocol can be reduced, the interrupt resources requested by hardware devices using the NVMe protocol from the host can be reduced, the utilization efficiency of interrupt resources can be improved, and the pressure on the demand for interrupt resources by hardware devices using the NVMe protocol can be reduced.

[0055] The interrupt processing method provided by the present application is described below based on a specific embodiment. The interrupt processing method provided by the embodiment of the present application can be applied to Figure 1 In the scene shown. Figure 1The scenario shown is only an example. The interrupt handling method provided in the embodiment of the present application can also be applied to the usage scenarios of other hosts and hardware devices using the NVMe protocol, without limitation.

[0056] For ease of understanding, the interaction process between the host and the hardware device using the NVMe protocol is described below. The interrupt processing method applied to the host and the interrupt processing method of the hardware device using the NVMe protocol will not be described separately. For details, please refer to the following description.

[0057] See also Figure 2 As shown, the figure is a flow chart of an interrupt handling method provided by an embodiment of the present application, which is applied to a system including a host and a hardware device using the NVMe protocol. The host and the hardware device using the NVMe protocol are connected via a PCIe bus. The method specifically includes the following steps.

[0058] S201: The host writes a command to the submission queue and sends a command read message to the hardware device using the NVMe protocol.

[0059] The submission queue is used to transmit commands issued by the host to the hardware device using the NVMe protocol. In a possible implementation, an Admin Message Channel and a Message Channel are set in the host and the hardware device using the NVMe protocol. Figure 3 As shown, the management message channel includes the management submission queue (Admin SQ) and the management completion queue (Admin CQ). The message channel includes the data submission queue (Input / OutputSQ, I / O SQ) and the data completion queue (I / O CQ). The management submission queue and the management completion queue are filled with management commands, and the data submission queue and the data completion queue are filled with data commands. A hardware device using the NVMe protocol has only one pair of Admin SQ and Admin CQ, and they are in a one-to-one correspondence, while there are multiple I / O SQs and I / O CQs, and the SQ and CQ are in a many-to-one or one-to-one correspondence, that is, one SQ can correspond to one CQ, or multiple SQs can correspond to one CQ.

[0060] The embodiment of the present application does not limit the type of submission queue of the host write command. The submission queue of the host write command can be a management submission queue or a data submission queue. In one possible implementation, the command written by the host is a management command, and the submission queue of the host write command is a management submission queue. In another possible implementation, the command written by the host is a data command, and the submission queue of the host write command is a data submission queue.

[0061] After writing a command to the submission queue, the host notifies the hardware device using the NVMe protocol to read the command from the submission queue. In one possible implementation, the host writes a special doorbell register, and the function of the doorbell register is to notify the hardware device using the NVMe protocol to read the command from the SQ. The doorbell register sends a command read message to the hardware device using the NVMe protocol.

[0062] S202: In response to obtaining a command read message, the hardware device using the NVMe protocol obtains the command from the submission queue and executes the command.

[0063] After obtaining the command read message, the hardware device using the NVMe protocol reads the command from the submission queue. The hardware device using the NVMe protocol executes the command and obtains the execution result after executing the command.

[0064] S203: The hardware device using the NVMe protocol writes the execution result of the execution command to the completion queue corresponding to the submission queue, writes the interruption reason to the target queue, and triggers a host interruption based on the target interruption number.

[0065] After executing the command and obtaining the execution result, the hardware device using the NVMe protocol transmits the execution result to the host. The hardware device using the NVMe protocol writes the execution result to the completion queue corresponding to the submission queue. The hardware device using the NVMe protocol writes the interruption reason to the target queue.

[0066] The target queue is a queue that is predetermined by the host and the hardware device using the NVMe protocol to cache the interruption cause. The target queue reuses the queue specified by the NVMe protocol to transmit the interruption cause that identifies different completion queues. The target queue can be a submission queue or a completion queue specified by the NVMe protocol. As an example, see Figure 3 As shown, the management submission queue is used as the target queue.

[0067] The embodiments of the present application do not limit the selection method of the target queue. In one possible implementation, a submission queue or a completion queue whose idleness meets the idleness threshold is pre-selected as the target queue. As an example, the management message channel includes the management submission queue and the management completion queue. The management message channel is generally used for overall control management, responsible for the management of functions such as initialization, new creation and destruction of channels, and is not responsible for user data transmission. Among them, the management submission queue is used to synchronously issue task instructions. The management completion queue is not fully utilized, and the idleness meets the idleness threshold. The management completion queue is used as the target queue. The management completion queue has a higher priority and a relatively high idleness. Using the management completion queue as the target queue does not affect the use of I / O SQ and I / O CQ, and avoids occupying resources for data transmission. In another possible implementation, the submission queue or the completion queue can be randomly selected as the target queue.

[0068] In addition, the embodiment of the present application does not limit the number of target queues, and one or more queues specified by the NVMe protocol can be used as target queues based on the setting needs of the target queues.

[0069] The target queue can be determined in the initialization phase. As an example, the embodiment of the present application provides a specific implementation method for determining the target queue, please refer to the following.

[0070] The interruption cause written to the target queue by the hardware device using the NVMe protocol is used to implement the subsequent processing of the execution result by the host. In addition, the interruption cause is used to identify the completion queue corresponding to the submission queue, that is, the completion queue to which the hardware device using the NVMe protocol writes the execution result. The host can read the execution result in the completion queue identified by the interruption cause based on the interruption cause read from the target queue. The embodiment of the present application does not limit the manner in which the interruption cause identifies the completion queue corresponding to the submission queue. As an example, each completion queue sets an integer variable as a queue number identifier. The interruption cause is the queue number identifier of the completion queue to which the hardware device using the NVMe protocol writes the execution result. The target interruption number is decoupled from the interruption cause. After the number of queues changes, it does not affect the interruption of the host triggered by the target interruption number, and the host reads the execution result based on the completion queue identified by the interruption cause in the target queue. In this way, the scalability of the number of queues can be improved on the basis of saving interruption resources.

[0071] Hardware devices using the NVMe protocol also trigger host interrupts based on the target interrupt number. The target interrupt number is used to trigger the host interrupt and instruct the host to read the interrupt cause from the target queue. The target interrupt number can be pre-applied during the initialization phase. For example, as an example, the host allocates interrupt numbers based on interrupt resources. The host uses interrupts with an offset of 0 for task notifications and interrupts with an offset of 1 for reading the interrupt cause in the target queue. The target interrupt number is 1.

[0072] It should be noted that the embodiments of the present application do not limit the order of writing execution results, writing interruption causes, and triggering interruptions in hardware devices using the NVMe protocol. The embodiments of the present application provide two specific implementation methods for hardware devices using the NVMe protocol to write the execution results of execution commands to the completion queue corresponding to the submission queue, write the interruption cause to the target queue, and trigger the host interruption based on the target interrupt number. Please refer to the following for details.

[0073] S204: In response to receiving an interrupt triggered by a target interrupt number, the host reads the interrupt cause from the target queue.

[0074] In response to receiving an interrupt triggered by a target interrupt number, the host reads the interrupt cause from the target queue.

[0075] In a possible implementation, the host pre-registers an interrupt processing function corresponding to the target interrupt number. The interrupt processing function corresponding to the target interrupt number has two functions, including reading the interrupt cause from the target queue after receiving the interrupt triggered by the target interrupt number, and calling the service processing function corresponding to the interrupt cause to perform subsequent processing on the processing result. Figure 4 As shown, this figure is a schematic diagram of a process of a host processing an interruption cause provided by an embodiment of the present application. In response to receiving an interruption triggered by a target interruption number, the host calls the interruption processing function corresponding to the target interruption number, reads the interruption cause from the target queue, and calls the service processing function corresponding to the interruption cause to perform subsequent processing on the execution result.

[0076] It should be noted that the target queue may cache multiple unread interruption reasons. In a possible implementation, after the host receives an interruption triggered by a target interruption number, all unread interruption reasons cached in the target queue are read and processed.

[0077] S205: Based on the interruption reason, the host reads the execution result from the completion queue corresponding to the submission queue and processes the execution result.

[0078] In one possible implementation, the interruption cause is a queue number code of a completion queue. Based on the interruption cause, the host can determine the completion queue to which the execution result is written. The host reads the execution result from the completion queue identified by the interruption cause and processes the execution result. Figure 4 For example, the host uses the scheduler to call the target interrupt number to determine the corresponding interrupt processing function. The host uses the interrupt processing function to process the interrupt cause, determine the queue number code of the completion queue identified by the interrupt cause, and read the execution result from the completion queue corresponding to the queue number code, and use the business processing function corresponding to the interrupt cause to process the execution result.

[0079] After the host processes the execution result, it can also write the doorbell register to notify the hardware device using the NVMe protocol that the execution result has been read.

[0080] Based on the above S201-S205 related contents, it can be known that by reusing the queue specified by the NVMe protocol as the target queue, caching the interruption cause, and using the target interruption number to trigger the interruption, the host can process the interruption cause cached by the target queue. In this way, the target interruption number and the interruption cause can be used to read the execution results in multiple completion queues, so as to realize the decoupling of interruption resources and queues. The number of interruption resources is not affected by the number of queues, which can reduce the interruption resources required by hardware devices using the NVMe protocol and improve the adaptability of hardware devices using the NVMe protocol. In addition, the target interruption number and the interruption cause are decoupled, and the number of message channels can be increased or decreased as needed without affecting the interruption resources, thereby improving the scalability of hardware devices using the NVMe protocol. In addition, reusing the queue specified by the NVMe protocol as the target queue can reduce code changes and reduce user perception. The target queue for caching interruption causes can be determined when the host and the hardware device using the NVMe protocol build queues. In one possible implementation method, an embodiment of the present application provides a specific implementation method for determining the target queue. See Figure 5 As shown, this figure is a schematic diagram of the process of building a target queue provided by an embodiment of the present application. During the host initialization process, that is, the process of building a queue, the following steps are included:

[0081] S501: The host selects a target queue on the host side from the submission queue on the host side and the completion queue on the host side.

[0082] See also Figure 6As shown, this figure is a schematic diagram of building a target queue provided by an embodiment of the present application. The host applies for a direct memory access (DMA) address to build a local host-side submission queue and a host-side completion queue. The host selects a target queue from the local submission queue and completion queue. In a possible implementation, the management completion queue is selected as the target queue.

[0083] S502: The host sends a management command to the hardware device using the NVMe protocol, where the management command includes the first address of the target queue on the host side.

[0084] As an example, see Figure 6 As shown, the host sends a management command (ADMIN CMD) to the hardware device using the NVMe protocol through the management submission queue. The management command includes the first address of the target queue on the host side, that is, the DMA address of the target queue determined by the host. The host sends a management command to the hardware device using the NVMe protocol, which can be implemented by DMA copy.

[0085] S503: The hardware device using the NVMe protocol obtains the management command sent by the host.

[0086] The hardware device using the NVMe protocol can parse the received management command to obtain the first address of the target queue on the host side included in the management command.

[0087] S504: The hardware device using the NVMe protocol builds a target queue on the hardware device side using the NVMe protocol based on the first address.

[0088] As an example, see Figure 6 As shown, the hardware device using the NVMe protocol constructs a target queue on the hardware device side using the NVMe protocol that is associated with the target queue on the host side based on the first address of the target queue. The way in which the hardware device using the NVMe protocol constructs the target queue is the same as the way in which the host constructs the target queue. The target queue on the hardware device side using the NVMe protocol and the target queue on the host side constructed form a complete target queue that can be used to transmit data. The target queue on the host side and the target queue on the hardware device side using the NVMe protocol can achieve data synchronization based on DMA copying.

[0089] Based on the relevant contents of S501-S504, it can be known that by sending a management command including the first address of the target queue by the host, the hardware device using the NVMe protocol can establish a target queue on the hardware device side using the NVMe protocol that is associated with the target queue on the host side, forming a complete target queue and realizing the configuration of the target queue.

[0090] It should be noted that in the process of sending the execution result and interruption reason to the host using the NVMe protocol hardware device, due to different business attributes, the NVMe protocol hardware device can interact with the host in a synchronous manner or an asynchronous manner. For different interaction modes, the order in which the host reads the interruption reason and reads the execution result is different. The following introduces the process of the hardware device using the NVMe protocol interacting with the host in a synchronous manner and the process of interacting with the host in an asynchronous manner.

[0091] First: Hardware devices using the NVMe protocol interact with the host in a synchronous manner.

[0092] In a possible implementation, a hardware device using the NVMe protocol writes the execution result of the execution command to the completion queue corresponding to the submission queue, writes the interruption reason to the target queue, and triggers a host interrupt based on the target interrupt number, including the following three steps:

[0093] A1: The hardware device using the NVMe protocol writes the execution result of the execution command to the completion queue corresponding to the submission queue.

[0094] In the process of synchronous interaction with the host, the hardware device using the NVMe protocol first transmits the execution result of the command to the host, then transmits the interruption reason and triggers the interruption.

[0095] See also Figure 7 As shown, the figure is a schematic diagram of a process of synchronous transmission between a hardware device using the NVMe protocol and a host provided by an embodiment of the present application. The hardware device using the NVMe protocol first transmits the execution result of the command to the host through the synchronization channel in the message channel. As an example, the process of transmitting the execution result from the hardware device using the NVMe protocol to the host is specifically that the hardware device using the NVMe protocol writes the execution result to the local, that is, the completion queue corresponding to the submission queue on the hardware device side using the NVMe protocol, and submits a request for data transmission to the DMA controller. The DMA controller is a module for implementing a memory access technology for directly accessing data between the host memory and the hardware device using the NVMe protocol. The DMA controller is connected to the host and the hardware device using the NVMe protocol respectively to realize data transmission between the host and the hardware device using the NVMe protocol. The DMA controller can synchronize the execution result written in the completion queue on the hardware device side using the NVMe protocol to the completion queue on the host side by using DMA copy and transfer, so as to realize the transmission of the execution result through the completion queue.

[0096] A2: The hardware device using the NVMe protocol writes the interrupt reason to the target queue and triggers a host interrupt based on the target interrupt number.

[0097] The hardware device using the NVMe protocol writes the interruption reason to the target queue so that the interruption can be triggered later, and the host processes the execution result based on the interruption reason. The time of executing step A1 should be earlier than the time of executing step A2, so that the transmission of the execution result can be completed after the host interruption is triggered.

[0098] See also Figure 7 As shown in the figure, after the hardware device using the NVMe protocol completes the transmission of the execution result, it transmits the interruption reason and triggers the interruption based on the target interruption number. Based on the target interruption number, the host reads the interruption reason from the target queue and processes the interruption reason. The host processes the interruption reason, that is, obtains the execution result from the completion queue identified by the interruption reason and processes the execution result.

[0099] Specifically, the hardware device using the NVMe protocol writes the interruption cause in the local target queue, that is, the target queue established in advance on the hardware device side using the NVMe protocol. The interruption cause is used to identify the completion queue corresponding to the submission queue. The hardware device using the NVMe protocol submits a request for data transmission to the DMA controller. The DMA controller synchronizes the interruption cause to the target queue on the host side through DMA copy and transfer, thereby transmitting the interruption cause through the target queue.

[0100] Hardware devices using the NVMe protocol can trigger host interrupts through the target interrupt number. Hardware devices using the NVMe protocol include the target interrupt number in the request including the interrupt cause submitted to the DMA controller. After completing the transmission of the interrupt cause, the DMA controller triggers an interrupt based on the target interrupt number included in the request.

[0101] Second: Hardware devices using the NVMe protocol interact with the host in an asynchronous manner.

[0102] In another possible implementation, a hardware device using the NVMe protocol writes the execution result of the execution command to the completion queue corresponding to the submission queue, writes the interruption reason to the target queue, and triggers a host interrupt based on the target interrupt number, including the following steps:

[0103] The hardware device using the NVMe protocol submits a first transmission request and a second transmission request to the controller respectively.

[0104] In the process of using asynchronous mode to interact with the host, the controller controls the order in which the hardware device using the NVMe protocol transmits data to the host, and the order in which the controller transmits data to the host is not determined by the time sequence in which the hardware device using the NVMe protocol submits data to the controller. Figure 8As shown, the figure is a schematic diagram of a process of asynchronous transmission between a hardware device and a host using the NVMe protocol provided by an embodiment of the present application. The hardware device using the NVMe protocol submits a first transmission request and a second transmission request to the controller through an asynchronous channel in the message channel. Among them, the controller is a DMA controller, or other controller that implements data interaction between a hardware device using the NVMe protocol and a host. The first transmission request includes an execution result and a transmission identifier. The transmission identifier is used to indicate the completion of the transmission of the execution result. The transmission identifier can be a flag bit in the first transmission request agreed in advance. In the process of processing the first transmission request, the controller writes the execution result to the completion queue on the host side and writes the transmission identifier in a pre-set storage space. The pre-set storage space is a space that both the host and the controller can read and write. The host can determine whether to write the execution result by querying whether the transmission identifier is written in the pre-set storage space. As an example, the value of the transmission identifier is "1". The value of the flag bit stored in the pre-set storage space is "0". In the process of processing the first transmission request, the controller writes the transmission identifier to the flag bit stored in the storage space, that is, the flag position is "1". The flag bit with a value of "1" is used to indicate that the transmission of the execution result is completed. It should be noted that the first transmission request includes an invalid interrupt number, or includes an interrupt invalid flag. An invalid interrupt number cannot trigger a host interrupt. The interrupt invalid flag is used to control the controller to turn off the function of triggering the host interrupt of this request, and the completion of the processing of the first transmission request cannot trigger a host interrupt.

[0105] The second transmission request includes the interruption reason and the target interruption number. The source address of this asynchronous transmission is set to the tail address of the target queue on the hardware device side using the NVMe protocol, and the destination address is the tail address of the target queue on the host side. The controller processes the second transmission request, writes the interruption reason to the target queue, and triggers a host interrupt based on the target interruption number.

[0106] The embodiment of the present application does not limit the order in which the hardware device using the NVMe protocol sends the first transmission request and the second transmission request to the controller. As an example, the hardware device using the NVMe protocol can first send the first transmission request to the controller, and then send the second transmission request. Alternatively, the hardware device using the NVMe protocol first sends the second transmission request to the controller, and then sends the first transmission request.

[0107] The order in which the controller processes the first transfer request and the second transfer request is not determined by the order in which the hardware device using the NVMe protocol submits the first transfer request and the second transfer request.

[0108] In a possible implementation, the controller processes the first transmission request first, and then processes the second transmission request. After the interrupt is triggered based on the second transmission request, the host can detect the transmission identifier in the preset storage space. In response to detecting the transmission identifier, the host continues to process the interrupt cause, that is, obtains the execution result from the completion queue of the interrupt cause identifier, and processes the execution result.

[0109] And use the business processing function to read and process the execution results from the completion queue corresponding to the submission queue.

[0110] In another possible implementation, the controller processes the second transmission request first, and then processes the first transmission request. After processing the second transmission request, a host interrupt is triggered. The host detects the transmission identifier in a preset storage space. Since the controller has not yet processed the first transmission request, the host cannot detect the transmission identifier. The host stops processing the interruption cause and repeats the detection of the transmission identifier until the transmission identifier is detected. The embodiment of the present application does not limit the specific implementation method of the host repeatedly detecting the transmission identifier. As an example, after the transmission identifier is not detected, the host mounts the task of processing the interruption to the host's scheduler, waits for the scheduler to determine the time for the next transmission identifier detection, and performs another transmission identifier detection after the time is reached. In response to detecting the transmission identifier, the host reads the execution result from the completion queue corresponding to the submission queue of the interruption cause identifier based on the interruption cause written by the controller for processing the second transmission request, and uses the business processing function corresponding to the interruption cause to process the execution result.

[0111] Based on the interrupt processing method provided in the embodiment of the present application, the embodiment of the present application also provides a hardware device 900 using the NVMe protocol, which can implement Figure 2 The functions of the hardware devices using the NVMe protocol in the illustrated embodiment. Fig. 9 As shown in FIG. 1 , the figure is a schematic diagram of the structure of a hardware device using the NVMe protocol provided in an embodiment of the present application. The hardware device using the NVMe protocol includes a processing unit 901 and a sending unit 902. The processing unit 901 is used to implement Figure 2 In S202 of the embodiment shown, the sending unit 902 is used to implement Figure 2 S203 in the illustrated embodiment.

[0112] Specifically, the processing unit 901 is used to obtain a command reading message sent by the host, obtain the command from the submission queue, and execute the command, and the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus;

[0113] A sending unit 902 is used to write the execution result of the command to the completion queue corresponding to the submission queue, write the interruption cause to the target queue, and trigger a host interruption based on a target interruption number, wherein the target interruption number is used to trigger a host interruption, and instruct the host to read the interruption cause from the target queue, wherein the interruption cause is used to identify the completion queue corresponding to the submission queue, and the target queue reuses the queue specified by the NVMe protocol, and is used to transmit interruption causes identifying different completion queues.

[0114] For the specific implementation process, please refer to the above Figure 2 The detailed description of the corresponding steps in the illustrated embodiment will not be repeated here one by one.

[0115] Based on the interrupt processing method provided in the embodiment of the present application, the embodiment of the present application also provides a host 1000, which can implement Figure 2 The functions of the host in the embodiment shown. Fig.10 As shown in FIG. 1 , the figure is a schematic diagram of the structure of a host provided in an embodiment of the present application. The host includes a sending unit 1001 and a processing unit 1002. The sending unit 1001 is used to implement Figure 2 In S201 of the embodiment shown, the processing unit 1002 is used to implement Figure 2 S204 and S205 in the illustrated embodiment.

[0116] Specifically, the sending unit 1001 is used to write a command into a submission queue and send a command read message to a hardware device using the NVMe protocol, wherein the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus;

[0117] The processing unit 1002 is used to read the interruption cause from the target queue in response to receiving the interruption triggered by the target interruption number, wherein the target queue reuses the queue specified by the NVMe protocol for transmitting the interruption cause identifying different completion queues;

[0118] The processing unit 1002 is further configured to read an execution result from a completion queue corresponding to the submission queue based on the interruption reason, and process the execution result, wherein the interruption reason is used to identify the completion queue corresponding to the submission queue.

[0119] For the specific implementation process, please refer to the above Figure 2 The detailed description of the corresponding steps in the illustrated embodiment will not be repeated here one by one.

[0120] Based on an interrupt processing method applied to a host and an interrupt processing method applied to a hardware device using the NVMe protocol provided in an embodiment of the present application, an embodiment of the present application further provides a system 1100. Fig.11 As shown in FIG. 1 , the figure is a schematic diagram of the structure of a system provided in an embodiment of the present application. The system 1100 includes a hardware device 1101 using the NVMe protocol and a host 1102. Among them, the hardware device 1101 using the NVMe protocol can be Figure 2 The hardware device 1101 using the NVMe protocol in the illustrated embodiment. The host 1102 can be Figure 2 The host in the illustrated embodiment.

[0121] Specifically, the host 1102 writes a command to the submission queue and sends a command read message to the hardware device 1101 using the NVMe protocol, and the host 1102 and the hardware device 1101 using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus;

[0122] In response to obtaining a command read message sent by the host 1102, the hardware device 1101 using the NVMe protocol obtains a command from a submission queue and executes the command;

[0123] The hardware device 1101 adopting the NVMe protocol writes the execution result of the command to the completion queue corresponding to the submission queue, writes the interruption reason to the target queue, and triggers the host interruption based on the target interruption number, the target interruption number is used to trigger the host interruption, and instructs the host to read the interruption reason from the target queue, the interruption reason is used to identify the completion queue corresponding to the submission queue, and the target queue reuses the queue specified by the NVMe protocol for transmitting the interruption reasons identifying different completion queues;

[0124] In response to receiving an interrupt triggered by the target interrupt number, the host 1102 reads the interrupt cause from a target queue, the target queue multiplexing a queue specified by the NVMe protocol;

[0125] The host 1102 reads the execution result from the completion queue corresponding to the submission queue based on the interruption reason and processes the execution result, wherein the interruption reason is used to identify the completion queue corresponding to the submission queue.

[0126] For the specific implementation process, please refer to the above Figure 2 The detailed description of the corresponding steps in the illustrated embodiment will not be repeated here one by one.

[0127] Fig.12 1 is a schematic diagram of a device structure provided in an embodiment of the present application. The hardware device 900 or host 1000 using the NVMe protocol can be Fig.12 See Fig.12The device 1200 includes at least one processor 1201 , a communication bus 1202 , and at least one network interface 1204 . Optionally, the device 1200 may also include a memory 1203 .

[0128] Processor 1201 may be a central processing unit (CPU), a network processor (NP) or a combination of a CPU and an NP. In one implementation, processor 1201 may also be a traffic management (TM) chip or hardware integrating NP and TM chips, and the TM chip or the hardware integrating NP and TM chips may execute the method for scheduling queues provided in the embodiment of the present application on the queues in the TM chip. Processor 1210 may further include a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

[0129] For example, when the aforementioned Figure 2 The host in the embodiment shown in the figure passes Fig.12 When implemented by the device shown, the processor can be used to: in response to receiving an interrupt triggered by the target interrupt number, read the interrupt cause from the target queue; based on the interrupt cause, read the execution result from the completion queue corresponding to the submission queue, and process the execution result.

[0130] For example, when the aforementioned Figure 2 The hardware device using the NVMe protocol in the illustrated embodiment is Fig.12 When implemented by the device shown, the processor can be used to: in response to obtaining a command read message sent by the host, obtain the command from the submission queue, and execute the command.

[0131] The communication bus 1202 is used to transmit information between the processor 1201, the network interface 1204 and the memory 1203. The bus system 1202 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus system 1202 can be divided into an address bus, a data bus, a control bus, etc. Fig.12 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0132] The memory 1203 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions. The memory 1203 may also be a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions. It may also be a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1203 may exist independently and be connected to the processor 1201 via the communication bus 1202. The memory 1203 may also be integrated with the processor 1201.

[0133] Optionally, the memory 1203 is used to store program codes or instructions for executing the solution of the present application, and the execution is controlled by the processor 1201. The processor 1201 is used to execute the program codes or instructions stored in the memory 1203. The program code may include one or more software modules. Optionally, the processor 1201 may also store program codes or instructions for executing the solution of the present application, in which case the processor 1201 does not need to read the program codes or instructions from the memory 1203.

[0134] The interface 1204 may be a device such as a transceiver, which is used to communicate with other devices or communication networks. For example, the communication network may be Ethernet, a radio access network (RAN), or a wireless local area network (WLAN). In an embodiment of the present application, the network interface 1204 may be used to receive messages sent by other nodes in the segment routing network, or to send messages to other nodes in the segment routing network. The network interface 1204 may be an Ethernet interface, a fast Ethernet (FE) interface, or a gigabit Ethernet (GE) interface.

[0135] In a specific implementation, as an embodiment, the device 1200 may include multiple processors, such as Fig.12 1 and 1207. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0136] Fig.13 Schematic diagram of the structure of a device provided in an embodiment of the present application. The host or hardware device using the NVMe protocol involved in the embodiment of the present application is used to Fig.13 The device shown is implemented.

[0137] See also Fig.13 As shown in the schematic diagram of the device structure, the device 1300 includes a main control board and one or more interface boards. The main control board is connected to the interface board in communication. The main control board is also called a main processing unit (MPU) or a route processing card. The main control board includes a CPU and a memory. The main control board is responsible for the control and management of each component in the device 1300, including route calculation, device management and maintenance functions. The interface board is also called a line processing unit (LPU) or a line card, which is used to receive and send messages.

[0138] In some embodiments, the main control board and the interface board or the interface board and the interface board communicate through a bus. In some embodiments, the interface boards communicate through a switching fabric board. In this case, the device 1300 also includes a switching fabric board, which is connected to the main control board and the interface board. The switching fabric board is used to forward data between the interface boards. The switching fabric board can also be called a switch fabric unit (SFU). The interface board includes a CPU, a memory, a forwarding engine and an interface card (IC), wherein the interface card may include one or more network interfaces. The network interface may be an Ethernet interface, a FE interface or a GE interface, etc. The CPU is connected to the memory, the forwarding engine and the interface card respectively. The memory is used to store a forwarding table. The forwarding engine is used to forward the received message based on the forwarding table stored in the memory. If the destination address of the received message is the IP address of the device 1300, the message is sent to the CPU of the main control board or the interface board for processing; if the destination address of the received message is not the IP address of the device 1300, the forwarding table is checked according to the destination. If the next hop and the outgoing interface corresponding to the destination address are found in the forwarding table, the message is forwarded to the outgoing interface corresponding to the destination address. The forwarding engine can be a network processor (NP). The interface card is also called a daughter card, which can be installed on the interface board and is responsible for converting the photoelectric signal into a data frame, and forwarding the data frame to the forwarding engine for processing or the interface board CPU after checking the legitimacy. In some embodiments, the CPU can also perform the functions of the forwarding engine, such as forwarding based on a general-purpose CPU, so that the forwarding engine is not required in the interface board. In some embodiments, the forwarding engine can be implemented by an ASIC or a field programmable gate array (FPGA). In some embodiments, the memory storing the forwarding table can also be integrated into the forwarding engine as a part of the forwarding engine.

[0139] The embodiment of the present application also provides a chip system, comprising: a processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instruction is executed by the processor, the chip system realizes the above Figure 2 The interrupt processing method provided in the illustrated embodiment.

[0140] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading the software code stored in the memory. Optionally, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately provided from the processor, which is not limited in the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be provided on different chips respectively. The present application does not specifically limit the type of memory and the manner in which the memory and the processor are provided.

[0141] Exemplarily, the chip system can be an FPGA, an ASIC, a system on chip (SoC), a CPU, an NP, a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0142] It should be understood that each step in the above method embodiment can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.

[0143] An embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when executed on a computer, enables the computer to execute the interrupt handling method provided in the above method embodiment and executed by a host or a hardware device using the NVMe protocol.

[0144] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the interrupt handling method provided in the above method embodiment and executed by a host or a hardware device using the NVMe protocol.

[0145] The terms "first", "second", "third", "fourth", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0146] In this application, "at least one item" means one or more, and "plurality" means two or more. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple. In this application, "A and / or B" is considered to include A alone, B alone, and A+B.

[0147] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0148] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical module 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0149] 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 obtained according to actual needs to achieve the purpose of the solution of this embodiment.

[0150] In addition, each module unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software module unit.

[0151] If the integrated unit is implemented in the form of a software module unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0152] Those skilled in the art should be aware that in one or more of the above examples, the functions described in this application can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any media that facilitates the transmission of a computer program from one place to another. Storage media can be any available media that a general or special-purpose computer can access.

[0153] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific implementation method of the present application.

[0154] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. An interrupt processing method, characterized in that: The method comprises: In response to obtaining a command read message sent by the host, a hardware device using a non-volatile memory express (NVMe) protocol obtains a command from a submission queue and executes the command, wherein the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus; The hardware device adopting the NVMe protocol writes the execution result of the command to the completion queue corresponding to the submission queue, writes the interruption cause to the target queue, and triggers the host interruption based on the target interruption number, wherein the target interruption number is used to trigger the host interruption and instruct the host to read the interruption cause from the target queue, wherein the interruption cause is used to identify the completion queue corresponding to the submission queue, and the target queue reuses the queue specified by the NVMe protocol for transmitting the interruption causes identifying different completion queues.

2. The method according to claim 1, characterized in that The time when the hardware device using the NVMe protocol writes the execution result of executing the command to the completion queue corresponding to the submission queue is earlier than the time when the hardware device using the NVMe protocol writes the interruption cause to the target queue.

3. The method according to claim 1, characterized in that The hardware device using the NVMe protocol writes the execution result of the command to the completion queue corresponding to the submission queue, writes the interruption reason to the target queue, and triggers a host interrupt based on the target interrupt number, including: A hardware device using the NVMe protocol submits a first transfer request and a second transfer request to the controller respectively, wherein the first transfer request includes an execution result of executing the command and a transfer identifier, and the second transfer request includes an interruption cause and a target interruption number, and the transfer identifier is used to indicate the completion of the transmission of the execution result. The controller is used to write the execution result to the completion queue corresponding to the submission queue based on the first transfer request, and transmit the transfer identifier to the host, write the interruption cause to the target queue based on the second transfer request, and trigger the host interrupt based on the target interruption number.

4. The method according to claim 3, characterized in that The first transfer request includes an invalid interrupt number, or the first transfer request includes an interrupt invalid flag, the invalid interrupt number cannot trigger the host interrupt, and the interrupt invalid flag is used to indicate that the interrupt number included in the first transfer request cannot trigger the host interrupt.

5. The method according to any one of claims 1 to 4, characterized in that: The interruption reason is the queue number code of the completion queue.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The hardware device adopting the NVMe protocol obtains a management command sent by the host, wherein the management command includes a first address of a target queue on the host side; The hardware device adopting the NVMe protocol constructs a target queue on the hardware device side adopting the NVMe protocol based on the first address, and the target queue on the hardware device side adopting the NVMe protocol is associated with the target queue on the host side to constitute the target queue.

7. The method according to any one of claims 1 to 6, characterized in that: The target queue is a queue whose idleness satisfies an idleness threshold.

8. An interrupt processing method, characterized in that: The method comprises: The host writes a command into a submission queue and sends a command read message to a hardware device using the NVMe protocol, wherein the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus; In response to receiving an interrupt triggered by the target interrupt number, the host reads the interrupt cause from the target queue, and the target queue reuses the queue specified by the NVMe protocol for transmitting the interrupt cause identifying different completion queues; The host reads an execution result from a completion queue corresponding to the submission queue based on the interruption reason and processes the execution result, wherein the interruption reason is used to identify the completion queue corresponding to the submission queue.

9. The method according to claim 8, characterized in that The interruption reason is the queue number code of the completion queue corresponding to the submission queue.

10. The method according to claim 8, characterized in that The host reads the execution result from the completion queue corresponding to the submission queue based on the interruption reason, including: In response to detecting a transmission identifier, the host reads an execution result from a completion queue corresponding to the submission queue based on the interruption cause, the transmission identifier being used to indicate completion of transmission of the execution result; In response to not detecting the transmission identifier, the host repeatedly detects the transmission identifier until the transmission identifier is detected.

11. The method according to claim 8, characterized in that The method further comprises: The host selects a queue whose idleness meets an idleness threshold from the submission queue on the host side and the completion queue on the host side as the target queue on the host side; The host sends a management command to the hardware device using the NVMe protocol, and the management command includes the first address of the target queue on the host side.

12. A hardware device using the NVMe protocol, characterized in that: The device comprises: A processing unit, configured to read a message in response to obtaining a command sent by a host, obtain a command from a submission queue, and execute the command, wherein the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus; A sending unit is used to write the execution result of the command to the completion queue corresponding to the submission queue, write the interruption cause to the target queue, and trigger the host interruption based on the target interruption number, wherein the target interruption number is used to trigger the host interruption, and instruct the host to read the interruption cause from the target queue, wherein the interruption cause is used to identify the completion queue corresponding to the submission queue, and the target queue reuses the queue specified by the NVMe protocol, and is used to transmit the interruption causes identifying different completion queues.

13. The device according to claim 12, characterized in that The time of writing the execution result of the command into the completion queue corresponding to the submission queue is earlier than the time of writing the interruption reason into the target queue.

14. The device according to claim 12, characterized in that The sending unit is used to submit a first transmission request and a second transmission request to the controller respectively, the first transmission request includes an execution result of executing the command and a transmission identifier, the second transmission request includes an interruption reason and a target interruption number, and the transmission identifier is used to indicate the completion of the transmission of the execution result. The controller is used to write the execution result to the completion queue corresponding to the submission queue based on the first transmission request, and transmit the transmission identifier to the host, write the interruption reason to the target queue based on the second transmission request, and trigger the host interrupt based on the target interruption number.

15. The device according to claim 14, characterized in that The first transfer request includes an invalid interrupt number, or the first transfer request includes an interrupt invalid flag, the invalid interrupt number cannot trigger the host interrupt, and the interrupt invalid flag is used to indicate that the interrupt number included in the first transfer request cannot trigger the host interrupt.

16. The device according to any one of claims 12 to 15, characterized in that The interruption reason is the queue number code of the completion queue.

17. The device according to any one of claims 12 to 16, characterized in that The device also includes: A receiving unit, configured to obtain a management command sent by the host, wherein the management command includes a first address of a target queue on the host side; The processing unit is also used to construct a target queue on the hardware device side that adopts the NVMe protocol based on the first address, and the target queue on the hardware device side that adopts the NVMe protocol is associated with the target queue on the host side to constitute the target queue.

18. The device according to any one of claims 12 to 17, characterized in that The target queue is a queue whose idleness satisfies an idleness threshold.

19. A host, characterized in that: The host comprises: A sending unit, used for writing commands into a submission queue and sending command read messages to a hardware device using the NVMe protocol, wherein the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus; A processing unit, configured to read an interruption cause from a target queue in response to receiving an interruption triggered by the target interruption number, wherein the target queue reuses a queue specified by the NVMe protocol for transmitting interruption causes identifying different completion queues; The processing unit is further configured to read an execution result from a completion queue corresponding to the submission queue based on the interruption reason, and process the execution result, wherein the interruption reason is used to identify the completion queue corresponding to the submission queue.

20. The host according to claim 19, characterized in that: The interruption reason is the queue number code of the completion queue corresponding to the submission queue.

21. The host according to claim 19, characterized in that: The processing unit is used to read the execution result from the completion queue corresponding to the submission queue based on the interruption reason, including: The processing unit is used to respond to the detection of a transmission identifier, and the host reads the execution result from the completion queue corresponding to the submission queue based on the interruption cause, and the transmission identifier is used to indicate the completion of the transmission of the execution result; in response to the failure to detect the transmission identifier, the host repeatedly detects the transmission identifier until the transmission identifier is detected.

22. The host according to claim 19, characterized in that: The processing unit is further configured for the host to select a queue whose idleness meets an idleness threshold from the submission queue on the host side and the completion queue on the host side as the target queue on the host side; The sending unit is also used to send a management command to the hardware device using the NVMe protocol, and the management command includes the first address of the target queue on the host side.

23. A system, characterized in that: The system includes a host and a hardware device using the NVMe protocol, the host and the hardware device using the NVMe protocol are connected based on a high-speed peripheral component interconnect standard PCIe bus, the hardware device using the NVMe protocol implements the interrupt processing method as described in any one of claims 1 to 7, and the host implements the interrupt processing method as described in any one of claims 8 to 11.

24. A computer-readable storage medium, characterized in that: The method comprises instructions, programs or codes, which, when executed on a computing device, enable the computing device to execute the interrupt processing method according to any one of claims 1 to 7, or the interrupt processing method according to any one of claims 8 to 11.