Firmware SMP boot bug

Open
#354 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
embedded-iot

Research direction

Start with fw_base.S and compare the cold-boot-hart lottery changes in commit 8151105af5e4bd5d2a17fe0babd6cff3b36496fb. Trace how _boot_status and _relocate_lottery are read and written by boot and non-boot harts. Done means a non-boot hart cannot be left waiting forever after relocation while boot-stage status remains correct.

Written by the indexing model from the issue text.

Description

The cold-boot-hart lottery in fw_base.S has recently been modified by using the _boot_status variable instead of the _relocate_lottery variable. This introduces a data race since the _boot_status variable is also written by the cold-boot hart to indicate the current boot stage without waiting for the other cores to have completed the lottery. If a non-boot hart enters the lottery when the boot-hart has already completed relocation _boot_status is overwritten and the non-boot hart is stuck forever in _wait_for_boot_hart.
The change has been introduced in this commit.

Dominant language
C
Stars
1.6k
Forks
734
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from riscv-software-src/opensbi

All issues in riscv-software-src/opensbi

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.