Skip to content

test(rp2350): assert PIO0+PIO1 resource behaviour at the SDK-claim level (#3899) - #4215

Merged
zackees merged 1 commit into
fix/1471-rp-pio-controller-leakfrom
fix/3899-rp-pio-parallel-resources
Sep 8, 2026
Merged

zackees merged 1 commit into
fix/1471-rp-pio-controller-leakfrom
fix/3899-rp-pio-parallel-resources

Conversation

@zackees

@zackees zackees commented Sep 8, 2026

Copy link
Copy Markdown
Member

Stacked on #4214 (shares the AutoResearch RPC registration files). Review that one first.

The gap

#3899 requires:

PIO0 + PIO1 simultaneous execution passes without resource collision, stale state machine, or DMA ownership leak.

runParallelTest drives both blocks at once, but for this exact pair it skips RX validation and asserts nothing about resources (AutoResearchRemoteRunParallelTest.cpp:308). Its PASS proves only that show() returned. All three named failure modes are invisible to it.

I previously cited that PASS as evidence for this criterion on #3899. It is not, and this replaces it with a measurement.

Approach

Query the SDK claim system directly — pio_sm_is_claimed, dma_channel_is_claimed — which is ground truth independent of the engine implementation.

The sample window matters. ChannelEngineRpPio claims per transmission and calls deinitialize() when the transfer drains, so resources are held only while a frame is in flight. Sampling after FastLED.wait() sees an idle engine and proves nothing — my first draft did exactly that and reported zero resources claimed, which looked alarming and was purely a measurement error.

Verified on RP2350W 2DCB876B587EA334 (256 LEDs × 8 frames)

Field Result Criterion
noResidueBetweenFrames True no stale state machine across a frame boundary
noLeak True no DMA ownership leak; baseline restored on teardown
noOverClaim True never >1 SM per block, never >2 DMA channels
observedInFlight True probe caught a live transfer (guards against vacuous pass)
RESULT: RPC smoke PASS (discovery, help, ping, payload, status, drivers,
        testNoSerial, RP concurrency, RP PIO contention,
        RP PIO0+PIO1 resources, error handling)

What is deliberately not asserted

Whether PIO0 and PIO1 are ever claimed at the same instant.

FastLED.show() drains the frame before returning on this path, so the observable in-flight window yields roughly one sample per frame — samplesTaken: 12 across 8 frames, even sampling in 1 ms slices. That is too coarse to separate genuine serialization from an unlucky sample.

Observed: pio1HeldOne: True, pio0HeldOne: False, bothHeldAtOnce: False. That is consistent with serialization but does not establish it, so pio0HeldOne / pio1HeldOne / bothHeldAtOnce are reported as diagnostics and do not gate success. Asserting either direction on this evidence would repeat the mistake this PR exists to correct.

Settling it needs either an async show path that leaves both engines in flight, or instrumentation inside the engine. Worth a follow-up; flagging rather than guessing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KkufoNxfnNRU9psT3R9F51

…vel (#3899)

#3899 requires PIO0 + PIO1 simultaneous execution to pass "without
resource collision, stale state machine, or DMA ownership leak".
runParallelTest drives both blocks but for this exact pair it skips RX
validation and asserts nothing about resources, so its PASS proves only
that show() returned. All three named failure modes are invisible to it.
I previously cited that PASS as evidence for this criterion; it isn't.

testRpPioParallelResources queries the SDK claim system directly
(pio_sm_is_claimed / dma_channel_is_claimed), which is ground truth
regardless of how the engine is implemented. ChannelEngineRpPio claims
per transmission and deinitializes when the transfer drains, so the
sample is taken between show() and wait() -- sampling after the wait
sees an idle engine and proves nothing.

Verified on RP2350W 2DCB876B587EA334, 256 LEDs x 8 frames:
  noResidueBetweenFrames=True  no state machine kept across a frame
  noLeak=True                  baseline restored after teardown
  noOverClaim=True             never >1 SM per block, never >2 DMA
  observedInFlight=True        probe actually caught a live transfer

Simultaneity is deliberately NOT asserted. show() drains the frame
before returning on this path, so the in-flight window yields ~1 sample
per frame (samplesTaken=12 over 8 frames) -- too coarse to separate
genuine serialization from an unlucky sample. pio0HeldOne, pio1HeldOne
and bothHeldAtOnce are reported as diagnostics for that open question
and do not gate success. Asserting either direction on this evidence
would be unfounded.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KkufoNxfnNRU9psT3R9F51
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 8b80fc67-119e-450e-905d-b1c74aceca9c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Sep 8, 2026
@zackees
zackees merged commit b9b353b into fix/1471-rp-pio-controller-leak Sep 8, 2026
8 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 8, 2026
@zackees
zackees deleted the fix/3899-rp-pio-parallel-resources branch November 17, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant