Credit-based interruption control method
By adopting a credit-based interrupt control method in the interrupt control center, combining the backpressure and discarding mechanism, the problem of centralized interrupt control center in managing the interrupt information buffer is solved, and refined control and reliable transmission of interrupt information is achieved.
Patent Information
- Application Number
- CN202311296876.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-09
- Publication Date
- 2025-04-11
AI Technical Summary
When managing interrupt information buffers, it is difficult for the centralized interrupt control center to accurately control the interrupt sending rate of each user, resulting in "interruption storms" in the shared buffer, while the exclusive buffer is prone to loss of interrupt information due to buffer overflow.
The credit-based interrupt control method is adopted. The interrupt control center preallocates credit for each user. When the user sends interrupt information, the credit is reduced by 1, and 1 is added after processing the interrupt. By setting the backpressure and discarding mechanism, it is determined when to backpressure the user or discard the interrupt information based on the utilization rate of the interrupt information buffer.
It realizes refined control of interrupt information, avoids interrupt storms and buffer overflow, ensures reliable transmission of interrupt information, and supports refined control in virtualized scenarios.
Smart Images

Figure CN119807100A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip technology, and in particular to a credit-based interruption control method. Background Art
[0002] When each subsystem of the chip system, that is, each user, encounters an error or a specific demand to be reported to the software for processing, it sends an interrupt to the interrupt control center (INT) for processing. The interrupt control center (INT) summarizes the interrupt information from each user, stores it in the interrupt information buffer, identifies the information and completes the work of reporting to the software. This centralized interrupt processing structure requires the allocation of an interrupt information buffer in the interrupt control center to temporarily store the summarized interrupts of each user. Since it is impossible to accurately control the interrupt sending rate of each user, the management of the interrupt information buffer is very difficult, and there are some defects whether it is exclusive or shared.
[0003] 1) Shared interrupt information buffer, that is, the interrupt information of each user is stored in the same buffer. When some users send a large number of interrupts in a short period of time, an "interrupt storm" is formed, which occupies a large amount of the buffer, causing the interrupts of other users to be discarded, and users interfere with each other.
[0004] 2) Exclusive interrupt information buffer, that is, the interrupt information of each user is stored in an independent buffer isolated from each other. This will limit the buffer of a single user to be relatively small. When the user sends a large number of interrupts in a short period of time, the buffer is prone to overflow, resulting in indiscriminate loss of user interrupts. The loss of key interrupts can easily cause serious problems. Summary of the invention
[0005] In view of the technical problem of buffer management faced by the above-mentioned centralized interrupt control center, the present invention proposes a credit-based interrupt control method.
[0006] A credit-based interruption control method comprises the following steps: The interrupt control center pre-allocates a certain amount of credits to each user; When a user sends an interruption message to the interruption control center, the interruption control center reduces the credit of the corresponding user by 1; After the interruption control center processes the interruption of a user, it increases the credit corresponding to the user by 1.
[0007] Furthermore, the method further comprises: If the back pressure setting of the interrupt control center is turned on, the interrupt control center decides when to back pressure the user according to the utilization rate of the interrupt information buffer; If the back pressure setting of the interrupt control center is turned off, the interrupt control center returns all credits corresponding to all interrupt information stored in the interrupt information buffer by the previous user to the corresponding user, and then the user can send interrupt information normally; If the interrupt discarding setting of the interrupt control center is turned on, the interrupt control center decides when to discard the corresponding interrupt information according to the utilization rate of the interrupt information buffer, and the interrupt control center returns credit to the user normally.
[0008] Furthermore, the interrupt information buffer is implemented by means of a Ring Buffer.
[0009] Furthermore, the interrupt control center determines when to back pressure the user according to the utilization rate of the interrupt information buffer, including: If the interrupt information received by the interrupt control center exceeds the waterline of the Ring Buffer, the interrupt control center starts back pressure on the user, that is, the interrupt control center does not return credit to the user, and the user cannot continue to send interrupts.
[0010] Furthermore, the area range of the waterline is 1 / 2-15 / 16 of the Ring Buffer.
[0011] Further, the discarding of the corresponding interruption information includes: Discard all interrupts of a specified user, or discard all interrupts of a certain function, or discard all interrupts with specific tag content.
[0012] Furthermore, the interrupt control center also configures credit delay return parameters, including: 1) starting to delay credit return after N interrupts; 2) setting a rate for returning credit; 3) setting the number of interrupts M for delayed credit return.
[0013] Furthermore, the interrupt control center is set before or after the interrupt information exceeds the waterline of the Ring Buffer.
[0014] Furthermore, after virtualization is enabled, the method is replaced by: The interrupt control center pre-allocates a certain amount of credits to each function of each user; When the function of the user sends an interruption message to the interruption control center, the interruption control center reduces the credit of the function of the corresponding user by 1; After the interruption control center processes the interruption of the function of a user, the corresponding credit of the function of the user is increased by 1.
[0015] The beneficial effects of the present invention are: 1) Fine-grained control: By setting the number of credits, waterline, and back pressure credits, more significant fine-grained control is achieved when a large number of interrupts occur; 2) Support virtualization scenarios, and can control interrupt information and back pressure credits in different PFs and VFs. The functions of each function do not affect each other, that is, both PF and a certain VF can work; 3) High flexibility, supporting users to avoid the loss of important interrupts by back-pressure credits, or discarding interrupts that users do not need to meet the corresponding discard information. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 is a schematic diagram of the credit-based interruption control method of the present invention.
[0018] Figure 2 It is a structural schematic diagram of the Ring Buffer involved in the present invention.
[0019] Figure 3 It is a schematic diagram of the Ring Buffer waterline involved in the present invention.
[0020] Figure 4 It is a schematic diagram of I / O virtualization of device direct access involved in the present invention.
[0021] Figure 5 is another schematic diagram of the credit-based interruption control method of the present invention.
[0022] Figure 6-9 Schematic diagram of a back pressure control process according to an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] The words "first, second, third, etc." or module A, module B, module C and the like in the specification and claims are used only to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that the specific order or sequence can be interchanged where permitted so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.
[0025] In the following description, the numbers representing the steps, such as S110, S120, etc., do not necessarily mean that the steps must be executed in this manner. If permitted, the order of the previous and next steps can be interchanged, or they can be executed simultaneously.
[0026] The term "comprising" as used in the description and claims should not be interpreted as being limited to what is listed thereafter; it does not exclude other elements or steps. Therefore, it should be interpreted as specifying the presence of the features, integers, steps or components mentioned, but does not exclude the presence or addition of one or more other features, integers, steps or components and groups thereof. Therefore, the expression "a device comprising means A and B" should not be limited to a device consisting of components A and B only.
[0027] References to "one embodiment" or "an embodiment" in this specification mean that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present invention. Therefore, the phrases "in one embodiment" or "in an embodiment" appearing in various places in this specification do not necessarily refer to the same embodiment, but may refer to the same embodiment. In addition, in one or more embodiments, the particular features, structures, or characteristics can be combined in any appropriate manner, as would be apparent to one of ordinary skill in the art from this disclosure.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. In the event of any inconsistency, the meanings described in this specification or derived from the contents recorded in this specification shall prevail. In addition, the terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0029] See also Figure 1 The embodiment of the present invention discloses a credit-based interruption control method, comprising the following steps: The interrupt control center (INT) pre-allocates a certain amount of credits to each user (client); When a user sends interruption information (cookie) to the interruption control center, the interruption control center reduces the credit of the corresponding user by 1; After the interruption control center processes the interruption of a user, it increases the credit corresponding to the user by 1.
[0030] Based on the preceding process, the following enhanced settings are used to provide more flexible back pressure or discard control.
[0031] Furthermore, the method further comprises: If the back pressure setting of the interrupt control center is turned on, the interrupt control center decides when to back pressure the user according to the utilization rate of the interrupt information buffer; If the back pressure setting of the interrupt control center is turned off, the interrupt control center returns all credits corresponding to all interrupt information stored in the interrupt information buffer by the previous user to the corresponding user, and then the user can send interrupt information normally; If the interrupt discarding setting of the interrupt control center is turned on, the interrupt control center decides when to discard the corresponding interrupt information according to the utilization rate of the interrupt information buffer, and the interrupt control center returns credit to the user normally.
[0032] So far, refer to Figure 5 The overall process of the solution in the present invention is as follows: each user sends the interrupt information cookie of the corresponding function to INT, the cookie is stored in the interrupt information buffer Ring Buffer FIFO, the credit is written into CREDIT_FIFO, and the rate of returning the credit is regulated. Determine whether to back pressure the credit or discard the interrupt. Through the multiplexer, schedule the credit and return the credit corresponding to {user, function}. In the case of back pressure, the credit corresponding to {user, function} is not returned, and the credit corresponding to {user, function} is scheduled in the discard or normal scenario.
[0033] Furthermore, the interrupt information buffer is implemented by means of Ring Buffer (RB).
[0034] In this embodiment, the interrupt information cookie is stored in the interrupt information buffer, which is implemented by Ring Buffer (RB). RB is a first-in-first-out buffer (FIFO) with two pointers, namely, the write pointer (WPTR) and the read pointer (RPTR), pointing to the write position and read position of the buffer. Figure 2 , 3 RB has the ability to read and write in a loop. The gray area is the written FIFO. When RB is full, data will be written again from the beginning, forming a loop.
[0035] Furthermore, the interrupt control center determines when to back pressure the user according to the utilization rate of the interrupt information buffer, including: If the interrupt information received by the interrupt control center exceeds the waterline of the Ring Buffer, the interrupt control center starts back pressure on the user, that is, the interrupt control center does not return credit to the user, and the user cannot continue to send interrupts.
[0036] Furthermore, the area range of the waterline is 1 / 2-15 / 16 of the Ring Buffer (RB).
[0037] In this embodiment, a certain number of credits is preset. When an "interrupt storm" occurs, the cookies received by INT exceed the waterline of RB. Back pressure can be used to prevent the client from continuing to send interrupts to INT by not returning credits. The waterline is set to prevent too many interrupts from causing RB overflow. The existence of the waterline and back pressure can prevent important interrupts from being discarded. Figure 3 As shown, the minimum unit is set to 1 / 16 of the RB size, and the waterline area ranges from 1 / 2 to 15 / 16 of the RB. Figure 3 The light grey area in the upper half is the setting range of the waterline, and the solid lines at 1 / 2 and 15 / 16 are the minimum and maximum values of the waterline respectively.
[0038] Therefore, by setting the ring buffer watermark to prevent the remote ring buffer from overflowing, when the interrupt information cookie exceeds the set watermark, the client's credit can be back-pressured and the client can be controlled to send cookies. By configuring the register, each client has a corresponding 1 bit for back-pressure, and the client that needs to set back-pressure can be controlled, and the corresponding credit of the client will not be returned to the client.
[0039] Further, the discarding of the corresponding interruption information includes: Discard all interrupts of a specified user, or discard all interrupts of a certain function, or discard all interrupts with specific tag content.
[0040] In this embodiment, after reaching the waterline, the interruption can be discarded and no longer reported. When the interruption is discarded, the credit is returned normally. The interruption that meets a specific parameter in the cookie information can be discarded to achieve the purpose of discarding redundant interruptions that the client does not need. Specifically, all interruptions corresponding to a certain client can be discarded, or all interruptions corresponding to a certain function can be discarded, or all interruptions with specific marking content can be discarded.
[0041] Furthermore, the interrupt control center also configures credit delay return parameters, including: 1) starting to delay credit return after N interrupts; 2) setting a rate for returning credit; 3) setting the number of interrupts M for delayed credit return.
[0042] Furthermore, the interrupt control center is set before or after the interrupt information exceeds the waterline of the Ring Buffer.
[0043] In this embodiment, the return time of the delayed credit can be set in advance, and does not necessarily have to be after the waterline.
[0044] The present invention further provides the following improved implementation scheme: Virtualization is a feature currently supported by many chips. The concept of virtualization and function is described below. When supporting virtualization, the client-based credit control can be further refined into the credit control of each client function: Furthermore, after virtualization is enabled, the method is replaced by: The interrupt control center pre-allocates a certain amount of credits to each function of each user; When the function of the user sends an interruption message to the interruption control center, the interruption control center reduces the credit of the function of the corresponding user by 1; After the interruption control center processes the interruption of the function of a user, the corresponding credit of the function of the user is increased by 1.
[0045] In this embodiment, virtualization means that the user can create multiple simulated environments or dedicated resources with a single physical hardware system as a carrier. The Virtual Machine Monitor (VMM, also called Hypervisor) divides the system into different and independent environments, namely virtual machines (VM). The virtual machine monitor is located in the virtual layer between the virtual machine and the underlying hardware device, providing the virtual machine with the resources required for the operating environment, and allowing each virtual machine to run independently and without interfering with each other in the same system. The physical hardware equipped with a virtual machine monitor is called the host (Host Hardware), and the virtual machine using its resources is called a guest virtual machine (Guest VM). These client virtualizations regard computing resources (such as CPU, memory, network, I / O (input / output) and storage, etc.) as a set of resources that can be reallocated, greatly improving resource utilization. Figure 4As shown, device-direct I / O virtualization realizes data plane acceleration, allowing the host to directly access the physical address (GPA) allocated by the corresponding driver running in the operating system (GuestOS) of the virtual machine, and the interrupt control center and credit control of the present invention both support device-direct I / O virtualization configuration.
[0046] SR-IOV (Single Root I / O Virtualization) is an extension of the PCIe specification defined by the PCI-SIG organization. Its purpose is to provide independent memory space, interrupts, DMA data streams, etc. for VMs (virtual machines) by providing a standard specification. The SR-IOV protocol introduces the concept of two types of functions: physical function (PF) and virtual function (VF). PF has fully configured resources and can be used to configure or control the host. VF is a function associated with PF, which can share one or more physical resources with the physical function and other VFs associated with the same physical function. SR-IOV supports a single host to virtualize multiple hosts, and the virtual host is directly connected to each virtual machine, realizing the application scenario of a single physical hardware supporting multiple virtual machines and improving resource utilization.
[0047] Specifically: when virtualization is turned off, only PF works and only one host accesses the VM; when virtualization is turned on, the number of VFs can be 4 or 8, and a single host virtualizes 4 or 8 hosts to access the VMs. When virtualization is turned off, only PF allocates the credits of the corresponding user. When virtualization is turned on, PF and 4 or 8 VFs exist at the same time, and each has a certain number of credits. Specifically, a function of the user (which can be PF or VF0 or VF1 or VF2 or VF3...) sends an interrupt to INT, and INT returns the credits of the user's function.
[0048] After virtualization is enabled, the process of this improvement solution can be: INT pre-allocates a certain amount of credit for each {user, function} (the function here can be a PF or a VF); When the user sends interrupt information (cookie) to INT, INT identifies {user, function} and reduces the corresponding credit by 1; After INT processes an interrupt cookie of {user, function}, it increases the credit corresponding to {user, function} by 1; When users send a large number of interrupts (i.e. when an "interrupt storm" occurs), INT can control the return time of credits and delay the credit return rate; Similar to the above, the following enhanced settings are provided: When a user sends a large number of interrupts, when the INT ring buffer reaches the set waterline, if back pressure is set to on, INT will not return the credit of {user, function} until the credit to {user, function} is consumed, and the function of the user can no longer send interrupts; If INT's back pressure is set to off, INT will return all credits corresponding to {user, function} to the user, and then the user's function can send interrupts normally; If INT's discard interrupt is set to on, after INT's ring buffer reaches the set waterline, INT can discard the interrupt corresponding to the specific information of {user, function}, and INT will return credit to {user, function} normally.
[0049] In addition, in order to further illustrate the solution of the present invention, the following specific implementation modes are also provided: The size of a cookie packet is 256 bits. 64 clients can send interrupts to INT. The width of RB_FIFO is 256 bits, corresponding to the size of a cookie. The depth is 128, corresponding to 64 clients. Each client has 2 credits, a total of 128 credits. The width of CREDIT_FIFO is 6 bits, corresponding to all client serial numbers. The depth is 128, corresponding to 128 credits.
[0050] In the initial state, there is no cookie packet in the Ring Buffer and the address is 0. When many clients send interrupts to INT, the RB_FIFO gradually becomes deeper until the depth reaches the set waterline.
[0051] At the same time, the multiplexer is also working. The maximum age is FIFO depth = 128. The credit with the maximum age is selected for scheduling. The scheduled age is cleared to 0, and the unscheduled age is increased by 1.
[0052] When the waterline is exceeded, it is necessary to determine whether the user chooses to backpressure credit or discard interrupts. Backpressured credits are not scheduled, and age+1. If it reaches 128, it remains unchanged. When backpressure is turned off, age can be scheduled. When interrupts need to be discarded, credits can be scheduled.
[0053] Among them, back pressure is implemented through age and credit buffer. How to schedule the client to return credit is specifically implemented through a multiplexer. For example, when the depth of age and credit buffer is 3, initialize all addresses with age=0, write new addresses with age=1, and other written addresses with age+1. If the maximum value is reached, it remains unchanged. When reading the address, age=0, and the age of other written addresses remains unchanged. Each time, the client with the largest age is scheduled to return credit. When the maximum age is written to 3, and the ages of two clients are written to 3 at the same time, the client with the smaller sequence is scheduled.
[0054] Reference Figure 6-9 As shown, the following are detailed steps: Figure 6 , client0 gives INT an interrupt, age+1, and buffer is written to client0.
[0055] Client1 sends an interrupt to INT, the ages of the two clients are increased by 1, and the buffer is written to client1.
[0056] Client2 gives INT an interrupt, the ages of the three clients are increased by 1, and the buffer is written to client2.
[0057] Figure 7 , INT returns credit to client0, reads age and clears it to 0; client1 and client2 correspond to age+1, and start to back pressure client1.
[0058] Client 1 is under back pressure and is not scheduled. Client 2 is scheduled, credit is returned, and age is cleared to 0. Client 0 writes age + 1.
[0059] Figure 8 , client1 releases the back pressure. Client1 has the largest age, so client1 is scheduled first; client0 writes age+1.
[0060] Finally, the remaining client0 is scheduled.
[0061] When client1 and client2 are back pressured at the same time ( Figure 6 and Fig. 9), schedule client0, client1 age reaches the maximum depth, remains unchanged at 3, and client2 age+1. When the back pressure of client1 and client2 is released at the same time, the age of both sides is 3, and client1 with a smaller sequence number is scheduled first, and client2 is scheduled last.
[0062] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may also include more other equivalent embodiments without departing from the concept of the present invention, all of which belong to the scope of protection of the present invention.
Claims
1. A credit-based interruption control method, characterized in that: The steps include: The interrupt control center pre-allocates a certain amount of credits to each user; When a user sends an interruption message to the interruption control center, the interruption control center reduces the credit of the corresponding user by 1; After the interruption control center processes the interruption of a user, it increases the credit corresponding to the user by 1.
2. The credit-based interruption control method according to claim 1, characterized in that: The method further comprises: If the back pressure setting of the interrupt control center is turned on, the interrupt control center decides when to back pressure the user according to the utilization rate of the interrupt information buffer; If the back pressure setting of the interrupt control center is turned off, the interrupt control center returns all credits corresponding to all interrupt information stored in the interrupt information buffer by the previous user to the corresponding user, and then the user can send interrupt information normally; If the interrupt discarding setting of the interrupt control center is turned on, the interrupt control center decides when to discard the corresponding interrupt information according to the utilization rate of the interrupt information buffer, and the interrupt control center returns credit to the user normally.
3. The credit-based interruption control method according to claim 2, characterized in that: The interrupt information buffer is implemented by means of Ring Buffer.
4. The credit-based interruption control method according to claim 3, characterized in that: The interrupt control center determines when to back pressure the user according to the utilization rate of the interrupt information buffer, including: If the interrupt information received by the interrupt control center exceeds the waterline of the Ring Buffer, the interrupt control center starts back pressure on the user, that is, the interrupt control center does not return credit to the user, and the user cannot continue to send interrupts.
5. The credit-based interruption control method according to claim 4, characterized in that: The area range of the waterline is 1 / 2-15 / 16 of the Ring Buffer.
6. The credit-based interruption control method according to claim 2, characterized in that: The discarding of the corresponding interruption information includes: Discard all interrupts of a specified user, or discard all interrupts of a certain function, or discard all interrupts with specific tag content.
7. The credit-based interruption control method according to claim 1, characterized in that: The interrupt control center also configures credit delay return parameters, including: 1) starting delayed credit return after N interrupts; 2) setting a rate for returning credit; 3) setting the number of interrupts M for delayed credit return.
8. The credit-based interruption control method according to claim 7, characterized in that: The interrupt control center is set before or after the interrupt information exceeds the waterline of the Ring Buffer.
9. The credit-based interruption control method according to claim 1, characterized in that: After virtualization is enabled, the method is replaced by: The interrupt control center pre-allocates a certain amount of credits to each function of each user; When the function of the user sends an interruption message to the interruption control center, the interruption control center reduces the credit of the function of the corresponding user by 1; After the interruption control center processes the interruption of the function of a user, the corresponding credit of the function of the user is increased by 1.
Citation Information
Cited By
Interrupt resource control method and device, processor, equipment, medium and product
CN121326533A