[PATCH v3 3/3] drm/exynos: exynos7_drm_decon: add vblank check in IRQ handling

Kaustabh Chakraborty posted 3 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH v3 3/3] drm/exynos: exynos7_drm_decon: add vblank check in IRQ handling
Posted by Kaustabh Chakraborty 3 months, 1 week ago
If there's support for another console device (such as a TTY serial),
the kernel occasionally panics during boot. The panic message and a
relevant snippet of the call stack is as follows:

  Unable to handle kernel NULL pointer dereference at virtual address 000000000000000
  Call trace:
    drm_crtc_handle_vblank+0x10/0x30 (P)
    decon_irq_handler+0x88/0xb4
    [...]

Otherwise, the panics don't happen. This indicates that it's some sort
of race condition.

Add a check to validate if the drm device can handle vblanks before
calling drm_crtc_handle_vblank() to avoid this.

Cc: stable@vger.kernel.org
Fixes: 96976c3d9aff ("drm/exynos: Add DECON driver")
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 43bcbe2e2917df43d7c2d27a9771e892628dd682..c0c0f23169c993ac315fc8d7bcbd09ea6ec9966a 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -636,6 +636,10 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
 	if (!ctx->drm_dev)
 		goto out;
 
+	/* check if crtc and vblank have been initialized properly */
+	if (!drm_dev_has_vblank(ctx->drm_dev))
+		goto out;
+
 	if (!ctx->i80_if) {
 		drm_crtc_handle_vblank(&ctx->crtc->base);
 

-- 
2.49.0
Re: [PATCH v3 3/3] drm/exynos: exynos7_drm_decon: add vblank check in IRQ handling
Posted by Inki Dae 3 months, 1 week ago
2025년 6월 27일 (금) 오전 4:21, Kaustabh Chakraborty <kauschluss@disroot.org>님이 작성:
>
> If there's support for another console device (such as a TTY serial),
> the kernel occasionally panics during boot. The panic message and a
> relevant snippet of the call stack is as follows:
>
>   Unable to handle kernel NULL pointer dereference at virtual address 000000000000000
>   Call trace:
>     drm_crtc_handle_vblank+0x10/0x30 (P)
>     decon_irq_handler+0x88/0xb4
>     [...]
>

It seems that if the display is already enabled by the bootloader
during the boot process, a vblank interrupt may be triggered before
the initialization of drm_dev is complete. This could be the root
cause of the issue.

Applied.

Thanks,
Inki Dae

> Otherwise, the panics don't happen. This indicates that it's some sort
> of race condition.
>
> Add a check to validate if the drm device can handle vblanks before
> calling drm_crtc_handle_vblank() to avoid this.
>
> Cc: stable@vger.kernel.org
> Fixes: 96976c3d9aff ("drm/exynos: Add DECON driver")
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
>  drivers/gpu/drm/exynos/exynos7_drm_decon.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> index 43bcbe2e2917df43d7c2d27a9771e892628dd682..c0c0f23169c993ac315fc8d7bcbd09ea6ec9966a 100644
> --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> @@ -636,6 +636,10 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
>         if (!ctx->drm_dev)
>                 goto out;
>
> +       /* check if crtc and vblank have been initialized properly */
> +       if (!drm_dev_has_vblank(ctx->drm_dev))
> +               goto out;
> +
>         if (!ctx->i80_if) {
>                 drm_crtc_handle_vblank(&ctx->crtc->base);
>
>
> --
> 2.49.0
>
>