dwc2: endpoint register updates still unlocked against the task on multi-core

Aperta
#4,232 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c
Ambito
embedded-iot

Direzione di ricerca

Start with src/portable/synopsys/dwc2/dcd_dwc2.c and review edpt_disable() plus the three edpt_schedule_packets() ISR call sites named in the issue. Read Programming Guide 4.20a (book 2137) before deciding whether the OUT-branch locking concern is hardware-dependent; record that research and decide per site. Any change must pass the usbtest full battery for at least 10 cycles on both slave and DMA variants of espressif_s31_function_core and on a single-core dwc2 board.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

followup Prio 📌

Deferred from the #4229 fix (branch claude/s31-slave-bulk-in, dwc2: serialize slave TX FIFO writes and flushes across cores). That fix serializes only TX FIFO writes and flushes under usbd_spin_lock. Several endpoint register and state updates in src/portable/synopsys/dwc2/dcd_dwc2.c still run unlocked against the task on another core. None was observed failing; all come from review.

A3: endpoint control updates in edpt_disable() are unlocked

  • The IN branch's DIEPCTL read-modify-writes (SNAK, then EPDIS | stall) and their INEPNE/EPDISD busy-waits run outside the lock. Only the flush is locked.
  • Widening the existing lock pair (the is_isr argument is already threaded through) would put those busy-waits, about one packet time, under the spinlock on both cores. That needs a latency analysis.
  • Keep the OUT branch unlocked. In slave mode GOUTNakEff is believed to set only after the RXFLVL ISR pops the Global-OUT-NAK pattern, so a task-side caller with the ISR's core masked could spin forever. This belief is unverified and needs read-doc (Programming Guide 4.20a, book 2137).

A4: ISR callers of edpt_schedule_packets() without the lock

  • edpt_schedule_packets() is documented "Must be called from critical section", but three ISR callers do not hold the lock:
    • handle_rxflvl_irq() RX_COMPLETE (EP0 OUT)
    • handle_epout_dma()
    • handle_epin_dma()
  • None writes a TX FIFO. They do touch ep0_pending and EP0 DIEPTSIZ/DIEPCTL, which dcd_edpt_xfer() writes from the task on the other core.

Acceptance

  • Decide per site, with a read-doc record for any hardware-dependent claim.
  • Any change validated with the usbtest full battery ≥10 cycles on espressif_s31_function_core (slave and DMA variants) and on a single-core dwc2 board.
Lingua principale
C
Stelle
7.3k
Fork
1.6k
Merge medio
1g 15h
PR unite (30g)
99

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hathach/tinyusb

Tutte le issue di hathach/tinyusb

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.