diff options
author | Gene Wu <Gene.Wu@arm.com> | 2010-08-23 11:18:41 -0500 |
---|---|---|
committer | Gene Wu <Gene.Wu@arm.com> | 2010-08-23 11:18:41 -0500 |
commit | d6736384b2bb280ec12d472cac6eb25a70b4af60 (patch) | |
tree | 4ab72a9724a1f349a6c9ddc3088e73d7cebd7f90 /src/mem | |
parent | 23626d99af9469b5a86f510e0542846f5af65cbd (diff) | |
download | gem5-d6736384b2bb280ec12d472cac6eb25a70b4af60.tar.xz |
MEM: Make CLREX a first class request operation and clear locks in caches when it in received
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/cache/cache_impl.hh | 28 | ||||
-rw-r--r-- | src/mem/cache/tags/base.hh | 6 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.cc | 8 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.hh | 6 | ||||
-rw-r--r-- | src/mem/cache/tags/iic.cc | 8 | ||||
-rw-r--r-- | src/mem/cache/tags/iic.hh | 6 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.cc | 8 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.hh | 5 | ||||
-rw-r--r-- | src/mem/request.hh | 3 |
9 files changed, 67 insertions, 11 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index e472b2601..d471b293a 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -273,12 +273,14 @@ bool Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk, int &lat, PacketList &writebacks) { - int id = pkt->req->hasContextId() ? pkt->req->contextId() : -1; - blk = tags->accessBlock(pkt->getAddr(), lat, id); - - if (pkt->req->isUncacheable()) { - if (blk != NULL) { - tags->invalidateBlk(blk); + if (pkt->req->isUncacheable()) { + if (pkt->req->isClrex()) { + tags->clearLocks(); + } else { + blk = tags->findBlock(pkt->getAddr()); + if (blk != NULL) { + tags->invalidateBlk(blk); + } } blk = NULL; @@ -286,6 +288,8 @@ Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk, return false; } + int id = pkt->req->hasContextId() ? pkt->req->contextId() : -1; + blk = tags->accessBlock(pkt->getAddr(), lat, id); DPRINTF(Cache, "%s%s %x %s\n", pkt->cmdString(), pkt->req->isInstFetch() ? " (ifetch)" : "", @@ -410,11 +414,13 @@ Cache<TagStore>::timingAccess(PacketPtr pkt) } if (pkt->req->isUncacheable()) { - int lat = hitLatency; - int id = pkt->req->hasContextId() ? pkt->req->contextId() : -1; - BlkType *blk = tags->accessBlock(pkt->getAddr(), lat, id); - if (blk != NULL) { - tags->invalidateBlk(blk); + if (pkt->req->isClrex()) { + tags->clearLocks(); + } else { + BlkType *blk = tags->findBlock(pkt->getAddr()); + if (blk != NULL) { + tags->invalidateBlk(blk); + } } // writes go in write buffer, reads use MSHR diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh index fc8470290..62ae4a032 100644 --- a/src/mem/cache/tags/base.hh +++ b/src/mem/cache/tags/base.hh @@ -140,6 +140,12 @@ class BaseTags * exits. */ virtual void cleanupRefs() {} + + /** + *iterated through all blocks and clear all locks + *Needed to clear all lock tracking at once + */ + virtual void clearLocks() {} }; class BaseTagsCallback : public Callback diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc index d13ba4973..4d1c2175f 100644 --- a/src/mem/cache/tags/fa_lru.cc +++ b/src/mem/cache/tags/fa_lru.cc @@ -286,3 +286,11 @@ FALRU::check() } return true; } + +void +FALRU::clearLocks() +{ + for (int i = 0; i < numBlocks; i++){ + blks[i].clearLoadLocks(); + } +} diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh index 5047da12a..94ffeaa58 100644 --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -280,6 +280,12 @@ public: { return (tag); } + + /** + *iterated through all blocks and clear all locks + *Needed to clear all lock tracking at once + */ + virtual void clearLocks(); }; #endif // __MEM_CACHE_TAGS_FA_LRU_HH__ diff --git a/src/mem/cache/tags/iic.cc b/src/mem/cache/tags/iic.cc index f9afa5839..b5bd66366 100644 --- a/src/mem/cache/tags/iic.cc +++ b/src/mem/cache/tags/iic.cc @@ -632,6 +632,14 @@ IIC::invalidateBlk(IIC::BlkType *tag_ptr) } void +IIC::clearLocks() +{ + for (int i = 0; i < numTags; i++){ + tagStore[i].clearLoadLocks(); + } +} + +void IIC::cleanupRefs() { for (unsigned i = 0; i < numTags; ++i) { diff --git a/src/mem/cache/tags/iic.hh b/src/mem/cache/tags/iic.hh index 5b12128c6..5553b8ca3 100644 --- a/src/mem/cache/tags/iic.hh +++ b/src/mem/cache/tags/iic.hh @@ -439,6 +439,11 @@ class IIC : public BaseTags IICTag* findVictim(Addr addr, PacketList &writebacks); void insertBlock(Addr addr, BlkType *blk, int context_src); + /** + *iterated through all blocks and clear all locks + *Needed to clear all lock tracking at once + */ + virtual void clearLocks(); /** * Called at end of simulation to complete average block reference stats. @@ -497,6 +502,7 @@ private: * @param data_ptr The data block to free. */ void freeDataBlock(unsigned long data_ptr); + }; #endif // __IIC_HH__ diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc index 0667c5428..a99936abf 100644 --- a/src/mem/cache/tags/lru.cc +++ b/src/mem/cache/tags/lru.cc @@ -217,6 +217,14 @@ LRU::invalidateBlk(BlkType *blk) } void +LRU::clearLocks() +{ + for (int i = 0; i < numBlocks; i++){ + blks[i].clearLoadLocks(); + } +} + +void LRU::cleanupRefs() { for (unsigned i = 0; i < numSets*assoc; ++i) { diff --git a/src/mem/cache/tags/lru.hh b/src/mem/cache/tags/lru.hh index be8d75b5a..ff9811046 100644 --- a/src/mem/cache/tags/lru.hh +++ b/src/mem/cache/tags/lru.hh @@ -224,6 +224,11 @@ public: { return hitLatency; } + /** + *iterated through all blocks and clear all locks + *Needed to clear all lock tracking at once + */ + virtual void clearLocks(); /** * Called at end of simulation to complete average block reference stats. diff --git a/src/mem/request.hh b/src/mem/request.hh index 8d1697ad2..7149f3199 100644 --- a/src/mem/request.hh +++ b/src/mem/request.hh @@ -71,6 +71,8 @@ class Request : public FastAlloc static const FlagsType UNCACHEABLE = 0x00001000; /** This request is to a memory mapped register. */ static const FlagsType MMAPED_IPR = 0x00002000; + /** This request is a clear exclusive. */ + static const FlagsType CLREX = 0x00004000; /** The request should ignore unaligned access faults */ static const FlagsType NO_ALIGN_FAULT = 0x00020000; @@ -456,6 +458,7 @@ class Request : public FastAlloc bool isSwap() const { return _flags.isSet(MEM_SWAP|MEM_SWAP_COND); } bool isCondSwap() const { return _flags.isSet(MEM_SWAP_COND); } bool isMmapedIpr() const { return _flags.isSet(MMAPED_IPR); } + bool isClrex() const { return _flags.isSet(CLREX); } bool isMisaligned() const |