Skip to content

fastrpc: quarantine domain after queue teardown failure - #427

Merged
Ekansh Gupta (ekanshibu) merged 1 commit into
qualcomm:developmentfrom
malto101:bug-fix-quarantine
Nov 25, 2026
Merged

Ekansh Gupta (ekanshibu) merged 1 commit into
qualcomm:developmentfrom
malto101:bug-fix-quarantine

Conversation

@malto101

Copy link
Copy Markdown
Contributor

If signal-wait cancellation or worker joining fails, retain the domain state and mark it unavailable rather than freeing memory a worker may still access. Later queue creation on that domain fails with AEE_EBADSTATE; teardown is not retried during the process lifetime.

Preserve the original queue-creation error during cleanup, and do not return a domain teardown error from dspqueue_close() after the queue handle has been freed. Document the quarantine behavior.

fixes #398

@malto101

Copy link
Copy Markdown
Contributor Author

@malto101

Dhruv Menon (malto101) commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

context around this PR

moved the changes related to dspqueue_cpu from #399 to here

question pending: on src/dspqueue/dspqueue_cpu.c:L196-L200
Vinayak quoted "Once teardown_failed is set, this return makes the domain unavailable until process exit. Every later dspqueue_create() on it gets AEE_EBADSTATE, and nothing retries the teardown"

to which i replied
"
Yes, this currently does make the domain unavailable until process exit
the main reason i chose that as a fail-closed fallback was that if cancellation or a join fails, we cannot safely assume the worker has stopped using the domain state. Retaining that state avoids a potential use-after-free or another unsafe join. Later dspqueue_create() calls fail with AEE_EBADSTATE.

A retry is possible, but not safely with the current teardown flow.
Teardown can fail after one worker has already been joined, so retrying would need to track which cancellation/join/cleanup steps completed and avoid repeating them. as per me, a robust recovery path would require an explicit teardown state machine and a careful synchronization, especially around "queues->mutex". background retry mechanism or process abort are also possible, but that also add its own complexity, need additional effort :( .

The current tradeoff i see is to retain the affected domain state and sacrifice that domain’s availability rather than risk corrupting process state. If runtime recovery is required, I’d implement it as an explicit staged retry path.(maybe split this into 2 PR, one for this specifically, any remaining can be here)
"

ref:#399 (comment)

If signal-wait cancellation or worker joining fails, retain the domain state and mark it unavailable rather than freeing memory a worker may still access. Later queue creation on that domain fails with AEE_EBADSTATE; teardown is not retried during the process lifetime.

Preserve the original queue-creation error during cleanup, and do not return a domain teardown error from dspqueue_close() after the queue handle has been freed. Document the quarantine behavior.

Signed-off-by: Dhruv Menon <[email protected]>
@anankulk

Copy link
Copy Markdown
Contributor
🤖 FastRPC AI Code Review — ✅ No issues found · patch 38157d41fbd9

No issues found by the FastRPC AI code reviewer.

To suppress a false positive: add an entry to .qvigor/review_feedback.json on the development branch with "decision": "denied".

@anankulk

Copy link
Copy Markdown
Contributor

Pre-merge CI results — patch 38157d41fbd9

Validated On

  • fastrpc baseline (development): 89508eaeed55
  • kernel baseline (qcom-next (reference)): 17bbb4b37bbc

Kernel: 7.3.0-g17bbb4b37bbc

Test Matrix

Targets Domain PD Type Tests Result
glymur-crdADSPSigned3/3✅ Pass
glymur-crdCDSPSigned3/3✅ Pass
glymur-crdCDSPUnsigned3/3✅ Pass
hamoa-iot-evkADSPSigned3/3✅ Pass
hamoa-iot-evkCDSPSigned3/3✅ Pass
hamoa-iot-evkCDSPUnsigned3/3✅ Pass
kaanapali-mtpADSPSigned3/3✅ Pass
kaanapali-mtpCDSPSigned3/3✅ Pass
kaanapali-mtpCDSPUnsigned3/3✅ Pass
lemans-evkADSPSigned3/3✅ Pass
lemans-evkCDSPSigned3/3✅ Pass
lemans-evkCDSPUnsigned3/3✅ Pass
lemans-evkCDSP1Signed3/3✅ Pass
lemans-evkCDSP1Unsigned3/3✅ Pass
lemans-evkGDSP0Signed3/3✅ Pass
lemans-evkGDSP0Unsigned3/3✅ Pass
lemans-evkGDSP1Signed3/3✅ Pass
lemans-evkGDSP1Unsigned3/3✅ Pass
monaco-evkADSPSigned3/3✅ Pass
monaco-evkCDSPSigned3/3✅ Pass
monaco-evkCDSPUnsigned3/3✅ Pass
monaco-evkGDSP0Signed3/3✅ Pass
monaco-evkGDSP0Unsigned3/3✅ Pass
purwa-iot-evkADSPSigned3/3✅ Pass
purwa-iot-evkCDSPSigned3/3✅ Pass
purwa-iot-evkCDSPUnsigned3/3✅ Pass
qcs615-adp-airADSPSigned3/3✅ Pass
qcs615-adp-airCDSPSigned3/3✅ Pass
qcs615-adp-airCDSPUnsigned3/3✅ Pass
qcs615-rideADSPSigned3/3✅ Pass
qcs615-rideCDSPSigned3/3✅ Pass
qcs615-rideCDSPUnsigned3/3✅ Pass
qcs6490-rb3gen2ADSPSigned3/3✅ Pass
qcs6490-rb3gen2CDSPSigned3/3✅ Pass
qcs6490-rb3gen2CDSPUnsigned3/3✅ Pass
qcs8300-rideADSPSigned3/3✅ Pass
qcs8300-rideCDSPSigned3/3✅ Pass
qcs8300-rideCDSPUnsigned3/3✅ Pass
qcs8300-rideGDSP0Signed3/3✅ Pass
qcs8300-rideGDSP0Unsigned3/3✅ Pass
qcs9100-ride-r3ADSPSigned3/3✅ Pass
qcs9100-ride-r3CDSPSigned3/3✅ Pass
qcs9100-ride-r3CDSPUnsigned3/3✅ Pass
qcs9100-ride-r3CDSP1Signed3/3✅ Pass
qcs9100-ride-r3CDSP1Unsigned3/3✅ Pass
qcs9100-ride-r3GDSP0Signed3/3✅ Pass
qcs9100-ride-r3GDSP0Unsigned3/3✅ Pass
qcs9100-ride-r3GDSP1Signed3/3✅ Pass
qcs9100-ride-r3GDSP1Unsigned3/3✅ Pass
shikra-evkCDSPSigned3/3✅ Pass
shikra-evkCDSPUnsigned3/3✅ Pass
sm8750-mtpADSPSigned3/3✅ Pass
sm8750-mtpCDSPSigned3/3✅ Pass
sm8750-mtpCDSPUnsigned3/3✅ Pass

LAVA Jobs:

@ekanshibu
Ekansh Gupta (ekanshibu) merged commit 3b7f929 into qualcomm:development Nov 25, 2026
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial queue teardown can leave stale state and trigger double pthread_join()

5 participants