[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251211032306.GO28860@pendragon.ideasonboard.com>
Date: Thu, 11 Dec 2025 12:23:06 +0900
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Jason Gunthorpe <jgg@...dia.com>, Tzung-Bi Shih <tzungbi@...nel.org>,
Benson Leung <bleung@...omium.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>,
Jonathan Corbet <corbet@....net>, Shuah Khan <shuah@...nel.org>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
chrome-platform@...ts.linux.dev, linux-kselftest@...r.kernel.org,
Bartosz Golaszewski <brgl@...ev.pl>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Simona Vetter <simona.vetter@...ll.ch>,
Dan Williams <dan.j.williams@...el.com>
Subject: Re: [PATCH v5 5/7] revocable: Add fops replacement
On Thu, Oct 23, 2025 at 05:04:57PM +0200, Greg KH wrote:
> On Thu, Oct 23, 2025 at 11:51:31AM -0300, Jason Gunthorpe wrote:
> > On Thu, Oct 23, 2025 at 10:22:01PM +0800, Tzung-Bi Shih wrote:
> >
> > > I was misunderstanding about the "sync" we were discussing for
> > > misc_deregister_sync(). The "sync", is analogous to synchronize_srcu()
> > > of revocable_provider_revoke() in the revocable version [1], doesn't wait
> > > for closing all opened files.
> >
> > Yes, and my remark is we don't need to obfuscate simple locks in core
> > kernel code.
>
> {sigh}
>
> Yes, that's not the goal here at all.
>
> I've refrained from jumping in as I think we are thinking of different
> stuff here, probably talking past each other in places.
>
> The original goal of having "revocable" is still needed, despite you
> feeling that cdev can live without it (I strongly disagree with that,
> and the v4l, gpio, i2c, and other subsystem developers have feelings
> along those lines as backed up by the many talks over the years about
> this.)
Replying late to this thread, I don't think this is right for V4L2. When
it comes to solving the .remove() vs. userspace race, I think the right
solution is at the cdev level. We could also implement it exactly the
same way in the V4L2 core, but that would be a shame as other subsystems
would need to replicate the same. There are existing implementations,
they're easy to use in drivers (if implemented in cdev with the little
amount of required driver-logic implemented in the V4L2 core, it would
be mostly transparent for drivers), easy to wrap your head around (no
obscure lifetime magic), and they work.
Where I believe a revocable infrastructure could be useful is for
solving the .remove() vs. *kernel usage* race, which is something GPIO
likely cares about strongly.
> The use of it in the Rust code already is kind of proof of this, it
> enables driver authors to not have to worry about a ton of real-world
> issues they would have to otherwise. Which is why I suggested copying
> that pattern into C to help us out here.
>
> Anyway...
>
> I've been traveling a ton, and it's not going to let up soon, but I'll
> try to dig into this more later next week, or on the next 12+ hour
> flight that I'll be just after that, to give a more detailed review and
> response, sorry I've not been able to do so yet.
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists