All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Johan Hovold <johan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	Linus Walleij <linusw@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Simona Vetter <simona.vetter@ffwll.ch>,
	Dan Williams <dan.j.williams@intel.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] Revert "revocable: Revocable resource management"
Date: Tue, 27 Jan 2026 15:57:44 +0000	[thread overview]
Message-ID: <aXjgeNY-jf9rIw09@google.com> (raw)
In-Reply-To: <20260124170535.11756-1-johan@kernel.org>

On Sat, Jan 24, 2026 at 06:05:32PM +0100, Johan Hovold wrote:
> I was surprised to learn that the revocable functionality was merged last week
> given the community feedback on list and at LPC, but not least since there are
> no users of it, which we are supposed to require to be able to evaluate it
> properly.
> 
> The chromeos ec driver issue which motivated this work turned out not to need
> it as was found during review. And the example gpiolib conversion was posted

Thanks for sharing your thoughts on revocable.

Regarding cros_ec_chardev, my last attempt [2] to solve its hot-plug issue by
synchronizing misc_{de,}register() with file operations using a global lock
highlighted the difficulty of alternatives: that approach serialized all file
operations and could easily lead to hung tasks if any file operation slept.
Given the drawbacks of [2], I believe cros_ec_chardev remains a valid use
case for revocable.

> the very same morning that this was merged which hardly provides enough time
> for evaluation (even if Bartosz quickly reported a performance regression).

The gpiolib conversion was provided as the first concrete user to enable
this evaluation process.  The performance regression Bartosz identified is
valuable feedback, and I believe it is addressed by [3].  I plan to send the
next version of the series after v7.0-rc1 and revisit the issue.

[3] https://lore.kernel.org/all/20260121040204.2699886-1-tzungbi@kernel.org/

> Turns out there are correctness issues with both the gpiolib conversion and
> the revocable design itself that can lead to use-after-free and hung tasks (see
> [1] and patch 3/3).

I appreciate you identifying the issues where multiple threads share a file
descriptor; this is a case I overlooked.  I see these kinds of findings as a
positive outcome of having wider review and a concrete user, allowing us to
identify and fix issues in the design.

> And as was pointed out repeatedly during review, and again at the day of the
> merge, this does not look like the right interface for the chardev unplug
> issue.

My focus has been on miscdevice [2], but I suspect cdev solutions for device
hot-plug would face similar synchronization challenges between device removal
and in-flight file operations.

> Revert the revocable implementation until a redesign has been proposed and
> evaluated properly.

I'll work on addressing the discovered issues and send follow-up fixes.  I
believe keeping the current series in linux-next would be beneficial, as it
allows for easier testing and wider evaluation by others, rather than
reverting at this stage.

> 
> Johan
> 
> 
> [1] https://lore.kernel.org/all/aXT45B6vLf9R3Pbf@hovoldconsulting.com/

---
[2]:
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
...
+static struct miscdevice *find_miscdevice(int minor)
+{
+       struct miscdevice *c;
+
+       list_for_each_entry(c, &misc_list, list)
+               if (c->minor == minor)
+                       return c;
+       return NULL;
+}
+
+static __poll_t misc_sync_poll(struct file *filp, poll_table *wait)
+{
+       struct miscdevice *c;
+
+       guard(mutex)(&misc_mtx);
+       c = find_miscdevice(iminor(filp->f_inode));
+       if (!c)
+               return -ENODEV;
+       if (!c->fops->poll)
+               return 0;
+
+       return c->fops->poll(filp, wait);
+}
...
+static const struct file_operations misc_sync_fops = {
+       .poll = misc_sync_poll,
+       .read = misc_sync_read,
+       .unlocked_ioctl = misc_sync_ioctl,
+       .release = misc_sync_release,
+};
+
 static int misc_open(struct inode *inode, struct file *file)
 {
        int minor = iminor(inode);
@@ -161,6 +237,7 @@ static int misc_open(struct inode *inode, struct file *file)
        replace_fops(file, new_fops);
        if (file->f_op->open)
                err = file->f_op->open(inode, file);
+       file->f_op = &misc_sync_fops;

  parent reply	other threads:[~2026-01-27 15:57 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-24 17:05 [PATCH 0/3] Revert "revocable: Revocable resource management" Johan Hovold
2026-01-24 17:05 ` [PATCH 1/3] Revert "selftests: revocable: Add kselftest cases" Johan Hovold
2026-01-24 17:05 ` [PATCH 2/3] Revert "revocable: Add Kunit test cases" Johan Hovold
2026-01-24 17:05 ` [PATCH 3/3] Revert "revocable: Revocable resource management" Johan Hovold
2026-01-24 17:37   ` Johan Hovold
2026-01-24 17:46   ` Danilo Krummrich
2026-01-26 13:20     ` Johan Hovold
2026-01-27 15:57       ` Tzung-Bi Shih
2026-01-24 18:42 ` [PATCH 0/3] " Laurent Pinchart
2026-01-24 19:08 ` Danilo Krummrich
2026-01-25 12:47   ` Greg Kroah-Hartman
2026-01-25 13:22     ` Laurent Pinchart
2026-01-25 14:07       ` Danilo Krummrich
2026-01-29  1:09         ` Laurent Pinchart
2026-01-25 13:24     ` Laurent Pinchart
2026-01-25 17:53     ` Danilo Krummrich
2026-01-26  0:07       ` Jason Gunthorpe
2026-01-26 16:08         ` Danilo Krummrich
2026-01-26 17:07           ` Jason Gunthorpe
2026-01-26 22:36             ` Danilo Krummrich
2026-01-28 23:40             ` Laurent Pinchart
2026-01-26 13:50     ` Johan Hovold
2026-01-27 21:18       ` Bartosz Golaszewski
2026-01-27 23:52         ` Jason Gunthorpe
2026-01-28  9:40           ` Bartosz Golaszewski
2026-01-28 10:01             ` Wolfram Sang
2026-01-28 15:05               ` Jason Gunthorpe
2026-01-28 15:20                 ` Bartosz Golaszewski
2026-01-28 16:01                   ` Jason Gunthorpe
2026-01-30 11:27                     ` Bartosz Golaszewski
2026-01-28 16:58                 ` Wolfram Sang
2026-01-29  1:08           ` Laurent Pinchart
2026-01-29  1:23             ` Jason Gunthorpe
2026-01-29  3:42               ` dan.j.williams
2026-01-29  9:56                 ` Danilo Krummrich
2026-01-29 10:43                   ` Laurent Pinchart
2026-01-30  0:36                   ` dan.j.williams
2026-01-29 10:38               ` Laurent Pinchart
2026-01-29 13:34                 ` Jason Gunthorpe
2026-01-29 14:52                   ` Laurent Pinchart
2026-01-29 22:29             ` Danilo Krummrich
2026-01-30  9:10               ` Laurent Pinchart
2026-02-03  9:10                 ` Maxime Ripard
2026-02-03 13:59                   ` Laurent Pinchart
2026-01-28 15:48         ` Johan Hovold
2026-01-29  9:11           ` Bartosz Golaszewski
2026-01-29 10:56             ` Laurent Pinchart
2026-01-29 13:50               ` Bartosz Golaszewski
2026-01-29 14:28                 ` Jason Gunthorpe
2026-01-29 14:45                   ` Laurent Pinchart
2026-01-29 14:49                 ` Laurent Pinchart
2026-01-29 22:00                   ` Danilo Krummrich
2026-01-30 11:19                   ` Bartosz Golaszewski
2026-01-29 13:27           ` Linus Walleij
2026-02-03 12:15       ` Johan Hovold
2026-02-03 12:26         ` Greg Kroah-Hartman
2026-02-03 12:30           ` [PATCH] driver core: disable revocable code from build Greg Kroah-Hartman
2026-02-03 13:20             ` Danilo Krummrich
2026-02-04  2:14             ` Tzung-Bi Shih
2026-02-04  5:28               ` [PATCH] selftests: Disable " Tzung-Bi Shih
2026-02-04  8:21                 ` Greg Kroah-Hartman
2026-02-03 13:57           ` [PATCH 0/3] Revert "revocable: Revocable resource management" Laurent Pinchart
2026-02-03 15:44             ` Greg Kroah-Hartman
2026-02-04 14:36           ` Johan Hovold
2026-01-27 15:57 ` Tzung-Bi Shih [this message]
2026-01-28 14:23   ` Johan Hovold
2026-01-28 23:28     ` Laurent Pinchart
2026-01-29 15:01   ` Tzung-Bi Shih
2026-01-30  9:12     ` Laurent Pinchart
2026-01-30 17:41       ` Danilo Krummrich

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=aXjgeNY-jf9rIw09@google.com \
    --to=tzungbi@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=corbet@lwn.net \
    --cc=dakr@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@nvidia.com \
    --cc=johan@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linusw@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=shuah@kernel.org \
    --cc=simona.vetter@ffwll.ch \
    --cc=wsa+renesas@sang-engineering.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.