Searched hist:"48426 cff7250486b9a00a2e0e69d53cb5ae6e413" (Results 1 – 1 of 1) sorted by relevance
| /rk3399_ARM-atf/services/std_svc/spm/spm_mm/ |
| H A D | spm_mm_main.c | 48426cff7250486b9a00a2e0e69d53cb5ae6e413 Thu Apr 03 09:29:39 UTC 2025 Boyan Karatotev <boyan.karatotev@arm.com> fix(spm-mm): prevent excessive racing
The current code does the following:
sp_state_wait_switch: lock() if (status == 0) status = 1 unlock()
[critical section]
sp_state_set: lock() status = 0 unlock()
One core will obtain the status for itself and then all other cores will get the lock, see the status is not available, release the lock, and try again. However, when there are many cores this causes a lot of lock contention and the original core is racing to obtain the lock to release the status. This starves the holder of the lock, resulting in an apparent deadlock, although given enough time it will pass.
Hold the lock throughout to prevent this.
Also make the functions static as they are never exported and drop sp_state_try_switch() as its unused and would not work anymore.
Change-Id: I0861d04ed95437e4ca9f203d9e79a6296b1ead56 Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
|