Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/36977 )

Change subject: mem: Minor refactor of how the abstract mem backdoor is exposed.
......................................................................

mem: Minor refactor of how the abstract mem backdoor is exposed.

Previously the SimpleMem depended on the fact that it inherited from the
AbstractMem in order to access and export it's back door. Now, the
AbstractMem has a method which will set a back door pointer if
appropriate, which the SimpleMem can use, or anything else which uses an
AbstractMem as its backing store.

Also, make the AbstractMem invalidate any existing back doors and refuse
to give out any new ones while some bit of memory is locked. That's
because if the storage is accessed directly, the AbstractMem will have
no change to manage its bookkeeping, and locking won't work properly.

Change-Id: If8c2a63e0827bb88b583f27ab4151d6b761e116e
---
M src/mem/abstract_mem.cc
M src/mem/abstract_mem.hh
M src/mem/simple_mem.cc
3 files changed, 20 insertions(+), 6 deletions(-)



diff --git a/src/mem/abstract_mem.cc b/src/mem/abstract_mem.cc
index 3600f34..7e09832 100644
--- a/src/mem/abstract_mem.cc
+++ b/src/mem/abstract_mem.cc
@@ -269,6 +269,7 @@
     DPRINTF(LLSC, "Adding lock record: context %d addr %#x\n",
             req->contextId(), paddr);
     lockedAddrList.push_front(LockedAddr(req));
+    backdoor.invalidate();
 }


diff --git a/src/mem/abstract_mem.hh b/src/mem/abstract_mem.hh
index cd18e0f..1a3c019 100644
--- a/src/mem/abstract_mem.hh
+++ b/src/mem/abstract_mem.hh
@@ -227,16 +227,31 @@
      */
     void setBackingStore(uint8_t* pmem_addr);

+    void
+    getBackdoor(MemBackdoorPtr &bd_ptr)
+    {
+        if (lockedAddrList.empty() && backdoor.ptr())
+            bd_ptr = &backdoor;
+    }
+
     /**
      * Get the list of locked addresses to allow checkpointing.
      */
-    const std::list<LockedAddr>& getLockedAddrList() const
-    { return lockedAddrList; }
+    const std::list<LockedAddr> &
+    getLockedAddrList() const
+    {
+        return lockedAddrList;
+    }

     /**
      * Add a locked address to allow for checkpointing.
      */
-    void addLockedAddr(LockedAddr addr) { lockedAddrList.push_back(addr); }
+    void
+    addLockedAddr(LockedAddr addr)
+    {
+        backdoor.invalidate();
+        lockedAddrList.push_back(addr);
+    }

     /** read the system pointer
      * Implemented for completeness with the setter
diff --git a/src/mem/simple_mem.cc b/src/mem/simple_mem.cc
index 3ed3d04..327a326 100644
--- a/src/mem/simple_mem.cc
+++ b/src/mem/simple_mem.cc
@@ -80,9 +80,7 @@
 SimpleMemory::recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &_backdoor)
 {
     Tick latency = recvAtomic(pkt);
-
-    if (backdoor.ptr())
-        _backdoor = &backdoor;
+    getBackdoor(_backdoor);
     return latency;
 }


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36977
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If8c2a63e0827bb88b583f27ab4151d6b761e116e
Gerrit-Change-Number: 36977
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to