Virtio device interrupt method and apparatus, back-end device, and chip

By introducing interrupt event counting and timeout timestamping mechanisms in VIRTIO devices, the interrupt event is merged, the interrupt processing process is optimized, the additional overhead and performance problems brought by the interrupt suppression function of VIRTIO specifications are solved, and the system performance is improved.

WO2025156551A1PCT designated stage Publication Date: 2025-07-31BEIJING JAGUAR MICROSYSTEMS CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/099563
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-01-25
Filing Date
2024-06-17
Publication Date
2025-07-31

AI Technical Summary

Technical Problem

In cloud computing virtualization technology, although the interrupt suppression function of VIRTIO specification reduces the interrupt frequency, the frequent interrupt checks and FLAG flag updates lead to additional overhead and PCIe bandwidth consumption, affecting system performance.

Method used

By introducing mechanisms such as interrupt event counting, minimum timeout timestamp and maximum timeout timestamp, multiple interrupt events are merged, interrupts are sent only when specific conditions are met, memory read and write operations and interrupt counts are reduced, and interrupt processing flow is optimized.

Benefits of technology

It effectively reduces CPU processing capacity consumption, saves PCIe bus bandwidth, improves data transmission efficiency, and solves the problem of unsatisfactory interrupt suppression function of VIRTIO specification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024099563_31072025_PF_FP_ABST
    Figure CN2024099563_31072025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to a VIRTIO device interrupt method and apparatus, a back-end device, and a chip. The method comprises: in response to having received a burst message, reading an interrupt event count, the minimum timeout timestamp and the maximum timeout timestamp of a VIRTIO queue corresponding to the burst message; and on the basis of the interrupt event count, the minimum timeout timestamp and the maximum timeout timestamp, determining whether a first interrupt sending condition is met, and if the first interrupt sending condition is met, sending an interrupt to a front-end driver, or if the first interrupt sending condition is not met, not sending an interrupt to the front-end driver, wherein the first interrupt sending condition is: ((interrupt events+1>=preset number of interrupt events)&&(current system time>=minimum timeout timestamp))||((interrupt events! =0)&&(current system time>=maximum timeout timestamp)). By means of the present application, the number of VIRTIO device interrupts can be reduced, thereby achieving the effect of reducing CPU interrupt overheads.
Need to check novelty before this filing date? Find Prior Art

Description

A VIRTIO device interruption method and device, back-end device, and chip

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to a Chinese patent application filed with the Patent Office of China on January 25, 2024, with application number 202410110539.6 and invention name “A VIRTIO device interruption method and apparatus, back-end equipment, and chip”. The entire contents of the patent application are incorporated herein by reference. Technical Field

[0003] The present application relates to the field of cloud computing virtualization technology, and in particular to a VIRTIO device interruption method and apparatus, back-end equipment, chip, and computer-readable storage medium. Background Art

[0004] In cloud computing virtualization technology, in order to allow multiple guest OSes (client operating systems) to run independently of the host OS (host operating system) on the same hardware, it is usually necessary to add a virtualization layer to achieve this. This virtualization layer is called VMM (Virtual Machine Monitor).

[0005] QEMU (Machine Emulator and Virtualizer), as a VMM, provides a fully virtualized environment. In this environment, the guest operating system is unaware of its existence as a virtual machine and requires no modifications. However, because all operations require software emulation, frequent traps and exits during device accesses cause serious performance issues. To address this, the paravirtualization technology VIRTIO (Virtual I / O Device) was developed.

[0006] VIRTIO is a general-purpose paravirtualized I / O framework that allows the VMM to simulate a series of virtualized devices. The VIRTIO framework consists of three main components: the front-end driver, back-end devices, and the virtualization queue (Virtqueue). The front-end driver is the driver for the VIRTIO simulated devices within the virtual machine (such as common VIRTIO network devices and VIRTIO disk devices). The front-end driver receives user-mode requests, encapsulates these requests according to a preset protocol, and sends them to the back-end device. The back-end device is typically implemented in QEMU and receives and parses I / O requests from the front-end driver, completing the request transmission and reception on the actual physical device, and ultimately notifying the front-end driver through an interrupt mechanism. Data between the front-end driver and the back-end device is exchanged through the Virtqueue.

[0007] According to the VIRTIO specification, a Virtqueue consists of a descriptor table, an available ring table, and a used ring table. The descriptor table stores information such as the data cache address, length, flags, and next-hop pointer. The available and used ring tables contain pointers to entries in the descriptor table. When sending a packet, the front-end driver places the packet into a cache. It then generates a descriptor based on the cache address and length, stores the descriptor address at the location pointed to by the current index in the available ring table, and updates the index. The front-end driver notifies the back-end device to send the packet. After multiple PCIe read requests (including reading the available ring table pointer, the descriptor table, the packet cache, and interrupt suppression), the back-end device receives the packet and sends it to the corresponding downstream module. Sending and receiving a large number of packets in a short period of time can trigger numerous interrupts. Upon receiving an interrupt, the system needs to save the current process's context and restore the previous process's context upon exiting the interrupt. This frequent context switching significantly consumes CPU processing power. To address the aforementioned interrupt issues, the VIRTIO specification introduces an interrupt suppression feature. This feature sets a FLAG flag (NO_INTERRUPT) in the available ring table during certain time periods, instructing the backend device not to send interrupts, thereby reducing the number of interrupts. However, this interrupt suppression feature introduces additional overhead. Each time a data packet is received, the FLAG flag in the available ring table must be read before sending an interrupt, consuming PCIe bandwidth. Furthermore, the PCIe read latency is typically around 1µs. By the time the FLAG flag is read and the decision to initiate an interrupt is made, the driver software may have already updated the value in the FLAG flag. This results in suboptimal interrupt suppression functionality that relies on the FLAG flag.

[0008] Summary of the Invention

[0009] The purpose of this application is to provide a VIRTIO device interruption method and apparatus, back-end equipment, chip, and computer-readable storage medium.

[0010] To achieve the above object, according to a first aspect of the present application, a VIRTIO device interrupt method is provided.

[0011] In response to receiving a burst message, triggering a current interrupt event, and reading an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of a VIRTIO queue corresponding to the burst message;

[0012] Determining whether a first interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp, and if so, sending an interrupt to the front-end driver; if not, not sending an interrupt to the front-end driver;

[0013] Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

[0014] In some embodiments, the method further comprises:

[0015] If the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, then updating the interrupt event count and the maximum timeout timestamp of the VIRTIO queue, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus the preset maximum timeout interval;

[0016] If the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, the interrupt event count of the VIRTIO queue is updated, and the updated interrupt event count is the interrupt event count before the update plus one.

[0017] In some embodiments, the method further comprises:

[0018] Polling and scanning the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition, and if so, sending an interrupt to the front-end driver; otherwise, not sending an interrupt to the front-end driver;

[0019] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0020] In some embodiments, the method further comprises:

[0021] When sending an interrupt to the front-end driver, the interrupt event count and the minimum timeout timestamp of the VIRTIO queue are also updated. The updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout interval.

[0022] According to a second aspect of the present application, a VIRTIO device interruption method is provided, the method comprising:

[0023] In response to receiving a burst message, triggering a current interrupt event, and reading an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of a VIRTIO queue corresponding to the burst message;

[0024] Determining whether a first interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp; if the first interrupt sending condition is met and the VIRTIO queue does not support active interrupt suppression, directly sending the interrupt to the front-end driver; if the first interrupt sending condition is met and the VIRTIO queue supports active interrupt suppression, obtaining an active suppression state signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression according to the active suppression state signal; if so, not sending the interrupt; if not, sending the interrupt to the front-end driver; if not, not sending the interrupt to the front-end driver;

[0025] Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

[0026] In some embodiments, the method further comprises:

[0027] If the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, then updating the interrupt event count and the maximum timeout timestamp of the VIRTIO queue, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus the preset maximum timeout interval;

[0028] If the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, the interrupt event count of the VIRTIO queue is updated, and the updated interrupt event count is the interrupt event count before the update plus one.

[0029] In some embodiments, the method further comprises:

[0030] Polling and scanning the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue does not support active interrupt suppression, sending an interrupt to the front-end driver; if not, not sending an interrupt to the front-end driver;

[0031] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0032] In some embodiments, the method further comprises:

[0033] Polling and scanning the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue supports active interrupt suppression, further obtaining an active suppression status signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression according to the active suppression status signal; if not, sending an interrupt to the front-end driver; if so, not sending an interrupt;

[0034] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0035] In some embodiments, the method further comprises:

[0036] In response to receiving an active suppression release signal, reading an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of the VIRTIO queue corresponding to the active suppression release signal;

[0037] Determine whether the first interrupt sending condition or the second interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp and the maximum timeout timestamp; if met, send an interrupt to the front-end driver and set the active inhibition status signal of the VIRTIO queue; if not met, do not send an interrupt to the front-end driver, clear the active inhibition status signal of the VIRTIO queue, and accumulate the interrupt event count.

[0038] In some embodiments, the method further comprises:

[0039] When sending an interrupt to the front-end driver, the interrupt event count and the minimum timeout timestamp of the VIRTIO queue are also updated. The updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout interval.

[0040] According to a third aspect of the present application, a VIRTIO device interruption device is provided, the device comprising:

[0041] a data reading module, configured to trigger a current interrupt event in response to receiving a burst message, and read an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of a VIRTIO queue corresponding to the burst message;

[0042] a first interrupt processing module, configured to determine whether a first interrupt sending condition is satisfied according to the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp; if so, send an interrupt to the front-end driver; and if not, do not send an interrupt to the front-end driver;

[0043] Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

[0044] In some embodiments, the apparatus comprises:

[0045] The second interrupt processing module is used to update the interrupt event count and maximum timeout timestamp of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus a preset maximum timeout interval; and is also used to update the interrupt event count of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one.

[0046] In some embodiments, the apparatus comprises:

[0047] A polling module, configured to poll and scan the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition, and if so, send an interrupt to the front-end driver; otherwise, do not send an interrupt to the front-end driver;

[0048] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0049] In some embodiments, the apparatus further comprises:

[0050] The third interrupt processing module is used to update the interrupt event count and minimum timeout timestamp of the VIRTIO queue when sending an interrupt to the front-end driver, the updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout time interval.

[0051] According to a fourth aspect of the present application, a VIRTIO device interruption device is provided, the device comprising:

[0052] a data reading module, configured to trigger a current interrupt event in response to receiving a burst message, and read an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of a VIRTIO queue corresponding to the burst message;

[0053] a first interrupt processing module, configured to determine whether a first interrupt sending condition is met based on the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp; if so, directly send the interrupt to the front-end driver; if so, and the VIRTIO queue does not support active interrupt suppression, obtain an active suppression state signal of the VIRTIO queue, and determine whether the VIRTIO queue is in active interrupt suppression based on the active suppression state signal; if so, do not send the interrupt; if not, send the interrupt to the front-end driver; if not, do not send the interrupt to the front-end driver;

[0054] The first interrupt sending condition is: ((interrupt event + 1 >= preset interrupt event number) && (current system time >= minimum timeout timestamp)) || ((interrupt event != 0) && (current system time >= maximum timeout timestamp))

[0055] In some embodiments, the apparatus comprises:

[0056] The second interrupt processing module is used to update the interrupt event count and maximum timeout timestamp of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus a preset maximum timeout interval; and is also used to update the interrupt event count of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one.

[0057] In some embodiments, the apparatus further comprises:

[0058] a polling module, configured to poll and scan the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue does not support active interrupt suppression, sending an interrupt to the front-end driver; and if not, not sending an interrupt to the front-end driver.

[0059] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0060] In some embodiments, the apparatus further comprises:

[0061] a polling module, configured to poll and scan the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue supports active interrupt suppression, further obtaining an active suppression status signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression according to the active suppression status signal; if not, sending an interrupt to the front-end driver; and if so, not sending an interrupt;

[0062] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0063] In some embodiments, the apparatus further comprises:

[0064] a third interrupt processing module, configured to, in response to receiving an active suppression release signal, read an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of the VIRTIO queue corresponding to the active suppression release signal;

[0065] Determine whether the first interrupt sending condition or the second interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp and the maximum timeout timestamp; if so, and the VIRTIO queue supports active interrupt suppression, send an interrupt to the front-end driver, and set the active suppression status signal of the VIRTIO queue; if not, do not send an interrupt to the front-end driver, clear the active suppression status signal of the VIRTIO queue, and accumulate the interrupt event count.

[0066] In some embodiments, the apparatus further comprises:

[0067] The fourth interrupt processing module is used to update the interrupt event count and minimum timeout timestamp of the VIRTIO queue when sending an interrupt to the front-end driver, the updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout time interval.

[0068] According to a fifth aspect of the present application, a VIRTIO backend device is provided, comprising the VIRTIO device interruption device.

[0069] According to a sixth aspect of the present application, a chip is provided, comprising the VIRTIO back-end device.

[0070] According to a seventh aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the VIRTIO device interrupt method is implemented.

[0071] In summary, the present application provides a VIRTIO device interrupt method and apparatus, back-end device, chip, and computer-readable storage medium. For the same VIRTIO queue, an interrupt is not initiated upon sending or receiving a data packet, but rather an interrupt is initiated only after a certain number of data packets are sent or received. Specifically, whether the first interrupt sending condition is met is determined by the interrupt event count, minimum timeout timestamp, and maximum timeout timestamp. The minimum timeout timestamp is used to ensure that the time interval between two interrupts sent by the same queue of the VIRTIO network device must be greater than the minimum timeout time; the maximum timeout timestamp is used to ensure that if there is one or more interrupt events in the same queue of the VIRTIO network device, an interrupt can be issued within the specified maximum timeout time. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0073] FIG1 is a flow chart of a VIRTIO device interruption method according to an embodiment of the present application.

[0074] FIG2 is a schematic diagram of interrupt data storage of a VIRTIO queue in an embodiment of the present application.

[0075] FIG3 is a schematic diagram of a packet receiving process of a VIRTIO network device in an embodiment of the present application.

[0076] FIG4 is a schematic diagram of a packet sending process of a VIRTIO network device in an embodiment of the present application.

[0077] FIG5 is a flow chart of a VIRTIO device interruption method according to an embodiment of the present application.

[0078] FIG6 is a schematic diagram of a polling scanning process in an embodiment of the present application.

[0079] FIG7 is a flowchart of another VIRTIO device interruption method in an embodiment of the present application.

[0080] FIG8 is a flow chart of another VIRTIO device interruption method according to an embodiment of the present application.

[0081] FIG9 is a flow chart of another polling scanning process in an embodiment of the present application.

[0082] FIG10 is a flow chart of releasing active suppression of a VIRTIO queue in an embodiment of the present application.

[0083] FIG11 is a simplified schematic diagram of an MSI-X interrupt module in one embodiment of the present application. DETAILED DESCRIPTION

[0084] The detailed description of the accompanying drawings is intended to serve as an illustration of the presently preferred embodiment of the present application, and is not intended to represent the only form in which the present application can be implemented. It should be understood that the same or equivalent functions can be accomplished by different embodiments intended to be included in the spirit and scope of the present application.

[0085] Embodiment 1 of the present application provides a VIRTIO device interruption method. Referring to FIG1 , the method includes the following steps:

[0086] Step S10, in response to receiving a burst message, triggering a current interrupt event, and reading an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of a VIRTIO queue corresponding to the burst message;

[0087] In some embodiments, a burst message refers to the operation of continuously sending or receiving multiple data packets in data communication, that is; in network communication, data is usually transmitted in the form of data packets; when multiple data packets need to be sent or received, burst messages can be used to improve the efficiency of data transmission; burst messages can reduce transmission overhead by sending or receiving multiple data packets in one transmission; compared to sending or receiving only one data packet at a time, burst messages can reduce transmission overhead and improve data transmission throughput; in hardware devices, burst messages are usually used in combination with technologies such as DMA (direct memory access) engines or caches to achieve efficient data transmission; by sending or receiving multiple data packets at one time, the number of times the DMA engine is started and stopped can be reduced, thereby improving the efficiency of data transmission.

[0088] In some embodiments, upon receiving a burst message, interrupt data of a VIRTIO queue corresponding to the burst message is queried in step S1. The interrupt data includes an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp. This embodiment provides a RAM memory to store the interrupt data of each VIRTIO queue. As shown in FIG2 , each row of the table corresponds to a VIRTIO queue. It should be noted that the interrupt data of each VIRTIO queue changes dynamically over time.

[0089] Step S20, determining whether a first interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp; if so, sending an interrupt to the front-end driver; if not, not sending an interrupt to the front-end driver;

[0090] Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

[0091] In some embodiments, "!=" indicates not equal to, ">=" indicates greater than or equal to, "&&" indicates a logical AND operation, and "||" indicates a logical OR operation. If the interrupt event count plus 1 is greater than or equal to a preset number of interrupt events, and the current system time is greater than or equal to the minimum timeout timestamp, then the first interrupt sending condition is met. Alternatively, if the interrupt event count is not equal to 0, and the current system time is greater than or equal to the maximum timeout timestamp, then the first interrupt sending condition is also met.

[0092] In some embodiments, the method of the first embodiment proposes a burst-based interrupt merging mechanism and a timeout-timestamp-based interrupt merging mechanism. For the same VIRTIO queue, an interrupt is not initiated upon sending or receiving a single data packet. Instead, an interrupt is initiated after a certain number of data packets are sent or received. Whether the interrupt sending condition is met can be determined by the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp. The minimum timeout timestamp is used to ensure that the time interval between two interrupts sent by the same queue of the VIRTIO network device is always greater than the minimum timeout period; the maximum timeout timestamp is used to ensure that if the same queue of the VIRTIO network device has one or more interrupt events, an interrupt is always issued within the specified maximum timeout period. Therefore, the first embodiment can merge multiple interrupt events, reduce multiple memory read and write operations, save PCIe bus bandwidth, and reduce the number of interrupts, thereby achieving the purpose of reducing CPU processing power consumption, thereby solving the technical problem of the unsatisfactory interrupt suppression function relying on the FLAG flag in the VIRTIO specification.

[0093] It should be noted that the method of the first embodiment can be used for packet reception and packet transmission of a VIRTIO network device, that is, to implement interruption control when a packet is successfully received, and interruption control when a packet is successfully transmitted;

[0094] As shown in Figure 3, the VIRTIO network device packet receiving process includes the VIRTIO front-end driver execution process and the back-end device execution process;

[0095] The VIRTIO front-end driver execution process includes:

[0096] In the first step, the driver prepares the received network packet buffer in advance. These packet buffers are usually divided into two parts: a 12-byte part for the VIRITO network device header content; and a 1522-byte part for the received network packet content. If the VIRTIO Mergae feature is successfully negotiated, the VIRTIO header and packet content will be put together and a 4096-byte buffer will be allocated.

[0097] In the second step, the address and length of the cache allocated in the first step are filled into the descriptor table, and these descriptors are strung together into a chain through the next hop; one chain corresponds to one network data packet.

[0098] The third step is to fill the chain head address of the descriptor table into the location pointed to by the current index of the available ring table, and update the index value (index value + 1);

[0099] It should be noted that the above steps 1 to 4 are all completed in the VIRITO front-end driver.

[0100] The VIRTIO backend device execution process includes:

[0101] After receiving the Notify notification, the VIRTIO backend device performs the following steps:

[0102] The fifth step is to read the pointer value in the available ring table according to the index in the available ring table, and use these pointer values ​​to read the relevant content in the descriptor table; this step is usually called descriptor prefetch, which can be completed by the descriptor table prefetch module. The reason why it is called prefetch is that the reading of the descriptor is completed before receiving the data packet. After receiving the data packet, the previously prefetched descriptor is directly used to reduce the data packet reception delay; when the Ethernet data packet interface module receives the data packet received on the link, the descriptor prefetched in the fifth step is used to send the data packet to the cache pointed to by the descriptor; at the same time, the content of the address pointed to by the current index of the used ring table is updated (4-byte pointer + 4-byte length).

[0103] Step 6: Write the received data packet into the data packet buffer (the buffer address is indicated by the descriptor content) through the data packet update module DMA.

[0104] Step 7: Update the used ring table to inform the front-end driver how many messages the current device has sent to the host.

[0105] In the eighth step, the MSI-X interrupt module reads the NO_INTERRUPT flag in the available ring table to determine whether the interrupt is currently suppressed. If it is not suppressed, it reads the MSI-X interrupt table, initiates an interrupt, and notifies the front-end driver that the network data packet has been received.

[0106] As shown in Figure 4, the VIRTIO network device packet issuance process includes the VIRTIO front-end driver execution process and the back-end device execution process;

[0107] The VIRTIO front-end driver execution process includes:

[0108] The first step is for the driver to place the data packet to be sent into the network packet buffer. According to the specification, a 12-byte VIRTIO network device header is added to each data packet. The VIRTIO network device header and the data packet content may be placed in the same buffer or divided into multiple parts and placed in different buffers.

[0109] The second step is to fill the address and length of the buffer used in the first step into the descriptor table. For packets that require multiple descriptors for multiple buffers, these descriptors are strung together into a chain through the next hop. One chain corresponds to one network packet.

[0110] The third step is to fill the chain head address of the descriptor table into the location pointed to by the current index of the available ring table, and update the index value (index value + 1);

[0111] The fourth step is to write the notification register (Notify) to notify the back-end device that there is a network data packet to be sent;

[0112] It should be noted that the above steps 1 to 4 are all completed in the VIRITO front-end driver.

[0113] The VIRTIO backend device execution process includes:

[0114] After receiving the Notify notification, the VIRTIO backend device performs the following steps:

[0115] Step 5: The available ring table reading module reads the pointer value in the available ring table according to the index in the available ring table;

[0116] In the sixth step, the descriptor table reading module uses the pointer value returned in the fifth step to read the relevant content in the descriptor table;

[0117] In the seventh step, the packet cache reading module uses the descriptor read in the sixth step to read the data packet from the packet cache pointed to by the descriptor and sends it to the downstream module (not shown in the figure);

[0118] In step 8, the used ring table update module updates the content of the address pointed to by the current index in the used ring table according to the result of step 7;

[0119] In the ninth step, the MSI-X interrupt module reads the interrupt suppression FLAG (located at the bottom of the available ring table, not shown in the figure) and reads the MSI-X interrupt table. If the interrupt suppression FLAG is not suppressed, an interrupt is initiated to notify the software that the network data packet is sent.

[0120] The method of this embodiment mainly includes the eighth step in Figure 3 and the ninth step in Figure 4, that is, the optimized design of the MSI-X interrupt module, so that the MSI-X interrupt module in Figures 3 and 4 can implement the method of the above embodiment.

[0121] Based on the above embodiment 1, in some embodiments, the method further includes:

[0122] When sending an interrupt to the front-end driver, the interrupt event count and the minimum timeout timestamp of the VIRTIO queue are also updated. The updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout interval.

[0123] Based on the above embodiment 1, in some embodiments, as shown in FIG5 , the method further includes:

[0124] If the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, then the interrupt event count (CNT) and the maximum timeout timestamp of the VIRTIO queue are updated, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus the preset maximum timeout interval;

[0125] If the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, the interrupt event count of the VIRTIO queue is updated, and the updated interrupt event count is the interrupt event count before the update plus one.

[0126] In some embodiments, whether the current interrupt event is the first interrupt event after the last interrupt is issued can be determined based on the interrupt event count of the VIRTIO queue obtained by query; the parameter value of the preset maximum timeout time interval can be pre-set by a global configuration register, and when the maximum timeout timestamp is updated, the parameter value of the preset maximum timeout time interval is read from the global configuration register.

[0127] Based on the above embodiment 1, in some embodiments, as shown in FIG6 , the method further includes:

[0128] Polling and scanning the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition, and if so, sending an interrupt to the front-end driver; otherwise, not sending an interrupt to the front-end driver;

[0129] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0130] In some embodiments, for a VIRTIO queue that receives a burst message, polling scanning refers to periodically obtaining the interrupt event count and maximum timeout timestamp of the VIRTIO queue according to a preset polling period, and determining whether a second interrupt sending condition is met. If the interrupt event count is not equal to 0 and the current system time is greater than or equal to the maximum timeout timestamp, then the second interrupt sending condition is met and an interrupt is sent to the front-end driver.

[0131] It should be noted that the current system time, the minimum timeout timestamp, and the maximum timeout timestamp in this embodiment are all counting times.

[0132] 7 , a second embodiment of the present application provides a VIRTIO device interruption method, the method comprising the following steps:

[0133] Step S30, in response to receiving a burst message, triggering a current interrupt event, and reading an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of a VIRTIO queue corresponding to the burst message;

[0134] In some embodiments, a burst message refers to the operation of continuously sending or receiving multiple data packets in data communication; in network communication, data is usually transmitted in the form of data packets; when multiple data packets need to be sent or received, burst messages can be used to improve the efficiency of data transmission; burst messages can reduce transmission overhead by sending or receiving multiple data packets in one transmission; compared to sending or receiving only one data packet at a time, burst messages can reduce transmission overhead and improve data transmission throughput; in hardware devices, burst messages are usually used in combination with technologies such as DMA (direct memory access) engines or caches to achieve efficient data transmission; by sending or receiving multiple data packets at one time, the number of times the DMA engine is started and stopped can be reduced, thereby improving the efficiency of data transmission.

[0135] In some embodiments, upon receiving a burst message, interrupt data of a VIRTIO queue corresponding to the burst message is queried in step S1. The interrupt data includes an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp. This embodiment provides a RAM memory to store the interrupt data of each VIRTIO queue. As shown in FIG2 , each row of the table corresponds to a VIRTIO queue. It should be noted that the interrupt data of each VIRTIO queue changes dynamically over time.

[0136] Step S40: determining whether a first interrupt sending condition is met based on the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp; if so, directly sending the interrupt to the front-end driver; if so, and the VIRTIO queue does not support active interrupt suppression, obtaining an active suppression state signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression based on the active suppression state signal; if so, not sending the interrupt; if not, sending the interrupt to the front-end driver; and if not, not sending the interrupt to the front-end driver;

[0137] Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

[0138] In some embodiments, if the interrupt event count plus 1 is greater than or equal to the preset number of interrupt events, and the current system time is greater than or equal to the minimum timeout timestamp, then the first interrupt sending condition is met. Alternatively, if the interrupt event count is not equal to 0, and the current system time is greater than or equal to the maximum timeout timestamp, then the first interrupt sending condition is also met.

[0139] In some embodiments, the method of the second embodiment of the present invention has two implementation methods. The first method does not support active interrupt suppression, and the second method supports active interrupt suppression. If it is the first method, when it is determined that the first interrupt sending condition is met, the interrupt is directly sent to the front-end driver; supporting active interrupt suppression means that after the same VIRTIO queue issues an interrupt, it actively enters the interrupt suppression state, and no interrupt is issued for subsequent interrupt events until the front-end driver releases the interrupt suppression state through the active suppression release signal, and then the interrupt can be sent again. Therefore, if it is the second method, after determining that the first interrupt sending condition is met, it is also necessary to determine whether it is in active interrupt suppression. Only when the VIRTIO queue is not in active interrupt suppression can the interrupt be sent.

[0140] In some embodiments, the second embodiment and the first embodiment above belong to the same inventive concept. The method of the second embodiment also proposes an interrupt merging mechanism based on burst messages and an interrupt merging mechanism based on timeout timestamps. For the same VIRTIO queue, an interrupt is not initiated upon sending or receiving a data packet, but rather an interrupt is initiated after sending or receiving a certain number of data packets. Whether the interrupt sending condition is met can be determined by the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp. The minimum timeout timestamp is used to ensure that the time interval between two interrupts sent by the same queue of the VIRTIO network device must be greater than the minimum timeout time; the maximum timeout timestamp is used to ensure that when the same queue of the VIRTIO network device has one or more interrupt events, an interrupt can be issued within the specified maximum timeout time. Therefore, the second embodiment can also merge multiple interrupt events, reduce multiple memory read and write operations, save PCIe bus bandwidth, reduce the number of interrupts, and thus achieve the purpose of reducing CPU processing power consumption, thereby solving the technical problem that the interrupt suppression function relying on the FLAG flag in the VIRTIO specification is not ideal.

[0141] It should be noted that the method of the second embodiment can be used for packet reception and packet transmission of a VIRTIO network device, that is, to implement interruption control when a packet is successfully received, and interruption control when a packet is successfully transmitted;

[0142] Based on the above embodiment 2, in some embodiments, the method further includes:

[0143] When sending an interrupt to the front-end driver, the interrupt event count and the minimum timeout timestamp of the VIRTIO queue are also updated. The updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout interval.

[0144] Based on the above embodiment 2, in some embodiments, as shown in FIG8 , the method further includes:

[0145] If the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, then the interrupt event count (CNT) and the maximum timeout timestamp of the VIRTIO queue are updated, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus the preset maximum timeout interval;

[0146] If the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, the interrupt event count of the VIRTIO queue is updated, and the updated interrupt event count is the interrupt event count before the update plus one.

[0147] In some embodiments, whether the current interrupt event is the first interrupt event after the last interrupt is issued can be determined based on the interrupt event count of the VIRTIO queue obtained by query; the parameter value of the preset maximum timeout time interval can be pre-set by a global configuration register, and when the maximum timeout timestamp is updated, the parameter value of the preset maximum timeout time interval is read from the global configuration register.

[0148] Based on the above embodiment 2, in some embodiments, as shown in FIG8 , the method further includes:

[0149] Polling and scanning the interrupt event count (CNT) and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue does not support active interrupt suppression, sending an interrupt to the front-end driver; if not, not sending an interrupt to the front-end driver;

[0150] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0151] In some embodiments, if the VIRTIO queue does not support active interrupt suppression, for the VIRTIO queue that receives the burst message, polling scanning refers to periodically obtaining the interrupt event count and maximum timeout timestamp of the VIRTIO queue according to a preset polling period, and determining whether the second interrupt sending condition is met. If the interrupt event count is not equal to 0 and the current system time is greater than or equal to the maximum timeout timestamp, then the second interrupt sending condition is met.

[0152] Based on the above embodiment 2, in some embodiments, as shown in FIG9 , the method further includes:

[0153] Polling and scanning the interrupt event count (CNT) and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue supports active interrupt suppression, further obtaining an active suppression status signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression according to the active suppression status signal; if not, sending an interrupt to the front-end driver; if so, not sending an interrupt;

[0154] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0155] In some embodiments, if the VIRTIO queue supports active interrupt suppression, for the VIRTIO queue that receives a burst message, polling scanning refers to periodically obtaining the interrupt event count and maximum timeout timestamp of the VIRTIO queue according to a preset polling period, and determining whether the second interrupt sending condition is met. If the interrupt event count is not equal to 0 and the current system time is greater than or equal to the maximum timeout timestamp, then the second interrupt sending condition is met, and it is further determined whether the VIRTIO queue is in active interrupt suppression. Only when the VIRTIO queue is not in active interrupt suppression can an interrupt be sent.

[0156] Based on the above embodiment 2, in some embodiments, the method further includes:

[0157] In response to receiving an active suppression release signal (arm_doorbell), reading an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of the VIRTIO queue corresponding to the active suppression release signal;

[0158] Determine whether the first interrupt sending condition or the second interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp and the maximum timeout timestamp; if met, send an interrupt to the front-end driver and set the active inhibition status signal of the VIRTIO queue; if not met, do not send an interrupt to the front-end driver, clear the active inhibition status signal of the VIRTIO queue, and accumulate the interrupt event count.

[0159] In some embodiments, the release condition of active suppression is determined by the front-end driver sending an active suppression release signal. As shown in Figure 10, after receiving the active suppression release signal sent by the front-end driver, the interrupt event count and the maximum and minimum timeout timestamp values ​​of the queue corresponding to the active suppression release signal are first read; then it is determined whether the first interrupt sending condition is met. If the first interrupt sending condition is met, the interrupt is sent, and the interrupt event count (CNT) is cleared, and the minimum timeout timestamp of the countdown is loaded again (current system time + minimum timeout interval of the global configuration register). In addition, the corresponding bitmap of the active suppression status signal is set to suppress subsequent interrupt events. If the first interrupt sending condition is not met, the corresponding bitmap of the active suppression status signal is cleared (so that the interrupt can be sent when the subsequent interrupt sending condition is met), and the interrupt event count (CNT) is accumulated. It can be adjusted according to (the pointer value carried in the active suppression release signal - the pointer value maintained internally by the hardware) / the preset active suppression burst value. The active suppression burst value is stored in the global register, and the value of the active suppression status signal is stored in the bitmap.

[0160] It should be noted that the current system time, the minimum timeout timestamp, and the maximum timeout timestamp in this embodiment are all counting times.

[0161] As shown in Figure 11, it is a simplified schematic diagram of the MSI-X interrupt module in one embodiment of the present application. In Figure 10, the MSI-X interrupt module is designed to include a selector, a storage RAM, a polling module, multiple global configuration registers, and an active suppression switch bitmap. The selector is used to input the burst message and active suppression release signal driven by the front-end. According to the burst message and active suppression release signal, the interrupt event count (CNT), minimum timeout timestamp (TIMESTAMP1) and maximum timeout timestamp (TIMESTAMP2) of each VIRTIO queue stored in the storage RAM can be queried. The polling module can be used to execute the polling scanning process. The multiple global configuration registers can be used to pre-write parameter values ​​such as the minimum timeout interval, maximum timeout interval, number of interrupt events, and number of active suppression bursts; the active suppression switch bitmap can be used to record the value of the active suppression status signal of each VIRTIO queue.

[0162] The third embodiment of the present application further provides a VIRTIO device interrupt apparatus, including the MSI-X interrupt module shown in FIG11 .

[0163] A fourth embodiment of the present application further provides a VIRTIO device interruption apparatus. The apparatus of this embodiment can be used to execute the VIRTIO device interruption method described in the first embodiment. The apparatus includes:

[0164] a data reading module, configured to trigger a current interrupt event in response to receiving a burst message, and read an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of a VIRTIO queue corresponding to the burst message;

[0165] a first interrupt processing module, configured to determine whether a first interrupt sending condition is satisfied according to the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp; if so, send an interrupt to the front-end driver; and if not, do not send an interrupt to the front-end driver;

[0166] Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

[0167] Based on the above fourth embodiment, in some embodiments, the device includes:

[0168] The second interrupt processing module is used to update the interrupt event count and maximum timeout timestamp of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus a preset maximum timeout interval; and is also used to update the interrupt event count of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one.

[0169] Based on the above fourth embodiment, in some embodiments, the device includes:

[0170] A polling module, configured to poll and scan the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition, and if so, send an interrupt to the front-end driver; otherwise, do not send an interrupt to the front-end driver;

[0171] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0172] Based on the above fourth embodiment, in some embodiments, the device includes:

[0173] The third interrupt processing module is used to update the interrupt event count and minimum timeout timestamp of the VIRTIO queue when sending an interrupt to the front-end driver, the updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout time interval.

[0174] A fifth embodiment of the present application further provides a VIRTIO device interruption apparatus. The apparatus of this embodiment can be used to execute the VIRTIO device interruption method described in the second embodiment. The apparatus includes:

[0175] a data reading module, configured to trigger a current interrupt event in response to receiving a burst message, and read an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of a VIRTIO queue corresponding to the burst message;

[0176] a first interrupt processing module, configured to determine whether a first interrupt sending condition is met based on the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp; if so, directly send the interrupt to the front-end driver; if so, and the VIRTIO queue does not support active interrupt suppression, obtain an active suppression state signal of the VIRTIO queue, and determine whether the VIRTIO queue is in active interrupt suppression based on the active suppression state signal; if so, do not send the interrupt; if not, send the interrupt to the front-end driver; if not, do not send the interrupt to the front-end driver;

[0177] Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

[0178] Based on the above fifth embodiment, in some embodiments, the device includes:

[0179] The second interrupt processing module is used to update the interrupt event count and maximum timeout timestamp of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus a preset maximum timeout interval; and is also used to update the interrupt event count of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one.

[0180] Based on the above fifth embodiment, in some embodiments, the device includes:

[0181] a polling module, configured to poll and scan the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue does not support active interrupt suppression, sending an interrupt to the front-end driver; and if not, not sending an interrupt to the front-end driver.

[0182] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0183] Based on the above fifth embodiment, in some embodiments, the device includes:

[0184] a polling module, configured to poll and scan the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue supports active interrupt suppression, further obtaining an active suppression status signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression according to the active suppression status signal; if not, sending an interrupt to the front-end driver; and if so, not sending an interrupt;

[0185] The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

[0186] Based on the above fifth embodiment, in some embodiments, the device includes:

[0187] a third interrupt processing module, configured to, in response to receiving an active suppression release signal, read an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of the VIRTIO queue corresponding to the active suppression release signal;

[0188] Determine whether the first interrupt sending condition or the second interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp and the maximum timeout timestamp; if so, and the VIRTIO queue supports active interrupt suppression, send an interrupt to the front-end driver, and set the active suppression status signal of the VIRTIO queue; if not, do not send an interrupt to the front-end driver, clear the active suppression status signal of the VIRTIO queue, and accumulate the interrupt event count.

[0189] Based on the above fifth embodiment, in some embodiments, the device includes:

[0190] The fourth interrupt processing module is used to update the interrupt event count and minimum timeout timestamp of the VIRTIO queue when sending an interrupt to the front-end driver, the updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout time interval.

[0191] The descriptor table reading module described in the above embodiment is merely illustrative. The modules described as separate components may or may not be physically separate, and the components of the modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected based on actual needs to achieve the purpose of the descriptor table reading module solution of the embodiment.

[0192] The sixth embodiment of the present application further provides a VIRTIO backend device, including the VIRTIO device interruption device described in the fourth or fifth embodiment above.

[0193] The seventh embodiment of the present application further proposes a chip, comprising the VIRTIO back-end device described in the sixth embodiment.

[0194] Embodiment 8 of the present application further proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the VIRTIO device interruption method as described in the above-mentioned embodiment 1 or 2 is implemented.

[0195] In some embodiments, the computer-readable storage medium may include: any entity or recording medium that can carry the computer program instructions, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0196] While various embodiments of the present application have been described above, the above descriptions are illustrative, non-exhaustive, and not intended to be limiting of the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A VIRTIO device interrupt method, characterized in that, The method includes: Upon receiving a burst packet, triggering the current interrupt event, and reading the interrupt event count, minimum timeout timestamp, and maximum timeout timestamp of the VIRTIO queue corresponding to the burst packet; Determining whether the first interrupt sending condition is satisfied according to the interrupt event count, minimum timeout timestamp, and maximum timeout timestamp. If satisfied, sending an interrupt to the front-end driver; if not satisfied, not sending an interrupt to the front-end driver; Wherein, the first interrupt sending condition is: ((interrupt event + 1 >= preset interrupt event number) && (current system time >= minimum timeout timestamp)) || ((interrupt event!= 0) && (current system time >= maximum timeout timestamp)).

2. The method according to claim 1, characterized in that, The method further includes: If the first interrupt sending condition is not satisfied and the current interrupt event is the first interrupt event after the last interrupt is sent, updating the interrupt event count and maximum timeout timestamp of the VIRTIO queue. The updated interrupt event count is the previous interrupt event count plus one, and the updated maximum timeout timestamp is the current system time plus a preset maximum timeout interval; If the first interrupt sending condition is not satisfied and the current interrupt event is not the first interrupt event after the last interrupt is sent, updating the interrupt event count of the VIRTIO queue. The updated interrupt event count is the previous interrupt event count plus one.

3. The method according to claim 1, wherein The method further includes: Polling and scanning whether the interrupt event count and maximum timeout timestamp of the VIRTIO queue satisfy the second interrupt sending condition. If satisfied, sending an interrupt to the front-end driver; if not satisfied, not sending an interrupt to the front-end driver; Wherein, the second interrupt sending condition is: (interrupt event count!= 0) && (current system time >= maximum timeout timestamp).

4. The method according to any one of claims 1-3, characterized in that, The method further includes: When sending an interrupt to the front-end driver, also updating the interrupt event count and minimum timeout timestamp of the VIRTIO queue. The updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus a preset minimum timeout interval.

5. A method for interrupting a VIRTIO device, characterized in that, The method includes: Upon receiving a burst packet, triggering the current interrupt event, and reading the interrupt event count, minimum timeout timestamp, and maximum timeout timestamp of the VIRTIO queue corresponding to the burst packet; Determining whether the first interrupt sending condition is satisfied according to the interrupt event count, minimum timeout timestamp, and maximum timeout timestamp. If satisfied and the VIRTIO queue does not support active interrupt suppression, directly sending an interrupt to the front-end driver. If satisfied and the VIRTIO queue supports active interrupt suppression, obtaining the active suppression status signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression according to the active suppression status signal. If so, not sending an interrupt; if not, sending an interrupt to the front-end driver. If not satisfied, not sending an interrupt to the front-end driver; Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

6. The method according to claim 5, characterized in that, The method further comprises: If the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, then updating the interrupt event count and the maximum timeout timestamp of the VIRTIO queue, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus the preset maximum timeout interval; If the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, the interrupt event count of the VIRTIO queue is updated, and the updated interrupt event count is the interrupt event count before the update plus one.

7. The method according to claim 6, wherein The method further comprises: Polling and scanning the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue does not support active interrupt suppression, sending an interrupt to the front-end driver; if not, not sending an interrupt to the front-end driver; The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

8. The method according to claim 6, wherein The method further comprises: Polling and scanning the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue supports active interrupt suppression, further obtaining an active suppression status signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression according to the active suppression status signal; if not, sending an interrupt to the front-end driver; if so, not sending an interrupt; The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

9. The method according to claim 7 or 8, characterized in that The method further comprises: In response to receiving an active suppression release signal, reading an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of the VIRTIO queue corresponding to the active suppression release signal; Determine whether the first interrupt sending condition or the second interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp and the maximum timeout timestamp; if met, send an interrupt to the front-end driver and set the active inhibition status signal of the VIRTIO queue; if not met, do not send an interrupt to the front-end driver, clear the active inhibition status signal of the VIRTIO queue, and accumulate the interrupt event count.

10. The method according to any one of claims 5 to 9, characterized in that, The method further comprises: When sending an interrupt to the front-end driver, the interrupt event count and the minimum timeout timestamp of the VIRTIO queue are also updated. The updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus the preset minimum timeout interval.

11. A VIRTIO device interrupt apparatus, characterized in that, The device comprises: A data reading module, which is used to trigger a current interrupt event in response to receiving a burst message, and read the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp of the VIRTIO queue corresponding to the burst message; A first interrupt handling module, which is used to determine whether the first interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp. If it is met, an interrupt is sent to the front-end driver; if not, no interrupt is sent to the front-end driver; Wherein, the first interrupt sending condition is: ((interrupt event + 1 >= preset interrupt event number) && (current system time >= minimum timeout timestamp)) || ((interrupt event!= 0) && (current system time >= maximum timeout timestamp)).

12. The device according to claim 11, wherein The device includes: A second interrupt handling module, which is used to update the interrupt event count and the maximum timeout timestamp of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt is sent. The updated interrupt event count is the previous interrupt event count plus one, and the updated maximum timeout timestamp is the current system time plus a preset maximum timeout interval; it is also used to update the interrupt event count of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt is sent. The updated interrupt event count is the previous interrupt event count plus one.

13. The device according to claim 11, characterized in that, The device includes: A polling module, which is used to poll and scan whether the interrupt event count and the maximum timeout timestamp of the VIRTIO queue meet the second interrupt sending condition. If it is met, an interrupt is sent to the front-end driver; if not, no interrupt is sent to the front-end driver; Wherein, the second interrupt sending condition is: (interrupt event count!= 0) && (current system time >= maximum timeout timestamp).

14. The device according to any one of claims 11-13, characterized in that, The device further includes: A third interrupt handling module, which is used to update the interrupt event count and the minimum timeout timestamp of the VIRTIO queue when sending an interrupt to the front-end driver. The updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus a preset minimum timeout interval.

15. A VIRTIO device interruption apparatus, characterized in that, The device includes: A data reading module, which is used to trigger a current interrupt event in response to receiving a burst message, and read the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp of the VIRTIO queue corresponding to the burst message; A first interrupt handling module, which is used to determine whether the first interrupt sending condition is met according to the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp. If it is met and the VIRTIO queue does not support active interrupt suppression, an interrupt is directly sent to the front-end driver. If it is met and the VIRTIO queue supports active interrupt suppression, the active suppression status signal of the VIRTIO queue is obtained, and Determine whether the VIRTIO queue is in active interrupt suppression according to the active suppression status signal, if so, do not send an interrupt, if not, send an interrupt to the front-end driver, and if not satisfied, do not send an interrupt to the front-end driver; Among them, the first interrupt sending condition is: ((interrupt event + 1>=preset interrupt event number) && (current system time>=minimum timeout timestamp)) || ((interrupt event!=0) && (current system time>=maximum timeout timestamp)).

16. The device according to claim 15, characterized in that, The device comprises: The second interrupt processing module is used to update the interrupt event count and maximum timeout timestamp of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one, and the updated maximum timeout timestamp is the current system time plus a preset maximum timeout interval; and is also used to update the interrupt event count of the VIRTIO queue if the first interrupt sending condition is not met and the current interrupt event is not the first interrupt event after the last interrupt was sent, where the updated interrupt event count is the interrupt event count before the update plus one.

17. The device according to claim 16, wherein The device further comprises: a polling module, configured to poll and scan the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue does not support active interrupt suppression, sending an interrupt to the front-end driver; and if not, not sending an interrupt to the front-end driver. The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

18. The device according to claim 16, characterized in that, The device further comprises: a polling module, configured to poll and scan the interrupt event count and the maximum timeout timestamp of the VIRTIO queue to determine whether they meet a second interrupt sending condition; if so, and the VIRTIO queue supports active interrupt suppression, further obtaining an active suppression status signal of the VIRTIO queue, and determining whether the VIRTIO queue is in active interrupt suppression according to the active suppression status signal; if not, sending an interrupt to the front-end driver; and if so, not sending an interrupt; The second interrupt sending condition is: (interrupt event count != 0) && (current system time>=maximum timeout timestamp).

19. The device according to claim 17 or 18, characterized in that, The device further comprises: a third interrupt processing module, configured to, in response to receiving an active suppression release signal, read an interrupt event count, a minimum timeout timestamp, and a maximum timeout timestamp of the VIRTIO queue corresponding to the active suppression release signal; Determine whether the first interrupt sending condition or the second interrupt sending condition is satisfied according to the interrupt event count, the minimum timeout timestamp, and the maximum timeout timestamp. If it is satisfied and the VIRTIO queue supports active interrupt suppression, send an interrupt to the front-end driver and set the active suppression status signal of the VIRTIO queue. If it is not satisfied, do not send an interrupt to the front-end driver, clear the active suppression status signal of the VIRTIO queue, and accumulate the interrupt event count.

20. The device according to any one of claims 15 to 19, characterized in that, The device further includes: A fourth interrupt processing module, configured to update the interrupt event count and the minimum timeout timestamp of the VIRTIO queue when sending an interrupt to the front-end driver. The updated interrupt event count is zero, and the updated minimum timeout timestamp is the current system time plus a preset minimum timeout interval.

21. A VIRTIO backend device, characterized in that It includes the VIRTIO device interrupt device according to any one of claims 10 to 20.

22. A chip, characterized in that, It includes the VIRTIO back-end device according to claim 21.

23. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which when executed by a processor, implements the VIRTIO device interrupt method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Interrupt request processing device and method and VIRTIO network equipment

    CN115113978A

  • Transmission optimization method based on Virtio-net

    CN116346737A

  • VIRTIO equipment interruption method and device, back-end equipment and chip

    CN117931406A

  • Method for Processing Interrupt by Virtualization Platform, and Related Device

    US20170102963A1