From: Matthew Poremba Date: Fri, 8 May 2020 22:18:43 +0000 (-0500) Subject: mem: Defer deletion of respQueue.front() in DRAMCtrl X-Git-Tag: v20.0.0.0~47 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=49390bb8f743e416413ba7832ade31d9bec96f06;p=gem5.git mem: Defer deletion of respQueue.front() in DRAMCtrl The front() of respQueue was being deleted before the last usuage of dram_pkt (which points to the same object) causing random crashes. Change-Id: I89862d10599dc0d1a50717dac8ed9298b4d74a3d Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28808 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- diff --git a/src/mem/dram_ctrl.cc b/src/mem/dram_ctrl.cc index 0a8479eb8..5f0fcc77a 100644 --- a/src/mem/dram_ctrl.cc +++ b/src/mem/dram_ctrl.cc @@ -716,7 +716,7 @@ DRAMCtrl::processRespondEvent() accessAndRespond(dram_pkt->pkt, frontendLatency + backendLatency); } - delete respQueue.front(); + assert(respQueue.front() == dram_pkt); respQueue.pop_front(); if (!respQueue.empty()) { @@ -738,6 +738,8 @@ DRAMCtrl::processRespondEvent() } } + delete dram_pkt; + // We have made a location in the queue available at this point, // so if there is a read that was forced to wait, retry now if (retryRdReq) {