summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/base/pollevent.cc3
-rw-r--r--src/python/swig/pyevent.cc3
-rw-r--r--src/sim/eventq.hh22
-rw-r--r--src/sim/init_signals.cc9
4 files changed, 37 insertions, 0 deletions
diff --git a/src/base/pollevent.cc b/src/base/pollevent.cc
index fb28d63d6..ea4d632d0 100644
--- a/src/base/pollevent.cc
+++ b/src/base/pollevent.cc
@@ -44,6 +44,7 @@
#include "base/types.hh"
#include "sim/async.hh"
#include "sim/core.hh"
+#include "sim/eventq.hh"
#include "sim/serialize.hh"
using namespace std;
@@ -224,5 +225,7 @@ PollQueue::setupAsyncIO(int fd, bool set)
if (set) {
async_event = true;
async_io = true;
+ /* Wake up some event queue to handle event */
+ getEventQueue(0)->wakeup();
}
}
diff --git a/src/python/swig/pyevent.cc b/src/python/swig/pyevent.cc
index 4651d252b..6d80a00cd 100644
--- a/src/python/swig/pyevent.cc
+++ b/src/python/swig/pyevent.cc
@@ -32,6 +32,7 @@
#include "python/swig/pyevent.hh"
#include "sim/async.hh"
+#include "sim/eventq.hh"
PythonEvent::PythonEvent(PyObject *obj, Priority priority)
: Event(priority), object(obj)
@@ -59,6 +60,8 @@ PythonEvent::process()
// that there's been an exception.
async_event = true;
async_exception = true;
+ /* Wake up some event queue to handle event */
+ getEventQueue(0)->wakeup();
}
// Since the object has been removed from the event queue, its
diff --git a/src/sim/eventq.hh b/src/sim/eventq.hh
index c390d2155..394fd4d8d 100644
--- a/src/sim/eventq.hh
+++ b/src/sim/eventq.hh
@@ -606,6 +606,21 @@ class EventQueue : public Serializable
void handleAsyncInsertions();
/**
+ * Function to signal that the event loop should be woken up because
+ * an event has been scheduled by an agent outside the gem5 event
+ * loop(s) whose event insertion may not have been noticed by gem5.
+ * This function isn't needed by the usual gem5 event loop but may
+ * be necessary in derived EventQueues which host gem5 onto other
+ * schedulers.
+ *
+ * @param when Time of a delayed wakeup (if known). This parameter
+ * can be used by an implementation to schedule a wakeup in the
+ * future if it is sure it will remain active until then.
+ * Or it can be ignored and the event queue can be woken up now.
+ */
+ virtual void wakeup(Tick when = (Tick)-1) { }
+
+ /**
* function for replacing the head of the event queue, so that a
* different set of events can run without disturbing events that have
* already been scheduled. Already scheduled events can be processed
@@ -635,6 +650,8 @@ class EventQueue : public Serializable
virtual void serialize(std::ostream &os);
virtual void unserialize(Checkpoint *cp, const std::string &section);
#endif
+
+ virtual ~EventQueue() { }
};
void dumpMainQueue();
@@ -693,6 +710,11 @@ class EventManager
eventq->reschedule(event, when, always);
}
+ void wakeupEventQueue(Tick when = (Tick)-1)
+ {
+ eventq->wakeup(when);
+ }
+
void setCurTick(Tick newVal) { eventq->setCurTick(newVal); }
};
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