From: sashiko-bot@kernel.org
To: "Wentao Liang" <vulab@iscas.ac.cn>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] slimbus: qcom-ngd-ctrl: drop the PM runtime reference after a sync transfer
Date: Wed, 04 Nov 2026 02:21:59 +0000 [thread overview]
Message-ID: <sashiko-outbox-196442@kernel.org> (raw)
In-Reply-To: <20261104021424.1468172-1-vulab@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] slimbus: qcom-ngd-ctrl: runtime PM underflow in qcom_slim_ngd_xfer_msg_sync()
--
commit 95f275b622c76bd63160fe6491c0337ce83609c2
Author: Wentao Liang <vulab@iscas.ac.cn>
slimbus: qcom-ngd-ctrl: drop the PM runtime reference after a sync transfer
This commit adds a pm_runtime_put() call on the success path of
qcom_slim_ngd_xfer_msg_sync() to balance the pm_runtime_get_sync() call made
at the start of the transfer.
> diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
> index eb983b6d1815f..9bee4b376877e 100644
> --- a/drivers/slimbus/qcom-ngd-ctrl.c
> +++ b/drivers/slimbus/qcom-ngd-ctrl.c
> @@ -942,6 +942,9 @@ static int qcom_slim_ngd_xfer_msg_sync(struct slim_controller *ctrl,
> ret = -ETIMEDOUT;
> goto pm_put;
> }
> +
> + pm_runtime_put(ctrl->dev);
[Severity: High]
Won't this underflow the runtime PM usage counter on ctrl->dev after every
successful synchronous transfer?
Every caller of qcom_slim_ngd_xfer_msg_sync() (qcom_slim_ngd_enable_stream(),
qcom_slim_ngd_disable_stream(), and qcom_slim_ngd_get_laddr()) allocates a
transaction ID via slim_alloc_txn_tid(ctrl, &txn).
When the reply or ACK (SLIM_USR_MC_ADDR_REPLY or SLIM_USR_MC_GENERIC_ACK)
arrives in qcom_slim_ngd_rx(), it invokes slim_msg_response(), which already
completes txn->comp (&done) and drops the runtime PM reference:
drivers/slimbus/qcom-ngd-ctrl.c:qcom_slim_ngd_rx() {
...
if (mc == SLIM_MSG_MC_REPLY_INFORMATION ||
mc == SLIM_MSG_MC_REPLY_VALUE || (mc == SLIM_USR_MC_ADDR_REPLY &&
mt == SLIM_MSG_MT_SRC_REFERRED_USER) ||
(mc == SLIM_USR_MC_GENERIC_ACK &&
mt == SLIM_MSG_MT_SRC_REFERRED_USER)) {
slim_msg_response(&ctrl->ctrl, &buf[4], buf[3], len - 4);
pm_runtime_mark_last_busy(ctrl->ctrl.dev);
}
}
drivers/slimbus/messaging.c:slim_msg_response() {
...
slim_free_txn_tid(ctrl, txn);
memcpy(msg->rbuf, reply, len);
if (txn->comp)
complete(txn->comp);
/* Remove runtime-pm vote now that response was received for TID txn */
pm_runtime_mark_last_busy(ctrl->dev);
pm_runtime_put_autosuspend(ctrl->dev);
}
Because slim_msg_response() drops the runtime PM reference when the response
is received, only the error and timeout paths in qcom_slim_ngd_xfer_msg_sync()
(where slim_msg_response() is not reached, as handled in commit 63c60a226c90)
should call pm_runtime_put(ctrl->dev). Calling pm_runtime_put(ctrl->dev) on
the success path releases the single pm_runtime_get_sync(ctrl->dev) reference
a second time, which can cause premature runtime suspension of the controller.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104021424.1468172-1-vulab@iscas.ac.cn?part=1
next prev parent reply other threads:[~2026-11-04 2:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 2:14 [PATCH] slimbus: qcom-ngd-ctrl: drop the PM runtime reference after a sync transfer Wentao Liang
2026-11-04 2:21 ` sashiko-bot [this message]
2026-11-04 7:41 ` Krzysztof Kozlowski
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=sashiko-outbox-196442@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vulab@iscas.ac.cn \
/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