Tuan Ta has uploaded this change for review. (
https://gem5-review.googlesource.com/8181
Change subject: cpu: Prevent suspended TimingSimple CPUs from fetching next
instructions
......................................................................
cpu: Prevent suspended TimingSimple CPUs from fetching next instructions
In TimingSimpleCPU model, when a CPU is suspended by a syscall (e.g.,
futex(FUTEX_WAIT)), the CPU waits for another CPU to wake it up
(e.g., FUTEX_WAKE operation). While staying Idle, the suspended CPU
should not try to fetch next instructions after the syscall.
This patch added a status check before a CPU schedule a fetch event
after a fault is handled.
Change-Id: I0cc953135686c9b35afe94942aa1d0b245ec60a2
---
M src/cpu/simple/timing.cc
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc
index 083de2b..53e6afd 100644
--- a/src/cpu/simple/timing.cc
+++ b/src/cpu/simple/timing.cc
@@ -679,25 +679,32 @@
return;
if (fault != NoFault) {
- DPRINTF(SimpleCPU, "Fault occured, scheduling fetch event\n");
+ DPRINTF(SimpleCPU, "Fault occured. Handling the fault\n");
advancePC(fault);
- Tick stall = dynamic_pointer_cast<SyscallRetryFault>(fault) ?
- clockEdge(syscallRetryLatency) : clockEdge();
+ // A syscall fault could suspend this CPU (e.g., futex_wait)
+ // If the _status is Idle, schedule an event to fetch the next
+ // instruction after 'stall' ticks.
+ // If the cpu has been suspended (i.e., _status == Idle), another
+ // cpu will wake this cpu up later.
+ if (_status != Idle) {
+ DPRINTF(SimpleCPU, "Scheduling fetch event after the Fault\n");
- reschedule(fetchEvent, stall, true);
+ Tick stall = dynamic_pointer_cast<SyscallRetryFault>(fault) ?
+ clockEdge(syscallRetryLatency) : clockEdge();
+ reschedule(fetchEvent, stall, true);
+ _status = Faulting;
+ }
- _status = Faulting;
return;
}
-
if (!t_info.stayAtPC)
advancePC(fault);
if (tryCompleteDrain())
- return;
+ return;
if (_status == BaseSimpleCPU::Running) {
// kick off fetch of next instruction... callback from icache
--
To view, visit https://gem5-review.googlesource.com/8181
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cc953135686c9b35afe94942aa1d0b245ec60a2
Gerrit-Change-Number: 8181
Gerrit-PatchSet: 1
Gerrit-Owner: Tuan Ta <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev