delete pkt;
return clockPeriod() * ipr_delay;
} else {
- // Temporarily lock and migrate to the event queue of the
- // VM. This queue is assumed to "own" all devices we need to
- // access if running in multi-core mode.
- EventQueue::ScopedMigration migrate(vm.eventQueue());
+ // Temporarily lock and migrate to the device event queue to
+ // prevent races in multi-core mode.
+ EventQueue::ScopedMigration migrate(deviceEventQueue());
return dataPort.submitIO(pkt);
}
*/
void syncThreadContext();
+ /**
+ * Get a pointer to the event queue owning devices.
+ *
+ * Devices always live in a separate device event queue when
+ * running in multi-core mode. We need to temporarily migrate to
+ * this queue when accessing devices. By convention, devices and
+ * the VM use the same event queue.
+ */
+ EventQueue *deviceEventQueue() { return vm.eventQueue(); }
+
/**
* Update the KVM if the thread context is dirty.
*/
}
const MemCmd cmd(isWrite ? MemCmd::WriteReq : MemCmd::ReadReq);
- // Temporarily lock and migrate to the event queue of the
- // VM. This queue is assumed to "own" all devices we need to
- // access if running in multi-core mode.
- EventQueue::ScopedMigration migrate(vm.eventQueue());
+ // Temporarily lock and migrate to the device event queue to
+ // prevent races in multi-core mode.
+ EventQueue::ScopedMigration migrate(deviceEventQueue());
for (int i = 0; i < count; ++i) {
RequestPtr io_req = new Request(pAddr, kvm_run.io.size,
Request::UNCACHEABLE, dataMasterId());