You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rp2: Fix power consumption when sleeping with a timeout.
Fixes a regression introduced in 3af006e
where WFE never blocked in `mp_wfe_or_timeout()` function and would
busy-wait instead. This increases power consumption measurably.
Root cause is that `mp_wfe_or_timeout()` calls soft timer functions that
(after the regression) call `recursive_mutex_enter()` and
`recursive_mutex_exit()`. The exit calls
`lock_internal_spin_unlock_with_notify()` and the default pico-sdk
implementation of this macro issues a SEV which negates the WFE that
follows it, meaning the CPU never suspends.
See https://forums.raspberrypi.com/viewtopic.php?p=2233908 for more
details.
The fix in this comment adds a custom "nowait" variant mutex that doesn't
do WFE/SEV, and uses this one for PendSV. This will use more power when
there's contention for the PendSV mutex as the other core will spin, but
this shouldn't happen very often.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <[email protected]>
0 commit comments