From 4e028f841234553b6dcb6812dad833f060970075 Mon Sep 17 00:00:00 2001 From: Marton Erdos Date: Thu, 17 Jun 2021 02:34:09 +0100 Subject: [PATCH] cpu-o3: Fix "OldestReady" scheduling bug Fixed a bug in the SMT scheduling function oldestReady(), where the oldest sequence number and its thread id were mixed up. Change-Id: I31df5eac73ecabbe04fb54624ee1b1867fa4d3c0 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46940 Reviewed-by: Richard Cooper Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/cpu/o3/commit.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cpu/o3/commit.cc b/src/cpu/o3/commit.cc index 2359c1a12d..23265d4e33 100644 --- a/src/cpu/o3/commit.cc +++ b/src/cpu/o3/commit.cc @@ -1498,6 +1498,7 @@ ThreadID Commit::oldestReady() { unsigned oldest = 0; + unsigned oldest_seq_num = 0; bool first = true; std::list::iterator threads = activeThreads->begin(); @@ -1517,9 +1518,11 @@ Commit::oldestReady() if (first) { oldest = tid; + oldest_seq_num = head_inst->seqNum; first = false; - } else if (head_inst->seqNum < oldest) { + } else if (head_inst->seqNum < oldest_seq_num) { oldest = tid; + oldest_seq_num = head_inst->seqNum; } } }