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

add option to use a busy waiting within the idle loop #1243

Merged
merged 5 commits into from
Jun 6, 2024

Conversation

stlankes
Copy link
Contributor

@stlankes stlankes commented Jun 1, 2024

Instead of the hlt instruction, the idle loop use the pause instruction. => lower latency to wake up the core, but higher energy consumption.

In addition, this PR support monitor/mwait instructions. In this, the kernel hasn't to send an IPI to wakeup a core. The second optimization is that the kernels sends only an IPI, if the core is halted.

@stlankes stlankes marked this pull request as draft June 1, 2024 07:34
@stlankes stlankes force-pushed the mwait branch 5 times, most recently from e9bceb9 to 80c8a17 Compare June 4, 2024 14:45
@stlankes stlankes changed the title add support mwait/monitor add option to use a polling idle loop Jun 4, 2024
@stlankes stlankes marked this pull request as ready for review June 4, 2024 14:54
@stlankes stlankes requested a review from mkroening June 4, 2024 14:55
@stlankes stlankes changed the title add option to use a polling idle loop add option to use a busy waiting within the idle loop Jun 4, 2024
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me aside from one nit. I'll run CI on the in-between commits too, to make sure there's no breakage.

stlankes and others added 5 commits June 6, 2024 17:40
- avoid using the halt instruction
- CPU waits until another CPU change the ready queue
- doesn't require wakeup IPIs
=> using busy waiting loop
@mkroening mkroening enabled auto-merge June 6, 2024 15:40
@mkroening mkroening added this pull request to the merge queue Jun 6, 2024
Merged via the queue into hermit-os:main with commit d450c15 Jun 6, 2024
13 checks passed
@mkroening mkroening deleted the mwait branch June 6, 2024 16:23
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.

2 participants