lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DC8ZS3RPS2W2.1D6MXZ28MP73K@nvidia.com>
Date: Fri, 22 Aug 2025 22:31:12 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Danilo Krummrich" <dakr@...nel.org>, <akpm@...ux-foundation.org>,
 <ojeda@...nel.org>, <alex.gaynor@...il.com>, <boqun.feng@...il.com>,
 <gary@...yguo.net>, <bjorn3_gh@...tonmail.com>, <lossin@...nel.org>,
 <a.hindborg@...nel.org>, <aliceryhl@...gle.com>, <tmgross@...ch.edu>,
 <abdiel.janulgue@...il.com>, <jgg@...pe.ca>, <lyude@...hat.com>,
 <robin.murphy@....com>, <daniel.almeida@...labora.com>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 0/5] Rust infrastructure for sg_table and scatterlist

On Thu Aug 21, 2025 at 1:52 AM JST, Danilo Krummrich wrote:
> This patch series provides abstractions for struct sg_table and struct
> scatterlist.
>
> Abdiel and me agreed for me to take over his previous iterations on this topic.
> I decided to send my patches as a new series rather than as a subsequent version
> of Abdiel's previous iterations, since the changes I made turned out to be much
> closer to a full rewrite.
>
> The most notable differences in design are:
>
>   - SGTable utilizes BorrowedPage, AsPageIter and VmallocPageIter from my patch
>     series in [1].
>
>   -  SGTable is a transparent wrapper over either struct Owned<P> (where P is
>      the provider of the backing pages) or struct Borrowed, which by itself is a
>      transparent wrapper over Opaque<bindings::sg_table>, i.e. either
>      SGTable<Owned<P>> or just SGTable (which is equivalent to
>      SGTable<Borrowed>.
>
>      - `SGTable<Owned<P>>`: Represents a table whose resources are fully managed
>        by Rust. It takes ownership of a page provider `P`, allocates the
>        underlying `struct sg_table`, maps it for DMA, and handles all cleanup
>        automatically upon drop. The DMA mapping's lifetime is tied to the
>        associated device using `Devres`, ensuring it is correctly unmapped
>        before the device is unbound.
>
>      - `SGTable<Borrowed>` (or just `SGTable`): A zero-cost representation of an
>        externally managed `struct sg_table`. It is created from a raw pointer
>        using `SGTable::as_ref()` and provides a lifetime-bound reference
>        (`&'a SGTable`) for operations like iteration.
>
>      - As a consequence, a borrowed SG table can be created with
>        SGTable::as_ref(), which returns a &'a SGTable, just like similar
>        existing abstractions.
>
>        An owned SGTable is created with SGTable::new(), which returns an
>        impl PinInit<SGTable<Owned<P>>, Error>, such that it can be initialized
>        directly within existing private data memory allocations while providing
>        the required pin guarantees.
>
>   - SGTable<Owned<P>> uses an inner type Devres<DmaMapSgt> to ensure that the
>     DMA mapping can't out-live device unbind.
>
>   - SGTable<Owned<P>> uses pin-init for initialization.
>
> This patch series depends on [1] (branch containing the patches in [2]). A
> branch containing this series (including dependencies) can be found in [3];
> Abdiel's latest series can be found in [4].
>
> [1] https://lore.kernel.org/rust-for-linux/20250820145434.94745-1-dakr@kernel.org/
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=page-iter
> [3] https://git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=scatterlist
> [4] https://lore.kernel.org/lkml/20250718103359.1026240-1-abdiel.janulgue@gmail.com/

I am going to do a full review of this revision over the weekend, but I
have already successfully used it in nova-core to boot the GSP. Thus,

Tested-by: Alexandre Courbot <acourbot@...dia.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ