summaryrefslogtreecommitdiff
path: root/src/sim/init_signals.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-10-16 05:49:53 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2014-10-16 05:49:53 -0400
commite2a13386e543901ba81b52f6cbd48d561ccb2b6d (patch)
treee863f21b2048dd1da44eb5e08f51ee0aedc76397 /src/sim/init_signals.cc
parent960935a5bd31b0a325285beb1deb816429c7fe00 (diff)
downloadgem5-e2a13386e543901ba81b52f6cbd48d561ccb2b6d.tar.xz
sim: EventQueue wakeup on events scheduled outside the event loop
This patch adds a 'wakeup' member function to EventQueue which should be called on an event queue whenever an event is scheduled on the event queue from outside code within the call tree of the gem5 event loop. This clearly isn't necessary for normal gem5 EventQueue operation but becomes the minimum necessary interface to allow hosting gem5's event loop onto other schedulers where there may be calls into gem5 from external code which schedules events onto an EventQueue between the current time and the time of the next scheduled event. The use case I have in mind is a SystemC hosting where the event loop is: while (more events) { wait(time_to_next_event or wakeup) setCurTick service events at this time } where the 'wait' needs to be woken up if time_to_next_event becomes shorter due to a scheduled event from SystemC arriving in a gem5 object. Requiring 'wakeup' to be called is a more efficient interface than requiring all gem5 event scheduling actions to affect the host scheduler. This interface could be located elsewhere, say on another global object, or by being passed by the host scheduler to objects which will schedule such events, but it seems cleanest to put it on EventQueue as it is actually a signal to the queue. EventQueue::wakeup is called for async_event events on event queue 0 as it's only important that *some* queue be triggered for such events.
Diffstat (limited to 'src/sim/init_signals.cc')
-rw-r--r--src/sim/init_signals.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sim/init_signals.cc b/src/sim/init_signals.cc
index 705a154e8..0e898954e 100644
--- a/src/sim/init_signals.cc
+++ b/src/sim/init_signals.cc
@@ -48,6 +48,7 @@
#include "base/cprintf.hh"
#include "sim/async.hh"
#include "sim/core.hh"
+#include "sim/eventq.hh"
#include "sim/init_signals.hh"
using namespace std;
@@ -58,6 +59,8 @@ dumpStatsHandler(int sigtype)
{
async_event = true;
async_statdump = true;
+ /* Wake up some event queue to handle event */
+ getEventQueue(0)->wakeup();
}
void
@@ -66,6 +69,8 @@ dumprstStatsHandler(int sigtype)
async_event = true;
async_statdump = true;
async_statreset = true;
+ /* Wake up some event queue to handle event */
+ getEventQueue(0)->wakeup();
}
/// Exit signal handler.
@@ -74,6 +79,8 @@ exitNowHandler(int sigtype)
{
async_event = true;
async_exit = true;
+ /* Wake up some event queue to handle event */
+ getEventQueue(0)->wakeup();
}
/// Abort signal handler.
@@ -89,6 +96,8 @@ ioHandler(int sigtype)
{
async_event = true;
async_io = true;
+ /* Wake up some event queue to handle event */
+ getEventQueue(0)->wakeup();
}
static void