[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DB91AA9OBJLO.34HG554WY12GX@nvidia.com>
Date: Fri, 11 Jul 2025 16:05:59 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Abdiel Janulgue" <abdiel.janulgue@...il.com>, <jgg@...pe.ca>,
<lyude@...hat.com>, <dakr@...nel.org>
Cc: "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 v2 1/2] rust: add initial scatterlist bindings
Hi Abdiel,
On Wed Jul 9, 2025 at 8:59 PM JST, Abdiel Janulgue wrote:
> Hi,
>
> On 03/07/2025 10:03, Alexandre Courbot wrote:
>> On Wed Jul 2, 2025 at 11:37 AM JST, Alexandre Courbot wrote:
>>> Thoughts? If Abdiel is comfortable with this I can submit a v3 with this design
>>> for review (putting myself as co-developer), on which Abdiel could then keep
>>> iterating, as I suspect this would be easier to understand than this long email
>>> :).
>>
>> Figured I could just as well share the code with you and save both of us
>> some time. ^_^;
>>
>> The top commit of this branch contains the proposal discussed:
>>
>> https://github.com/Gnurou/linux/tree/scatterlists
>>
>> The sample code has been updated to add dummy examples for the 3
>> use-cases discussed (reference to an existing `sg_table`, refcounted
>> reference, and owned data).
>>
>> There are still things missing, including the typestate on `SGEntry`, as
>> it wasn't necessary to demonstrate the basic idea.
>>
>> Note also that if we decide to only support DMA-mapped SG-entries, we
>> can remove a bunch of code, including the one that maps a `SGTable` if
>> the backing type implements `BorrowMut`.
>>
>> For your consideration. :) Please feel free to take and use anything you
>> find useful.
>
> Sorry for the delay, just came back from a week vacation.
Welcome back!
>
> Regarding your question regarding why I dropped type-state, I thought
> the general consensus here is to drop this approach:
>
> https://lore.kernel.org/lkml/DAC20AXGABW2.X147X4JPMRBS@nvidia.com/
>
> I think I might have misunderstood after re-reading it now. What you
> probably meant was to have no intermediate state from initialized to
> mapped to create the sg_table?
Sorry, that was poorly phrased - and yes this is what I meant. Since we
have no use for unmapped SG tables at the moment, let's start with this
simple and working approach. We can always add more states/stuff later
if the need arises.
>
> Anyways, thanks for the code above I'll look into this in detail and
> pick bits to integrate into v3 :)
Looking forward to it! Please don't hesitate to reach out if anything is
unclear.
Powered by blists - more mailing lists