riscv-software-src / riscv-pk

RISC-V Proxy Kernel
Other
593 stars 308 forks source link

Make htif_poweroff thread-safe #211

Closed zhemao closed 4 years ago

zhemao commented 4 years ago

This fixes an issue we were seeing in which a dual-core BOOM simulation wasn't shutting down properly. I believe the root cause was that the core calling htif_poweroff was getting into a data race with the other core calling htif_console_getchar. Having htif_poweroff take the htif lock and use __set_tohost to write the tohost register seems to solve the issue.

aswaterman commented 4 years ago

Makes perfect sense. Thanks, @zhemao and @timsnyder-siv