mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>,
	 Daniel Vetter <daniel@ffwll.ch>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Subject: Re: [PATCH] drm/mipi-dsi: Fix devm unregister & detach
Date: Wed, 26 Jun 2024 17:07:20 +0200	[thread overview]
Message-ID: <20240626-warping-nondescript-mustang-bfce27@houat> (raw)
In-Reply-To: <66ab4206-d1c8-4aad-99a7-c4c316e343a9@ideasonboard.com>

[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]

On Wed, Jun 26, 2024 at 12:55:39PM GMT, Tomi Valkeinen wrote:
> On 26/06/2024 11:49, Maxime Ripard wrote:
> > Hi,
> > 
> > On Wed, Jun 19, 2024 at 12:07:48PM GMT, Tomi Valkeinen wrote:
> > > From: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> > > 
> > > When a bridge driver uses devm_mipi_dsi_device_register_full() or
> > > devm_mipi_dsi_attach(), the resource management is moved to devres,
> > > which releases the resource automatically when the bridge driver is
> > > unbound.
> > > 
> > > However, if the DSI host goes away first, the host unregistration code
> > > will automatically detach and unregister any DSI peripherals, without
> > > notifying the devres about it. So when the bridge driver later is
> > > unbound, the resources are released a second time, leading to crash.
> > 
> > That's super surprising. mipi_dsi_device_unregister calls
> > device_unregister, which calls device_del, which in turn calls
> > devres_release_all.
> 
> Hmm, right.
> 
> > If that doesn't work like that, then it's what needs to be fixed, and
> > not worked around in the MIPI-DSI bus.
> 
> Well, something causes a crash for both the device register/unregister case
> and the attach/detach case, and the call stacks and debug prints showed a
> double unregister/detach...
> 
> I need to dig up the board and check again why the devres_release_all() in
> device_del() doesn't solve this. But I can probably only get back to this in
> August, so it's perhaps best to ignore this patch for now.
> 
> However, the attach/detach case is still valid? I see no devres calls in the
> detach paths.

I'm not sure what you mean by the attach/detach case. Do you expect
device resources allocated in attach to be freed when detach run?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2024-06-26 15:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19  9:07 Tomi Valkeinen
2024-06-26  8:49 ` Maxime Ripard
2024-06-26  9:55   ` Tomi Valkeinen
2024-06-26 15:07     ` Maxime Ripard [this message]
2024-06-26 15:53       ` Tomi Valkeinen
2024-07-02 11:43         ` Maxime Ripard
2024-07-15  8:32           ` Tomi Valkeinen
2024-07-25 11:28             ` Maxime Ripard
2024-08-07 12:19               ` Tomi Valkeinen
2024-09-02  9:26                 ` Maxime Ripard
2024-09-02 10:50                   ` Daniel Vetter
2024-09-02 12:31                     ` Tomi Valkeinen
2024-09-03  7:40                       ` Simona Vetter
2024-09-03  8:27                         ` Tomi Valkeinen
2024-09-03 11:14                           ` Simona Vetter
2024-09-03 11:56                       ` Maxime Ripard
2024-09-03 12:43                         ` Simona Vetter
2024-09-03 13:05                         ` Tomi Valkeinen
2024-09-03 17:36                           ` Simona Vetter

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=20240626-warping-nondescript-mustang-bfce27@houat \
    --to=mripard@kernel.org \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=tomi.valkeinen+renesas@ideasonboard.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®