All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guillaume La Roque" <glaroque@baylibre.com>
Cc: dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH 7/8] drm/meson: serialize OSD state updates with the IRQ
Date: Mon, 30 Nov 2026 22:14:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-242088@kernel.org> (raw)
In-Reply-To: <20261130-meson-g12a-osd2-v1-7-aa982300c20e@baylibre.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/meson: missing event_lock around osd[0] disable in
  meson_crtc_atomic_disable()
--

commit e0db1ea984d5b9d13ce988817e791f6169eef00f
Author: Guillaume La Roque <glaroque@baylibre.com>

drm/meson: serialize OSD state updates with the IRQ

This commit uses event_lock to serialize OSD state updates and commit
flags across atomic flush, plane/CRTC disable, and the CRTC IRQ handler.

> diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
> index 55edb8e2e1af4..b2181151acd67 100644
> --- a/drivers/gpu/drm/meson/meson_crtc.c
> +++ b/drivers/gpu/drm/meson/meson_crtc.c
> @@ -170,13 +170,16 @@ static void meson_g12a_crtc_atomic_disable(struct drm_crtc *crtc,
>  {
>  	struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
>  	struct meson_drm *priv = meson_crtc->priv;
> +	unsigned long flags;
>  
>  	DRM_DEBUG_DRIVER("\n");
>  
>  	drm_crtc_vblank_off(crtc);
>  
> +	spin_lock_irqsave(&priv->drm->event_lock, flags);
>  	priv->viu.osd[0].enabled = false;
>  	priv->viu.osd[0].commit = false;
> +	spin_unlock_irqrestore(&priv->drm->event_lock, flags);
>  
>  	priv->viu.vd1_enabled = false;
>  	priv->viu.vd1_commit = false;

[Severity: Medium]
Should meson_crtc_atomic_disable() also take priv->drm->event_lock when
clearing priv->viu.osd[0].enabled and priv->viu.osd[0].commit?

drivers/gpu/drm/meson/meson_crtc.c:meson_crtc_atomic_disable() {
    ...
	drm_crtc_vblank_off(crtc);

	priv->viu.osd[0].enabled = false;
	priv->viu.osd[0].commit = false;
    ...
	/* Disable VPP Postblend */
	writel_bits_relaxed(VPP_OSD1_POSTBLEND | VPP_VD1_POSTBLEND |
			    VPP_VD1_PREBLEND | VPP_POSTBLEND_ENABLE, 0,
			    priv->io_base + _REG(VPP_MISC));
    ...
}

drm_crtc_vblank_off() does not disable hardware vsync when vsync_forced is
set (e.g. on GXM with AFBCD active) and does not wait for an in-flight
meson_crtc_irq() to complete.  Without event_lock,
meson_crtc_atomic_disable() can run concurrently with meson_crtc_irq() on
non-G12A SoCs:

CPU0                              CPU1
meson_crtc_irq()                  meson_crtc_atomic_disable()
  spin_lock_irqsave(&event_lock)
  if (osd[0].enabled &&
      osd[0].commit)
                                    osd[0].enabled = false;
                                    osd[0].commit = false;
                                    writel_bits_relaxed(..., 0,
                                                        ... + _REG(VPP_MISC))
    meson_crtc_enable_osd1()
      writel_bits_relaxed(
        VPP_OSD1_POSTBLEND, ...,
        ... + _REG(VPP_MISC))     <-- re-enables OSD1 / races on VPP_MISC
    afbcd.ops->enable()
  spin_unlock_irqrestore(&event_lock)

This can corrupt the read-modify-write on VPP_MISC or leave OSD1 and AFBCD
enabled after CRTC disable.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-meson-g12a-osd2-v1-0-aa982300c20e@baylibre.com?part=7

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Guillaume La Roque" <glaroque@baylibre.com>
Cc: dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH 7/8] drm/meson: serialize OSD state updates with the IRQ
Date: Mon, 30 Nov 2026 22:14:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-242088@kernel.org> (raw)
In-Reply-To: <20261130-meson-g12a-osd2-v1-7-aa982300c20e@baylibre.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/meson: missing event_lock around osd[0] disable in
  meson_crtc_atomic_disable()
--

commit e0db1ea984d5b9d13ce988817e791f6169eef00f
Author: Guillaume La Roque <glaroque@baylibre.com>

drm/meson: serialize OSD state updates with the IRQ

This commit uses event_lock to serialize OSD state updates and commit
flags across atomic flush, plane/CRTC disable, and the CRTC IRQ handler.

> diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
> index 55edb8e2e1af4..b2181151acd67 100644
> --- a/drivers/gpu/drm/meson/meson_crtc.c
> +++ b/drivers/gpu/drm/meson/meson_crtc.c
> @@ -170,13 +170,16 @@ static void meson_g12a_crtc_atomic_disable(struct drm_crtc *crtc,
>  {
>  	struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
>  	struct meson_drm *priv = meson_crtc->priv;
> +	unsigned long flags;
>  
>  	DRM_DEBUG_DRIVER("\n");
>  
>  	drm_crtc_vblank_off(crtc);
>  
> +	spin_lock_irqsave(&priv->drm->event_lock, flags);
>  	priv->viu.osd[0].enabled = false;
>  	priv->viu.osd[0].commit = false;
> +	spin_unlock_irqrestore(&priv->drm->event_lock, flags);
>  
>  	priv->viu.vd1_enabled = false;
>  	priv->viu.vd1_commit = false;

[Severity: Medium]
Should meson_crtc_atomic_disable() also take priv->drm->event_lock when
clearing priv->viu.osd[0].enabled and priv->viu.osd[0].commit?

drivers/gpu/drm/meson/meson_crtc.c:meson_crtc_atomic_disable() {
    ...
	drm_crtc_vblank_off(crtc);

	priv->viu.osd[0].enabled = false;
	priv->viu.osd[0].commit = false;
    ...
	/* Disable VPP Postblend */
	writel_bits_relaxed(VPP_OSD1_POSTBLEND | VPP_VD1_POSTBLEND |
			    VPP_VD1_PREBLEND | VPP_POSTBLEND_ENABLE, 0,
			    priv->io_base + _REG(VPP_MISC));
    ...
}

drm_crtc_vblank_off() does not disable hardware vsync when vsync_forced is
set (e.g. on GXM with AFBCD active) and does not wait for an in-flight
meson_crtc_irq() to complete.  Without event_lock,
meson_crtc_atomic_disable() can run concurrently with meson_crtc_irq() on
non-G12A SoCs:

CPU0                              CPU1
meson_crtc_irq()                  meson_crtc_atomic_disable()
  spin_lock_irqsave(&event_lock)
  if (osd[0].enabled &&
      osd[0].commit)
                                    osd[0].enabled = false;
                                    osd[0].commit = false;
                                    writel_bits_relaxed(..., 0,
                                                        ... + _REG(VPP_MISC))
    meson_crtc_enable_osd1()
      writel_bits_relaxed(
        VPP_OSD1_POSTBLEND, ...,
        ... + _REG(VPP_MISC))     <-- re-enables OSD1 / races on VPP_MISC
    afbcd.ops->enable()
  spin_unlock_irqrestore(&event_lock)

This can corrupt the read-modify-write on VPP_MISC or leave OSD1 and AFBCD
enabled after CRTC disable.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-meson-g12a-osd2-v1-0-aa982300c20e@baylibre.com?part=7

  reply	other threads:[~2026-11-30 22:14 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 21:57 [PATCH 0/8] drm/meson: add a second RGB plane on G12A Guillaume La Roque
2026-11-30 21:57 ` Guillaume La Roque
2026-11-30 21:57 ` [PATCH 1/8] drm/meson: honor framebuffer offsets for the primary plane Guillaume La Roque
2026-11-30 21:57   ` Guillaume La Roque
2026-12-01  8:21   ` Neil Armstrong
2026-12-01  8:21     ` Neil Armstrong
2026-11-30 21:57 ` [PATCH 2/8] drm/meson: isolate primary plane scaler setup Guillaume La Roque
2026-11-30 21:57   ` Guillaume La Roque
2026-11-30 21:57 ` [PATCH 3/8] drm/meson: keep RGB scanout state per OSD Guillaume La Roque
2026-11-30 21:57   ` Guillaume La Roque
2026-11-30 21:57 ` [PATCH 4/8] drm/meson: parameterize the G12A OSD color matrix setup Guillaume La Roque
2026-11-30 21:57   ` Guillaume La Roque
2026-12-01  8:28   ` Neil Armstrong
2026-12-01  8:28     ` Neil Armstrong
2026-11-30 21:57 ` [PATCH 5/8] drm/meson: handle primary plane zpos allocation failure Guillaume La Roque
2026-11-30 21:57   ` Guillaume La Roque
2026-12-01  8:26   ` Neil Armstrong
2026-12-01  8:26     ` Neil Armstrong
2026-11-30 21:57 ` [PATCH 6/8] drm/meson: select RGB plane registers by OSD index Guillaume La Roque
2026-11-30 21:57   ` Guillaume La Roque
2026-12-01  8:32   ` Neil Armstrong
2026-12-01  8:32     ` Neil Armstrong
2026-11-30 21:57 ` [PATCH 7/8] drm/meson: serialize OSD state updates with the IRQ Guillaume La Roque
2026-11-30 21:57   ` Guillaume La Roque
2026-11-30 22:14   ` sashiko-bot [this message]
2026-11-30 22:14     ` sashiko-bot
2026-11-30 21:57 ` [PATCH 8/8] drm/meson: add a linear RGB overlay on G12A OSD2 Guillaume La Roque
2026-11-30 21:57   ` Guillaume La Roque
2026-11-30 22:16   ` sashiko-bot
2026-11-30 22:16     ` sashiko-bot

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-242088@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=glaroque@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --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.