Abstract:
A cache system for multiple processors including multiple caches, one of the caches serving each respective processor, a main memory system, and a bus interconnecting the caches and the main memory, the bus allowing data to be written directly between the caches without accessing the main memory system.

Description:
BACKGROUND 
     This invention relates to caching data. 
     Caches improve the performance of microprocessors by storing copies of data that would otherwise be subject to frequent accesses from main memory. Because changes to the data in the cache are not immediately copied back to main memory, the version of data kept in main memory may not be correct. Because a cache typically uses memory chips that have faster access times than those used in main memory, a microprocessor can read and write data in its cache faster than in its main memory. Fast access cache memory chips cost more than slower access main memory chips and so a cache is typically smaller than main memory. Only a portion of the main memory data can reside in the cache at one time. Caches have circuitry to transfer data back and forth from main memory depending on which data the microprocessor is accessing. When data which the microprocessor needs to read or write is not in its cache, the cache decides whether to copy the data from main memory to the cache. Whole groups of contiguous words, known as &#34;lines&#34;, are copied at one time into the cache. When the cache is full, lines being copied overwrite old lines. 
     Cache management is more complicated in multiprocessor systems in which, for example, one microprocessor runs a word processing system while another runs a data base, or two microprocessors run different tasks of a single data base program. Both processors may seek to access the same location in main memory, creating a conflict between the processors&#39; caches. 
     In the known system illustrated in FIG. 1, the two processors CPU A 10 and CPU B 12 share a common level 2 cache 22. CPU A 10 and CPU B 12 are connected to a common host bus 14 by which they communicate with a cache/memory controller 16. The cache/memory controller manages access to main memory 18 by CPU A and CPU B and by other devices via a PCI bus 20. Each CPU has its own level 1 cache (not shown) which is typically on the same chip as the CPU and is not shared with the other CPU. CPU A and CPU B resolve ownership of the host bus via bus arbitration signals 24. Those same signals are used to resolve conflicts involving the level 1 caches in the two CPUs. 
     A typical known cache, shown in FIG. 2, has a cache memory 30 holding lines of data 32a-k, each including two or more words 34a-e. The number of lines in the cache and the number of words per line varies from cache to cache. 
     The typical known cache also includes a tag ram 36, which contains an address 38a-k and a status 40a-k for each line in the cache. Each address is an address in main memory corresponding to the data in the corresponding line in the cache. For example, address 38a may be the main memory address corresponding to the data in line 32a. 
     The status indicates the validity of the data in the corresponding line. For example, status 40a may contain the status for line 32a. Each status can have one of four values: (1) &#34;modify&#34;, which means that a CPU has modified one or more words in the corresponding line, leaving the data in main memory corresponding to that line &#34;stale&#34;; (2) &#34;exclusive&#34;, which means that the data is available in only one cache and it is not modified; (3) &#34;shared&#34;, which means that the data in the corresponding line is potentially shared with other caches in the system; and (4) &#34;invalid&#34;, which means that the data in the corresponding line of the cache is invalid. 
     Because each CPU has its own cache, the possibility exists for conflict between the caches such as, for example, if CPU B changes data in its cache without changing main memory and CPU A attempts to read the same data from main memory into its cache. Unless the CPUs resolve this conflict, i.e. as shown in FIG. 3 for a known system, CPU A will process stale data. Assume CPU A has control of the host bus, i.e. is the &#34;host master&#34;, so CPU A attempts to read from its level 1 cache. CPU A experiences a &#34;read miss&#34;, meaning that its level 1 cache does not contain a line corresponding to the address sought to be accessed 52. CPU A tries to read the corresponding line of data from the level 2 cache or from main memory 56 and notifies CPU B of the impending read via the bus arbitration signals. CPU B detects that its level 1 cache contains the line CPU A is about to read and that the status of the line is &#34;modify&#34; which means that the data CPU A is attempting to read from the level 2 cache or main memory is stale. This is called a &#34;hit on modify.&#34; CPU B notifies CPU A that the read is to a data line with stale data 58. CPU A completes the read from the level 2 cache or main memory through the cache/memory controller and discards the stale data 60. CPU A transfers control of the host bus to CPU B 62. CPU B writes the modified line to main memory through the cache/memory controller and changes the status of the modified line to &#34;shared&#34; 64. CPU A transfers control of the host memory back to CPU A 66. CPU A reads a line of data into its L1 cache from main memory through the cache/memory controller 68. CPU A then completes the read from its level 1 cache 70. CPU A and B change the status of the line in their L1 caches to &#34;shared.&#34; 
     A similar sequence occurs if CPU A experiences a write miss to its L1 cache 72. The operation follows the same logic described above for steps 56, 58, 60, 62, 64, 66 and 68, except that in step 64 CPU B changes the status of the requested line in its L1 cache to &#34;invalid&#34; because it knows CPU A is about to write to that line. After CPU A reads the line of data into its L1 cache from main memory, it performs the write to its L1 cache and changes the status of the line in its L1 cache to &#34;modified&#34; 74. 
     SUMMARY 
     In general, in one aspect, the invention features a cache system for multiple processors comprising multiple caches, one of the caches serving each respective processor, a main memory system, and a bus interconnecting the caches and the main memory system, the bus allowing data to be written directly between the caches without accessing the main memory system. 
     Implementations of the invention may include one or more of the following. The caches may be level two caches and the cache system may further comprise multiple level one caches, one of the level one caches serving each respective processor. The cache system may further comprise snoop signals connecting the multiple caches. 
     In general, in another aspect, the invention features a method for performing an allocation cycle to a cache comprising accessing a main memory system only once. 
     Implementations of the invention may include one or more of the following. The method may further comprise a first cache controller informing a second cache controller of the allocation cycle, and the second cache controller informing the first cache controller that the allocation cycle is accessing a stale item of data from the main memory system. The method may further comprise the first cache controller discarding the stale item of data retrieved from main memory. The method may further comprise a first cache controller writing an item of data from a first cache memory to a second cache memory. The method may further comprise a second cache controller intercepting the item of data as it is being written into the second cache memory. 
     In general, in another aspect, the invention features a cache system comprising a cache memory, a main memory system, a bus connected to the cache memory and the main memory system, a first cache controller connected to the cache memory and to the bus, the first cache controller controlling access to the cache memory, and a second cache controller capable of writing data into the cache memory via the bus without accessing the main memory system. 
     Implementations of the invention may include one or more of the following. The cache system may further comprise a plurality of snoop signals connecting the first cache controller to the second cache controllers. The cache system may further comprise a first processor connected to the first cache controller, and a second processor connected to the second cache controller. The cache system may further comprise a first level one cache serving the first processor, and a second level one cache serving the second processors. 
     In general, in another aspect, the invention features a cache system having two cache controllers connected by snoop signal lines. 
     Implementations of the invention may include one or more of the following. The cache system may further comprise a bus interconnecting the first cache controller and the second cache controller. The cache system may further comprise a first cache memory, access to which is controlled by the first cache controller, and a second cache memory, access to which is controlled by the second cache controller. The cache system may further comprise a bus interconnecting the first and second cache controllers and the first and second cache memories. The cache system may further comprise a main memory system. The first cache controller may be capable of moving an item of data between the first cache memory and the second cache memory without accessing the main memory system. The second cache controller may be capable of intercepting the data as it is moved between the first cache memory and the second cache memory. 
     In general, in another aspect, the invention features a cache system comprising multiple processors, multiple caches, one of the caches serving each respective processor, a main memory system, and a bus interconnecting the multiple caches and the main memory system wherein an item of data may be written from one of the caches to another without accessing main memory system. 
     In general, in another aspect, the invention features a computer system, comprising multiple processors, multiple caches one of the caches serving each respective processor, a main memory system, a first bus interconnecting the caches and the main memory system, the first bus allowing data to be written directly between the caches without accessing the main memory system, and a second bus connected to the main memory system. 
     Implementations of the invention may include one or more of the following. The computer system may further comprise peripheral devices connected to the second bus. The peripheral devices may be able to access the main memory system while an item of data is being written between the caches. 
     In general, in another aspect, the invention features in a multiple cache system a method for writing data between the caches without accessing a main memory system. 
     In general, in another aspect, the invention features a cache system wherein an allocation cycle to a cache requires only one access to a main memory system. 
     In general, in another aspect, the invention features a method for performing an allocation cycle to a cache comprising a first cache controller informing a second cache controller of the allocation cycle, the second cache controller informing the first cache controller that the allocation cycle is accessing a stale item of data from a main memory system, the first cache controller discarding the stale item of data retrieved from main memory, the first cache controller writing an item of data from a first cache memory to a second cache memory, and the second cache controller intercepting the item of data as it is being written into the second cache memory. 
     Advantages of the invention may include one or more of the following. 
     The invention may improve performance by reducing the number of read and write cycles to main memory associated with resolving cache conflicts, thus freeing the main memory for accesses from other devices. The invention separates the function of controlling main memory from the function of controlling the level 2 caches, which may allow the memory controller design to be more closely conformed to the function of controlling main memory. 
     Other advantages or features will become apparent from the following description and from the claims. 
    
    
     DESCRIPTION 
     FIG. 1 is a block diagrams of a known multiprocessor system. 
     FIG. 2 is a block diagram of a known cache. 
     FIG. 3 is a flow chart of the operation of the system of FIG. 1. 
     FIG. 4 is a block diagram of an embodiment of a new multi-processor system 
     FIGS. 5, 5A, and 6 are flow charts. 
    
    
     In FIG. 4, CPU A, 80, which has a level 1 cache A (&#34;L1 A&#34;) 81, communicates with a level 2 cache controller A (&#34;L2CC A&#34;) 82 via a dedicated bus 84. A CPU B, 86, which has a level 1 cache B (&#34;L1 B&#34;) 87, communicates with a level 2 cache controller B (&#34;L2CC B&#34;) 88 via a dedicated bus 90. L2CC A communicates with a level 2 cache A, 92, (&#34;L2 A&#34;) via cache control signals A, 94. L2CC B communicates with a level 2 cache B, 96, (&#34;L2 B&#34;) via cache control signals B, 98. L2CC A, L2CC B, L2 A, and L2 B share access to a host bus 100 with a memory controller 102, separate from the two level 2 cache controllers. The L2CC A communicates with the L2CC B via host bus mediation signals 104, by which L2CC A and L2CC B determine which processor has control over the host bus, and via snoop signals 106, by which each level 2 cache controller monitors (&#34;snoops&#34;) the reads and writes of the other. The memory controller allows devices connected to a PCI bus 108 or the host bus to access a main memory 110 via a dedicated bus 112. 
     When a level 2 cache controller, e.g. L2CC A, receives a read or write request from a CPU, e.g. CPU A, it determines whether the data is to be accessed is in its cache memory, e.g. L2 A. If not, L2CC A decides, through one of a number of known algorithms, whether a line including the data to be accessed should be copied from main memory to L2 A in operations called &#34;read allocation&#34; or &#34;write allocation&#34; cycles, or if the data should be simply accessed in main memory without reading it into L2 A, called a &#34;single write&#34; cycle. If a read or write allocation cycle occurs in L2CC A and the data in main memory is stale but is fresh in L2 B, the invention transfers the data from L2 B to L2 A without writing it to main memory. 
     Initially, as illustrated in FIGS. 5 and 5A, CPU A is the bus master and CPU B is the non-bus-master. CPU A initiates a read or a write to a main memory location not stored in a line in either L1 A or L2 A, but which is stored in a modified line in L2 B, 120. If CPU A initiates a read (or write), it will have a read (or write) miss to L1 A, 122 (128), because L1 A does not contain the data. CPU A will initiate a read (write) to L2CC A which will have a read (write) miss to L2 A, 124 (128), because L2 A does not contain the data. 
     In either case (read or write), L2CC A must retrieve the needed line of data. L2CC A initiates a read of the required line from main memory through the memory controller 130. L2CC B snoops the address of L2CC A&#39;s read through snoop signals, detects a hit on modify by finding L2CC A&#39;s read in its tag ram with a &#34;modify&#34; status, and notifies L2CC A of the hit on modify via a return snoop signal 132. L2CC A either reads and discards the stale line from main memory or terminates the read from main memory as soon as L2CC B sends its notification of the hit on modify. In either case, L2CC A transfers control of the host bus to L2CC B using the host bus mediation signals 136. L2CC B writes the modified line directly to L2 A via the host bus 138. L2CC A &#34;snarfs&#34;, or intercepts but without disrupting the transfer, the transferred data as it is being written to L2 A, 140. L2CC B transfers control of the host bus back to L2CC A using the host bus mediation signals 142. L2CC A returns the &#34;snarfed&#34; line to CPU A which writes it into L1 A, 144. 
     If CPU A&#39;s original request was a read, CPU A reads the requested data from its L1 cache 146. L2CC A and L2CC B both change the status of the requested line to &#34;shared&#34; 148, 150, FIG. 5A. 
     If CPU A&#39;s original request was a write, CPU A writes the data to L1 A and sends the data to L2CC A which writes it to L2 A, 152, FIG. 5. L2CC A changes the status of the requested line to &#34;modify&#34; 154 and L2CC B invalidates the requested (modified) line 156, FIG. 5A. 
     A read allocation or write allocation cycle with a hit on modify in the non-bus-master&#39;s cache requires at most one access to main memory through the memory controller, which keeps the memory controller free for accesses to main memory via the PCI bus. 
     In a single write to memory, illustrated in FIG. 6, the writing CPU does not attempt to update its cache, unlike an allocate cycle. Initially CPU A is the bus master initiating a write to a location in memory which is present in a line in L2 B having a &#34;modify&#34; status. CPU A has a write miss to L1 A, 162, and initiates a write to L2CC A. L2CC A has a write miss to L2 A cache 164. L2CC A initiates a single write, rather than a write allocation cycle, to main memory 166. L2CC B snoops L2CC A&#39;s write to memory via the snoop signals, detects the address of the write in its tag ram in a line with a &#34;modify&#34; status, and notifies L2CC A of the hit on modify 168. L2CC A completes the write to main memory 170. L2CC B &#34;snarfs&#34;, or intercepts but without disrupting the transfer, the data as it is written to main memory and updates L2 B with the modified data 172. L2CC B keeps the status of the affected line &#34;modify&#34; 174. 
     A detailed description of an embodiment is contained in Appendices A and B. incorporated by reference. The Appendices describe an L2C chip and an L2D chip which together make up an embodiment of the invention. 
     Other embodiments are within the scope of the following claims. 
     For example, the system may be composed of more than two processors. ##SPC1##