[PATCH v2] lib: sbi_ipi: Protect the IPI device list with a read-write lock
Nickolai Zeldovich
nickolai at csail.mit.edu
Mon Nov 16 07:27:51 PST 2026
On Mon, Nov 16, 2026 at 10:06 AM Samuel Holland
<samuel.holland at sifive.com> wrote:
> This is a more fundamental issue, not just with the IPI device list. Effectively
> none of the cold boot code is written with synchronization in mind, and
> functions like sbi_hsm_hart_wait() and sbi_ipi_raw_clear() can call into
> arbitrary platform code (think timer or irqchip drivers), so any driver
> subsystem could have a race here. I think the only robust solution is to move
> wake_coldboot_harts() to the very end of the coldboot process, so secondary
> harts never see a partially-initialized state.
This sounds like a reasonable plan to me. That said, I don't really
have a broad understanding of OpenSBI's overall architecture yet.
The early-wake support came from
https://github.com/riscv-software-src/opensbi/commit/7862c244 to
reduce secondary HART spinning, motivated by trying to improve qemu
boot times and reduce power consumption on real hardware. Maybe a
better plan to address that concern is to improve the spin code in
wait_for_coldboot, say by using pause or wrs.nto?
Nickolai.
More information about the opensbi
mailing list