From 334b8377f35b183148dfda3a7a5d71bee2990b81 Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Fri, 21 Jun 2019 16:24:28 +0200 Subject: [PATCH] mem: Move eraseIfNullEntry to when holder is updated 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 Maintainer: Nikos Nikoleris Tested-by: kokoro --- src/mem/snoop_filter.cc | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/mem/snoop_filter.cc b/src/mem/snoop_filter.cc index d368dd868..b0422e2bc 100644 --- a/src/mem/snoop_filter.cc +++ b/src/mem/snoop_filter.cc @@ -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 -- 2.30.2