-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inet: ScopedLwIPLock for better safety and added locks at necessary places #28655
Conversation
PR #28655: Size comparison from bf0b45a to fdd9753 Increases (5 builds for cc32xx, psoc6)
Decreases (1 build for nrfconnect)
Full report (20 builds for cc32xx, cyw30739, k32w, linux, mbed, nrfconnect, psoc6, qpg)
|
PR #28655: Size comparison from bf0b45a to af549d8 Increases (15 builds for bl702, bl702l, cc32xx, efr32, psoc6, telink)
Decreases (12 builds for bl602, nrfconnect, telink)
Full report (60 builds for bl602, bl702, bl702l, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
PR #28655: Size comparison from bf0b45a to 09c60e5 Increases (5 builds for mbed, nrfconnect, qpg)
Decreases (2 builds for nrfconnect)
Full report (6 builds for mbed, nrfconnect, qpg)
|
PR #28655: Size comparison from bf0b45a to 0a90a51 Increases above 0.2%:
Increases (51 builds for bl602, bl702, bl702l, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (19 builds for cyw30739, efr32, esp32, linux, nrfconnect, psoc6, telink)
Full report (60 builds for bl602, bl702, bl702l, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
@shubhamdp ok, so ok, let me rephrase: actually, what is being done is good, because it fixes what is currently broken. but i think further changes hsould be made to accommodate |
@rojer I though of adding a static_assert, but ESP32/ASR/BouffaloLab do not have that enabled. I will fix that for ESP32 in follow up PR (please check the PR description), but I am not sure about ASR and BouffaloLab. If not static_assert, are you suggesting that we dump the |
@shubhamdp well, as things stand, any platform that doesn't have yes, i think the right thing to do is to use |
for context: on our platform we deliberately use LWIP with |
…laces (project-chip#28655) * inet: scoped lwip locks for better safety and add at few more places * Do not static assert if LWIP_TCPIP_CORE_LOCKING is disabled * Add scope for locks * move out the error variable definition to the top
…laces (project-chip#28655) * inet: scoped lwip locks for better safety and add at few more places * Do not static assert if LWIP_TCPIP_CORE_LOCKING is disabled * Add scope for locks * move out the error variable definition to the top
* inet: ScopedLwIPLock for better safety and added locks at necessary places (#28655) * inet: scoped lwip locks for better safety and add at few more places * Do not static assert if LWIP_TCPIP_CORE_LOCKING is disabled * Add scope for locks * move out the error variable definition to the top * [ESP32] Enable LWIP_TCPIP_CORE_LOCKING by default and added static assert for the same (#28798) * [ESP32] Enable LWIP_TCPIP_CORE_LOCKING by default and acquire lwip locks when initializing route_hook * inet: static assert if LWIP_TCPIP_CORE_LOCKING is disabled Static assert is disabled for ASR and bouffalolab platforms * typo * UDPEndPointImplLwIP: Support LWIP_TCPIP_CORE_LOCKING=0 (#29057) Wrap calls to LwIP APIs in `tcpip_api_call()`, as required. When `LWIP_TCPIP_CORE_LOCKING` is enabled, this internally becomes `LOCK_TCPIP_CORE/UNLOCK_TCPIP_CORE` and when it isn't, it posts a message to the TCPIP task to run the function. Added CHIP stack locking to the UDP receive function. --------- Co-authored-by: Deomid Ryabkov <rojer@rojer.me>
Related: #28590
Almost every platform other than ESP32 enables the config
LWIP_TCPIP_CORE_LOCKING
which ensures that the thread safety in the LwIP.I enabled the same option on ESP32 platform along with one more,
CONFIG_LWIP_CHECK_THREAD_SAFETY=y
which asserts when LwIP code runs from non-LwIP task and added the lock/unlock which were missing in following APIs:Added the RAII locking for LwIP core.
How was this tested
LWIP_TCPIP_CORE_LOCKING
andCONFIG_LWIP_CHECK_THREAD_SAFETY
for ESP32C3.lighting-app/esp32
and verified commissioning/cluster-control, read/write/wildcard-subscribe works.light-switch-app/esp32
and verified commissioning, read/write/wildcard-subscribe works.NOTE: I had to add lock in
esp_route_hook_init()
which consumes LwIP APIs.Follow up PR: Default the
LWIP_TCPIP_CORE_LOCKING
andCONFIG_LWIP_CHECK_THREAD_SAFETY
on ESP32.