From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, shuahkh@osg.samsung.com,
laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl
Subject: Re: [RFC 00/16] Make use of kref in media device, grab references as needed
Date: Fri, 15 Jul 2016 07:19:13 -0300 [thread overview]
Message-ID: <20160715071913.009908a1@recife.lan> (raw)
In-Reply-To: <1468535711-13836-1-git-send-email-sakari.ailus@linux.intel.com>
Em Fri, 15 Jul 2016 01:34:55 +0300
Sakari Ailus <sakari.ailus@linux.intel.com> escreveu:
> Hi folks,
>
> I've been working on this for some time now but only got the full patchset
> working some moments ago. The patchset properly, I believe, fixes the
> issue of removing a device whilst streaming.
>
> Media device is refcounted and its memory is only released once the last
> reference is gone: unregistering is simply unregistering, it no longer
> should release memory which could be further accessed.
>
> A video node or a sub-device node also gets a reference to the media
> device, i.e. the release function of the video device node will release
> its reference to the media device. The same goes for file handles to the
> media device.
>
> As a side effect of refcounting the media device, it is allocate together
> with the media devnode. The driver may also rely its own resources to the
> media device. Alternatively there's also a priv field to hold drivers
> private pointer (for container_of() is an option in this case).
>
> I've tested this by manually unbinding the omap3isp platform device while
> streaming. Driver changes are required for this to work; by not using
> dynamic allocation (i.e. media_device_alloc()) the old behaviour is still
> supported. This is still unlikely to be a grave problem as there are not
> that many device drivers that support physically removable devices. We've
> had this problem for other devices for many years without paying much
> notice --- that doesn't mean I don't think at least drivers for removable
> devices shouldn't be changed as part of the set later on, I'd just like to
> get review comments on the approach first.
>
> The three patches that originally partially resolved some of these issues
> are reverted in the beginning of the set. I'm still posting this as an RFC
> mainly since the testing is somewhat limited so far.
I didn't look inside this patch series. Won't likely have time to
look at core changes before the end of the merge window. However,
I found several structural problems on this RFC:
1) Please do incremental changes, instead of reverting patches. It is
really hard for reviewers to be sure that nothing breaks when someone
simply reverts a previous approach and add its own.
2) Each individual patch should not cause regressions to none of
the existing drivers or to the core. The revert re-introduces bugs.
3) Each patch should not break compilation. Patch 06/16, for example,
changes the structure used by the release method:
-static void media_device_release(struct media_devnode *mdev)
+static void media_device_release(struct media_devnode *devnode)
Without touching a single driver. That means compilation breakages.
This is not acceptable upstream.
It should be touching *all* drivers that use the function altogether.
4) From a very quick look at the series, without trying to compile the
series (with would very likely break), it seems that all drivers that
uses the media controller should be migrated to the new way.
It means that you'll need to patch all drivers altogether as you're
changing the kAPI at the same patch you change it.
So, please rework your patch series to make it easier for everybody
to review and test it.
Thanks,
Mauro
next prev parent reply other threads:[~2016-07-15 10:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 22:34 [RFC 00/16] Make use of kref in media device, grab references as needed Sakari Ailus
2016-07-14 22:34 ` [RFC 01/16] Revert "[media] media: fix media devnode ioctl/syscall and unregister race" Sakari Ailus
2016-07-14 22:34 ` [RFC 02/16] Revert "[media] media: fix use-after-free in cdev_put() when app exits after driver unbind" Sakari Ailus
2016-07-14 22:34 ` [RFC 03/16] Revert "[media] media-device: dynamically allocate struct media_devnode" Sakari Ailus
2016-07-14 22:34 ` [RFC 04/16] media: Remove useless curly braces and parentheses Sakari Ailus
2016-07-14 22:35 ` [RFC 05/16] media: devnode: Refcount the media devnode Sakari Ailus
2016-08-02 12:12 ` Hans Verkuil
2016-08-05 10:59 ` Sakari Ailus
2016-07-14 22:35 ` [RFC 06/16] media: Dynamically allocate the media device Sakari Ailus
2016-07-14 22:35 ` [RFC 07/16] media-device: struct media_device requires struct device Sakari Ailus
2016-07-14 22:35 ` [RFC 08/16] media: Provide a way to the driver to set a private pointer Sakari Ailus
2016-07-14 22:35 ` [RFC 09/16] media: Add release callback for media device Sakari Ailus
2016-07-14 22:35 ` [RFC 10/16] media: Document media device allocation API Sakari Ailus
2016-07-14 22:35 ` [RFC 11/16] v4l: Acquire a reference to the media device for every video device Sakari Ailus
2016-07-14 22:35 ` [RFC 12/16] media: Shuffle functions around Sakari Ailus
2016-07-14 22:35 ` [RFC 13/16] media-device: Postpone graph object removal until free Sakari Ailus
2016-07-14 22:35 ` [RFC 14/16] omap3isp: Allocate the media device dynamically Sakari Ailus
2016-07-14 22:35 ` [RFC 15/16] omap3isp: Release the isp device struct by media device callback Sakari Ailus
2016-07-14 22:35 ` [RFC 16/16] omap3isp: Don't rely on devm for memory resource management Sakari Ailus
2016-07-15 10:19 ` Mauro Carvalho Chehab [this message]
2016-07-19 7:27 ` [RFC 00/16] Make use of kref in media device, grab references as needed Sakari Ailus
2016-07-19 7:52 ` Sakari Ailus
2016-07-19 11:50 ` 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=20160715071913.009908a1@recife.lan \
--to=mchehab@osg.samsung.com \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=shuahkh@osg.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.