From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: tomi.valkeinen@ti.com, dri-devel@lists.freedesktop.org,
Jyri Sarha <jsarha@ti.com>
Subject: Re: [PATCH] drm/drm_bridge: adjust bridge module's refcount
Date: Wed, 30 Nov 2016 11:39:34 +0200 [thread overview]
Message-ID: <3478034.JaDBSRZ5xn@avalon> (raw)
In-Reply-To: <cd94ffa6-edb4-c509-a133-8f4c355ce72a@samsung.com>
Hi Andrzej,
On Wednesday 30 Nov 2016 10:26:24 Andrzej Hajda wrote:
> On 30.11.2016 09:16, Laurent Pinchart wrote:
> > On Wednesday 30 Nov 2016 09:11:56 Andrzej Hajda wrote:
> >> On 29.11.2016 22:12, Jyri Sarha wrote:
> >>> Store the module that provides the bridge and adjust its refcount
> >>> accordingly. The bridge module unload should not be allowed while the
> >>> bridge is attached.
> >>
> >> Module refcounting as a way of preventing driver from unbinding
> >> is quite popular, but as other developers said already is incorrect
> >> solution - it does not really prevent from unbinding and is a hack.
> >
> > Absolutely, module refcounting must not be used as a way to prevent
> > unbinding, but it's still necessary to prevent functions from
> > disappearing. The unbinding race has to be fixed through reference
> > counting to prevent objects from being freed, but if an object contains
> > function pointers that refer to code part of a module, object refcounting
> > won't prevent the code from being removed. Only module refcounting helps
> > there. The two techniques are thus complementary.
>
> It is not true. There at least two existing and proper solutions, which
> do not use refcounting:
>
> 1. components - if you put the bridge into component framework, it will
> bring down drm device before detaching the bridge.
Don't get me started on that one. The component concept is fine, its
implementation less so. It's on my (long) to-do list of things to fix.
> 2. proper callbacks from the provider (bridge in this case) to the
> consumer (encoder or drm device). Such callbacks exists for example in
> case of MIPI-DSI panels attached to encoders. On removal
> panel calls mipi_dsi_detach, which calls .detach ops in associated
> encoder, encoder safely disables the video pipeline and the panel
> continue its removal.
*safely* is the keyword here. I have yet to see a solution based on a removal
notification callback that is both race-free and easy to use in drivers.
> Of course both solutions have some pitfalls, the first one removes whole
> drmdev instead of disabling one pipeline,
The DRM subsystem doesn't have hotplug support (except for displayed connected
to connectors of course), let alone hot-unplug support. That should be fixed,
but will be a very long term goal.
Regardless of that, the component framework also relies on a removal
notification callback, which has the same drawback as the DSI one. Handling
this in a race-free way is complex. Seeing how drivers fail at simple things
(such as calling to drm_bridge_detach(), which all but one driver fail to do),
I'd be surprised if even a single driver got the component unbind handling
right.
> the second one is specific for DSI bus, but they clearly shows refcounting
> is not the only option.
Sorry, I meant the only working and (more or less) simple option ;-)
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-11-30 9:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20161129211315epcas3p2a805abe8449509312f481ab7dcea96ef@epcas3p2.samsung.com>
2016-11-29 21:12 ` [PATCH] drm/drm_bridge: adjust bridge module's refcount Jyri Sarha
2016-11-29 21:30 ` Jyri Sarha
2016-11-29 22:06 ` Laurent Pinchart
2016-11-30 8:13 ` Daniel Vetter
2016-11-30 8:25 ` Laurent Pinchart
2016-11-30 9:12 ` Daniel Vetter
2016-11-30 9:56 ` Laurent Pinchart
2016-11-30 10:55 ` Daniel Vetter
2016-11-30 11:03 ` Laurent Pinchart
2016-11-30 13:09 ` Daniel Vetter
2016-12-01 7:07 ` Andrzej Hajda
2016-12-01 7:18 ` Daniel Vetter
2016-12-01 13:22 ` Andrzej Hajda
2016-12-01 15:12 ` Daniel Vetter
2016-12-02 6:49 ` Andrzej Hajda
2016-11-30 8:32 ` Jyri Sarha
2016-11-30 8:37 ` Laurent Pinchart
2016-11-30 8:55 ` Jyri Sarha
2016-11-30 9:03 ` Laurent Pinchart
2016-11-30 9:13 ` Jyri Sarha
2016-11-30 9:30 ` Laurent Pinchart
2016-11-30 8:11 ` Andrzej Hajda
2016-11-30 8:16 ` Laurent Pinchart
2016-11-30 9:26 ` Andrzej Hajda
2016-11-30 9:39 ` Laurent Pinchart [this message]
2016-12-01 6:50 ` Andrzej Hajda
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=3478034.JaDBSRZ5xn@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=a.hajda@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jsarha@ti.com \
--cc=tomi.valkeinen@ti.com \
/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