[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5380b2a1-8a92-4362-a014-132fbc301579@gmail.com>
Date: Mon, 2 Jun 2025 15:25:58 +0300
From: Abdiel Janulgue <abdiel.janulgue@...il.com>
To: Jason Gunthorpe <jgg@...pe.ca>, Alexandre Courbot <acourbot@...dia.com>
Cc: dakr@...nel.org, lyude@...hat.com, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, Valentin Obst <kernel@...entinobst.de>,
open list <linux-kernel@...r.kernel.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>, airlied@...hat.com,
rust-for-linux@...r.kernel.org,
"open list:DMA MAPPING HELPERS" <iommu@...ts.linux.dev>,
Petr Tesarik <petr@...arici.cz>, Andrew Morton <akpm@...ux-foundation.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
Sui Jingfeng <sui.jingfeng@...ux.dev>, Randy Dunlap <rdunlap@...radead.org>,
Michael Kelley <mhklinux@...look.com>
Subject: Re: [PATCH 1/2] rust: add initial scatterlist bindings
On 02/06/2025 14:40, Jason Gunthorpe wrote:
> On Sat, May 31, 2025 at 09:54:20PM +0900, Alexandre Courbot wrote:
>
>> So if I understood your idea correctly, this would mean creating the
>> SGTable and mapping it in one call, eschewing the typestate entirely?
>
> Probably no need for a type state
>
>> And the `SGTable` would own the backing data, and only release it upon
>> destruction and unmapping?
>
> But I don't think you can do this, it is not allowed to pin kmalloc
> memory for instance so you have to do something as you showed to tie
> the lifetime to the kmalloc across the sgtable lifetime.
>
We could explicitly have the SGTable own the backing store, so the
lifetime of the pages is connected to it? ie., we have a VVec with the
kmalloc allocator, instead of passing a a reference to pages, one could
have the page builder something in the likes of:
sgt.init(||
let k = Vec::<PageSlice, Kmalloc>::new();
k.reserve(pages, GFP_KERNEL) {
...
)
Anyway this probably needs the related (still WIP btw) support in:
https://lore.kernel.org/rust-for-linux/20241119112408.779243-3-abdiel.janulgue@gmail.com/
/Abdiel
Powered by blists - more mailing lists