dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guangshuo Li" <lgs201920130244@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] gpu: ipu-v3: prg: fix clock cleanup on remove
Date: Sun, 13 Sep 2026 13:21:11 +0000	[thread overview]
Message-ID: <20260913132112.165FE1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260913131117.1561280-1-lgs201920130244@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but a sleeping function `readl_poll_timeout` is used in a display driver function designed to be called from the atomic commit path.
- [High] This problem wasn't introduced by this patch, but the return value of `pm_runtime_get_sync()` is ignored, leading to unclocked hardware register access on failure.
--

commit e147aed08964b1f246d1a5b035f162b665564efa
Author: Guangshuo Li <lgs201920130244@gmail.com>

gpu: ipu-v3: prg: fix clock cleanup on remove

ipu_prg_probe() enables the IPG and AXI clocks before enabling runtime
PM. The clocks are subsequently controlled by the runtime suspend and
resume callbacks.

> diff --git a/drivers/gpu/ipu-v3/ipu-prg.c b/drivers/gpu/ipu-v3/ipu-prg.c
> index d38d3ba54d722..93033e847d0e5 100644
> --- a/drivers/gpu/ipu-v3/ipu-prg.c
> +++ b/drivers/gpu/ipu-v3/ipu-prg.c

[ ... ]

While reviewing this file, I noticed a few pre-existing issues regarding
runtime PM and atomic context that might be worth addressing.

drivers/gpu/ipu-v3/ipu-prg.c:ipu_prg_channel_disable() {
    ...
	pm_runtime_get_sync(prg->dev);

	val = readl(prg->regs + IPU_PRG_CTL);
	val |= IPU_PRG_CTL_BYPASS(prg_chan);
	writel(val, prg->regs + IPU_PRG_CTL);
    ...
}

[Severity: High]
This isn't a bug introduced by this patch, but the return value of
pm_runtime_get_sync() is ignored, leading to potential unclocked hardware
register access on failure.

If clk_prepare_enable() fails during resume, the clocks remain disabled.

Is it possible for the hardware to trigger a Synchronous External Abort (AXI
bus error) and a kernel panic when readl() and writel() unconditionally access
the unclocked registers immediately after?

The same pattern also exists in ipu_prg_channel_configure():

drivers/gpu/ipu-v3/ipu-prg.c:ipu_prg_channel_configure() {
    ...
	pm_runtime_get_sync(prg->dev);

	val = (stride - 1) & IPU_PRG_STRIDE_STRIDE_MASK;
	writel(val, prg->regs + IPU_PRG_STRIDE(prg_chan));
    ...
}

[Severity: High]
This isn't a bug introduced by this patch, but the return value of
pm_runtime_get_sync() is also ignored here.

Should we check the return value and handle the error to prevent unclocked
access?

drivers/gpu/ipu-v3/ipu-prg.c:ipu_prg_channel_configure() {
    ...
	/* wait for both double buffers to be filled */
	readl_poll_timeout(prg->regs + IPU_PRG_STATUS, val,
			   (val & IPU_PRG_STATUS_BUFFER0_READY(prg_chan)) &&
			   (val & IPU_PRG_STATUS_BUFFER1_READY(prg_chan)),
			   5, 1000);
    ...
}

[Severity: High]
This isn't a bug introduced by this patch, but a sleeping function
readl_poll_timeout() is used in a display driver function designed to be
called from the atomic commit path.

ipu_prg_channel_configure() is called from ipu_plane_atomic_update(), which is
a plane atomic update callback.

Since readl_poll_timeout() internally calls usleep_range() and will sleep,
could this trigger might_sleep() warnings or deadlocks in the atomic commit
path? 

Should readl_poll_timeout_atomic() be used here instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260913131117.1561280-1-lgs201920130244@gmail.com?part=1

      reply	other threads:[~2026-09-13 13:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13 13:11 [PATCH] gpu: ipu-v3: prg: fix clock cleanup on remove Guangshuo Li
2026-09-13 13:21 ` sashiko-bot [this message]

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=20260913132112.165FE1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lgs201920130244@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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