Re: [PATCH v12 2/3] rust: add dma coherent allocator abstraction.
From: Danilo Krummrich
Date: Thu Mar 06 2025 - 11:40:43 EST
On Thu, Mar 06, 2025 at 12:18:18PM -0400, Jason Gunthorpe wrote:
> 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.
Huh! Never noticed that in the past.
>
> > > 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.
Yeah, that's what I propose then.
>
> 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.
Oh, I didn't do that. How could I, since I did not knew what was referred
to? :-)
Quite the opposite, I fully agree with that.
I think for this we need higher level abstraction (which now that I know what
was meant I know Sima proposed already), or maybe provide an API that can
consolidate single operations for a single Devres container, etc.
But that's out of scope for this series.
- Danilo