Skip to content

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

Merged
mkroening merged 5 commits intohermit-os:mainfrom
stlankes:mwait
Jun 6, 2024
Merged

add option to use a busy waiting within the idle loop#1243
mkroening merged 5 commits intohermit-os:mainfrom
stlankes:mwait

Conversation

@stlankes
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread src/scheduler/mod.rs Outdated
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
…ate`

Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
@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
@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