From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, sakari.ailus@iki.fi,
kyungmin.park@samsung.com, sw0312.kim@samsung.com,
a.hajda@samsung.com
Subject: Re: [RFC PATCH v2 0/2] Media entity links handling
Date: Mon, 10 Jun 2013 16:38:06 +0200 [thread overview]
Message-ID: <51B5E4CE.1000504@samsung.com> (raw)
In-Reply-To: <152314640.pO20KFaLY3@avalon>
Hi Laurent,
On 06/09/2013 10:23 PM, Laurent Pinchart wrote:
> Hi Sylwester,
>
> On Sunday 09 June 2013 21:41:37 Sylwester Nawrocki wrote:
>> Hi All,
>>
>> This small patch set adds a function for removing all links at a media
>> entity. I found out such a function is needed when media entites that
>> belong to a single media device have drivers in different kernel modules.
>> This means virtually all camera drivers, since sensors are separate
>> modules from the host interface drivers.
>>
>> More details can be found at each patch's description.
>
> The patches look good to me.
Thanks, I would push v3 upstream if everyone agrees. I think there is further
work to be done, to allow the media entities race-free access to their parent
media device and the graph mutex. For example, entity->parent->graph_mutex is
needed to access entity->stream_count in a subdev driver, but for that it needs
to be ensured that entity->parent doesn't change unexpectedly.
>> The links removal from a media entity is rather strightforward, but when
>> and where links should be created/removed is not immediately clear to me.
>>
>> I assumed that links should normally be created/removed when an entity
>> is registered to its media device, with the graph mutex held.
>>
>> I'm open to opinions whether it's good or not and possibly suggestions
>> on how those issues could be handled differently.
>
> It's a very good question. So far links were created at initialization time
> and assumed to stay until the device gets torn down. Existing drivers thus
> access the links without holding the graph mutex.
>
> An easy solution to fix race conditions at link creation time would be to take
> the graph mutex in media_entity_create_link(). We will still have to fix
> drivers to take the mutex when accessing links, I don't think there's a way
> around that. We also need to precisely define what the graph mutex protects
> and how drivers can access links and entities. This will become especially
> important when the media controller framework will be used in DRM/KMS.
I agree with that. Clear and documented semantics of the graph mutex is
essential. And it all really seems required for proper subdevs hotplugging,
deferred probing support etc.
Regards,
Sylwester
prev parent reply other threads:[~2013-06-10 14:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-09 19:41 [RFC PATCH v2 0/2] Media entity links handling Sylwester Nawrocki
2013-06-09 19:41 ` [RFC PATCH v2 1/2] media: Add a function removing all links of a media entity Sylwester Nawrocki
2013-06-09 19:41 ` [RFC PATCH v2 2/2] V4L: Remove all links of a media entity when unregistering subdev Sylwester Nawrocki
2013-06-09 20:23 ` [RFC PATCH v2 0/2] Media entity links handling Laurent Pinchart
2013-06-10 14:38 ` Sylwester Nawrocki [this message]
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=51B5E4CE.1000504@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=a.hajda@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
--cc=sw0312.kim@samsung.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