Skip to content
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

make wakeup behave like unpark #97

Merged
merged 1 commit into from
Nov 13, 2024
Merged

make wakeup behave like unpark #97

merged 1 commit into from
Nov 13, 2024

Conversation

Freax13
Copy link
Owner

@Freax13 Freax13 commented Nov 13, 2024

wakeup IPIs will now set a token much like Thread::unpark does.

Previously there was a race condition:

  1. AP 0 starts to halt and calls Scheduler::halt
  2. AP 1 wants to schedule a new AP, so it pick 0. It sends an IPI to AP 0.
  3. AP 0 executes the wakeup IPI.
  4. AP 0 executes hlt.

To prevent this from happening, we now remember that AP was woken up and run it one more time when it executes hlt the first time after being woken up.

wakeup IPIs will now set a token much like Thread::unpark does.

Previously there was a race condition:
1. AP 0 starts to halt and calls Scheduler::halt
2. AP 1 wants to schedule a new AP, so it pick 0. It sends an IPI to AP
   0.
3. AP 0 executes the wakeup IPI.
4. AP 0 executes `hlt`.

To prevent this from happening, we now remember that AP was woken up
and run it one more time when it executes `hlt` the first time after
being woken up.
@Freax13 Freax13 merged commit 4716a7a into main Nov 13, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant