linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* DMA Engine Documentation: TX Descriptor and Submission
@ 2019-01-28  8:47 Federico Vaga
  2019-02-01  4:17 ` Vinod Koul
  0 siblings, 1 reply; 4+ messages in thread
From: Federico Vaga @ 2019-01-28  8:47 UTC (permalink / raw)
  To: Vinod Koul; +Cc: dmaengine, linux-kernel, linux-doc

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DMA Engine Documentation: TX Descriptor and Submission
  2019-01-28  8:47 DMA Engine Documentation: TX Descriptor and Submission Federico Vaga
@ 2019-02-01  4:17 ` Vinod Koul
  2019-02-01  9:59   ` Federico Vaga
  0 siblings, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2019-02-01  4:17 UTC (permalink / raw)
  To: Federico Vaga; +Cc: dmaengine, linux-kernel, linux-doc

On 28-01-19, 09:47, Federico Vaga wrote:
> 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.

Nope they can't and should not touch the descriptor after submission.
The client get cookie and that is supposed to be used
> 
> 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..?

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DMA Engine Documentation: TX Descriptor and Submission
  2019-02-01  4:17 ` Vinod Koul
@ 2019-02-01  9:59   ` Federico Vaga
  2019-02-02  9:35     ` Vinod Koul
  0 siblings, 1 reply; 4+ messages in thread
From: Federico Vaga @ 2019-02-01  9:59 UTC (permalink / raw)
  To: Vinod Koul; +Cc: dmaengine, linux-kernel, linux-doc



On February 1, 2019 4:17:50 AM UTC, Vinod Koul <vkoul@kernel.org> wrote:
>On 28-01-19, 09:47, Federico Vaga wrote:
>> 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.
>
>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


>> 
>> 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..?

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à.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DMA Engine Documentation: TX Descriptor and Submission
  2019-02-01  9:59   ` Federico Vaga
@ 2019-02-02  9:35     ` Vinod Koul
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2019-02-02  9:35 UTC (permalink / raw)
  To: Federico Vaga; +Cc: dmaengine, linux-kernel, linux-doc

On 01-02-19, 09:59, Federico Vaga wrote:
> 
> 
> On February 1, 2019 4:17:50 AM UTC, Vinod Koul <vkoul@kernel.org> wrote:
> >On 28-01-19, 09:47, Federico Vaga wrote:
> >> 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.
> >
> >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
> 
> 
> >> 
> >> 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..?
> 

Please wrap your replies within 80chars

> 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...

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-02  9:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28  8:47 DMA Engine Documentation: TX Descriptor and Submission Federico Vaga
2019-02-01  4:17 ` Vinod Koul
2019-02-01  9:59   ` Federico Vaga
2019-02-02  9:35     ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).