mem-cache: Do not try to compress dataless packets
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Fri, 25 Oct 2019 16:30:10 +0000 (18:30 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Tue, 29 Oct 2019 21:32:02 +0000 (21:32 +0000)
Fix filling blocks so that packets that do not contain data do not
generate a compression attempt. This can happen, for example, with
invalidation responses, which will trigger a packet data access
assertion.

Change-Id: I2a1e7983657f6e5e770b148ab62c9de9ac3986ac
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22164
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/cache/base.cc

index fcf03741c5eea503cc3648015a0b922d1f9b819f..ebfb0927513d1fa0dd70766f8bc06006b0762e32 100644 (file)
@@ -1413,7 +1413,7 @@ BaseCache::allocateBlock(const PacketPtr pkt, PacketList &writebacks)
     // compressor is used, the compression/decompression methods are called to
     // calculate the amount of extra cycles needed to read or write compressed
     // blocks.
-    if (compressor) {
+    if (compressor && pkt->hasData()) {
         compressor->compress(pkt->getConstPtr<uint64_t>(), compression_lat,
                              decompression_lat, blk_size_bits);
     }