-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
target/riscv: Fix SMP group is in inconsistent state #1171
base: riscv
Are you sure you want to change the base?
Conversation
7652128
to
21d836a
Compare
@lz-bro I am afraid I have not understood what case this merge request addresses; not even after reading the commit description and the discussion so far. Please, could you provide a very clear description in the commit message. Doing so will help:
Thank you. |
Let me try to explain this issue. When openocd calls A. if no hardware state change occurs,sequence is: B. If core0 hit soft breakpoints on hardware, one possible sequence is Let's re-assume that core0/core1 are both running and consider case C C. If core0 hit semihosting ebeak on hardware, one possible sequence is: Let's re-assume that core0/core1 are both running and consider case D D. If core0 hit semihosting ebeak on the hardware, but the timing was earlier than in case C, one possible sequence is: Thank you. |
Things are a bit complicated. |
@JanMatCodasip @aap-sc Does my description of the issue help you understand what the issue is ? |
@zqb-all Thank you for describing the situation in more detail. It will take me some time to get back to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zqb-all, thank you for the clear and accurate description of the situation that you're trying to address. It helped me to understand the code change. I am also sorry for replying late.
Overall this fix looks good and I have posted some comments.
8193431
to
0affedb
Compare
a573dc7
to
dd6e9eb
Compare
LGTM, thank you. |
Sorry for the delay. I finally took the time and courage and thoroughly read @zqb-all `s explanation. Yep I managed to understand what the problem is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM to me, though I have few minor comments.
@@ -193,6 +193,7 @@ struct riscv_info { | |||
/* Used by riscv_openocd_poll(). */ | |||
bool halted_needs_event_callback; | |||
enum target_event halted_callback_event; | |||
unsigned int halt_group_repoll_count; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If looks like that halt_group_repoll_count
should not be part of target state. It looks like we use it only for the purposes of riscv_openocd_poll. Maybe we could introduce some kind of wrapper function?
This can be implemented in separate MR.
If the harts are just in the process of halting due to being members of the halt group, we should wait until they finish halting, so that the true halt reason can be discovered (e.g. semihosting request, and then handled correctly).
dd6e9eb
to
d5969d5
Compare
If all current halted states are due to a halt group, then a new "triggered a halt" event has occurred.