Repository navigation
Instruction execution in constrained LR/SC loop #2761
Replies: 3 comments 1 reply
|
"Dynamic code" means the instructions actually executed, in contrast with static code, which is how the program is laid out in memory. In this context, the LR/SC sequence might have forward jumps and taken forward branches, which skip over static instructions; the skipped instructions are not part of the dynamic instruction sequence. If you show me the static code sequence rather than the CFG, I can tell you if it appears to be constrained. |
|
Thanks for the response. I have attached the assembly file showing the static instruction sequence. It is big, but it is the first When you say instructions actually executed, is this dependent on the instruction scheduling mechanism (in-order, out-of-order)? In this example, it is conceivable that the |
No, I'm only referring to architecturally executed instructions. If the processor is capable of speculative OOO execution, the processor is still responsible for figuring out how to make the LR/SC forward-progress guarantee work correctly, with respect to the architecturally executed instructions. So, we can analyze this loop by only considering the four instructions LR/BNE/SC/BNEZ; we don't need to worry about anything after the loop-closing backwards branch. We can analyze its forward progress by making sure that we're guaranteed to exit the loop. In the case the BNE in the middle is taken, we exit the loop trivially, so that case is OK. And if the case that the BNE is not taken, then we have an LR/SC loop that is constrained, so in that case, the loop will either (a) eventually terminate because of a sucessful SC in a constrained LR/SC loop or (b) eventually use the BNE to exit the loop because another thread changed the value in memory. So, regardless, forward progress will eventually be made. |


No, I'm only referring to architecturally executed instructions. If the processor is capable of speculative OOO execution, the processor is still responsible for figuring out how to make the LR/SC forward-progress guarantee work correctly, with respect to the architecturally executed instructions.
So, we can analyze this loop by only considering the four instructions LR/BNE/SC/BNEZ; we don't need to worry about anything after the loop-closing backwards branch. We can analyze its forward progress by making sure that we're guaranteed to exit the loop. In the case the BNE in the middle is taken, we exit the …