[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250605160204.GC44681@ziepe.ca>
Date: Thu, 5 Jun 2025 13:02:04 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Boqun Feng <boqun.feng@...il.com>
Cc: Alexandre Courbot <acourbot@...dia.com>,
Abdiel Janulgue <abdiel.janulgue@...il.com>, dakr@...nel.org,
lyude@...hat.com, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...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 Thu, Jun 05, 2025 at 08:35:59AM -0700, Boqun Feng wrote:
> Late to the party, but seems to me the main problem here is that we
> cannot pass a reference to .set_page(), note that there is some work
> that would change the Rust struct Page from a `*mut page` to a
> `page`[0], and then we can impl Ownable[1] and AlwaysRefCounted for
> `Page`, if that's done, then I believe the correct parameter for
> set_page() would be an ARef<Page>.
There are alot of things that want to go into scatterlists that don't
have struct pages that are refcountable (eg frozen pages used by
kmalloc).
So I don't think you want to go in the direction of forcing
struct page refcounting in scatter table. That is not how the C API
works for good reason.
I also don't think it is a good idea to push more struct page stuff
into Rust as we are trying to eliminate struct page from the
kernel. It is better for rust to stick to KVAs and convert to struct
page in core code only where absolutely necessary for someon reason.
Which is another part of why I suggested set_page should not be part
of the driver facing rust API for scatterlist.
Jason
Powered by blists - more mailing lists