summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2019-09-26 07:25:25 +0300
committerAnup Patel <anup@brainfault.org>2019-10-02 14:33:58 +0300
commite561c6303639ed510183da25d3d54555a53371c9 (patch)
treefa270edee3f3d2a8204d8c504d3b2ee6445a80f6 /include
parent2c7bab76a2eb2366026e0482b18679fe94c1dac6 (diff)
downloadopensbi-e561c6303639ed510183da25d3d54555a53371c9.tar.xz
lib: Fix coldboot race condition observed on emulators/simulators
If we are running on RISC-V emulator/simulator with large number of HARTs where each HART is a regular thread under UNIX host then it is possible that some of the secondary HARTs don't get chance to run and sbi_hart_wake_coldboot_harts() is called before secondary HARTs call sbi_hart_wait_for_coldboot(). In this situation, some of the secondary HARTs will never come-out of coldboot wait loop. To tackle this, we introduce a global flag coldboot_done which will be protected by coldboot lock and it will be set by primary HART from sbi_hart_wake_coldboot_harts() before waking-up secondary HARTs. We also re-arrange acquire/release of coldboot lock to reduce further chances of race-condition. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Zong Li <zong.li@sifive.com> Reviewed-by: Nylon Chen<nylon7@andestech.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions