mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Douglas Anderson <dianders@chromium.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Bajjuri Praneeth <praneeth@ti.com>,
	Louis Chauvet <louis.chauvet@bootlin.com>,
	thomas.petazzoni@bootlin.com, Jyri Sarha <jyri.sarha@iki.fi>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Subject: Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
Date: Tue, 14 Oct 2025 18:21:22 +0200	[thread overview]
Message-ID: <20251014182122.5f63b027@kmaincent-XPS-13-7390> (raw)
In-Reply-To: <p4u2goyadub3dfuz4empf3g7a44b2ausy4hjjkcwj7nzgeochx@xztpij2i2lao>

Hello Maxime,

On Tue, 14 Oct 2025 17:36:47 +0200
Maxime Ripard <mripard@kernel.org> wrote:

> On Tue, Oct 14, 2025 at 04:32:28PM +0200, Kory Maincent wrote:
> > From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
> > 
> > The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> > should only be called when the device has been successfully registered.
> > Currently, these functions are called unconditionally in tilcdc_fini(),
> > which causes warnings during probe deferral scenarios.
> > 
> > [    7.972317] WARNING: CPU: 0 PID: 23 at
> > drivers/gpu/drm/drm_atomic_state_helper.c:175
> > drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [    8.005820]
> > drm_atomic_helper_crtc_duplicate_state from
> > drm_atomic_get_crtc_state+0x68/0x108 [    8.005858]
> > drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [
> >  8.005885]  drm_atomic_helper_disable_all from
> > drm_atomic_helper_shutdown+0x90/0x144 [    8.005911]
> > drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [
> > 8.005957]  tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
> > 
> > Fix this by moving both drm_kms_helper_poll_fini() and
> > drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> > block, ensuring they only execute after successful device registration.
> > 
> > Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at
> > shutdown/remove time for misc drivers") Signed-off-by: Kory Maincent
> > (TI.com) <kory.maincent@bootlin.com> ---
> >  drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 7caec4d38ddf..2031267a3490
> > 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > @@ -172,11 +172,11 @@ static void tilcdc_fini(struct drm_device *dev)
> >  	if (priv->crtc)
> >  		tilcdc_crtc_shutdown(priv->crtc);
> >  
> > -	if (priv->is_registered)
> > +	if (priv->is_registered) {
> >  		drm_dev_unregister(dev);
> > -
> > -	drm_kms_helper_poll_fini(dev);
> > -	drm_atomic_helper_shutdown(dev);
> > +		drm_kms_helper_poll_fini(dev);
> > +		drm_atomic_helper_shutdown(dev);
> > +	}
> >  	tilcdc_irq_uninstall(dev);
> >  	drm_mode_config_cleanup(dev);  
> 
> I don't think that's the right fix. tilcdc_fini is pretty complex
> because it gets called from multiple locations with various level of
> initialisation.
> 
> This is done because tilcdc_init is using a bunch of deprecated
> functions with better alternatives now, and those would make the job of
> tilcdc_fini much easier.
> 
> That's what we should be focusing on.

I am also currently focusing on improving this driver (which has indeed some
weird code leftover), but this work will land in drm misc next while this is a
fix for the current implementation which fix an unwanted warning.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

  reply	other threads:[~2025-10-14 16:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 14:32 Kory Maincent
2025-10-14 15:36 ` Maxime Ripard
2025-10-14 16:21   ` Kory Maincent [this message]
2025-10-21 13:14     ` Kory Maincent
2025-10-21 16:01       ` Maxime Ripard
2025-10-15  5:00 ` Swamil Jain
2025-10-22  7:05 ` Tomi Valkeinen
2025-10-22  8:58   ` Kory Maincent
2025-10-22  9:04     ` Kory Maincent

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=20251014182122.5f63b027@kmaincent-XPS-13-7390 \
    --to=kory.maincent@bootlin.com \
    --cc=airlied@gmail.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jyri.sarha@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louis.chauvet@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=praneeth@ti.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®