@@ -562,6 +562,19 @@ Commit::takeOverFrom()
562562 rob->takeOverFrom ();
563563}
564564
565+ void
566+ Commit::activateThread (ThreadID tid)
567+ {
568+ if (commitPolicy != CommitPolicy::RoundRobin) {
569+ return ;
570+ }
571+
572+ auto thread_it = std::find (priority_list.begin (), priority_list.end (), tid);
573+ if (thread_it == priority_list.end ()) {
574+ priority_list.push_back (tid);
575+ }
576+ }
577+
565578void
566579Commit::deactivateThread (ThreadID tid)
567580{
@@ -1001,7 +1014,6 @@ Commit::commit()
10011014 std::list<ThreadID>::iterator end = activeThreads->end ();
10021015
10031016 int num_squashing_threads = 0 ;
1004-
10051017 while (threads != end) {
10061018 ThreadID tid = *threads++;
10071019
@@ -1212,9 +1224,9 @@ Commit::commitInsts()
12121224 continue ;
12131225 }
12141226
1215- while (num_committed < commit_width &&
1216- num_committed_per_thread[commit_thread] <
1217- commit_width_per_thread[commit_thread]) {
1227+ while (num_committed < commit_width &&
1228+ num_committed_per_thread[commit_thread] <
1229+ commit_width_per_thread[commit_thread]) {
12181230 // hardware transactionally memory
12191231 // If executing within a transaction,
12201232 // need to handle interrupts specially
@@ -1453,6 +1465,11 @@ Commit::commitInsts()
14531465
14541466 }
14551467
1468+ if (head_inst->isReadBarrier () ||
1469+ head_inst->isWriteBarrier ()) {
1470+ cpu->armSyncVisibleStoreReplay (tid);
1471+ }
1472+
14561473 if (cpu->difftestEnabled ()) {
14571474 diffInst (tid, head_inst);
14581475 }
@@ -1562,6 +1579,7 @@ Commit::commitInsts()
15621579 if (!interrupt && avoidQuiesceLiveLock &&
15631580 onInstBoundary && cpu->checkInterrupts (0 ))
15641581 squashAfter (tid, head_inst);
1582+
15651583 } else {
15661584 DPRINTF (Commit, " Unable to commit head instruction PC:%s "
15671585 " [tid:%i] [sn:%llu].\n " ,
@@ -1617,8 +1635,9 @@ Commit::diffInst(ThreadID tid, const DynInstPtr &inst) {
16171635 cpu->diffInfo .physEffAddr = inst->physEffAddr ;
16181636 cpu->diffInfo .effSize = inst->effSize ;
16191637 cpu->diffInfo .goldenValue = inst->getGolden ();
1638+ cpu->diffInfo .loadDiffEvidenceKind = inst->loadDiffEvidenceKind ();
1639+ cpu->diffInfo .loadDiffEvidenceData = inst->getLoadDiffEvidenceData ();
16201640 cpu->diffInfo .amoOldGoldenValue = inst->getAmoOldGoldenValue ();
1621- cpu->recordCommittedStore (tid, inst);
16221641 cpu->difftestStep (tid, inst->seqNum );
16231642}
16241643
@@ -1649,9 +1668,12 @@ Commit::commitHead(const DynInstPtr &head_inst, unsigned inst_num)
16491668 // Memory-ordering instructions such as sfence.vma must not execute
16501669 // until older stores are visible; otherwise page-table updates may
16511670 // race with the TLB invalidation.
1652- if ((head_inst->isMemRef () || head_inst->isReturn () ||
1653- head_inst->isReadBarrier () || head_inst->isWriteBarrier ()) &&
1654- (inst_num > 0 || !iewStage->flushStores (tid))) {
1671+ const bool needs_store_drain =
1672+ head_inst->isMemRef () || head_inst->isReturn () ||
1673+ head_inst->isReadBarrier () || head_inst->isWriteBarrier ();
1674+ const bool stores_drained =
1675+ !needs_store_drain || iewStage->flushStores (tid, head_inst->seqNum );
1676+ if (needs_store_drain && (inst_num > 0 || !stores_drained)) {
16551677 DPRINTF (Commit,
16561678 " [tid:%i] [sn:%llu] "
16571679 " Waiting for all stores to writeback.\n " ,
@@ -1705,7 +1727,7 @@ Commit::commitHead(const DynInstPtr &head_inst, unsigned inst_num)
17051727
17061728 if (inst_fault != NoFault) {
17071729 traceLogInstFault (head_inst, inst_fault);
1708- if (!iewStage->flushStores (tid) || inst_num > 0 ) {
1730+ if (!iewStage->flushStores (tid, head_inst-> seqNum ) || inst_num > 0 ) {
17091731 DPRINTF (Commit,
17101732 " [tid:%i] [sn:%llu] "
17111733 " Stores outstanding, fault must wait.\n " ,
@@ -2189,6 +2211,22 @@ Commit::getCommittingThread()
21892211ThreadID
21902212Commit::roundRobin ()
21912213{
2214+ for (auto it = priority_list.begin (); it != priority_list.end ();) {
2215+ if (std::find (activeThreads->begin (), activeThreads->end (), *it) ==
2216+ activeThreads->end ()) {
2217+ it = priority_list.erase (it);
2218+ } else {
2219+ ++it;
2220+ }
2221+ }
2222+
2223+ for (ThreadID tid : *activeThreads) {
2224+ if (std::find (priority_list.begin (), priority_list.end (), tid) ==
2225+ priority_list.end ()) {
2226+ priority_list.push_back (tid);
2227+ }
2228+ }
2229+
21922230 std::list<ThreadID>::iterator pri_iter = priority_list.begin ();
21932231 std::list<ThreadID>::iterator end = priority_list.end ();
21942232
0 commit comments