mem-ruby: Fix a bug in MessageBuffer randomization
authorXianwei Zhang <xianwei.zhang@amd.com>
Wed, 19 Sep 2018 23:14:40 +0000 (19:14 -0400)
committerXianwei Zhang <xianwei.zhang@amd.com>
Mon, 24 Sep 2018 21:06:38 +0000 (21:06 +0000)
In the previous implementation, messages are randomly inserted with
delays only if both RubySystem and MessageBuffer randomization flags
are set true.  However, to find race conditions and cover more slicc
transitions, ruby random testers rely on setting RubySystem flag to
turn on randomization on all message buffers.
As a fix, this patch enables a message buffer to have randomization
when either RubySystem or its own flag is set.

Change-Id: I1e076908ff07e5846ebad4f4fc1c8f28d40bbfd4
Reviewed-on: https://gem5-review.googlesource.com/12784
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

src/mem/ruby/network/MessageBuffer.cc
src/mem/ruby/network/MessageBuffer.py
src/mem/ruby/system/RubySystem.py

index f4eca3b1ef604581de1d72cfd477bc8bbb077b0c..560b69c637291005c045653d22aa4543d861abff 100644 (file)
@@ -156,7 +156,9 @@ MessageBuffer::enqueue(MsgPtr message, Tick current_time, Tick delta)
     assert(delta > 0);
     Tick arrival_time = 0;
 
-    if (!RubySystem::getRandomization() || !m_randomization) {
+    // random delays are inserted if either RubySystem level randomization flag
+    // is turned on, or the buffer level randomization is set
+    if (!RubySystem::getRandomization() && !m_randomization) {
         // No randomization
         arrival_time = current_time + delta;
     } else {
index d8a028532ca039d63c09f2d4e3d8999072eee1bc..b8a44ba915ecff3756e082c4d02ee6f7586549d3 100644 (file)
@@ -37,7 +37,10 @@ class MessageBuffer(SimObject):
     ordered = Param.Bool(False, "Whether the buffer is ordered")
     buffer_size = Param.Unsigned(0, "Maximum number of entries to buffer \
                                      (0 allows infinite entries)")
-    randomization = Param.Bool(False, "")
+    randomization = Param.Bool(False, "Insert random delays on message \
+                                       enqueue times (enforced to have \
+                                       random delays if RubySystem \
+                                       randomization flag is True)")
 
     master = MasterPort("Master port to MessageBuffer receiver")
     slave = SlavePort("Slave port from MessageBuffer sender")
index 358f4dfca025fca0356e220dd67603e6bc2385aa..5dcfe2f81de53539c653f934a73cb8fdbef0840d 100644 (file)
@@ -35,7 +35,9 @@ class RubySystem(ClockedObject):
     type = 'RubySystem'
     cxx_header = "mem/ruby/system/RubySystem.hh"
     randomization = Param.Bool(False,
-        "insert random delays on message enqueue times");
+        "insert random delays on message enqueue times (if True, all message \
+         buffers are enforced to have randomization; otherwise, a message \
+         buffer set its own flag to enable/disable randomization)");
     block_size_bytes = Param.UInt32(64,
         "default cache block size; must be a power of two");
     memory_size_bits = Param.UInt32(64,