From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Benson Leung <bleung@chromium.org>,
linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@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>,
Johan Hovold <johan@kernel.org>,
"Paul E . McKenney" <paulmck@kernel.org>,
Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH 3/8] char: misc: Introduce misc_sync_register()
Date: Sat, 9 May 2026 17:40:52 +0800 [thread overview]
Message-ID: <af8BJCaJYVBr_P3u@tzungbi-laptop> (raw)
In-Reply-To: <20260508115444.GA9887@nvidia.com>
On Fri, May 08, 2026 at 08:54:44AM -0300, Jason Gunthorpe wrote:
> On Fri, May 08, 2026 at 09:38:38AM +0000, Tzung-Bi Shih wrote:
>
> > I see this as the cost for synchronizing file operations with misc driver
> > registration, as previously mentioned in [2], which I believe is necessary
> > to prevent the race conditions. I'm open to discussing potential
> > optimizations or alternative approaches if you have suggestions.
>
> I think the past threads had many different ideas, I don't know why
> you choose to present this with something that is clearly acceptable..
In previous discussions, we explored using `inode->i_cdev`[3], but that
proved infeasible for misc devices[4]. Since all misc drivers share a
single cdev, we cannot use that approach to store per-miscdevice context.
This led us to the current design.
[3] https://lore.kernel.org/all/20251021121536.GG316284@nvidia.com
[4] https://lore.kernel.org/all/aQ1xfHuyg1y8eJQ_@google.com
>
> The drivers ops lookup needs to be O(1) on the system call path.
Achieving O(1) lookup is currently infeasible for the misc subsystem.
This is because misc devices use the minor number[5] as a search key to
determine which miscdevice the file operation is tied to, which
inherently involves a linear search.
[5] https://elixir.bootlin.com/linux/v7.0/source/drivers/char/misc.c#L127
next prev parent reply other threads:[~2026-05-09 9:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260427134659.95181-1-tzungbi@kernel.org>
[not found] ` <20260427134659.95181-4-tzungbi@kernel.org>
[not found] ` <20260428160956.GC718365@nvidia.com>
2026-05-08 9:38 ` [PATCH 3/8] char: misc: Introduce misc_sync_register() Tzung-Bi Shih
2026-05-08 11:54 ` Jason Gunthorpe
2026-05-09 9:40 ` Tzung-Bi Shih [this message]
2026-05-09 16:32 ` Jason Gunthorpe
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=af8BJCaJYVBr_P3u@tzungbi-laptop \
--to=tzungbi@kernel.org \
--cc=arnd@arndb.de \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--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=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rafael@kernel.org \
--cc=shuah@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox