The present invention relates in general to systems and methods for reporting task completion.
When tasks are queued (posted) for execution, but task execution does not necessarily take place in the same order in which the tasks were posted, in certain circumstances issues may arise because indication/s of task completion will not take place in the same order in which the tasks are queued (posted).
The present invention, in certain exemplary embodiments thereof, seeks to provide improved systems and methods for reporting task completion. In certain exemplary embodiments, indication/s of task completion are provided in the same order in which the tasks are queued (posted), even when task execution takes place in a different order from that in which the tasks were queued (posted).
There is thus provided in accordance with an exemplary embodiment of the present invention a system including queue handling logic, the queue handling logic including communication hardware for communicating with a memory, the memory being configured to hold a work control structure (WCS) having a plurality of work control records (WCRs) the WCS being configured in a first-in-first-out manner having a head and a tail, each WCR including a work specifying field defining a unit of work to be carried out, and a completion indicator indicating whether the unit of work to be carried out has been completed, and being initially set to indicate that the unit of work to be carried out has not been completed, and the queue handling logic is configured, upon fetching a work request (WR) for execution, to push a WCR corresponding to the WR to the WCS via the communication hardware, and further configured to perform the following via the communication hardware: A) to inspect the WCR at the head of the WCS, B) when the completion indicator of the WCR at the head of the WCS indicates that the unit of work associated with the WCR at the head of the WCS has been completed: to pop the WCR at the head of the WCS from the WCS, and to report completion of the WCR at the head of the WCS to a host processor external to the system, and C) to iteratively perform A, B, and C.
Further in accordance with an exemplary embodiment of the present invention the queue handling logic is also configured to insert a WCR at the tail of the WCS.
Still further in accordance with an exemplary embodiment of the present invention the queue handling logic is configured to insert a WCR at the tail of the WCS based, at least in part, on a request originating at the host processor.
Additionally in accordance with an exemplary embodiment of the present invention at least one of the plurality of WCRs is allocated by the WCS from a global pool of WCRs.
Moreover in accordance with an exemplary embodiment of the present invention the memory is external to the system.
Further in accordance with an exemplary embodiment of the present invention the system includes the memory.
Still further in accordance with an exemplary embodiment of the present invention the communication hardware includes a bus.
Additionally in accordance with an exemplary embodiment of the present invention completion of the WCR at the head of the work queue is reported to an application running on the host processor.
Moreover in accordance with an exemplary embodiment of the present invention the system also includes work processing logic including work execution logic and completion indication logic, and the work execution logic is configured to carry out a unit of work associated with a given WCR, and the completion indication logic is configured, when the unit of work associated with the given WCR has been completed by the work execution logic, to set the completion indicator in the given WCR to indicate that the unit of work associated with the given WCR has been completed.
Further in accordance with an exemplary embodiment of the present invention the system is included in one of the following: a network element, a disk controller, and an accelerator device.
Still further in accordance with an exemplary embodiment of the present invention the system is included in a network element, and the network element includes a network interface card (NIC).
Additionally in accordance with an exemplary embodiment of the present invention the unit of work to be carried out includes a data transfer by the NIC over a hardware networking medium.
Moreover in accordance with an exemplary embodiment of the present invention the system also includes timeout logic configured, upon expiration of a timeout, to set the completion indicator of the WCR at the head of the WCS to indicate that the unit of work associated with the WCR at the head of the WCS has completed, even if the unit of work associated with the WCR at the head of the WCS has not completed.
Further in accordance with an exemplary embodiment of the present invention, when the completion indicator of the WCR at the head of the WCS is set to indicate that the unit of work associated with the WCR at the head of the WCS has completed upon expiration of the timeout, the completion indicator of the WCR at the head of the WCS is set to include an error indication.
There is also provided in accordance with another exemplary embodiment of the present invention a method including, in queue handling logic, the queue handling logic including communication hardware for communicating with a memory, the memory being configured to hold a work control structure (WCS) having a plurality of work control records (WCRs), the WCS being configured in a first-in-first-out manner having a head and a tail, each WCR including a work specifying field defining a unit of work to be carried out, and a completion indicator indicating whether the unit of work to be carried out has been completed, and being initially set to indicate that the unit of work to be carried out has not been completed, performing the following: upon fetching a work request (WR) for execution, pushing a WCR corresponding to the WR to the WCS via the communication hardware, and performing the following via the communication hardware: A) inspecting the WCR at the head of the WCS, B) when the completion indicator of the WCR at the head of the WCS indicates that the unit of work associated with the WCR at the head of the WCS has been completed popping the WCR at the head of the WCS from the WCS, and reporting completion of the WCR at the head of the WCS to a host processor external to the queue handling logic, and C) iteratively performing A, B, and C.
Further in accordance with an exemplary embodiment of the present invention the method also includes inserting a WCR at the tail of the WCS.
Still further in accordance with an exemplary embodiment of the present invention the inserting a WCR at the tail of the WCS is based, at least in part, on a request originating at the host processor.
Additionally in accordance with an exemplary embodiment of the present invention at least one of the plurality of WCRs is allocated by the WCS from a global pool of WCRs.
Moreover in accordance with an exemplary embodiment of the present invention the memory is external to the queue handling logic.
Further in accordance with an exemplary embodiment of the present invention the queue handling logic includes the memory.
Still further in accordance with an exemplary embodiment of the present invention the communication hardware includes a bus.
Additionally in accordance with an exemplary embodiment of the present invention the method also includes reporting completion of the WCR at the head of the work queue to an application running on the host processor.
Moreover in accordance with an exemplary embodiment of the present invention the following is carried out by work processing logic including work execution logic and completion indication logic: the work execution logic carrying out a unit of work associated with a given WCR, and the completion indication logic setting, when the unit of work associated with the given WCR has been completed by the work processing logic, the completion indicator in the given WCR to indicate that the unit of work associated with the given WCR has been completed.
Further in accordance with an exemplary embodiment of the present invention the queue handling logic is included in one of the following a network element, a disk controller, and an accelerator device.
Still further in accordance with an exemplary embodiment of the present invention the queue handling logic is included in a network element, and the network element includes a network interface card (NIC).
Additionally in accordance with an exemplary embodiment of the present invention the unit of work to be carried out includes a data transfer by the NIC over a hardware networking medium.
Moreover in accordance with an exemplary embodiment of the present invention the following is carried out by timeout logic: upon expiration of a timeout, setting the completion indicator of the WCR at the head of the WCS to indicate that the unit of work associated with the WCR at the head of the WCS has completed, even if the unit of work associated with the WCR at the head of the WCS has not completed.
Further in accordance with an exemplary embodiment of the present invention, when the completion indicator of the WCR at the head of the WCS is set to indicate that the unit of work associated with the WCR at the head of the WCS has completed upon expiration of the timeout, the completion indicator of the WCR at the head of the WCS is set to include an error indication.
The present invention will be understood and appreciated more fully from the following detailed description, taken in conjunction with the drawings in which:
By way of introduction, it is known in certain systems that a Work Queue (WQ) is a structure that is used for interfacing between two entities. For example, and without limiting the generality of the foregoing, a WQ is one method by which an entity (which may be, by way of non-limiting example, a software entity), sometimes known as a requesting entity, running on a host processor (which may also be termed herein a “CPU”) may request service from a hardware entity, sometimes known as an executing entity. Such an executing entity may comprise, by way of non-limiting example, a networking device. By way of further non-limiting example, such a executing entity may comprise a network interface controller (NIC) (which may be considered to be a particular type of networking device), a disk controller, or an accelerator device (such as, by way of non-limiting example, a data compressing or decompressing device). The requesting entity generally pushes work requests (WRs) to the WQ; the requesting entity is also sometimes called a producer of the WR. The WRs are executed by the executing entity, sometimes called a consumer of the WR.
For the consumer to signal to the producer that a WR has been completed, a completion queue (CQ) may be used. Completion queue entries (CQEs) are pushed to the CQ by the consumer. Each CQE signals completion of execution of one or more WRs that were posted to the work queue, the WRs having been processed and completed.
A system of the type discussed above is described in U.S. Pat. No. 7,152,122 to Kagan et al, the disclosure of which is hereby incorporated herein by reference.
In a case where the order of WRs beginning execution (or being fetched for execution from the WQ) is also the order of execution completion, that is, the WRs depend on each other, in the sense that execution of an earlier WR is necessary for execution of a later WR to take place, then in general such a later WR can complete only after the predecessor WR had completed, so that CQEs will be pushed to the CQ in the same order as the WRs in the WQ. However, if the order of execution and completion of each one of the WRs is independent of other WRs, then the order in which CQEs are pushed into the CQ may be “random”; that is, the CQEs are not pushed in any particular order.
In the opinion of the inventor of the present invention, there may be benefits in receiving the CQEs from the CQ in the same order that the WRs were posted to the WQ. The present invention, in exemplary embodiments thereof, sees to provide such benefits.
The inventors of the present invention believe that, in general in existing systems before the present invention, pushing CQEs to a completion queue in the same order that the associated WRs were pushed into the work queue, occurs for tasks that actually complete in the same order that they began execution. One non-limiting example of such a situation is reliable connection QP RDMA operations. By contrast, in such existing systems, tasks that complete in a different order than the order that they began execution are often reported to the completion queue with CQEs in the order they completed, which is not necessarily the order in which the associated WRs were posted to the WQ. Such out of order signaling of CQEs may lead to certain burdens on the producer of the WR. First, the CQEs must be reported for each WR. Since a CQE only indicates completion of its associated WR, and does not imply completion of other WRs, one CQE per WR is required. In a case where CQEs are reported in the order the WRs were posted, a CQE indicating a WR completion implicitly indicates completion of predecessor WRs.
Another burden on the WR producer is that the WR producer may need to log and follow the WRs that are completed and released, so the producer can know which WRs can be re-used, since WRs can be recycled (reused) only after they are completed. This burden does not exist with in-order signaling of completion, as is sought to be provided in certain exemplary embodiments of the present invention, since the producer generally needs only to follow the last WR that had been completed, and does not need to follow previous WRs in order to know which WRs can be re-used.
Reference is now made to
The system of
It is appreciated that the host 105, while shown in
The networking element 110 comprises:
The networking element 110 is depicted in
Neither memory of the networking element 110 nor memory of the host 105 are explicitly shown in
The WCS 125 comprises a plurality of work control records (WCRs), depicted in
It is appreciated that, in certain exemplary embodiments, the various WCRs may be dynamically allocated by the WCS 125 from a global pool which is also available to other work control structures; likewise, WCRs may, when appropriate, be deallocated by the WCS 125 back to the global pool. In such exemplary embodiments, performance of the system of
The WCR 132 and the WCR 142 are shown in
The WCR 142 also comprises a completion indicator 148, shown as set to 1 (one), indicating that the unit of work associated with the WCR 142 has been completed. It will be appreciated that one is an arbitrary value, and that, alternatively, any appropriate value indicating that the unit of work associated with the WCR 142 has been completed may be used. The WCR 142 also comprises a work specifying field 150.
While not shown for sake of simplicity of depiction, it will be appreciated that, in general, the WCR 134, the WCR 136, the WCR 138, and the WCR 140 also each comprise a completion indicator and a work specifying field.
Exemplary functioning of the system 100 of
The host 105 comprises a host queue handling module 160. The host queue handling module 160 handles: a work queue (WQ) 165, holding work requests (WRs, not shown for sake of simplicity of depiction); and a completion queue (CQ) 170, holding completion queue entries (CQEs, not shown for sake of simplicity of depiction). As is known in the art (and described, for example, in U.S. Pat. No. 7,152,122 to Kagan et al, the disclosure of which has been incorporated herein by reference), the host queue handling module 160 posts WRs to the WQ 165 to indicate that a unit of work is to be done (such as, for example, by a networking element) and polls CQEs from the CQ 170, the CQEs (each associated with a previously-posted WR) indicating that the unit of work indicated by the associated WR has completed. However, at least the following are believed by the inventor of the present invention not to be known in the art: the interaction between the components shown in
An exemplary mode of operation of the system 100 of
When a unit of work is to be done (by way of non-limiting example, when a WR is posted by the host queue handling module 160 to the WQ 165), a WCR associated with that unit of work is pushed (typically to the end of) the WCS 125. By way of example, the queue handling logic 115 pushes the WCR 132 to the end of the WCS 125; the WCR 132 has a completion indicator 144 indicating that the unit of work associated with the WCR 132 has not been completed. The WCR 132 also has a work specifying field 146, which specifies (to the work processing logic 120), what work is to be carried out. By way of particular non-limiting example, since in the exemplary embodiment of
The work specified in the work specifying field 146 is carried out by the work processing logic 120. When, in due course, the work specified in the work specifying field 146 has been completed, the work processing logic 120 sets the value of the completion indicator 144 to indicate that the work specified by the work specifying field 146 has been completed. Alternatively, specific logic such as, for example, completion indication logic (not shown) which may be comprised in the work processing logic 120 or elsewhere in the networking element 110, may be responsible for setting the value of the completion indicator 144 to indicate that the work specified by the work specifying field 146 has been completed.
It is appreciated that, as described above, the work specified in work specifying fields in various WCRs in the WCS 125 may be completed other than in the order that the WCRs are pushed into the WCS 125. In order to provide in-order signaling of completion, as described above, the queue handling logic 115 may poll the WCR which is at the head of the WCS 125. Alternatively, the queue handling logic 115 may be configured to detect that the “oldest” WCR in the WCS 125 (the WCR which is at the head of the WCS 125) has a completion indicator 144 indicating that the work associated with that WCR has been completed, and may at that time (in addition to generating a CQE for that “oldest” WCR in the CQ 170) also examine the next WCR in the WCS 125. In short, only when the completion indicator of the WCR at the head of the WCS 125 indicates that the work specified by the work specifying field of the WCR at the head of the WCS 125 has been completed, the queue handling logic pops the WCR from the head of the WCS 125 and indicates that the work has completed (such as, for example, by sending a CQE to the CQ 170 of the host).
Specifically, in
Persons skilled in the art will appreciate that the above-described exemplary functioning of the system 100 of
It is appreciated that a situation might arise wherein the unit of work specified by a particular WCR is “never” completed, due to some system problem, or is not completed for a very “long” time; the definition of “long” in this context would depend on many parameters of an actual system. To prevent the system of
Reference is now made to
The exemplary method of
Upon beginning of a work request (WR) (or upon fetching a WR for execution), a work control request (WCR) corresponding to the WR is pushed to a work control structure (WCS), via communication hardware. (step 210). The WCS may be external to the queue handling logic; in alternative exemplary embodiments, the WCS may be comprised in the queue handling logic.
The following steps in the method are also performed via the communication hardware.
It is appreciated that software components of the present invention may, if desired, be implemented in ROM (read only memory) form. The software components may, generally, be implemented in hardware, if desired, using conventional techniques. It is further appreciated that the software components may be instantiated, for example: as a computer program product or on a tangible medium. In some cases, it may be possible to instantiate the software components as a signal interpretable by an appropriate computer, although such an instantiation may be excluded in certain embodiments of the present invention.
It is appreciated that various features of the invention which are, for clarity, described in the contexts of separate embodiments may also be provided in combination in a single embodiment. Conversely, various features of the invention which are, for brevity, described in the context of a single embodiment may also be provided separately or in any suitable subcombination.
It will be appreciated by persons skilled in the art that the present invention is not limited by what has been particularly shown and described hereinabove. Rather the scope of the invention is defined by the appended claims and equivalents thereof:
The present application is a Continuation of U.S. Ser. No. 16/571,122 of Shahar et al, filed 15 Sep. 2019.
Number | Name | Date | Kind |
---|---|---|---|
5339449 | Karger et al. | Aug 1994 | A |
5802394 | Baird et al. | Sep 1998 | A |
6718370 | Coffman et al. | Apr 2004 | B1 |
6789143 | Craddock et al. | Sep 2004 | B2 |
7013419 | Kagan et al. | Mar 2006 | B2 |
7149819 | Pettey | Dec 2006 | B2 |
7152122 | Kagan et al. | Dec 2006 | B2 |
7912988 | Boyd et al. | Mar 2011 | B2 |
7945911 | Garthwaite | May 2011 | B1 |
8463966 | Riocreux et al. | Jun 2013 | B2 |
8813245 | Corley | Aug 2014 | B1 |
9026744 | Hofmann et al. | May 2015 | B2 |
9104512 | BlockSome et al. | Aug 2015 | B2 |
9471402 | Bayareddy et al. | Oct 2016 | B1 |
10051038 | Makhervaks et al. | Aug 2018 | B2 |
10558581 | Lazier | Feb 2020 | B1 |
10698767 | De Kadt | Jun 2020 | B1 |
11055130 | Shahar et al. | Jul 2021 | B2 |
11416294 | Davis | Aug 2022 | B1 |
20050050188 | Davis | Mar 2005 | A1 |
20060184949 | Craddock et al. | Aug 2006 | A1 |
20070088871 | Kwong | Apr 2007 | A1 |
20070208820 | MakherVaks et al. | Sep 2007 | A1 |
20070256058 | Marfatia et al. | Nov 2007 | A1 |
20080275989 | Ebersole | Nov 2008 | A1 |
20090168786 | Sarkar | Jul 2009 | A1 |
20110055531 | Bellows et al. | Mar 2011 | A1 |
20110082985 | Haines et al. | Apr 2011 | A1 |
20150143384 | Lojewski | May 2015 | A1 |
20150379424 | Dirac et al. | Dec 2015 | A1 |
20160026604 | Pandit et al. | Jan 2016 | A1 |
20160246641 | Kogan et al. | Aug 2016 | A1 |
20160283415 | McBride et al. | Sep 2016 | A1 |
20180217754 | Lee | Aug 2018 | A1 |
20180349145 | Tye et al. | Dec 2018 | A1 |
20180365053 | Burroughs | Dec 2018 | A1 |
20190034381 | Burstein et al. | Jan 2019 | A1 |
20200073713 | Nield | Mar 2020 | A1 |
20200257555 | Underwood et al. | Aug 2020 | A1 |
20200301753 | Havlir et al. | Sep 2020 | A1 |
20200356419 | Jacob et al. | Nov 2020 | A1 |
20200401458 | Roy | Dec 2020 | A1 |
20210081207 | Shahar et al. | Mar 2021 | A1 |
Entry |
---|
U.S. Appl. No. 16/571,220 Office Action dated Jun. 30, 2022. |
EP Application # 20195810.5 Search Report dated Feb. 4, 2021. |
Kuperstein et al., “Automatic Inference of Memory Fences”, Published in Formal Methods in Computer Aided Design, pp. 1-9, Oct. 20-23, 2010. |
Wikipedia, “Memory barrier”, pp. 1-4, Apr. 5, 2019. |
Howells et al., “Linux Kernel Memory Barriers”, pp. 1-48, Jun. 19, 2019. |
McKenney., “Memory Barriers: a Hardware View for Software Hackers”, Linux Technology Center, pp. 1-28, Jul. 3, 2010. |
U.S. Appl. No. 16/571,220 Office Action dated Dec. 24, 2021. |
U.S. Appl. No. 16/571,220 Office Action dated Nov. 10, 2022. |
U.S. Appl. No. 16/571,220 Office Action dated May 5, 2023. |
Number | Date | Country | |
---|---|---|---|
20210286646 A1 | Sep 2021 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 16571122 | Sep 2019 | US |
Child | 17331657 | US |