sim-se: don't wake up threads that are halted on futex
authorCiro Santilli <ciro.santilli@arm.com>
Wed, 20 Nov 2019 16:51:47 +0000 (16:51 +0000)
committerCiro Santilli <ciro.santilli@arm.com>
Mon, 25 Nov 2019 12:02:11 +0000 (12:02 +0000)
At Ia6b4d3e6148c64721d810b8f1fffaa208a394b06 the futex wake up started
skipping selecting threads that are already awake, which already prevented
some deadlocks.

However, threads that are Halting or Halted should not be woken up either,
as those represent cores in which processes have already exited.

Before this commit, this could lead an exited core to wake up, which would
then immediately re-execute the exit syscall, and possibly leave one
genuinely sleeping core locked and:

Exiting @ tick 18446744073709551615 because simulate() limit reached

Change-Id: I1531b56d605d47252dc0620bb3e755b7cf84df97
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22963
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/sim/futex_map.hh

index 5e60f7c376cb51e5f1329fe431054d94023a5dfd..bbb484a5e117bf9aa435807bc008c60d0d077b73 100644 (file)
@@ -158,7 +158,7 @@ class FutexMap : public std::unordered_map<FutexKey, WaiterList>
             // must only count threads that were actually
             // woken up by this syscall.
             auto& tc = waiterList.front().tc;
-            if (tc->status() != ThreadContext::Active) {
+            if (tc->status() == ThreadContext::Suspended) {
                 tc->activate();
                 woken_up++;
             }