[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251117153301.GD10864@nvidia.com>
Date: Mon, 17 Nov 2025 11:33:01 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Tzung-Bi Shih <tzungbi@...nel.org>
Cc: Benson Leung <bleung@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.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,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
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 v6 1/3] revocable: Add fops replacement
On Mon, Nov 10, 2025 at 06:28:17AM +0000, Tzung-Bi Shih wrote:
> > It just means the user of this needs to understand there are
> > limitations on what release can do. Usually release just frees memory,
> > that is fine.
> >
> > I think it would be strange for a release to touch revocable data,
> > that might suggest some larger problem.
>
> I think it'd be inevitable for accessing some devm memory in ->release(),
> e.g. [1].
>
> [1] https://elixir.bootlin.com/linux/v6.17/source/drivers/platform/chrome/cros_ec_chardev.c#L260
Again, that's symptomatic of a "larger problem" :\
The blocking notifier registration to receive events to relay out to
the file descriptors should be part this drivers probe/remove
lifecycle so it has the proper lifetime. Trying to use a revocable
idea here will create a weirdly unbalanced/dangling blocking notifier
registration :(
Inside cros_ec_chardev it should have a simple list of open file
descriptors and the single blocking notifier callback can iterate over
the list and memdup the events. Then your release is just a simple
locked list del on a global list which doesn't have a lifecycle
problem.
Jason
Powered by blists - more mailing lists