From: Sungkeun Kim Date: Sat, 22 Aug 2020 20:55:33 +0000 (-0500) Subject: cpu: Failure to restore RAS during squash X-Git-Tag: v20.1.0.0~133 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=808e573cda930258e306133369cfbe54ea224514;p=gem5.git cpu: Failure to restore RAS during squash During squash of branch predictor history, RAS recovery mess up the stack because of function "restore" in RAS (src/cpu/pred/ras.cc). In restore function, it does not update "usedEntries" variable resulting in restore failure. To be specific, in order to remove mispredicted call, it uses pop() and it updates tos. However in order to restore mispredicted ret instruction, it uses restore() but it does not update tos. This pair of function call mess up the RAS resulting in many misspeculation. The solution is to update usedEntries variable as “push” function does. This is possible because restoration is done with reverse order of push and pop. Jira Issue: https://gem5.atlassian.net/browse/GEM5-732 Change-Id: Ia14e71c26d20b2795fd55a6a0dd3284c03570614 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33214 Reviewed-by: Trivikram Reddy Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/src/cpu/pred/ras.cc b/src/cpu/pred/ras.cc index e07ac6aa9..33eec0ea4 100644 --- a/src/cpu/pred/ras.cc +++ b/src/cpu/pred/ras.cc @@ -74,4 +74,8 @@ ReturnAddrStack::restore(unsigned top_entry_idx, tos = top_entry_idx; addrStack[tos] = restored; + + if (usedEntries != numEntries) { + ++usedEntries; + } }