Dirty data protection for cache memories
AssigneeSun Microsystems, Inc.
InventorPeter L. Fu
Life of this patent
Estimating the term…
Abstract
A method is described for protecting dirty data in cache memories in a cost-effective manner. When an instruction to write data to a memory location is received, and that memory location is being cached, the data is written to a plurality of cache lines, which are referred to as duplicate cache lines. When the data is written back to memory, one of the duplicate cache lines is read. If the cache line is not corrupt, it is written back to the appropriate memory location and marked available. In one embodiment, if more duplicate cache lines exist, they are invalidated. In another embodiment, the other corresponding cache lines may be read for the highest confidence of reliability, and then marked clean or invalid.
Claims24
A method for maintaining dirty data comprising:
- a. receiving a request to write data to a memory location that is cached to a cache;
- b. writing the data to a plurality of cache lines in the cache, the plurality of cache lines written to being duplicate cache lines;
- and
- c. marking the duplicate cache lines dirty.
A method for saving dirty data comprising:
- a. reading data from a first dirty cache line in a plurality of cache lines in a cache, the first dirty cache line corresponding to a first memory location;
- b. determining if the data is corrupt;
- and
- c. if the data is not corrupt, then:
- i. writing the data to the first memory location;
- ii. marking the cache line available;
- iii. determining at least one duplicate dirty cache line of the first dirty cache line;
- and
- iv. marking each of the at least one duplicate dirty cache line as an available cache line.
A method for saving dirty data comprising:
- a. reading data from a first cache line in a plurality of cache lines in a cache, the first cache line corresponding to a first memory location;
- b. determining if the first cache line is a clean line;
- c. determining if the data is corrupt;
- and
- d. if the data is not corrupt, and the first cache line is not a clean line, then:
- i. writing the data to the first memory location;
- ii. marking the first cache line available;
- and
- iii. determining at least one duplicate dirty cache line of the first dirty cache line and marking each of the at least one duplicate dirty cache line invalid.
A machine-readable medium having stored thereon data representing sequences of instructions, the sequences of instructions which, when executed by a processor, cause the processor to perform the following:
- receive an instruction to write data to a memory location in a memory that is cached to a cache;
- write the data to a plurality of cache lines in the cache, the plurality of cache lines written to being duplicate cache lines;
- and
- mark the duplicate cache lines as dirty.
A machine-readable medium having stored thereon data representing sequences of instructions, the sequences of instructions which, when executed by a processor, cause the processor to perform the following:
- receive an instruction to write back at least one dirty cache line to a memory;
- select a first dirty cache line of a plurality of cache lines in a cache to write back to the memory;
- determine a corresponding memory location in the memory to write back to by examining a tag portion of the first dirty cache line;
- determine if the first dirty cache line has data that is corrupt;
- writing the data back to the memory if the data is not corrupt, and marking the first dirty cache line available;
- and
- determining at least one duplicate dirty cache line of the first dirty cache line and marking the at least one duplicate dirty cache line invalid.
A machine-readable medium having stored thereon data representing sequences of instructions, the sequences of instructions which, when executed by a processor, cause the processor to perform the following:
- a. receive an instruction to write back at least one cache line to a memory;
- b. select a cache line of a plurality of cache lines in an associated set of a cache to write back to the memory;
- c. determine if the cache line is a clean line;
- d. determine a corresponding memory location in the memory to write back to by examining a tag portion of the cache line;
- e. determining if the cache line has data that is not corrupt;
- f. if the data is not corrupt, then marking the cache line available, and:
- i. writing the data back to the memory;
- ii. determining if the cache line was a dirty cache line;
- iii. if the cache line was a dirty cache line, then determining at least one duplicate dirty cache line of the first dirty cache line and marking the at least one duplicate dirty cache line invalid;
- and
- iv. if the cache line was not a dirty cache line, then repeating the method at 17(b) until no more associated cache lines exist.
An apparatus comprising a cache controller to:
- intercept a request to write data to a cached memory location;
- determine an associated set having cache lines, the associated set corresponding to the memory location;
- and
- write the data to a plurality of cache lines in the associated set that are available.
A system comprising:
- a main memory having at least one memory location that is cached to a cache;
- a cache having a plurality of cache lines to store data;
- and
- a processor to receive an instruction to write data to a cached memory location;
- a cache controller to determine an associated set corresponding to the memory location, the associated set having a plurality of cache lines, and to write the data to a plurality of available cache lines in the associated set.
A system comprising:
- a main memory having at least one memory location that is cached to a cache;
- a cache having a plurality of cache lines to store data;
- and
- a first means to receive an instruction to write data to a cached memory location;
- a second means to determine an associated set corresponding to the memory location, the associated set having a plurality of cache lines;
- and
- a third means to write the data to a plurality of available cache lines in the associated set.
Dependencies are inferred from the claim text.