mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Bing Bu Cao <bingbu.cao@linux.intel.com>, linux-kernel@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tian Shu Qiu <tian.shu.qiu@intel.com>,
	Jian Xu Zheng <jian.xu.zheng@intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Yong Zhi <yong.zhi@intel.com>, Bingbu Cao <bingbu.cao@intel.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] media: intel-ipu3: cio2: register the mdev on v4l2 async notifier complete
Date: Mon, 3 Sep 2018 09:35:48 +0200	[thread overview]
Message-ID: <c1e54228-a21a-b4a2-1083-c75b2dda797c@redhat.com> (raw)
In-Reply-To: <cd307d41-ed19-5ab0-cbdb-a743cdb76e09@linux.intel.com>

Hi,

Thanks a lot your feedback.

On 09/03/2018 09:25 AM, Bing Bu Cao wrote:
> 
> 
> On 08/31/2018 11:20 PM, Javier Martinez Canillas wrote:
>> Commit 9832e155f1ed ("[media] media-device: split media initialization and
>> registration") split the media_device_register() function in two, to avoid
>> a race condition that can happen when the media device node is accessed by
>> userpace before the pending subdevices have been asynchronously registered.
>>
>> But the ipu3-cio2 driver calls the media_device_register() function right
>> after calling media_device_init() which defeats the purpose of having two
>> separate functions.
>>
>> In that case, userspace could have a partial view of the media device if
>> it opened the media device node before all the pending devices have been
>> bound. So instead, only register the media device once all pending v4l2
>> subdevices have been registered.
> Javier, Thanks for your patch.
> IMHO, there are no big differences for registering the cio2 before and after all the subdevices are ready.
> User may see a partial view of media graph but it presents what it really is then.
> It indicate that device is not available currently not it is not there.

I disagree that there are no differences. The media graph shouldn't be exposed
until its complete. That's the reason why we have a v4l2 async notifier .bound
and .complete callbacks (otherwise the .bound would be enough).

It's also the reason why media register was split in _init and _register, as I
mentioned in the commit message.

> Could you help tell more details about your problem? The full context is helpful for me to reproduce your problem.

If an application opens the media device node, how it would know that has an
incomplete media graph? how it would know once the subdevice has been .bound
and that has to query the media graph again?

AFAIK there's no way to notify that information to user-space currenctly but
I may be wrong.

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat

  reply	other threads:[~2018-09-03  7:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31 15:20 Javier Martinez Canillas
2018-09-03  7:25 ` Bing Bu Cao
2018-09-03  7:35   ` Javier Martinez Canillas [this message]
2018-09-03  8:49     ` Bing Bu Cao
2018-09-03  8:52       ` Javier Martinez Canillas
2018-09-04  5:01         ` Qiu, Tian Shu
2018-09-04  6:46           ` Sakari Ailus
2018-09-04  7:52             ` Javier Martinez Canillas
2018-09-27 10:09             ` Hans Verkuil
2018-09-27 11:04               ` Javier Martinez Canillas
2018-09-04  8:46           ` Javier Martinez Canillas

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=c1e54228-a21a-b4a2-1083-c75b2dda797c@redhat.com \
    --to=javierm@redhat.com \
    --cc=bingbu.cao@intel.com \
    --cc=bingbu.cao@linux.intel.com \
    --cc=jian.xu.zheng@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=yong.zhi@intel.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

all inboxes | Powered by JetHome®