Y334275 opened a new pull request, #21761:
URL: https://github.com/apache/nuttx/pull/21761

   These commits fix the ESP32-S3 OTG request lifecycle on SMP.
   
   Fixes: #18541
   
   The IN endpoint used to complete a request as soon as all bytes were
   written to the TxFIFO, before XFRC.  The class driver could then release
   the request while the controller still owned it.  On SMP, the request
   queue and active state could also be changed concurrently from the
   interrupt and task contexts.
   
   The series:
   
   - keeps IN requests in flight until XFRC and completes them when all
     bytes have been transmitted;
   - clears active/in-flight state when requests are cancelled, including
     the path where the hardware has already disabled the IN endpoint;
   - returns cancelled requests through esp32s3_req_complete() so EP0
     keeps its stall reflection semantics;
   - protects the OTG request queues with a controller lock.
   
   ## Summary
   
   Without these changes, an SMP build can hang when a host opens the CDC
   ACM port while the target is continuously sending IN data.  The host
   open triggers the CDC control path; the baseline then enters
   esp32s3_epin_disable() and waits for EPDISD with interrupts disabled.
   If the endpoint is already deactivated, that wait never returns and the
   console stops as well.
   
   ## Impact
   
   - Only arch/xtensa/src/esp32s3/esp32s3_otg_device.c.
   - No public API or build changes.
   - Fixes CDC ACM IN/OUT request handling on SMP.
   - Single-core behavior is unchanged.
   
   ## Testing
   
   Board: ESP32-S3-WROOM-1 N4, official esp32s3-devkit:smp configuration.
   
   Config:
   
       CONFIG_SMP=y
       CONFIG_SMP_NCPUS=2
       CONFIG_IRQCOUNT=y
       CONFIG_ESP32S3_OTG=y
       CONFIG_USBDEV=y
       CONFIG_CDCACM=y
       CONFIG_NSH_BUILTIN_APPS=y
   
   Target test app:
   
https://github.com/Y334275/nuttx-apps/tree/mavlink-otg-test/testing/mavlink_otg
   
   ### Reproduction
   
   1. Build and flash the SMP image; start:
   
          mavlink_otg &
   
   2. The app prints A/B/C and COMx appears.
   3. Open COMx from the host (serial terminal).
   
   Baseline (without this series), 3/3 runs:
   
       open COMx -> no return for 10 s
       target console also stops responding
   
   Fixed, 5/5 runs:
   
       open COMx -> HEARTBEAT/PARAM_VALUE received
       host reconnect 5/5 OK
       tx_hb=12, custom_mode increases
       params=176 in stress mode
   
   After a target reset, fixed also passed 3/3 reconnect runs.
   
   Assisted-by: DeepSeek (deepseek-flash)
   Signed-off-by: liu <[email protected]>
   


-- 
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]

Reply via email to