Embodiments of the invention described herein relate to cache memory. More particularly, embodiments of the invention relate to a technique for sharing a locked cache line among one or more agents within a computer system or network in a fair manner.
Typical prior art caching schemes allow critical programs and bus agents within computer systems to access lines of cache that are locked or “owned” by another program or agent using techniques involving significant overhead in terms of processing operations and time. Furthermore, prior art caching schemes typically require even more overhead in order to return ownership to the original or other owner once the critical program or agent has used the data from the cache line. Moreover, prior art cache line sharing techniques do not typically take into account which agents or programs have already had an opportunity to own the cache line when determining whether to return the cache line to its original owner or some other agent or program in the system. Accordingly, prior art cache line sharing techniques can be “unfair”, as they may result in one agent or programming gaining ownership of a cache line more than others.
For example, in one prior art cache line sharing technique, ownership is transferred to other programs or agents within a system according to which agent or program has most recently requested ownership. In this example, a program or agent could gain ownership of a cache line multiple times before other agents or programs have been granted ownership once. Furthermore, in some prior art cache line sharing techniques, numerous bus cycles may be needed for a program or agent requesting ownership of the cache line to signal its request to the original owner and for the original owner to communicate ownership back to the requesting agent or program. The problem is exacerbated when there are a number of requesting agents each waiting for ownership of a particular locked cache line, which can result in greater system performance degradation.
Claimed subject matter is particularly and distinctly pointed out in the concluding portion of the specification. The claimed subject matter, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings in which:
In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the claimed subject matter. However, it will be understood by those skilled in the art that the claimed subject matter may be practiced without these specific details. In other instances, well-known methods, procedures, components and circuits have not been described in detail so as not to obscure the claimed subject matter.
Embodiments of the invention comprise at least one technique to allow a number of agents, such as a processor or software program being executed by a processor, within a computer system or computer network to access a locked (“owned”) cache line, under certain circumstances, without incurring as much of the operational overhead and resulting performance degradation of many prior art techniques. Furthermore, embodiments of the invention comprise at least one technique to allow such agents to gain ownership of the cache line in substantially fair manner. In at least one embodiment, a locked cache line has associated therewith a vector or vectors of at least two bits, each vector(s) to indicate whether an agent or program (hereafter “agent”) having access to the locked cache line is waiting and/or has been granted ownership of the cache line, respectively. In at least one embodiment, the two bit vectors are included in a cache line description buffer corresponding to the locked cache line, and the two bit vectors can migrate with the ownership of the cache line to other agents.
In at least one embodiment of the invention, the agent that owns the cache line may transition ownership of the cache line to other agents that are waiting to gain ownership of the cache line. However, unlike in some prior art techniques, embodiments of the invention facilitate an allocation of ownership of the cache line according to an algorithm that allows agents that have not received ownership of the cache line to receive ownership of the cache line before others that have already received ownership of the cache line. Furthermore, embodiments of the invention help to reduce communication traffic on an interconnect between the bus agent currently owning the cache line and other agents waiting for ownership of the cache line.
In order for an agent owning the locked cache line of
In one embodiment, ownership of the cache line is granted only to those agents who have not previously been granted ownership of the cache line before all other requesting agents have been granted ownership the cache line, as indicated by the grant bit not being set, and who are requesting ownership of the cache line, as indicated by the waiting bit being set. If an agent is waiting for ownership of the cache line, but has already received ownership before the other agents in the two bit vectors have received ownership, then ownership is not granted to that agent by the current owner. In one embodiment, after all waiting agents (those with their waiting bit set in the grant vector) have been granted ownership of the cache line (indicated by the grant bit being set), the grant bits of all agents are cleared and the selection process may start again.
Cache line descriptor buffer 205 may also contain bit vector(s) 216 to indicate which agents in the system to which the cache corresponds are waiting for ownership of the cache line 201 and which ones have been granted ownership of the cache line 201 before all other waiting agents have been granted ownership of cache line 201. In other embodiments, descriptor buffer entry 216 may contain two bit vectors to indicate which agents are waiting for the cache line and which ones have been granted the cache line. In one embodiment, the information stored in the two bit vectors 216 is transferred along with the ownership of the cache line 201 to other agents, such that each agent that owns the cache line 201 may examine the two bit vectors and determine which agent should next receive ownership of the cache line 201.
The system of
At least one embodiment of the invention may be located within the PtP interface circuits within each of the PtP bus agents of
If the requesting agent is currently waiting for ownership of the cache line and has not been previously granted ownership of the cache line before all other requesting agents have been granted ownership of the cache line, then at operation 415, ownership of the cache line is granted to the requesting agent, and the two bit vectors along with the cache line ownership is transferred to the requesting agent. Otherwise, if the requesting agent is waiting for ownership of the cache line but has previously been granted ownership of the cache line before all other requesting agents have been granted ownership of the cache line, then at operation 420, the requesting agent is not granted ownership to the cache line and the current owning agent or some other logic or program examines the two bit vectors' entry of another waiting agent in the two bit vectors at operation 425, and the process returns to operation 410. The other waiting agent whose wait and grant bits are examined may correspond to the next sequential entry in the two bit buffer, in one embodiment, whereas in other embodiments, the other waiting agent may be chosen according to some algorithm that may not choose the next sequential waiting agent whose wait and grant bits are in the two bit vectors.
After ownership and the two bit vectors of a cache line is transferred from one agent to another, according to one embodiment, a signal may be sent from the agent owning the cache line or from some other logic or program to the rest of the agents waiting to receive ownership that invalidates each of their respective copies of the cache line and resets the wait bits in each of their line description buffers corresponding to the cache line to a state indicating that none are currently waiting to receive ownership of the cache line. The agents that wish to receive ownership of the cache line may then indicate to the current owner of the cache line to reassert the wait bit corresponding to the signaling agent. Alternatively, in one embodiment, only those agents who do not have the grant bit set for the cache line may receive a signal to invalidate the cache line and reset the wait bit, which preserves the two bit vectors' state of the cache line for those agents that have previously been granted ownership of the cache line before all other agents waiting for ownership of the cache line.
Reference in the specification to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. The appearances of the phrase “in one embodiment” in various places in the specification are not necessarily all referring to the same embodiment.
In the foregoing specification, the invention has been described with reference to specific embodiments thereof. It will, however, be evident that various modifications and changes can be made thereto without departing from the broader spirit and scope of the invention. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.