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

riscv-rt: example multicore.rs could cause HART to loop forever because of race condition #272

Open
MLFlexer opened this issue Feb 28, 2025 · 0 comments

Comments

@MLFlexer
Copy link

In the multicore.rs example, the other HARTs wait for an interrupt before entering main. However it seems as though there could be a race condition if HART 0 sets the interrupt flag to 1 in

(addr as *mut u32).write_volatile(1);
, and then HART 1 sets it to 0 in
(addr as *mut u32).write_volatile(0);
.

This would make the interrupt flag be 0, when HART 1 is entering the loop in

loop {
wfi();
if mip::read().msoft() {
break;
}
}
, and remain 0, because HART 0 has already set the flag, but it was overwritten by HART 1.

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

No branches or pull requests

1 participant