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
IDF & FreeRTOS performance (IDF-224) #2233
Comments
There are also delays while receiving UDP datagrams. SSID: "test_ssid" Max datagram size is 1024 bytes. I have reproduced it while sending some data every 80 ms. |
I have been trying debugging this using uxTaskGetSystemState function but it returns really strange values. EDIT: It seems that delays during wifi driver initialization are caused by "ipc1" task. Is it really necessary? |
Ad UDP receiving:
"tiT" task still preempts testing task running with 20 priority. https://github.com/michprev/idf_performance/tree/cc853cccf9abd5c7f17a875746eb93963820a400 |
Hi @michprev ,
The WiFi driver will save some calibration data to NVS during initialization, which requires writing to flash. Writing to flash requires suspending task execution on both cores (ISRs marked as IRAM-safe will always continue to run). You can clear the nvs_enable flag in the wifi_init_config_t structure if you'd prefer that WiFi didn't store data in NVS. For the other questions, it'll be easier to reply after they're split out into separate issues. Thanks. |
(I realised when you were talking about UDP you meant pauses in the higher priority app_task, not pauses in the UDP reception, and that you figured out uxTaskGetSystemState(), so please disregard the request for multiple issues.) |
Basically the issue is that even when testing task runs with priority 20 it is being preempted by 18 priority LWIP task. It would also make sense to make LWIP task core affinity configurable - the same way as wifi task (CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE). |
Re making LwIP task affinity configurable — good point, this should be added soon. |
How does priority 18 task preempt priority 20 task that is in a busy loop? |
One possibility (not confirmed at this point) is that somewhere the priority 18 task takes a mutex, and then gets preempted by the higher priority (23) wifi task, which tries to take the same mutex. Due to priority inheritance LwIP task starts to execute. It should start executing on CPU0 though, but maybe there is some bug in the logic. |
In some cases applications need to ensure that WiFi/BT related tasks run on CPU1. This option can be used to set task affinity in such case. #2233 (comment)
Cannot reproduce the preemption issue in v3.1.3. Keeping open as 5d1ccb9 has not been merged into any of stable releases yet. |
The LWIP affinity fix is now in the v3.2 release. Please let us know if you find new steps to reproduce. |
In some cases applications need to ensure that WiFi/BT related tasks run on CPU1. This option can be used to set task affinity in such case. espressif/esp-idf#2233 (comment)
I think it makes sense to create an issue like this to care about performance problems that happen inside interrupt or exception vectors (or inside anything called by them).
From the beginning PRO core was ment to run all the necessary stuff while APP core should be free to use. This is why we should focus on APP core.
So far we know that there is "tiT" task (LWIP TCP/IP task) that can migrate between both cores.
What is maximum priority this task can run at?
I have created example project at https://github.com/michprev/idf_performance.
I have discovered there are some delays during wifi driver initialization. I am not sure this is a legit problem. https://github.com/michprev/idf_performance/tree/bb9c4331406d515ce1294a39b65cafcf4e4826e8
The text was updated successfully, but these errors were encountered: