mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mizuno Miotsuki <founder@crepuse.com>
To: Frank Li <Frank.li@oss.nxp.com>
Cc: "vkoul@kernel.org" <vkoul@kernel.org>,
	"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"ulfh@kernel.org" <ulfh@kernel.org>,
	"Frank.Li@kernel.org" <Frank.Li@kernel.org>,
	"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>,
	"huibin.hong@rock-chips.com" <huibin.hong@rock-chips.com>,
	"rmk+kernel@arm.linux.org.uk" <rmk+kernel@arm.linux.org.uk>,
	"sugar.zhang@rock-chips.com" <sugar.zhang@rock-chips.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] dmaengine: pl330: Fix unbalanced runtime PM
Date: Tue, 3 Nov 2026 10:14:35 +0000	[thread overview]
Message-ID: <ECCA077A-F53E-4F1F-86EE-2871A9CD564B@crepuse.com> (raw)
In-Reply-To: <auDEcFRBeICtT6LP@lizhi-Precision-Tower-5810>

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

  reply	other threads:[~2026-11-03 10:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 10:27 [PATCH v2] " Sugar Zhang
2026-10-14 23:58 ` [PATCH v3] " Mizuno Miotsuki via B4 Relay
2026-10-15 16:51   ` Frank Li
2026-10-16 10:49     ` Mizuno Miotsuki
2026-10-27 15:34       ` Frank Li
2026-11-03 10:14         ` Mizuno Miotsuki [this message]
2026-10-16 14:25   ` Frank Li
2026-10-16 23:39     ` Mizuno Miotsuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ECCA077A-F53E-4F1F-86EE-2871A9CD564B@crepuse.com \
    --to=founder@crepuse.com \
    --cc=Frank.Li@kernel.org \
    --cc=Frank.li@oss.nxp.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=huibin.hong@rock-chips.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=sugar.zhang@rock-chips.com \
    --cc=ulfh@kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®