public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Cc: linux-media@vger.kernel.org, sakari.ailus@iki.fi,
	kyungmin.park@samsung.com, sw0312.kim@samsung.com,
	a.hajda@samsung.com, hj210.choi@samsung.com,
	s.nawrocki@samsung.com
Subject: Re: [RFC PATCH v2 0/2] Media entity links handling
Date: Sun, 09 Jun 2013 22:23:02 +0200	[thread overview]
Message-ID: <152314640.pO20KFaLY3@avalon> (raw)
In-Reply-To: <1370806899-17709-1-git-send-email-s.nawrocki@samsung.com>

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.

> 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.

-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2013-06-09 20:22 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 ` Laurent Pinchart [this message]
2013-06-10 14:38   ` [RFC PATCH v2 0/2] Media entity links handling Sylwester Nawrocki

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=152314640.pO20KFaLY3@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=hj210.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sakari.ailus@iki.fi \
    --cc=sw0312.kim@samsung.com \
    --cc=sylvester.nawrocki@gmail.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