Tom Rollet has submitted this change. ( 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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47041
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Maintainer: Daniel Carvalho <oda...@yahoo.com.br>
Tested-by: kokoro <noreply+kok...@google.com>
---
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, 34 insertions(+), 5 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/cache/mshr.cc b/src/mem/cache/mshr.cc
index 2927d05..71bf6ae 100644
--- a/src/mem/cache/mshr.cc
+++ b/src/mem/cache/mshr.cc
@@ -178,6 +178,8 @@
     }

emplace_back(pkt, readyTime, order, source, markPending, alloc_on_fill);
+
+    DPRINTF(MSHR, "New target allocated: %s\n", pkt->print());
 }


@@ -411,6 +413,8 @@
         targets.add(pkt, whenReady, _order, Target::FromCPU, !inService,
                     alloc_on_fill);
     }
+
+    DPRINTF(MSHR, "After target allocation: %s", print());
 }

 bool
@@ -719,12 +723,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 b23ed28..c8fc5da 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..4a32d90 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 new MSHR. Number in use will be %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,17 @@
 }

 void
+MSHRQueue::deallocate(MSHR* mshr)
+{
+
+    DPRINTF(MSHR, "Deallocating all targets: %s", mshr->print());
+    Queue<MSHR>::deallocate(mshr);
+    DPRINTF(MSHR, "MSHR deallocated. 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..a725016 100644
--- a/src/mem/cache/queue.hh
+++ b/src/mem/cache/queue.hh
@@ -234,7 +234,8 @@
      *
      * @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: 3
Gerrit-Owner: Tom Rollet <tom.rol...@huawei.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: Tom Rollet <tom.rol...@huawei.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
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