All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Douglas Anderson <dianders@chromium.org>,
	dri-devel@lists.freedesktop.org,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Philip Chen <philipchen@chromium.org>,
	Sankeerth Billakanti <quic_sbillaka@quicinc.com>,
	Robert Foss <robert.foss@linaro.org>,
	freedreno@lists.freedesktop.org,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	linux-arm-msm@vger.kernel.org, Stephen Boyd <swboyd@chromium.org>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/4] drm/bridge: Add devm_drm_bridge_add()
Date: Wed, 8 Jun 2022 17:50:15 +0200	[thread overview]
Message-ID: <YqDFNx0Oim9RBIMf@phenom.ffwll.local> (raw)
In-Reply-To: <20220521091751.opeiqbmc5c2okdq6@houat>

On Sat, May 21, 2022 at 11:17:51AM +0200, Maxime Ripard wrote:
> Hi,
> 
> On Tue, May 10, 2022 at 12:29:43PM -0700, Douglas Anderson wrote:
> > This adds a devm managed version of drm_bridge_add(). Like other
> > "devm" function listed in drm_bridge.h, this function takes an
> > explicit "dev" to use for the lifetime management. A few notes:
> > * In general we have a "struct device" for bridges that makes a good
> >   candidate for where the lifetime matches exactly what we want.
> > * The "bridge->dev->dev" device appears to be the encoder
> >   device. That's not the right device to use for lifetime management.
> > 
> > Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> 
> If we are to introduce more managed helpers, I think it'd be wiser to
> introduce them as DRM-managed, and not device managed.
> 
> Otherwise, you'll end up in a weird state when a device has been removed
> but the DRM device is still around.

Top-level post since I didn't see any good place to reply in the thread
below:

- devm is for device stuff, which drm_bridge is (it's not uapi visible in
  any way or fasion)

- drmm is for uapi visible stuff (like drm_encoder)

Yes the uapi-visible stuff can outlive the device-related pieces. The way
to handle this is:

- drm_dev_unplug() when the device disappears underneath you (or just a
  part, I guess the infra for that doesn't exist yet and maybe we should
  add it).

- drm_dev_enter/exit wrapped around the device related parts.

Iow, this patch here I think is the right direction, and gets my

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

But also, it's definitely not a complete solution as the discussion in the
thread here points out.

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Sankeerth Billakanti <quic_sbillaka@quicinc.com>,
	Philip Chen <philipchen@chromium.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>,
	linux-arm-msm@vger.kernel.org,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	dri-devel@lists.freedesktop.org,
	Douglas Anderson <dianders@chromium.org>,
	Robert Foss <robert.foss@linaro.org>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Stephen Boyd <swboyd@chromium.org>,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/4] drm/bridge: Add devm_drm_bridge_add()
Date: Wed, 8 Jun 2022 17:50:15 +0200	[thread overview]
Message-ID: <YqDFNx0Oim9RBIMf@phenom.ffwll.local> (raw)
In-Reply-To: <20220521091751.opeiqbmc5c2okdq6@houat>

On Sat, May 21, 2022 at 11:17:51AM +0200, Maxime Ripard wrote:
> Hi,
> 
> On Tue, May 10, 2022 at 12:29:43PM -0700, Douglas Anderson wrote:
> > This adds a devm managed version of drm_bridge_add(). Like other
> > "devm" function listed in drm_bridge.h, this function takes an
> > explicit "dev" to use for the lifetime management. A few notes:
> > * In general we have a "struct device" for bridges that makes a good
> >   candidate for where the lifetime matches exactly what we want.
> > * The "bridge->dev->dev" device appears to be the encoder
> >   device. That's not the right device to use for lifetime management.
> > 
> > Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> 
> If we are to introduce more managed helpers, I think it'd be wiser to
> introduce them as DRM-managed, and not device managed.
> 
> Otherwise, you'll end up in a weird state when a device has been removed
> but the DRM device is still around.

Top-level post since I didn't see any good place to reply in the thread
below:

- devm is for device stuff, which drm_bridge is (it's not uapi visible in
  any way or fasion)

- drmm is for uapi visible stuff (like drm_encoder)

Yes the uapi-visible stuff can outlive the device-related pieces. The way
to handle this is:

- drm_dev_unplug() when the device disappears underneath you (or just a
  part, I guess the infra for that doesn't exist yet and maybe we should
  add it).

- drm_dev_enter/exit wrapped around the device related parts.

Iow, this patch here I think is the right direction, and gets my

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

But also, it's definitely not a complete solution as the discussion in the
thread here points out.

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  parent reply	other threads:[~2022-06-08 15:50 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 19:29 [PATCH v3 0/4] drm/dp: Make DP AUX bus usage easier; use it on ps8640 Douglas Anderson
2022-05-10 19:29 ` Douglas Anderson
2022-05-10 19:29 ` [PATCH v3 1/4] drm/dp: Export symbol / kerneldoc fixes for DP AUX bus Douglas Anderson
2022-05-10 19:29   ` Douglas Anderson
2022-05-11  0:20   ` Dmitry Baryshkov
2022-05-11  0:20     ` Dmitry Baryshkov
2022-05-20 20:27   ` Doug Anderson
2022-05-20 20:27     ` Doug Anderson
2022-06-01 20:29   ` Dmitry Baryshkov
2022-06-01 20:29     ` Dmitry Baryshkov
2022-05-10 19:29 ` [PATCH v3 2/4] drm/dp: Add callbacks to make using DP AUX bus properly easier Douglas Anderson
2022-05-10 19:29   ` Douglas Anderson
2022-06-01 20:35   ` Dmitry Baryshkov
2022-06-01 20:35     ` Dmitry Baryshkov
2022-05-10 19:29 ` [PATCH v3 3/4] drm/bridge: Add devm_drm_bridge_add() Douglas Anderson
2022-05-10 19:29   ` Douglas Anderson
2022-05-11  0:22   ` Dmitry Baryshkov
2022-05-11  0:22     ` Dmitry Baryshkov
2022-05-20 20:28     ` Doug Anderson
2022-05-20 20:28       ` Doug Anderson
2022-05-21  9:17   ` Maxime Ripard
2022-05-21  9:17     ` Maxime Ripard
2022-05-23 17:00     ` Doug Anderson
2022-05-23 17:00       ` Doug Anderson
2022-05-31 21:06       ` Doug Anderson
2022-05-31 21:06         ` Doug Anderson
2022-06-03  8:21         ` Maxime Ripard
2022-06-03  8:21           ` Maxime Ripard
2022-06-03 10:19           ` Dmitry Baryshkov
2022-06-03 10:19             ` Dmitry Baryshkov
2022-06-03 13:52             ` Doug Anderson
2022-06-03 13:52               ` Doug Anderson
2022-06-03 14:16               ` Maxime Ripard
2022-06-03 14:16                 ` Maxime Ripard
2022-06-03 14:14             ` Maxime Ripard
2022-06-03 14:14               ` Maxime Ripard
2022-06-03 14:56               ` Doug Anderson
2022-06-03 14:56                 ` Doug Anderson
2022-06-09 13:30                 ` Maxime Ripard
2022-06-09 13:30                   ` Maxime Ripard
2022-06-08 15:50     ` Daniel Vetter [this message]
2022-06-08 15:50       ` Daniel Vetter
2022-05-10 19:29 ` [PATCH v3 4/4] drm/bridge: parade-ps8640: Handle DP AUX more properly Douglas Anderson
2022-05-10 19:29   ` Douglas Anderson
2022-06-01 20:46   ` Dmitry Baryshkov
2022-06-01 20:46     ` Dmitry Baryshkov
2022-05-31 21:03 ` [PATCH v3 0/4] drm/dp: Make DP AUX bus usage easier; use it on ps8640 Doug Anderson
2022-05-31 21:03   ` Doug Anderson
2022-06-02 22:18 ` Doug Anderson
2022-06-02 22:18   ` Doug Anderson

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=YqDFNx0Oim9RBIMf@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=hsinyi@chromium.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime@cerno.tech \
    --cc=philipchen@chromium.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_sbillaka@quicinc.com \
    --cc=robert.foss@linaro.org \
    --cc=swboyd@chromium.org \
    --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 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.