From: Shuah Khan <shuahkh@osg.samsung.com>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: laurent.pinchart@ideasonboard.com, perex@perex.cz,
tiwai@suse.com, hans.verkuil@cisco.com, chehabrafael@gmail.com,
javier@osg.samsung.com, jh1009.sung@samsung.com,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
alsa-devel@alsa-project.org, Shuah Khan <shuahkh@osg.samsung.com>
Subject: Re: [RFC PATCH 2/4] media: Add Media Device Allocator API documentation
Date: Mon, 28 Mar 2016 15:14:35 -0600 [thread overview]
Message-ID: <56F99EBB.3070007@osg.samsung.com> (raw)
In-Reply-To: <20160328152821.18142532@recife.lan>
On 03/28/2016 12:28 PM, Mauro Carvalho Chehab wrote:
> Em Fri, 25 Mar 2016 22:38:43 -0600
> Shuah Khan <shuahkh@osg.samsung.com> escreveu:
>
>> Add Media Device Allocator API documentation.
>
> Please merge this with the previous patch.
Yes. I will merge them.
-- Shuah
>
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>> include/media/media-dev-allocator.h | 32 ++++++++++++++++++++++++++++++++
>> 1 file changed, 32 insertions(+)
>>
>> diff --git a/include/media/media-dev-allocator.h b/include/media/media-dev-allocator.h
>> index 2932c90..174840c 100644
>> --- a/include/media/media-dev-allocator.h
>> +++ b/include/media/media-dev-allocator.h
>> @@ -20,6 +20,38 @@
>>
>> #ifdef CONFIG_MEDIA_CONTROLLER
>> /**
>> + * DOC: Media Controller Device Allocator API
>> + * There are known problems with media device life time management. When media
>> + * device is released while an media ioctl is in progress, ioctls fail with
>> + * use-after-free errors and kernel hangs in some cases.
>> + *
>> + * Media Device can be in any the following states:
>> + *
>> + * - Allocated
>> + * - Registered (could be tied to more than one driver)
>> + * - Unregistered, not in use (media device file is not open)
>> + * - Unregistered, in use (media device file is not open)
>> + * - Released
>> + *
>> + * When media device belongs to more than one driver, registrations should be
>> + * refcounted to avoid unregistering when one of the drivers does unregister.
>> + * A refcount field in the struct media_device covers this case. Unregister on
>> + * a Media Allocator media device is a kref_put() call. The media device should
>> + * be unregistered only when the last unregister occurs.
>> + *
>> + * When a media device is in use when it is unregistered, it should not be
>> + * released until the application exits when it detects the unregistered
>> + * status. Media device that is in use when it is unregistered is moved to
>> + * to_delete_list. When the last unregister occurs, media device is unregistered
>> + * and becomes an unregistered, still allocated device. Unregister marks the
>> + * device to be deleted.
>> + *
>> + * When media device belongs to more than one driver, as both drivers could be
>> + * unbound/bound, driver should not end up getting stale media device that is
>> + * on its way out. Moving the unregistered media device to to_delete_list helps
>> + * this case as well.
>> + */
>> +/**
>> * media_device_get() - Allocate and return global media device
>> *
>> * @mdev
>
>
next prev parent reply other threads:[~2016-03-28 21:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-26 4:38 [RFC PATCH 0/4] Media Device Allocator API Shuah Khan
2016-03-26 4:38 ` [RFC PATCH 1/4] media: Add " Shuah Khan
2016-03-26 12:50 ` Joe Perches
2016-03-28 13:45 ` Shuah Khan
2016-03-28 18:28 ` Mauro Carvalho Chehab
2016-03-28 21:34 ` Shuah Khan
2016-04-05 16:19 ` Mauro Carvalho Chehab
2016-03-26 4:38 ` [RFC PATCH 2/4] media: Add Media Device Allocator API documentation Shuah Khan
2016-03-28 18:28 ` Mauro Carvalho Chehab
2016-03-28 21:14 ` Shuah Khan [this message]
2016-03-26 4:38 ` [RFC PATCH 3/4] media: Add refcount to keep track of media device registrations Shuah Khan
2016-03-28 18:28 ` Mauro Carvalho Chehab
2016-03-28 21:37 ` Shuah Khan
2016-04-05 16:23 ` Mauro Carvalho Chehab
2016-03-26 4:38 ` [RFC PATCH 4/4] drivers: change au0828, uvcvideo, snd-usb-audio to use Media Device Allocator Shuah Khan
2016-03-28 18:28 ` Mauro Carvalho Chehab
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=56F99EBB.3070007@osg.samsung.com \
--to=shuahkh@osg.samsung.com \
--cc=alsa-devel@alsa-project.org \
--cc=chehabrafael@gmail.com \
--cc=hans.verkuil@cisco.com \
--cc=javier@osg.samsung.com \
--cc=jh1009.sung@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.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