From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Shuah Khan <shuahkh@osg.samsung.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-media@vger.kernel.org,
Helen Koike <helen.koike@collabora.co.uk>
Subject: Re: [RFC v3 00/21] Make use of kref in media device, grab references as needed
Date: Thu, 26 Jan 2017 07:10:02 -0200 [thread overview]
Message-ID: <20170126071002.38795fb9@vento.lan> (raw)
In-Reply-To: <20170125110231.GL3205@valkosipuli.retiisi.org.uk>
Em Wed, 25 Jan 2017 13:02:31 +0200
Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> Hi Mauro,
>
> On Tue, Jan 24, 2017 at 08:49:02AM -0200, Mauro Carvalho Chehab wrote:
> > Hi Sakari,
> >
> > Just returned this week from vacations. I'm reading my long e-mail backlog,
> > starting from my main inbox...
> >
> > Em Mon, 2 Jan 2017 09:53:49 +0200
> > Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> >
> > > Hi Mauro,
> > >
> > > On Mon, Dec 19, 2016 at 07:46:55AM -0200, Mauro Carvalho Chehab wrote:
> > > > Em Fri, 16 Dec 2016 17:07:23 +0200
> > > > Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> > > >
> > > > > Hi Hans,
> > > >
> > > > > > chrdev_open in fs/char_dev.c increases the refcount on open() and decreases it
> > > > > > on release(). Thus ensuring that the cdev can never be removed while in an
> > > > > > ioctl.
> > > > >
> > > > > It does, but it does not affect memory which is allocated separately of that.
> > > > >
> > > > > See this:
> > > > >
> > > > > <URL:https://www.mail-archive.com/linux-media@vger.kernel.org/msg106390.html>
> > > >
> > > > That sounds promising. If this bug issues other drivers than OMAP3,
> > > > then indeed the core has a bug.
> > > >
> > > > I'll see if I can reproduce it here with some USB drivers later this week.
> > >
> > > It's not a driver problem so yes, it is reproducible on other hardware.
> >
> > Didn't have time to test it before entering into vacations.
> >
> > I guess I won't have any time this week to test those issues on
> > my hardware, as I suspect that my patch queue is full. Also, we're
> > approaching the next merge window. So, unfortunately, I won't have
> > much time those days to do much testing.
> >
> > Btw, Hans commented that you were planning to working on it this month.
> >
> > Do you have some news with regards to the media controller bind/unbind
> > fixes?
>
> I have a bunch of meeting notes to send from the Oslo meeting with Hans and
> Laurent; I should have that ready by the end of the week. The RFC patchset
> certainly needs changes based on that.
OK. I'll wait for your notes and the new patchset.
> > > > While IMHO it is overkill trying to support hot plug on omap3, I won't
> > > > mind if you do that, provided that your patch series can be applied in
> > > > a way that it won't cause regressions for real hot-pluggable hardware.
> > >
> > > This is not really about the OMAP3 ISP driver hotplug support; it is indeed
> > > about the framework's ability to support hotpluggable hardware. The current
> > > painpoint is removing hardware; the current frameworks aren't quite up to
> > > that at the moment.
> >
> > The point here is that, while it would be fun to allow unbinding OMAP3
> > V4L2 drivers, OMAP3 doesn't really require hotplug support. On the other
> > hand, on USB drivers, where unbind is a requirement, the current status
> > of the tree is that hotplug works. I did some massive parallel bind/unbind
> > loops here to double check, when we added such fixup patches. Granted, I
> > won't doubt that there are still some rare race conditions that I was
> > unable to reproduce on the time I tested. I also didn't try to hack the
> > Kernel to introduce extra delays to make those race conditions more
> > likely to happen.
> >
> > Anyway, my main concern with this patch is that it breaks hotplug on devices
> > that really need it, while it fix support only for OMAP3 (with doesn't need).
>
> I don't disagree with you. Obviously the intent is not to break
> hot-pluggable hardware, albeit the changes needed to avoid that haven't been
> implemented yet. (One of the reasons it's been RFC all the time.)
>
> >
> > Also, it starts with a series of patches that will cause regressions.
> >
> > I won't matter changing the solution to some other approach that would
> > work, provided that the patches are added on an incremented way, and
> > won't introduce regressions to USB drivers.
>
> It may be possible to avoid increasing the time window during which bad
> things could happen before fully removing them.
The fix should be to protecting those windows by either a kref, lock or
a lockless (RCU) approach.
> However the patchset is a
> lot easier to work with without bundling the reverts into other (and likely
> multiple) patches as the reverted patches took quite a different direction
> than is followed in this patchset.
Doing the reverts before doing the fixes do break things. What you're
reverting is basically the logic that unbinds the struct media_devnode
from struct media_device. This is independent from whatever changes
you would be doing at struct media_device. So, you could do all changes
there, apply such changes on OMAP3 and on the USB drivers and then
rebind struct media_devnode at struct media_device[1].
[1] assuming that everyone agrees that rebinding it is for the best.
I still think that having a separate struct is better - but this is
something that I'll analise again after seeing the hole picture after
your changes - and the rationale for it.
>
> Let's discuss this later, at the time when we have a patchset that produces
> a sound code base (on the top of that patchset) that is understood to be
> free of object lifetime issues as long as hot-pluggable hardware goes.
Let's discuss it later when you submit your newer RFC patchset on the
top of the upstream code.
> >
> > > > On that matter, just like we use vivid as a testbench and as an
> > > > example for other drivers, it would be great if we could merge
> > > > the vimc driver. What's the status of Helen's patchset?
> > >
> > > That's a good point. I wasn't reviewing that driver back then when the
> > > patches were posted, but should it go in, it should make a good example for
> > > writing other drivers as well.
> > >
> >
> > I saw Laurent's comments about Helen's last patch series. From his
> > comments:
> >
> > "I've reviewed the whole patch but haven't had time to test it. I've also
> > skipped the items marked as TODO or FIXME as they're obviously not ready yet
> > :-) Overall this looks good to me, all the issues are minor."
> >
> > Helen promised a new version fixing those minor issues. Perhaps we should merge
> > her next series upstream with such issues addressed and see how it behaves.
>
> I'll review Helen's set next.
Thanks!
Regards,
Mauro
next prev parent reply other threads:[~2017-01-26 9:10 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 23:43 [RFC v3 00/21] Make use of kref in media device, grab references as needed Sakari Ailus
2016-08-26 23:43 ` [RFC v3 01/21] Revert "[media] media: fix media devnode ioctl/syscall and unregister race" Sakari Ailus
2016-08-26 23:43 ` [RFC v3 02/21] Revert "[media] media: fix use-after-free in cdev_put() when app exits after driver unbind" Sakari Ailus
2016-08-26 23:43 ` [RFC v3 03/21] Revert "[media] media-device: dynamically allocate struct media_devnode" Sakari Ailus
2016-08-26 23:43 ` [RFC v3 04/21] media: Remove useless curly braces and parentheses Sakari Ailus
2016-08-26 23:43 ` [RFC v3 05/21] media: devnode: Rename mdev argument as devnode Sakari Ailus
2016-08-26 23:43 ` [RFC v3 06/21] media device: Drop nop release callback Sakari Ailus
2016-08-26 23:43 ` [RFC v3 07/21] media-device: Make devnode.dev->kobj parent of devnode.cdev Sakari Ailus
2016-08-26 23:43 ` [RFC v3 08/21] media: Enable allocating the media device dynamically Sakari Ailus
2016-08-26 23:43 ` [RFC v3 09/21] media: Split initialising and adding media devnode Sakari Ailus
2016-08-26 23:43 ` [RFC v3 10/21] media: Shuffle functions around Sakari Ailus
2016-08-26 23:43 ` [RFC v3 11/21] media device: Refcount the media device Sakari Ailus
2016-08-26 23:43 ` [RFC v3 12/21] media device: Initialise media devnode in media_device_init() Sakari Ailus
2016-08-26 23:43 ` [RFC v3 13/21] media device: Deprecate media_device_{init,cleanup}() for drivers Sakari Ailus
2016-08-26 23:43 ` [RFC v3 14/21] media device: Get the media device driver's device Sakari Ailus
2016-08-26 23:43 ` [RFC v3 15/21] media: Provide a way to the driver to set a private pointer Sakari Ailus
2016-08-26 23:43 ` [RFC v3 16/21] media: Add release callback for media device Sakari Ailus
2016-08-26 23:43 ` [RFC v3 17/21] v4l: Acquire a reference to the media device for every video device Sakari Ailus
2016-08-26 23:43 ` [RFC v3 18/21] media-device: Postpone graph object removal until free Sakari Ailus
2016-08-26 23:43 ` [RFC v3 19/21] omap3isp: Allocate the media device dynamically Sakari Ailus
2016-08-26 23:43 ` [RFC v3 20/21] omap3isp: Release the isp device struct by media device callback Sakari Ailus
2016-08-26 23:43 ` [RFC v3 21/21] omap3isp: Don't rely on devm for memory resource management Sakari Ailus
2016-12-15 11:23 ` Laurent Pinchart
2016-12-15 11:39 ` Sakari Ailus
2016-12-15 11:42 ` Laurent Pinchart
2016-12-15 11:45 ` Sakari Ailus
2016-12-15 11:57 ` Laurent Pinchart
2016-12-15 19:17 ` Shuah Khan
2016-12-16 13:32 ` Sakari Ailus
2016-12-16 14:39 ` Shuah Khan
2016-11-07 20:16 ` [RFC v3 00/21] Make use of kref in media device, grab references as needed Shuah Khan
2016-11-08 8:19 ` Sakari Ailus
2016-11-09 16:49 ` Shuah Khan
2016-11-09 17:00 ` Shuah Khan
2016-11-09 17:46 ` Mauro Carvalho Chehab
2016-11-14 13:27 ` Sakari Ailus
2016-11-22 17:44 ` Mauro Carvalho Chehab
2016-11-22 18:13 ` Hans Verkuil
2016-11-22 18:41 ` Shuah Khan
2016-11-22 22:56 ` Shuah Khan
2016-11-28 10:45 ` Sakari Ailus
2016-11-29 11:13 ` Mauro Carvalho Chehab
2016-12-13 10:53 ` Sakari Ailus
2016-12-13 12:24 ` Mauro Carvalho Chehab
2016-12-13 22:23 ` Shuah Khan
2016-12-15 10:39 ` Laurent Pinchart
2016-12-15 14:56 ` Shuah Khan
2016-12-16 16:58 ` Laurent Pinchart
2016-12-15 11:30 ` Sakari Ailus
2016-12-15 12:56 ` Laurent Pinchart
2016-12-15 14:03 ` Hans Verkuil
2016-12-15 14:32 ` Mauro Carvalho Chehab
2016-12-15 14:45 ` Hans Verkuil
2016-12-15 15:45 ` Mauro Carvalho Chehab
2016-12-15 16:07 ` Hans Verkuil
2016-12-16 16:47 ` Laurent Pinchart
2016-12-16 16:43 ` Laurent Pinchart
2016-12-15 14:45 ` Shuah Khan
2016-12-15 15:26 ` Hans Verkuil
2016-12-15 16:06 ` Shuah Khan
2016-12-15 16:28 ` Hans Verkuil
2016-12-15 17:09 ` Shuah Khan
2016-12-15 17:25 ` Mauro Carvalho Chehab
2016-12-15 17:51 ` Shuah Khan
2016-12-16 10:11 ` Hans Verkuil
2016-12-16 10:57 ` Mauro Carvalho Chehab
2016-12-16 11:27 ` Hans Verkuil
2016-12-16 12:00 ` Mauro Carvalho Chehab
2016-12-16 14:45 ` Hans Verkuil
2016-12-19 9:28 ` Media summit in Feb? - Was: " Mauro Carvalho Chehab
2016-12-21 1:31 ` Mauro Carvalho Chehab
2016-12-21 14:27 ` Shuah Khan
2016-12-22 17:47 ` Laurent Pinchart
2016-12-22 20:43 ` Mauro Carvalho Chehab
2016-12-16 10:03 ` Hans Verkuil
2016-12-16 10:12 ` Mauro Carvalho Chehab
2016-12-23 18:13 ` Laurent Pinchart
2016-12-15 17:08 ` Mauro Carvalho Chehab
2016-12-23 17:55 ` Laurent Pinchart
2016-12-23 17:48 ` Laurent Pinchart
2016-12-23 17:27 ` Laurent Pinchart
2016-12-16 15:07 ` Sakari Ailus
2016-12-16 16:34 ` Laurent Pinchart
2016-12-19 9:46 ` Mauro Carvalho Chehab
2017-01-02 7:53 ` Sakari Ailus
2017-01-24 10:49 ` Mauro Carvalho Chehab
2017-01-25 11:02 ` Sakari Ailus
2017-01-26 9:10 ` Mauro Carvalho Chehab [this message]
2017-05-30 23:41 ` Shuah Khan
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=20170126071002.38795fb9@vento.lan \
--to=mchehab@s-opensource.com \
--cc=helen.koike@collabora.co.uk \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).