An embodiment of the invention is related to the processing of memory read and memory write requests in computer systems having both strong and relaxed transaction ordering. Other embodiments are also described.
A computer system has a fabric of several devices that communicate with each other using transactions. For example, a processor (which may be part of a multi-processor system) issues transaction requests to access main memory and to access I/O devices (such as a graphics display adapter and a network interface controller). The I/O devices can also issue transaction requests to access locations in a memory address map (memory read and memory write requests). There are also intermediary devices that act as a bridge between devices that communicate via different protocols. The fabric also has queues in various places, to temporarily store requests until resources are freed up before they are propagated or forwarded.
To ensure that transactions are completed in the sequence intended by the programmer of the software, strong ordering rules may be imposed on transactions that move through the fabric at the same time. However, this safe approach generally hampers performance in a complex fabric. For example, consider the scenario where a long sequence of transactions is followed by a completely unrelated one. If the sequence makes slow progress, then it significantly degrades the performance of the device waiting for the unrelated transaction to complete. For that reason, some systems implement relaxed ordering where certain transactions are allowed to bypass earlier ones.
However, consider a system whose fabric uses the Peripheral Components Interconnect (PCI) Express communications protocol, as described in PCI Express Base Specification 1.0a available from PCI-SIG Administration, Portland, Oreg. The PCI Express protocol is an example of a point to point protocol in which memory read requests are not allowed to pass memory writes. In other words, in a PCI Express fabric, a memory read is not allowed to proceed until an earlier memory write (that will share a hardware resource, such as a queue, with the memory read) has become globally visible. Globally visible means any other device or agent can access the written data.
The embodiments of the invention are illustrated by way of example and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” embodiment of the invention in this disclosure are not necessarily to the same embodiment, and they mean at least one.
Beginning with
The root device 114 also has a second port 128 to the switch device 118, through which transaction requests may be sent and received. The second port 128 is designed in accordance with a point-to-point communication protocol that has a relatively strong transaction ordering rule that a memory read cannot pass a memory write. An example of such a protocol is the PCI Express protocol. Other communication protocols having similar transaction ordering rules may alternatively be used. The root device also has an ingress queue (not shown) to store received memory read and memory write requests that are directed upstream, in this case coming from the switch device 118. An egress queue (not shown) is provided to store memory read and memory write requests that are to be sent to the processor 104.
In operation, consider for example, that the endpoint 122 originates a memory read request that propagates or is forwarded by the switch device 118 to the root device 114 which in turn forwards the request to, for example, the processor 104. According to an embodiment of the invention, the memory read request packet is provided with a relaxed ordering flag (also referred to as a read request relaxed ordering hint, RRRO). The endpoint 122 may have a configuration register (not shown) that is accessible to a device driver running in the system (being executed by the processor 104). The register has a field that, when asserted by the device driver, permits the endpoint 122 to set the RRRO hint or flag in the packet, prior to transmission of the read request packet, if it may be expected that out of order processing of the memory read is tolerable. Logic (not shown) may be provided in the root device 114, to detect this relaxed ordering flag in the memory read request and in response allow the request to pass one or more previously enqueued memory write requests in either an ingress or egress queue. This reordering should only be allowed if the logic finds no address conflict between the memory read and any memory writes that are to be passed. If there is an address conflict, then the read and write requests are kept in source-originated order, to ensure that the read will obtain any previously written data. By reordering, the switch device 118 or the root device 114 will move that transaction ahead of the previously enqueued memory write requests that are directed upstream.
The memory read and write requests may target a main memory section 106 or 110. Such requests are, in this embodiment, handled by logic within the processor 104 or 108. This may include an on-chip memory controller (not shown) that is used to actually access, for example, a DRAM device in the main memory section 106, 110. The above-described embodiment of the invention may help reduce read request latency (which can be particularly high when the memory is “integrated” with the processor as in this case), by relaxing the ordering requirements on memory read requests originating from I/O devices. This may be particularly advantageous in a system having a full duplex point-to-point system interface according to the PCI Express protocol that has strong ordering, and a coherent point-to-point link used to communicate with the processors 104, 108 and that has relaxed ordering. That is because strong transaction ordering on memory read requests may lead to relatively poor utilization of, for example, the coherent link in the outbound or downstream direction (that is, the direction taken by read completions, from main memory 106, 110 to the requestor). Thus, even though the switch device 118 has interfaces to point-to-point links that have strong transaction ordering rules, at least with respect to a memory read request not being allowed to pass a memory write, the switch device 118 and the root device 114 may be modified in accordance with an embodiment of the invention to actually implement relaxed ordering as described here, with respect to a memory read that has a relaxed ordering flag or hint asserted.
Turning now to
The memory read and memory write requests are to be forwarded to the first device in accordance with a different communication protocol that has a relatively relaxed transaction ordering rule in that a memory read may pass a memory write (212). The method is such that the forwarded memory read request is allowed to pass the forwarded memory write request whenever a relaxed ordering flag in the received memory read request is found to be asserted. Note that this should only be allowed if there is no address conflict between the passing memory read and the memory write that is being passed. An address conflict is when two transactions access the same address at the same time.
Turning now to
According to another embodiment of the invention, to preserve flush semantics from the standpoint of software that is using the NIC 320, the root device 114 is designed to deliver the completion packet of the memory read request to its requester (here the NIC 320) over the point-to-point link to the switch device 118, only if all earlier memory writes (sharing certain hardware resources, such as an ingress or egress queue, with the read request) have become globally visible. In this case, a memory write sent to the processor over the coherent link is globally visible when the root device 114 receives an acknowledgement (ack) packet from the accessed main memory section 106 or 110, in response to the memory write having been applied. This ack packet is a feature of the coherent link which may be used to indicate global visibility. Thus, the root device 114 holds or delays the read completions received from main memory, until all previous pending writes (sharing resources with the read request) are globally visible.
To implement legacy flush semantics, a requestor (such as the NIC 320) may follow a sequence of memory write requests by sending a read. That is because the memory write transactions, be it on the legacy bus 318 or the point-to-point link (e.g., PCI Express interface), do not call for a completion packet to be returned to the requestor. The only way that such a requestor can find out whether its earlier write requests have actually reached main memory is to follow these with the read (which may be directed at the same address as the writes, or a different one). The read, in contrast to the write, is a non-posted transaction, such that a completion packet (whether containing data or not) is returned to the requestor once the read request has been applied at the target device. Using such a mechanism, a requestor can confirm to its software that the sequence of writes have, in fact, completed, because by definition, in the legacy and the point-to-point link interfaces, the read should not pass the earlier writes. This means that if the read completion has been received, the software will assume that all earlier writes have reached their target devices.
An advantage of the above-described technique for delaying the forwarding of read completions to the requestor may be appreciated by the following example. Assume the endpoint in this case the NIC 320 is a legacy network adapter card that is retrieving data from a network (e.g., the Internet) and writing this data to main memory. A long sequence of writes are therefore generated by the NIC 320 which are forwarded over the point-to-point links between the bridge and the switch device and between the switch device and the root device. In that case, these writes are posted in the sense that no completion packet is to be returned to the requestor. To preserve legacy flush semantics, the NIC 320 follows the last write request with a memory read request. Assume next that the NIC 320 waits for the read completion packet in response to which it immediately interrupts the processor on a sideband line or pin (not shown). This interrupt is designed to signal the processor that the data collected from the network is now in memory and should be processed according to an interrupt service routine, for example, in the device driver routine corresponding to the NIC 320. This device driver routine will assume that all data from the previous writes have already been written to main memory and, as such, will attempt to read that data. Note that the interrupt is relatively fast because of the sideband pin that is available, such that there is a relatively short delay between receiving the completion packet in the NIC 320 and the device driver starting to read data from main memory. Accordingly, in such a situation, if the read completion packet is received by the NIC 320 too soon, namely before all of the write data has been written to main memory, then incorrect data may be read since the write transactions have not finished. Thus, it can be appreciated that if the root device delays the forwarding of the read completion packet (over the point-to-point link to the switch device 118) until the ack packet is received for the last memory write from the main memory (over the coherent link), then the device driver software for the NIC 320 is, in fact, guaranteed to read the correctly updated data in response to the interrupt.
Turning now to
Although the above examples may describe embodiments of the present invention in the context of logic circuits, other embodiments of the present invention can be accomplished by way of software. For example, in some embodiments, the present invention may be provided as a computer program product or software which may include a machine or computer-readable medium having stored thereon instructions (e.g., a device driver) which may be used to program a computer (or other electronic devices) to perform a process according to an embodiment of the invention. In other embodiments, operations might be performed by specific hardware components that contain microcode, hardwired logic, or by any combination of programmed computer components and custom hardware components.
A machine-readable medium may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), but is not limited to, floppy diskettes, optical disks, Compact Disc, Read-Only Memory (CD-ROMs), and magneto-optical disks, Read-Only Memory (ROMs), Random Access Memory (RAM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic or optical cards, flash memory, a transmission over the Internet, electrical, optical, acoustical or other forms of propagated signals (e.g., carrier waves, infrared signals, digital signals, etc.) or the like.
Further, a design may go through various stages, from creation to simulation to fabrication. Data representing a design may represent the design in a number of manners. First, as is useful in simulations, the hardware may be represented using a hardware description language or another functional description language. Additionally, a circuit level model with logic and/or transistor gates may be produced at some stages of the design process. Furthermore, most designs, at some stage, reach a level of data representing the physical placement of various devices in the hardware model. In the case where conventional semiconductor fabrication techniques are used, data representing a hardware model may be the data specifying the presence or absence of various features on different mask layers for masks used to produce the integrated circuit. In any representation of the design, the data may be stored in any form of a machine-readable medium. An optical or electrical wave modulated or otherwise generated to transmit such information, a memory, or a magnetic or optical storage such as a disc may be the machine readable medium. Any of these mediums may “carry” or “indicate” the design or software information. When an electrical carrier wave indicating or carrying the code or design is transmitted, to the extent that copying, buffering, or re-transmission of the electrical signal is performed, a new copy is made. Thus, a communication provider or a network provider may make copies of an article (a carrier wave) embodying techniques of the present invention.
The invention is not limited to the specific embodiments described above. For example, although the coupling between the root device and the processor, in some embodiments, is referred to as a coherent, point-to-point link, an intermediate device such as a cache coherent switch may be included in between the processor and the root device. In addition, in