Skip to contentSkip to conversation

docs: dmaengine: clarify ordering rules around cookie completion

PATCH Applied Vinod Koul 5 participants 7 messages Oct 9 – Oct 11

Subsystems (2)
lore
Share & tools
lore

Vinod Koul

author maintainer
#0 lore raw

PATCH 1/1 docs: dmaengine: clarify ordering rules around cookie completion

Sashiko pointed in [1] about the cookie completion order. It is good to Document that for ensuring that dma buffer is flushed and no stale data is seeing by consumer, we need to make sure such action is taken before drivers invoke dma cookie completion.

[1]: https://lore.kernel.org/r/[email protected]

---
 Documentation/driver-api/dmaengine/provider.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/driver-api/dmaengine/provider.rst +5 -0
index 2897ade67b39..1bcbce705659 100644
@@ -557,6 +557,11 @@ dma_cookie_t
 - Not really relevant any more since the introduction of ``virt-dma``
   that abstracts it away.
 
+- dmaengine drivers need to ensure buffers are flushed before invoking
+  vchan_cookie_complete() or dma_cookie_complete(). This would imply a call
+  to unmapping buffers or any such architcure calls to ensure caller seeing
+  buffers are flushed is done before invoking these calls.
+
 dma_vec
 
 - A small structure that contains a DMA address and length.
Signature · 1 line
2.53.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] docs: typo 'architcure' and grammatical errors in dmaengine provider documentation --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] docs: typo 'architcure' and grammatical errors in dmaengine provider documentation --

commit 5e1e4fe7c0e4434abe23aff6f6d55d9b232ea575
Author: Vinod Koul <[email protected]>

docs: dmaengine: clarify ordering rules around cookie completion

This commit adds documentation to clarify the ordering rules for DMA cookie completion, ensuring buffers are flushed before drivers invoke the completion.

Documentation/driver-api/dmaengine/provider.rst dma_cookie_t · line 561

Quoted 12 lines
Documentation/driver-api/dmaengine/provider.rst +4 -0
index f4ed98f701c91..073ba6c0f29dc 100644
@@ -555,6 +555,11 @@ dma_cookie_t
 - Not really relevant any more since the introduction of ``virt-dma``
   that abstracts it away.
 
+- dmaengine drivers need to ensure buffers are flushed before invoking
+  vchan_cookie_complete() or dma_cookie_complete(). This would imply a call
+  to unmapping buffers or any such architcure calls to ensure caller seeing
+  buffers are flushed is done before invoking these calls.

[Severity: Low]
This isn't a bug, but there is a typo here ('architcure' instead of 'architecture'), and the phrasing "to ensure caller seeing buffers are flushed is done before invoking these calls" is grammatically awkward.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Vinod Koul
Quoted 8 lines · Vinod Koul

Sashiko pointed in [1] about the cookie completion order. It is good to Document that for ensuring that dma buffer is flushed and no stale data is seeing by consumer, we need to make sure such action is taken before drivers invoke dma cookie completion.

[1]: https://lore.kernel.org/r/[email protected]

Reviewed-by on v1 1/1
#3 lore raw
In reply to Vinod Koul
Quoted 8 lines · Vinod Koul

Sashiko pointed in [1] about the cookie completion order. It is good to Document that for ensuring that dma buffer is flushed and no stale data is seeing by consumer, we need to make sure such action is taken before drivers invoke dma cookie completion.

[1]: https://lore.kernel.org/r/[email protected]

Quoted 20 lines
---
 Documentation/driver-api/dmaengine/provider.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/driver-api/dmaengine/provider.rst +5 -0
index 2897ade67b39..1bcbce705659 100644
@@ -557,6 +557,11 @@ dma_cookie_t
 - Not really relevant any more since the introduction of ``virt-dma``
   that abstracts it away.
 
+- dmaengine drivers need to ensure buffers are flushed before invoking
+  vchan_cookie_complete() or dma_cookie_complete(). This would imply a call
+  to unmapping buffers or any such architcure calls to ensure caller seeing
+  buffers are flushed is done before invoking these calls.
+
 dma_vec
 
 - A small structure that contains a DMA address and length.
Reviewed-by on v1 1/1
#4 lore raw
In reply to Vinod Koul
Quoted 17 lines · Vinod Koul

Sashiko pointed in [1] about the cookie completion order. It is good to Document that for ensuring that dma buffer is flushed and no stale data is seeing by consumer, we need to make sure such action is taken before drivers invoke dma cookie completion.

[1]: https://lore.kernel.org/r/[email protected]

---
 Documentation/driver-api/dmaengine/provider.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/driver-api/dmaengine/provider.rst +0 -0
index 2897ade67b39..1bcbce705659 100644

Documentation/driver-api/dmaengine/provider.rst dma_cookie_t · line 562

Quoted 6 lines
Documentation/driver-api/dmaengine/provider.rst +3 -0
@@ -557,6 +557,11 @@ dma_cookie_t
 - Not really relevant any more since the introduction of ``virt-dma``
   that abstracts it away.
 
+- dmaengine drivers need to ensure buffers are flushed before invoking
+  vchan_cookie_complete() or dma_cookie_complete(). This would imply a call
+  to unmapping buffers or any such architcure calls to ensure caller seeing

Sashiko report a typo architcure

Quoted 8 lines
Documentation/driver-api/dmaengine/provider.rst +2 -1
+  buffers are flushed is done before invoking these calls.
+
 dma_vec
 
 - A small structure that contains a DMA address and length.
--

2.53.0

author maintainer
#5 lore raw
Quoted 21 lines · Frank Li
Quoted 20 lines · Vinod Koul

Sashiko pointed in [1] about the cookie completion order. It is good to Document that for ensuring that dma buffer is flushed and no stale data is seeing by consumer, we need to make sure such action is taken before drivers invoke dma cookie completion.

[1]: https://lore.kernel.org/r/[email protected]

---
 Documentation/driver-api/dmaengine/provider.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/driver-api/dmaengine/provider.rst +0 -0
index 2897ade67b39..1bcbce705659 100644
@@ -557,6 +557,11 @@ dma_cookie_t
 - Not really relevant any more since the introduction of ``virt-dma``
   that abstracts it away.
 
Quoted 5 lines

Documentation/driver-api/dmaengine/provider.rst dma_cookie_t · line 562

Quoted 3 lines
Documentation/driver-api/dmaengine/provider.rst +3 -0
+- dmaengine drivers need to ensure buffers are flushed before invoking
+  vchan_cookie_complete() or dma_cookie_complete(). This would imply a call
+  to unmapping buffers or any such architcure calls to ensure caller seeing

Sashiko report a typo architcure

Yeah looks like my spell checker didnt caught it, I will apply now with that fixed

Quoted 11 lines
Quoted 8 lines
Documentation/driver-api/dmaengine/provider.rst +2 -1
+  buffers are flushed is done before invoking these calls.
+
 dma_vec
 
 - A small structure that contains a DMA address and length.
--

2.53.0

Signature · 1 line
~Vinod
author maintainer Applied
#6 lore raw
In reply to Vinod Koul
Quoted 8 lines · Vinod Koul

Sashiko pointed in [1] about the cookie completion order. It is good to Document that for ensuring that dma buffer is flushed and no stale data is seeing by consumer, we need to make sure such action is taken before drivers invoke dma cookie completion.

[1]: https://lore.kernel.org/r/[email protected]

[...]

Applied, thanks!

[1/1] docs: dmaengine: clarify ordering rules around cookie completion

      commit: fa89be96e845de705eed6edd01ecb79d46ee21c7

Best regards,

Signature · 1 line
~Vinod