mem: Move eraseIfNullEntry to when holder is updated
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Fri, 21 Jun 2019 14:24:28 +0000 (16:24 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Fri, 2 Aug 2019 11:42:46 +0000 (11:42 +0000)
The entry should only be tested for deletion when holder is updated.

Change-Id: I5a10b6fa876912709b7467860d43c23c60f38568
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19750
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/snoop_filter.cc

index d368dd868ef0eb2fa89c1cc79b03cbf15e3df7db..b0422e2bc08541141d1d7fe922d412bc11df6059 100644 (file)
@@ -206,9 +206,6 @@ SnoopFilter::lookupSnoop(const Packet* cpkt)
 
     SnoopItem& sf_item = sf_it->second;
 
-    DPRINTF(SnoopFilter, "%s:   old SF value %x.%x\n",
-            __func__, sf_item.requested, sf_item.holder);
-
     SnoopMask interested = (sf_item.holder | sf_item.requested);
 
     totSnoops++;
@@ -232,13 +229,14 @@ SnoopFilter::lookupSnoop(const Packet* cpkt)
         // Early clear of the holder, if no other request is currently going on
         // @todo: This should possibly be updated even though we do not filter
         // upward snoops
+        DPRINTF(SnoopFilter, "%s:   old SF value %x.%x\n",
+                __func__, sf_item.requested, sf_item.holder);
         sf_item.holder = 0;
+        DPRINTF(SnoopFilter, "%s:   new SF value %x.%x\n",
+                __func__, sf_item.requested, sf_item.holder);
+        eraseIfNullEntry(sf_it);
     }
 
-    eraseIfNullEntry(sf_it);
-    DPRINTF(SnoopFilter, "%s:   new SF value %x.%x interest: %x \n",
-            __func__, sf_item.requested, sf_item.holder, interested);
-
     return snoopSelected(maskToPortList(interested), lookupLatency);
 }
 
@@ -320,21 +318,20 @@ SnoopFilter::updateSnoopForward(const Packet* cpkt,
     if (!is_hit)
         return;
 
-    SnoopItem& sf_item = sf_it->second;
-
-    DPRINTF(SnoopFilter, "%s:   old SF value %x.%x\n",
-            __func__,  sf_item.requested, sf_item.holder);
-
     // If the snoop response has no sharers the line is passed in
     // Modified state, and we know that there are no other copies, or
     // they will all be invalidated imminently
     if (!cpkt->hasSharers()) {
+        SnoopItem& sf_item = sf_it->second;
+
+        DPRINTF(SnoopFilter, "%s:   old SF value %x.%x\n",
+                __func__, sf_item.requested, sf_item.holder);
         sf_item.holder = 0;
-    }
-    DPRINTF(SnoopFilter, "%s:   new SF value %x.%x\n",
-            __func__, sf_item.requested, sf_item.holder);
-    eraseIfNullEntry(sf_it);
+        DPRINTF(SnoopFilter, "%s:   new SF value %x.%x\n",
+                __func__, sf_item.requested, sf_item.holder);
 
+        eraseIfNullEntry(sf_it);
+    }
 }
 
 void