To prevent deadlocks and stalls in a system, an arbiter may be present to receive requests from multiple agents and arbitrate the requests to provide access grants to resources of the system. In some systems, arbitration is performed according to a fixed priority privilege in which a certain number of grants are allowed to avoid a higher priority requestor from starving lower priority requestors. Grant operation typically starts from the highest priority requester and proceeds to the lowest priority requestor. In some systems, the lower priority requestor can only receive a grant when higher priority requestors have no active requests or have exhausted their grant count. Requestors commonly receive reloaded grant counts when no active requests are present, every requestor participating in arbitration has exhausted their grant counts, or no active request from any requester with a grant count exists.
A common starvation problem with this arbitration scheme is when one of the requestors has not exhausted its grant count but could not be granted a grant due to a lack of required target resources. When this scenario occurs, no requestor with active requests can receive a grant once they have reached their grant count limit, causing grant operation to come to a stall until the target resource is freed up. While this problem can be resolved by reloading grant counts, this solution can cause starvation in lower priority requestors and thus arbitration fairness no longer prevails.
In various embodiments, an arbiter may provide for opportunistic granting of requests from one or more requesters. More specifically, in an arbiter that provides for a fixed priority for N number of requestors, when a required resource is unavailable for a given requestor during an arbitration cycle, the arbiter may opportunistically grant one or more requests to other requestors that seek to access available resources in place of the fixed priority requestor. In this way, stalls due to unavailable resources for a fixed requestor can be avoided.
Accordingly, to service requests from requesters with no grant count remaining, a secondary arbitration unit may run along aside a primary arbitration unit to arbitrate requests with sufficient required resources and an insufficient grant count, and opportunistically inject grant-by-grant when the primary arbitration unit cannot grant to any requesters with sufficient grant count and insufficient required resources. As shown in the truth table of Table 1, embodiments allow granting to a requestor with no grant count but with required resources available. With this arbitration policy, it is guaranteed that no arbitration stall could occur due to lack of a grant count, while at the same time prevailing to a fixed priority arbitration.
Thus as shown in Table 1 a resource having a grant count of zero may be granted an opportunistic arbitration slot when a required resource is available (i.e., having an available indicator 1), reducing stalls by enabling the requestor to gain access to the required resource when it is available.
Opportunistically granting access to a resource enables a system's performance to come close to the ideal case where no resource conflict occurs. Likewise, the longer the delay penalty the higher the performance ratio over a fixed priority arbiter. For this particular example of starvation due to the resources lacking scenario, embodiments may realize an appreciable gain in performance over a fixed priority arbiter. In reality, the resource conflict penalty is significantly higher, and thus the performance gain will be proportionally higher.
Referring now to
Referring now to
In various embodiments, arbiter 120 may be a fixed priority grant count arbiter to provide one or more grants to each of requestors 110 during an arbitration round or cycle. However, as described above due to unavailability of a required resource for a given requester, arbiter 120 may further provide for opportunistic granting of access to available resources to one or more requestors having a zero fixed priority count.
As shown in
Referring still to
Referring now to
A deadlock may occur in a fixed priority arbiter if there is an in-out dependency on a particular agent participating in the arbitration. An agent has an in-out dependency if it is both a master (i.e., it can issue request) and a target (i.e., it is a resource of the arbiter) in the arbitration system, and it thus can enter a state where it does not free up a resource on its target interface unless the request on its master interface is granted. The in-out dependency in an agent usually occurs when an agent cannot accept more read cycles as a target before its completion cycle requests as a master are accepted.
For example, in a system where agent A is both a master (MA) and a target (TA), MA is allocated to have 1 grant per complete arbitration cycle, TA at anytime could have up to 3 outstanding requests in its queue, and the shared outgoing data queue can buffer data up to 4 requests. Two other agents involved in this case include agent B master (MB) with 4 grant counts per complete arbitration cycle and agent C master (MC) with 2 grant counts per complete arbitration cycle. At anytime MB can have 1 outstanding non-posted transaction and MC can have up to 2 outstanding non-posted transactions in the system. MB has the highest fixed priority and MC is the lowest. The fixed priority arbitration system reloads grant count allocations for all masters at the end of every completed system arbitration cycle.
The deadlock occurs when agent B master, MB, sends 1 non-posted transaction followed by 1 posted transaction (e.g., write) to TA, agent C master, MC, sends 2 non-posted transaction to TA, and at the same time agent A master, MA, sends 3 posted requests to other target in the arbitration system. In chronological order, the non-posted request from MB will be granted followed by 2 non-posted requests from MC and 1 posted request from MA. Since the MA can only receive 1 grant for this arbitration cycle, therefore only 1 of 3 posted requests from MA is able to complete. Once TA is ready to return a read completion for posted requests from MB and MC, completion data is pushed into the shared data buffer queue of agent A behind the 2 pending posted write data from MA. The system arbitration cycle cannot be completed because MB still has an available grant count and outstanding requests that have yet to be serviced (pending for completion data which got blocked behind MA posted write data in agent A).
Embodiments may thus resolve the deadlock by allowing posted requests from MA master with no grant count available to be granted when system arbitration cannot commit another grant for any other master with a grant count remaining. By opportunistically granting the request from the master with no grant count remaining, MA, posted write data from the shared buffer can now be unloaded, thus unblocking completion data going back to MB and MC. MB can start sending its posted request to TA once receiving completion data from TA target. Thus embodiments allow posted requests from MA master to occur via the opportunistic arbitration.
Embodiments may be implemented in code and may be stored on a storage medium having stored thereon instructions which can be used to program a system to perform the instructions. The storage medium may include, but is not limited to, any type of disk including floppy disks, optical disks, compact disk read-only memories (CD-ROMs), compact disk rewritables (CD-RWs), and magneto-optical disks, semiconductor devices such as read-only memories (ROMs), random access memories (RAMs) such as dynamic random access memories (DRAMs), static random access memories (SRAMs), erasable programmable read-only memories (EPROMs), flash memories, electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, or any other type of media suitable for storing electronic instructions.
While the present invention has been described with respect to a limited number of embodiments, those skilled in the art will appreciate numerous modifications and variations therefrom. It is intended that the appended claims cover all such modifications and variations as fall within the true spirit and scope of this present invention.