Skip to contentSkip to conversation

DMA Engine Documentation: TX Descriptor and Submission

DISCUSSION Federico Vaga 2 participants 4 messages Jan 28, 2019 – Feb 2, 2019 Documentation

lore
Share & tools
lore
#0 lore raw

Hi,

I have a new question concerning documentation.

https://www.kernel.org/doc/html/latest/driver-api/dmaengine/client.html

From this document it is not really clear, at least to me, if clients can consider valid the struct dma_async_tx_descriptor after submission to the DMA engine.

Clients get a TX descriptor from a DMA engine using things like dmaengine_prep_*. These calls - may - allocate new descriptors and return them to the caller; this may include other structures which are not visible to clients. So, if my understanding is correct, this means that it's the DMA engine that, on TX completion, releases any TX descriptor allocated by dmaengine_prep_*. This implies that the pointer that the client is using must be considered invalid right after dmaengine_submit().

If what I understood by reading the documentation and the code is correct, then I think that this should be mentioned in the Documentation. If I'm wrong, please tell me where :)

Thanks

#1 lore raw
Quoted 9 lines · Federico Vaga

Hi,

I have a new question concerning documentation.

https://www.kernel.org/doc/html/latest/driver-api/dmaengine/client.html

Quoted 1 line

From this document it is not really clear, at least to me, if clients can

consider valid the struct dma_async_tx_descriptor after submission to the DMA engine.

Nope they can't and should not touch the descriptor after submission. The client get cookie and that is supposed to be used

Quoted 11 lines

Clients get a TX descriptor from a DMA engine using things like dmaengine_prep_*. These calls - may - allocate new descriptors and return them to the caller; this may include other structures which are not visible to clients. So, if my understanding is correct, this means that it's the DMA engine that, on TX completion, releases any TX descriptor allocated by dmaengine_prep_*. This implies that the pointer that the client is using must be considered invalid right after dmaengine_submit().
If what I understood by reading the documentation and the code is correct, then I think that this should be mentioned in the Documentation. If I'm wrong, please tell me where :)

And what exactly are you trying to do here..?

Signature · 1 line
~Vinod
#2 lore raw
Quoted 8 lines · Vinod Koul
Quoted 5 lines · Federico Vaga

Hi,

I have a new question concerning documentation.

https://www.kernel.org/doc/html/latest/driver-api/dmaengine/client.html

Quoted 1 line
Quoted 8 lines
Quoted 1 line
Quoted 1 line

From this document it is not really clear, at least to me, if

clients can

Quoted 1 line

consider valid the struct dma_async_tx_descriptor after submission

to the

Quoted 1 line

DMA engine.

Nope they can't and should not touch the descriptor after submission. The client get cookie and that is supposed to be used

Good, thanks

Quoted 11 lines
Quoted 3 lines

Clients get a TX descriptor from a DMA engine using things like dmaengine_prep_*. These calls - may - allocate new descriptors and

return

Quoted 1 line

them to the caller; this may include other structures which are not

visible to

Quoted 1 line

clients. So, if my understanding is correct, this means that it's the

DMA

Quoted 1 line

engine that, on TX completion, releases any TX descriptor allocated

by

Quoted 1 line

dmaengine_prep_*. This implies that the pointer that the client is

Quoted 8 lines

using

Quoted 2 lines

must be considered invalid right after dmaengine_submit(). If what I understood by reading the documentation and the code is

correct,

Quoted 2 lines

then I think that this should be mentioned in the Documentation. If I'm wrong, please tell me where :)

And what exactly are you trying to do here..?

What if I answer: "the right thing"? Joking. I just expressed my understanding of something which is not documented properly (my opinion). I wanted to be sure that the logic, the reasons behind are the ones that I understood. I will propose a patch to the documentation, unless you want to do it.

Signature · 1 line
Inviato dal mio dispositivo Android con K-9 Mail. Perdonate la brevità.
#3 lore raw
Quoted 13 lines · Federico Vaga
Quoted 10 lines · Vinod Koul
Quoted 5 lines · Federico Vaga

Hi,

I have a new question concerning documentation.

https://www.kernel.org/doc/html/latest/driver-api/dmaengine/client.html

Quoted 2 lines
Quoted 2 lines

From this document it is not really clear, at least to me, if

clients can

Quoted 30 lines
Quoted 6 lines
Quoted 1 line

consider valid the struct dma_async_tx_descriptor after submission

to the

Quoted 1 line

DMA engine.

Nope they can't and should not touch the descriptor after submission. The client get cookie and that is supposed to be used

Good, thanks

Quoted 19 lines
Quoted 3 lines

Clients get a TX descriptor from a DMA engine using things like dmaengine_prep_*. These calls - may - allocate new descriptors and

return

Quoted 1 line

them to the caller; this may include other structures which are not

visible to

Quoted 1 line

clients. So, if my understanding is correct, this means that it's the

DMA

Quoted 1 line

engine that, on TX completion, releases any TX descriptor allocated

by

Quoted 1 line

dmaengine_prep_*. This implies that the pointer that the client is

using

Quoted 2 lines

must be considered invalid right after dmaengine_submit(). If what I understood by reading the documentation and the code is

correct,

Quoted 2 lines

then I think that this should be mentioned in the Documentation. If I'm wrong, please tell me where :)

And what exactly are you trying to do here..?

Please wrap your replies within 80chars

Quoted 6 lines

What if I answer: "the right thing"? Joking. I just expressed my understanding of something which is not documented properly (my opinion). I wanted to be sure that the logic, the reasons behind are the ones that I understood. I will propose a patch to the documentation, unless you want to do it. -- Inviato dal mio dispositivo Android con K-9 Mail. Perdonate la brevità.

Sure please feel free to send a patch :)

Mostly people ask these questions based on a driver they are working off, and it makes sense to fix the assumptions by asking what they are trying to achieve...

Signature · 1 line
~Vinod