[riot-notifications] [RIOT-OS/RIOT] nrf52/i2c: Use mutex and IRQ for blocking (#14165)

Hauke Petersen notifications at github.com
Fri May 29 14:53:52 CEST 2020

Did you do some kind of runtime measurements for small i2c transfers? The reason why I back then implemented the wait loop like this was that the context switching overhead did not justify the benefits gained... 

In many use cases we see rather short transfers (e.g. read status reg from a device). For those we might end up in significant overhead: 
- mutx_lock() puts the calling thread to sleep
- context store
- scheduler selects internmediate thread to run
- context restore
- other thread runs (potentially very shortly)
- I2C ISR, mutex unlock
- context store
- scheduler run, selecting our initial thread again
- context restore
- end of 'wait loop'
--> So in bad cases, we get two context switches while the intermediate task did potentially very little to no runtime for short I2C payloads. So would be good to make sure its worth it :-)

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200529/c44f112e/attachment.htm>

More information about the notifications mailing list