Tom Rollet has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/47041 )

Change subject: mem-cache: Add MSHR debuging information
......................................................................

mem-cache: Add MSHR debuging information

Add debug statment in MSHR and MSHRQueue class to track the
number of free MSHR each time a new one is allocated/deallocated.

Also track the allocation/deallocation of each MSHR target.

Change-Id: I2533e7660da1cde3052425f8db8852e59d463b42
---
M src/mem/cache/mshr.cc
M src/mem/cache/mshr.hh
M src/mem/cache/mshr_queue.cc
M src/mem/cache/mshr_queue.hh
M src/mem/cache/queue.hh
5 files changed, 38 insertions(+), 5 deletions(-)



diff --git a/src/mem/cache/mshr.cc b/src/mem/cache/mshr.cc
index 8b75e42..3196760 100644
--- a/src/mem/cache/mshr.cc
+++ b/src/mem/cache/mshr.cc
@@ -308,6 +308,8 @@
     inService = false;
     downstreamPending = false;

+    DPRINTF(MSHR, "MSHR allocated\n");
+
     targets.init(blkAddr, blkSize);
     deferredTargets.init(blkAddr, blkSize);

@@ -319,6 +321,9 @@

     // All targets must refer to the same block
     assert(target->matchBlockAddr(targets.front().pkt, blkSize));
+
+    DPRINTF(MSHR, "New target allocated: %s\n         %s",
+            target->print(), print());
 }


@@ -408,6 +413,9 @@
         targets.add(pkt, whenReady, _order, Target::FromCPU, !inService,
                     alloc_on_fill);
     }
+
+    DPRINTF(MSHR, "New target allocated: %s\n         %s",
+            pkt->print(), print());
 }

 bool
@@ -716,12 +724,12 @@
              hasFromCache() ? "HasFromCache" : "");

     if (!targets.empty()) {
-        ccprintf(os, "%s  Targets:\n", prefix);
-        targets.print(os, verbosity, prefix + "    ");
+        ccprintf(os, "%s      Targets:\n", prefix);
+        targets.print(os, verbosity, prefix + "        ");
     }
     if (!deferredTargets.empty()) {
-        ccprintf(os, "%s  Deferred Targets:\n", prefix);
-        deferredTargets.print(os, verbosity, prefix + "      ");
+        ccprintf(os, "%s      Deferred Targets:\n", prefix);
+        deferredTargets.print(os, verbosity, prefix + "        ");
     }
 }

diff --git a/src/mem/cache/mshr.hh b/src/mem/cache/mshr.hh
index ccf1137..02a7afe 100644
--- a/src/mem/cache/mshr.hh
+++ b/src/mem/cache/mshr.hh
@@ -53,7 +53,9 @@
 #include <vector>

 #include "base/printable.hh"
+#include "base/trace.hh"
 #include "base/types.hh"
+#include "debug/MSHR.hh"
 #include "mem/cache/queue_entry.hh"
 #include "mem/packet.hh"
 #include "mem/request.hh"
@@ -460,6 +462,8 @@
      */
     void popTarget()
     {
+        DPRINTF(MSHR, "Force deallocating MSHR targets: %s\n",
+                targets.front().pkt->print());
         targets.pop_front();
     }

diff --git a/src/mem/cache/mshr_queue.cc b/src/mem/cache/mshr_queue.cc
index cea32fd..722c96a 100644
--- a/src/mem/cache/mshr_queue.cc
+++ b/src/mem/cache/mshr_queue.cc
@@ -46,6 +46,7 @@

 #include <cassert>

+#include "debug/MSHR.hh"
 #include "mem/cache/mshr.hh"

 MSHRQueue::MSHRQueue(const std::string &_label,
@@ -64,6 +65,9 @@
     assert(mshr->getNumTargets() == 0);
     freeList.pop_front();

+
+    DPRINTF(MSHR, "Allocating MSHR %lu/%lu\n",
+            allocatedList.size() + 1, numEntries);
mshr->allocate(blk_addr, blk_size, pkt, when_ready, order, alloc_on_fill);
     mshr->allocIter = allocatedList.insert(allocatedList.end(), mshr);
     mshr->readyIter = addToReadyList(mshr);
@@ -73,6 +77,18 @@
 }

 void
+MSHRQueue::deallocate(MSHR* mshr)
+{
+
+    Queue<MSHR>::deallocate(mshr);
+
+    DPRINTF(MSHR, "Deallocated all targets %s", mshr->print());
+    DPRINTF(MSHR, "Deallocate MSHR. Number in use: %lu/%lu\n",
+            allocatedList.size(), numEntries);
+}
+
+
+void
 MSHRQueue::moveToFront(MSHR *mshr)
 {
     if (!mshr->inService) {
diff --git a/src/mem/cache/mshr_queue.hh b/src/mem/cache/mshr_queue.hh
index 98147fa..253ffd0 100644
--- a/src/mem/cache/mshr_queue.hh
+++ b/src/mem/cache/mshr_queue.hh
@@ -97,6 +97,11 @@
                    Tick when_ready, Counter order, bool alloc_on_fill);

     /**
+     * Deallocate a MSHR and its targets
+     */
+    void deallocate(MSHR *mshr) override;
+
+    /**
      * Moves the MSHR to the front of the pending list if it is not
      * in service.
      * @param mshr The entry to move.
diff --git a/src/mem/cache/queue.hh b/src/mem/cache/queue.hh
index 81999a7..fd0b43a 100644
--- a/src/mem/cache/queue.hh
+++ b/src/mem/cache/queue.hh
@@ -234,7 +234,7 @@
      *
      * @param entry
      */
-    void deallocate(Entry *entry)
+    virtual void deallocate(Entry *entry)
     {
         allocatedList.erase(entry->allocIter);
         freeList.push_front(entry);

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/47041
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: I2533e7660da1cde3052425f8db8852e59d463b42
Gerrit-Change-Number: 47041
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Rollet <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to