Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4919

General • Cross-CPU SEV/WFE, Event Signals, Event Register

$
0
0
I have a couple of questions about RP2040 datasheet sections 2.3.3 "Event Signals" and 2.4.2.8.2. "Wait For Event and Send Event", please. Particularly related to the dual-processor implementation:

The description for the Send-Event instruction says "The Send-Event (SEV) instruction causes an event to be signalled to the other processor.". To confirm, does this actually signal both processors? This comment in the SDK say that it signals both processors, and that's consistent with observed behaviour and "standard" Cortex-M behaviour, but wanted to double check.

Is the single-bit "Event Register" described in section 2.4.2.8.2 duplicated per-CPU or a single shared bit between both CPUs? Specifically, does executing SEV set this bit in a shared register and the first CPU to execute WFE will clear it for both CPUs? Or, alternatively, does executing SEV set this bit in each CPU's individual Event Register and each core will clear its own register individually when it executes WFE?

Extra Context

Ran into some unexpected behaviour with the default SDK mutex_exit() behaviour. Because this calls the default lock_internal_spin_unlock_with_notify() implementation which executes SEV after unlocking.

If there is lock contention then this will wake up a core blocked in WFE, but what we're seeing is that when there's no lock contention then the next WFE on the same core will resume immediately as the event flag was set when it previously unlocked the mutex. I know we can replace this spinlock implementation with our own, but not sure what the best approach is that works with the hardware constraints.

Thanks in advance for any pointers.

Statistics: Posted by projectgus — Tue Jul 02, 2024 2:13 am



Viewing all articles
Browse latest Browse all 4919

Trending Articles