changeset 37d20d5c5bed in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=37d20d5c5bed
description:
dev: Protect PollEvent processing when running in parallel mode
The calling thread is undefined when the PollQueue services events.
This implies that PollEvents need to handle the case where they are
processed from a different thread than the thread that created the
event. This changeset adds temporary event queue migrations to the VNC
server, the ethernet tap device, and the terminal to protect them from
inter-thread calls.
diffstat:
src/base/vnc/vncserver.cc | 5 +++++
src/dev/ethertap.cc | 5 +++++
src/dev/terminal.cc | 5 +++++
3 files changed, 15 insertions(+), 0 deletions(-)
diffs (45 lines):
diff -r 3b0bcc8c34ca -r 37d20d5c5bed src/base/vnc/vncserver.cc
--- a/src/base/vnc/vncserver.cc Tue Apr 08 13:26:30 2014 -0500
+++ b/src/base/vnc/vncserver.cc Wed Apr 09 16:01:43 2014 +0200
@@ -174,6 +174,11 @@
void
VncServer::accept()
{
+ // As a consequence of being called from the PollQueue, we might
+ // have been called from a different thread. Migrate to "our"
+ // thread.
+ EventQueue::ScopedMigration migrate(eventQueue());
+
if (!listener.islistening())
panic("%s: cannot accept a connection if not listening!", name());
diff -r 3b0bcc8c34ca -r 37d20d5c5bed src/dev/ethertap.cc
--- a/src/dev/ethertap.cc Tue Apr 08 13:26:30 2014 -0500
+++ b/src/dev/ethertap.cc Wed Apr 09 16:01:43 2014 +0200
@@ -106,6 +106,11 @@
void
TapListener::accept()
{
+ // As a consequence of being called from the PollQueue, we might
+ // have been called from a different thread. Migrate to "our"
+ // thread.
+ EventQueue::ScopedMigration migrate(tap->eventQueue());
+
if (!listener.islistening())
panic("TapListener(accept): cannot accept if we're not listening!");
diff -r 3b0bcc8c34ca -r 37d20d5c5bed src/dev/terminal.cc
--- a/src/dev/terminal.cc Tue Apr 08 13:26:30 2014 -0500
+++ b/src/dev/terminal.cc Wed Apr 09 16:01:43 2014 +0200
@@ -84,6 +84,11 @@
void
Terminal::DataEvent::process(int revent)
{
+ // As a consequence of being called from the PollQueue, we might
+ // have been called from a different thread. Migrate to "our"
+ // thread.
+ EventQueue::ScopedMigration migrate(term->eventQueue());
+
if (revent & POLLIN)
term->data();
else if (revent & POLLNVAL)
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev