parsa-epfl / libqflex

Contains the API used for interfacing between QEMU and Flexus.
0 stars 4 forks source link

KnottyKraken derails after 100-1000 cycles #16

Open branylagaffe opened 1 month ago

branylagaffe commented 1 month ago

Description

After 100 to 1000, KnottyKraken is queuing instruction with PA=0x00000000, VA=0xFFFFFFFF...

Steps to Reproduce

  1. Run KnottyKraken with any workload

Additional Information


4953 <BaseSemanticAction.cpp:103> {28670484060}- ESC[1;36msatisfy CPU[00]#2 CPU[00]#2 UpdateAddressAction 0ESC[0m
4954 <BaseSemanticAction.cpp:172> {28670484060}- CPU[00]#2 UpdateAddressAction rescheduled
4955 <CoreImpl.cpp:3021> {28670484060}- ESC[0;32mreschedule CPU[00]#2 UpdateAddressActionESC[0m
4956 <UpdateAddressAction.cpp:109> {28670484060}- Executing CPU[00]#2 UpdateAddressAction
4957 <UpdateAddressAction.cpp:124> {28670484060}- ESC[1;31mupdateAddress adding offset 0xfffffffffffffff0 to address 0ESC[0m
4958 <UpdateAddressAction.cpp:128> {28670484060}- ESC[1;31mupdateAddress final address is fffffffffffffff0ESC[0m
4959 <CoreImpl.cpp:4283> {28670484060}- Resolved VAddr for LSQ(AwaitingAddress)[1] Store(16) v:ffffffffffffffff p:ffffffffffffffff {raise InvalidExceptionType(36) } {#2[00]  {clsStore}  QEMU
 disas: stp x29, x30, [sp, #-0x10]! {raised}} to v:fffffffffffffff0
4960 <CoreImpl.cpp:4284> {28670484060}- ESC[0;32mresolveVAddr Resolved VAddr for LSQ(AwaitingAddress)[1] Store(16) v:ffffffffffffffff p:ffffffffffffffff {raise InvalidExceptionType(36) } {#2
[00]  {clsStore}  QEMU disas: stp x29, x30, [sp, #-0x10]! {raised}} to v:fffffffffffffff0ESC[0m
4961 <CoreImpl.cpp:5022> {28670484060}- in updateVaddr
4962 <UpdateAddressAction.cpp:132> {28670484060}- ESC[1;36mupdateAddress CPU[00]#2 UpdateAddressAction updating vaddr = v:fffffffffffffff0ESC[0m
``
BugraEryilmaz commented 1 month ago

The issue was on the QEMU API for register read. It was using env->regs to read registers, but regsis ARM register list and we should use xregs which is the register list for aarch64. ARM has 16 registers and the rest of the registers we read is garbage. This was resulting in reading 0 for the stack pointer. Fixed it in f5c988f0b6456140dda0844ecd95f71ac178d3d1

Side note: the predicted as branch but not branch had no impact on this, but fixed by changing the check to check the branch type instead of existence of branch check. 336dfe0db00c9e4f662ffeff185f98d8bf160d92

branylagaffe commented 1 month ago

Good Work @BugraEryilmaz You need to explain to me how you found out about that 👍🏻

I have been looking for this for 2 whole days