All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ze Huang" <ze.huang@oss.qualcomm.com>
To: <sashiko-reviews@lists.linux.dev>,
	"Ze Huang" <ze.huang@oss.qualcomm.com>
Cc: <Frank.Li@kernel.org>, <dri-devel@lists.freedesktop.org>,
	<imx@lists.linux.dev>
Subject: Re: [PATCH v2 6/8] drm/repaper: replace struct drm_simple_display_pipe with regular atomic helpers
Date: Sun, 19 Jul 2026 02:16:32 +0800	[thread overview]
Message-ID: <DK1WICQ7ML3R.302LNW6ENFBSP@oss.qualcomm.com> (raw)
In-Reply-To: <20260716092142.355731F000E9@smtp.kernel.org>

On Thu Jul 16, 2026 at 5:21 PM CST, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
>
> New issues:
> - [High] Missing CRTC active check in the plane's atomic_update callback causes the driver to send SPI framebuffer updates to a powered-off display panel.
>
> Pre-existing issues:
> - [High] The CRTC atomic enable/disable and plane atomic update callbacks execute sleeping functions and allocate memory with GFP_KERNEL, which is forbidden in atomic context.
> --
>
> --- Patch [6]: [PATCH v2 6/8] drm/repaper: replace struct drm_simple_display_pipe with regular atomic helpers ---
> commit 3d9748839d37276a557c720301a5a848296e54b7
> Author: Ze Huang <ze.huang@oss.qualcomm.com>
>
> drm/repaper: replace struct drm_simple_display_pipe with regular atomic helpers
>     
> Convert repaper to explicit primary plane, CRTC and encoder objects.
> Keep shadow-plane helpers, framebuffer access handling and no-scaling
> plane-state validation from simple-KMS path.
>
>> diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
>> index c8270591afc7f..7057075161c4d 100644
>> --- a/drivers/gpu/drm/tiny/repaper.c
>> +++ b/drivers/gpu/drm/tiny/repaper.c
>
> [ ... ]
>
>> -static void repaper_pipe_enable(struct drm_simple_display_pipe *pipe,
>> -				struct drm_crtc_state *crtc_state,
>> -				struct drm_plane_state *plane_state)
>> +static void repaper_crtc_helper_atomic_enable(struct drm_crtc *crtc,
>> +					      struct drm_atomic_commit *commit)
>>  {
>> -	struct repaper_epd *epd = drm_to_epd(pipe->crtc.dev);
>> +	struct repaper_epd *epd = drm_to_epd(crtc->dev);
>
> [Severity: High]
> This is a pre-existing issue, but do the CRTC atomic enable/disable and plane
> atomic update callbacks execute sleeping functions in atomic context?
>
> The DRM subsystem explicitly forbids sleeping in CRTC enable/disable and plane
> update callbacks. However:
> - repaper_crtc_helper_atomic_enable() calls usleep_range()
> - repaper_crtc_helper_atomic_disable() calls msleep()
> - repaper_plane_helper_atomic_update() calls repaper_fb_dirty(), which
>   allocates memory using GFP_KERNEL
>
> Since these operations are now wired directly to the standard atomic helpers
> which run in atomic context (for example, during non-blocking commits), can
> this cause system instability or deadlocks?
>

I think it is a false positive.

>
> [ ... ]
>
>> -static void repaper_pipe_update(struct drm_simple_display_pipe *pipe,
>> -				struct drm_plane_state *old_state)
>> +static void repaper_plane_helper_atomic_update(struct drm_plane *plane,
>> +					       struct drm_atomic_commit *commit)
>>  {
>> -	struct drm_plane_state *state = pipe->plane.state;
>> -	struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state);
>> +	struct drm_plane_state *old_pstate = drm_atomic_get_old_plane_state(commit, plane);
>> +	struct drm_plane_state *pstate = drm_atomic_get_new_plane_state(commit, plane);
>> +	struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(pstate);
>>  	struct drm_rect rect;
>>  
>> -	if (!pipe->crtc.state->active)
>> +	if (!pstate->fb)
>>  		return;
>>  
>> -	if (drm_atomic_helper_damage_merged(old_state, state, &rect))
>> -		repaper_fb_dirty(state->fb, shadow_plane_state->data,
>> +	if (drm_atomic_helper_damage_merged(old_pstate, pstate, &rect))
>> +		repaper_fb_dirty(pstate->fb, shadow_plane_state->data,
>>  				 &shadow_plane_state->fmtcnv_state);
>
> [Severity: High]
> Can this cause the driver to send SPI framebuffer updates to a powered-off
> display panel?
>
> The previous code checked !pipe->crtc.state->active here to ensure we
> do not update inactive displays. During a DPMS OFF request,
> drm_atomic_helper_commit_modeset_disables() runs first and disables the
> panel by calling repaper_crtc_helper_atomic_disable(). 
>
> Next, drm_atomic_helper_commit_planes() will still call this update
> function because active_only is not set by default and pstate->visible
> can remain true.
>
> Without the crtc_state->active check, doesn't this result in writing data
> to dead hardware via repaper_fb_dirty(), potentially causing SPI timeouts
> or driver hangs?
>

OK, I'll restore crtc state check here.

>>  }
>
> [ ... ]


  reply	other threads:[~2026-07-18 18:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  9:01 [PATCH v2 0/8] drm: replace simple display pipe users with atomic helpers Ze Huang
2026-07-16  9:01 ` [PATCH v2 1/8] drm/arcpgu: replace struct drm_simple_display_pipe with regular " Ze Huang
2026-07-16  9:15   ` sashiko-bot
2026-07-18 17:15     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 2/8] drm/aspeed: " Ze Huang
2026-07-16  9:27   ` sashiko-bot
2026-07-18 17:21     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 3/8] drm/mcde: " Ze Huang
2026-07-16  9:21   ` sashiko-bot
2026-07-18 17:52     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 4/8] drm/pl111: " Ze Huang
2026-07-16  9:26   ` sashiko-bot
2026-07-18 18:05     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 5/8] drm/gm12u320: " Ze Huang
2026-07-16  9:14   ` sashiko-bot
2026-07-17  7:18   ` Thomas Zimmermann
2026-07-18 15:42     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 6/8] drm/repaper: " Ze Huang
2026-07-16  9:21   ` sashiko-bot
2026-07-18 18:16     ` Ze Huang [this message]
2026-07-16  9:01 ` [PATCH v2 7/8] drm/tve200: " Ze Huang
2026-07-16  9:25   ` sashiko-bot
2026-07-18 18:22     ` Ze Huang
2026-07-16  9:02 ` [PATCH v2 8/8] drm/xen: " Ze Huang
2026-07-16  9:28   ` sashiko-bot
2026-07-18 18:50     ` Ze Huang

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=DK1WICQ7ML3R.302LNW6ENFBSP@oss.qualcomm.com \
    --to=ze.huang@oss.qualcomm.com \
    --cc=Frank.Li@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.