From e5415671bd8871b99e754b5db75714a6492c0917 Mon Sep 17 00:00:00 2001 From: Tuan Ta Date: Mon, 2 Apr 2018 15:20:02 -0400 Subject: cpu: fixed how O3 CPU executes an exit system call When a thread executed an exit syscall in SE mode, the thread context was removed immediately in the same cycle, which left inflight squash operations and trap event incomplete. The problem happened when a new thread was assigned to the CPU later. The new thread started with some incomplete transactions of the previous thread (e.g., squashing). This problem could cause incorrect execution flow for the new thread (i.e., pc was not reset properly at the exit point), deadlock (i.e., some stage-to-stage signals were not reset) and incorrect rename map between logical and physical registers. This patch adds a new state called 'Halting' to the thread context and defers removing thread context from a CPU until a trap event initiated by an exit syscall execution is processed. This patch also makes sure that the removal of a thread context happens after all inflight transactions of the to-be-removed thread in the pipeline complete. Change-Id: If7ef1462fb8864e22b45371ee7ae67e2a5ad38b8 Reviewed-on: https://gem5-review.googlesource.com/c/8184 Reviewed-by: Giacomo Gabrielli Maintainer: Jason Lowe-Power --- src/cpu/thread_context.hh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/cpu/thread_context.hh') diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh index a570b9a00..6b9ff1a12 100644 --- a/src/cpu/thread_context.hh +++ b/src/cpu/thread_context.hh @@ -111,6 +111,10 @@ class ThreadContext /// synchronization, etc. Suspended, + /// Trying to exit and waiting for an event to completely exit. + /// Entered when target executes an exit syscall. + Halting, + /// Permanently shut down. Entered when target executes /// m5exit pseudo-instruction. When all contexts enter /// this state, the simulation will terminate. -- cgit v1.2.3