Re: [PATCH v12 2/3] rust: add dma coherent allocator abstraction.
From: Jason Gunthorpe
Date: Thu Mar 06 2025 - 11:18:35 EST
On Thu, Mar 06, 2025 at 04:54:14PM +0100, Danilo Krummrich wrote:
> (For some reason, when replying to this mail, mutt removed Sima from To: and
> instead switched Cc: to To:, hence resending.)
It is normal, Simona's mail client is setup to do that.
> > I think for basic driver allocations that you just need to run the device
> > stuffing it all into devres is ok.
>
> What exactly do you mean with that? DMA memory allocations or "normal" memory
> allocations?
Simona means things like a coherent allocation backing something
allocated once like a global queue for talking to the device.
Ie DMA API usage that is not on the performance path.
> > But for dma mappings at runtime this will be too slow.
>
> What exactly do you mean with "DMA mappings at runtime"? What to you think is
> is slow in this aspect?
Things like dma_map_sg(), dma_map_page(), etc, etc.
You cannot propose to add any runtime overhead to those paths and get
any support from the kernel community. They are performance paths
optimized to be fast.
For example: proposing to wrap their allocation in a devm container -
allocate a tracking structure, acquire the per-device spinlock and
thread the tracking into the devm linked list. For every single IO on
the performance path.
That idea would get a very hard NAK.
Jason