tmedicci opened a new pull request, #9404: URL: https://github.com/apache/nuttx/pull/9404
## Summary Considering SMP, multiples CPU would be able to call `up_nputs` simultaneously. This function is most used by syslog and, in spite of the syslog supporting buffered output, the implementation of the `up_nputs` allows multiple threads to run concurrently, messing with the log messages. Please check https://github.com/apache/nuttx/pull/6618 for more information about the locking mechanism being implemented in `up_nputs` level. Also, this PR enables the syslog buffering on xtensa-based devices to ensure concurrent tasks will not mess with the syslog messages. Finally, use `up_putc` instead `up_puts` in `showprogress` define on ESP32: during initialization, it isn't possible to use `up_puts` once it's protected against concurrent access through a mutex lock. Instead, using `up_putc` makes it similar to ESP32S2 and ESP32S3 and perfectly fits for `showprogress` usage. ## Impact Please refer to https://github.com/apache/nuttx/issues/3599#issuecomment-825813320: this PR ensures the syslog generation/capture is thread-safe by using syslog buffering. It also ensures that publication is thread-safe by using a lock mechanism on the serial console published (`up_nputs` implementation). ## Testing Internal CI testing + `esp32s2-devkit:sta_softap` with the following configs added: ``` CONFIG_DEBUG_ASSERTIONS=y CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y CONFIG_DEBUG_ERROR=y CONFIG_DEBUG_FEATURES=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ERROR=y CONFIG_DEBUG_FS_INFO=y CONFIG_DEBUG_FS_WARN=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_NET=y CONFIG_DEBUG_WARN=y CONFIG_DEBUG_WIRELESS=y CONFIG_DEBUG_WIRELESS_ERROR=y CONFIG_DEBUG_WIRELESS_INFO=y CONFIG_DEBUG_WIRELESS_WARN=y CONFIG_ESP_WPA_DEBUG_PRINT=y CONFIG_SYSLOG_BUFFER=y ``` which produced the following messages during startup prior to the proposed solution: ``` [CPU0] esp_event_post: Event: base=WIFI_EVENT id=2 data=0 data_size=0 ticks=4294967295 [CPU1] esp_wifi_sta_start: OK to start Wi-Fi station [CPU0][ CPesU1p_]e svtpi_wffors_k_sctab:t: W mi-ouFin tpstt=a 0xst3farct9f 368 relp[atCPh=U0w]ap Ii. (co3n05f ) buwiff=0i:x fc[9CPe1U0e0] Set ps type: 0 [CPU0] ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
