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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z3-NqwAG_96yq8VD@pollux>
Date: Thu, 9 Jan 2025 09:49:47 +0100
From: Danilo Krummrich <dakr@...nel.org>
To: Christoph Hellwig <hch@....de>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
	Abdiel Janulgue <abdiel.janulgue@...il.com>,
	daniel.almeida@...labora.com, aliceryhl@...gle.com,
	robin.murphy@....com, rust-for-linux@...r.kernel.org,
	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>,
	Trevor Gross <tmgross@...ch.edu>,
	Valentin Obst <kernel@...entinobst.de>,
	open list <linux-kernel@...r.kernel.org>,
	Marek Szyprowski <m.szyprowski@...sung.com>, airlied@...hat.com,
	"open list:DMA MAPPING HELPERS" <iommu@...ts.linux.dev>,
	Greg KH <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v8 2/2] rust: add dma coherent allocator abstraction.

On Thu, Jan 09, 2025 at 09:08:12AM +0100, Christoph Hellwig wrote:
> On Wed, Jan 08, 2025 at 04:21:33PM +0100, Danilo Krummrich wrote:
> > What does "your code" mean? Duplicated in every driver?
> 
> Yes, interfaces to the DMA API should stay in readable C code and not
> in weird bindings so that it reminds greppable and maintainable.
> 

Rust drivers shouldn't use C APIs directly, but rather use an abstraction of the
corresponding C API.

One reason for that is that some requirements C APIs naturally have, can be
abstracted in a way, that the Rust compiler already ensures certain things and
hence drivers have less potential to produce errors.

(I understand this is very abstract and we can go into details and examples, if
you like.)

So, in the end, Rust drivers would just end up with each of them including a
copy of those abstractions, rather than using the C APIs from all over the place
within the driver.

This wouldn't help with what you ask for, it would just duplicate the "problem".

If you don't feel comfortable maintaining the Rust abstraction (or just don't
want to), that's fine. I don't think anyone expects you to do that, we can take
care of that instead.

>From your perspective, I think you can just think of the Rust abstraction as a
single driver calling into the DMA API.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ