-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add support for starting cores with PSCI #169
Conversation
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.
Happy to approve but please look at the one thing I asked about.
} | ||
|
||
pub fn halt_and_wait() { | ||
/* TODO: spin a bit */ | ||
/* TODO: actually put the cpu into deeper and deeper sleep */ | ||
todo!() | ||
/* TODO: actually put the cpu into deeper and deeper sleep, see PSCI */ |
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.
Since the todo!() was removed is this still a TODO?
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.
I think so. wfe
puts the core in some low power state (standby), but PSCI gives more control to put the core in different power level states (e.g., retention).
In this PR we add basic support for SMP to the ARM version of the kernel. It uses PSCI to boot up cores. PSCI is the power management interface commonly supported by ARM devices. The kernel gets to the same place as before (running the startup terminal from init). There are still other stuff missing and issues related to synchronization (e.g. locks) which we plan to address in future PR's.
Two bugs surfaced while implementing this which required changes to the generic kernel code. One is that when creating the idle thread, before setting the current thread, the kernel tries to acquire a lock to allocate some memory. The issues is that all cores race to acquire the mutex which calls scheduler to run other work if they need to wait which then crashes since no current thread is defined. So we have the mutex avoid calling the scheduler if no current thread is defined. The second problem was that
init_secondary
was called in main (from the boot core) which caused issues with ARM initialization code. I tried to remove it, but it seemed to cause the x86_64 code to not boot. The workaround for now was to conditionally compile that in for x86_64 code.Summary
init_secondary
for x86_64 in main