Re: [PATCH v3] dmaengine: pl330: Fix unbalanced runtime PM
From: Mizuno Miotsuki
Date: Tue Nov 03 2026 - 05:29:05 EST
Hi Frank,
Thanks for the suggestion. I reviewed the descriptor lifecycle and implemented a separate per-descriptor PM accounting experiment to evaluate it.
In the current design, `pch->active` represents ownership of one channel PM reference. Both `pl330_tasklet()` and `pl330_terminate_all()` claim that reference under `pch->lock`, with the actual put performed afterwards.
The reported imbalance occurs when termination has already consumed the reference, but the late tasklet unconditionally sets `power_down = true` and issues another put. The v3 change fixes this specific case without changing the existing ownership model.
For per-descriptor accounting, references must be acquired when descriptors first enter `work_list`, retained across cyclic callbacks, and released on completion or termination. Repeated `issue_pending()` calls must not acquire duplicate references. The experiment also exposed a separate concern around `_stop()` in a late empty tasklet.
I implemented and tested these cases. Deterministic tests using extracted production C functions reproduce the original imbalance and pass with both approaches under the tested interleavings. These are host-side tests with ASan/UBSan, not full kernel or hardware validation.
The per-descriptor approach adds PM operations and lifecycle complexity, while still requiring channel scheduling state. I haven't found a correctness advantage that justifies replacing the narrow fix.
Krzysztof also independently reported that the equivalent fix has been working on RK3128 hardware for about a month.
Would it be reasonable to merge the existing v3 fix first and address the `_stop()` guard and other PM lifecycle issues separately?
Thanks,
Mizuno