Skip to content

Hermit does not sleep with multiple CPUs when MWAIT is available #2706

Description

@mkroening

To reproduce:

use std::thread;
use std::time::Duration;

#[cfg(target_os = "hermit")]
use hermit as _;

fn main() {
	loop {
		thread::sleep(Duration::from_hours(1));
	}
}

Build:

cargo build --target=x86_64-unknown-hermit -Zbuild-std=std,panic_abort --features hermit/smp,hermit/loader --package hello_world

Run without issue (no MWAIT):

qemu-system-x86_64 \
-cpu Skylake-Client \
-smp 2 \
-m 1G \
-display none \
-serial stdio \
-kernel hermit-loader-x86_64-multiboot \
-initrd target/x86_64-unknown-hermit/debug/hello_world

Run with MWAIT (use -cpu max):

qemu-system-x86_64 \
-cpu max \
-smp 2 \
-m 1G \
-display none \
-serial stdio \
-kernel hermit-loader-x86_64-multiboot \
-initrd target/x86_64-unknown-hermit/debug/hello_world

Now, two CPUs are fully utilized.

Is this expected or a bug?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions