From: Yury Norov <ynorov@nvidia.com>
To: Eliot Courtney <ecourtney@nvidia.com>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
"Burak Emir" <burak.emir@gmail.com>,
"Yury Norov" <yury.norov@gmail.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"John Hubbard" <jhubbard@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Timur Tabi" <ttabi@nvidia.com>, "Zhi Wang" <zhiw@nvidia.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v12 0/2] rust: Add support for reserving of ranges of IDs
Date: Wed, 18 Nov 2026 13:06:55 -0500 [thread overview]
Message-ID: <av3pKdesSwpPYnnq@yury> (raw)
In-Reply-To: <20261112-chid-v12-0-49ad43286dad@nvidia.com>
On Thu, Nov 12, 2026 at 09:37:11PM +0900, Eliot Courtney wrote:
> Add support for reserving of ranges of IDs, with a usage in nova-core
> for channel IDs.
>
> The bitmap and `IdPool` parts from earlier versions are in v7.4-rc1
> now, and this version has the remaining patches: exact `IdPool`
> capacities and `ChannelIdPool`.
>
> Channel ID tracking is needed for allotting ranges of channel IDs to
> vGPU guests, and later for regular host channel ID reservation.
> nova-core needs allocation of a contiguous sequence of IDs with a
> specific length and sometimes a specific alignment [1].
>
> About the tradeoffs between different data structures:
> - IDA/xarray do not support allocating a contiguous sequence of IDs
> (ida_alloc_range() allocates a single ID within a range, not a contiguous
> sequence).
> - A maple tree works, but is not as good a fit. The ID space is small
> (limited to 2048) and aligned allocation needs an alloc_range()+erase() retry
> loop (plus a Mutex around it, or new mas_empty_area() bindings) that
> essentially reimplements bitmap_find_next_zero_area(). See the maple tree
> version at [2]. For 2048 IDs a bitmap is also considerably faster and smaller
> [3].
> - The bitmap API natively supports aligned contiguous area allocation
> (bitmap_find_next_zero_area()).
>
> This is based on drm-rust-next.
Reviewed-by: Yury Norov <ynorov@nvidia.com>
> [1]: https://lore.kernel.org/all/84bc8bd2-e292-4b84-9580-a1b5df4c5bdc@nvidia.com/
> [2]: https://lore.kernel.org/all/20260710-chid-maple-v1-1-4ee869055268@nvidia.com/
> [3]: https://lore.kernel.org/all/20260717053241.916441-1-ynorov@nvidia.com/
Maybe add this links in the commit message too?
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
> ---
> Changes in v12:
> - Drop the patches that were applied to drm-rust-next and driver-core
> - Rebase on drm-rust-next
> - Drop the zero capacity part of the patch #1 commit message (Yury)
> - Add reviewed-by tags
> - Link to v11: https://patch.msgid.link/20261109-chid-v11-0-082aa9bf5a91@nvidia.com
>
> Changes in v11:
> - Rebase on drm-rust-next (pre-reqs are merged now)
> - Split patch #1 by subsystem (Danilo). Just splitting with no actual
> changes, so I kept the reviewed-by tags on the new patches
> - Add reviewed-by tags
> - Link to v10: https://patch.msgid.link/20261019-chid-v10-0-67de9180b4ed@nvidia.com
>
> Changes in v10:
> - Drop the patches that were applied to rust-next
> - Rebase on drm-rust-next (plus pre-reqs)
> - Use a capacity of 1 instead of 0 in the grow_request() example in
> patch #2 (Yury)
> - Convert the remaining Alignment::new() users in nova-core in patch #1
> - Link to v9: https://patch.msgid.link/20260930-chid-v9-0-0d6cca376cff@nvidia.com
>
> Changes in v9:
> - Rebase on drm-rust-next
> - Moved cv! to a separate series which this now depends on
> - Reference Link: tag from the text + indent code in patch #4 commit
> message (Miguel)
> - Add reviewed-by tags
> - Link to v8: https://patch.msgid.link/20260827-chid-v8-0-bc74c77d0214@nvidia.com
>
> Changes in v8:
> - Clarify overflow cases in patch #2 (Alex)
> - Replace nz! with generalized cv! macro (Gary)
> - Add cv! macro to prelude
> - Split SizeConstants and adding new constants patch (Alex)
> - Move alignment size constants conersions patch (Alex)
> - Drop NonZero on IdPool, fix grow_request instead (Alice, Alex)
> - Add shrink/grow doctests (Burak)
> - Link to v7: https://patch.msgid.link/20260817-chid-v7-0-a5872e64d8f4@nvidia.com
>
> Changes in v7:
> - Add nz! macro for compile time NonZero
> - Implement SizeConstants for Alignment + add sub 1k size constants
> - Use Alignment constants + nz! in this series
> - Add final patch converting existing callers to use Alignment constants
> - Rename alloc_area/release_area -> reserve_ids / release_ids
> - Link to v6: https://patch.msgid.link/20260813-chid-v6-0-160be5dfb5bd@nvidia.com
>
> Changes in v6:
> - Take a NonZero nbits in `next_zero_area_off`, `set` and `clear` (Yury)
> - Remove `UnusedArea`, `IdPool::alloc_area` now allocates directly (Yury)
> - Add patch: take a NonZero capacity in `IdPool::with_capacity()`
> - Add patch: do not round the capacity up to `BitmapVec::MAX_INLINE_LEN`,
> which also removes the bounds check in `ChannelIdPool::alloc_area`
> - Add more testing of Drop for `ChannelIdPool` (Yury)
> - Link to v5: https://patch.msgid.link/20260812-chid-v5-0-6c767770b3f4@nvidia.com
>
> Changes in v5:
> - `bitmap_assert!` i32::MAX length for Bitmap::from_raw* (Yury)
> - Only run overflow check on 32-bit (Yury)
> - Link to v4: https://patch.msgid.link/20260810-chid-v4-0-c9f206fdcb97@nvidia.com
>
> Changes in v4:
> - Add `next_zero_area_off` to match C code (Yury)
> - Replace overflow checks to match C code in bitmap-for-next.
> - Tighten `Bitmap` unsafe contract to disallow Bitmaps larger than i32::MAX
> - Link to v3: https://patch.msgid.link/20260729-chid-v3-0-20cc08032bbc@nvidia.com
>
> Changes in v3:
> - Use `Alignment` type in id_pool and bitmap (Alice)
> - Remove hang check on the basis that it's extraordinarily rare.
> - Link to v2: https://patch.msgid.link/20260723-chid-v2-0-c35e5e9fb3d9@nvidia.com
>
> Changes in v2:
> - Collected Alice's Reviewed-by on patch 1.
> - Address Yury's comments w.r.t. using __bitmap_set etc directly.
> - Address Yury's comments w.r.t. following the C names
> - Additionally check for an overflow case that causes a hang
> - Added more info to cover letter + patch 4 w.r.t. channel ID allottment
> requirements
> - Add align parameter to ChannelIdPool::alloc_area() plus an aligned
> allocation test
> - Add missing INVARIANT comment when constructing UnusedArea
> - Link to v1:
> https://patch.msgid.link/20260703-chid-v1-0-84fe8259e46e@nvidia.com
>
> ---
> Eliot Courtney (2):
> rust: id_pool: do not round capacity up to BitmapVec::MAX_INLINE_LEN
> gpu: nova-core: add ChannelIdPool
>
> drivers/gpu/nova-core/gpu.rs | 2 +
> drivers/gpu/nova-core/gpu/channel.rs | 198 +++++++++++++++++++++++++++++++++++
> rust/kernel/id_pool.rs | 38 +++++--
> 3 files changed, 232 insertions(+), 6 deletions(-)
> ---
> base-commit: 6e557330b874b0e1fdd03e8fe4c438f36c93eefa
> change-id: 20260608-chid-18fa943c6d6c
>
> Best regards,
> --
> Eliot Courtney <ecourtney@nvidia.com>
prev parent reply other threads:[~2026-11-18 18:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 12:37 [PATCH v12 0/2] rust: Add support for reserving of ranges of IDs Eliot Courtney
2026-11-12 12:37 ` [PATCH v12 1/2] rust: id_pool: do not round capacity up to BitmapVec::MAX_INLINE_LEN Eliot Courtney
2026-11-12 12:37 ` [PATCH v12 2/2] gpu: nova-core: add ChannelIdPool Eliot Courtney
2026-11-17 14:02 ` Alexandre Courbot
2026-11-17 14:09 ` Eliot Courtney
2026-11-18 0:27 ` [PATCH v12 0/2] rust: Add support for reserving of ranges of IDs Alexandre Courbot
2026-11-18 18:06 ` Yury Norov [this message]
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=av3pKdesSwpPYnnq@yury \
--to=ynorov@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=burak.emir@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=work@onurozkan.dev \
--cc=yury.norov@gmail.com \
--cc=zhiw@nvidia.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.