Skip to contentSkip to conversation

dma-buf/dma_resv_usage: update explicit sync documentation

PATCH In review Christian König 5 participants 5 messages Jul 12, 2022 – Aug 10, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-buf/dma_resv_usage: update explicit sync documentation

Make it clear that DMA_RESV_USAGE_BOOKMARK can be used for explicit synced user space submissions as well and document the rules around adding the same fence with different usages.

---
 include/linux/dma-resv.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
include/linux/dma-resv.h +13 -3
index c8ccbc94d5d2..264e27e56dff 100644
@@ -62,6 +62,11 @@ struct dma_resv_list;
  * For example when asking for WRITE fences then the KERNEL fences are returned
  * as well. Similar when asked for READ fences then both WRITE and KERNEL
  * fences are returned as well.
+ *
+ * Already used fences can be promoted in the sense that a fence with
+ * DMA_RESV_USAGE_BOOKMARK could become DMA_RESV_USAGE_READ by adding it again
+ * with this usage. But fences can never be degraded in the sense that a fence
+ * with DMA_RESV_USAGE_WRITE could become DMA_RESV_USAGE_READ.
  */
 enum dma_resv_usage {
 	/**
@@ -98,10 +103,15 @@ enum dma_resv_usage {
 	 * @DMA_RESV_USAGE_BOOKKEEP: No implicit sync.
 	 *
 	 * This should be used by submissions which don't want to participate in
-	 * implicit synchronization.
+	 * any implicit synchronization.
+	 *
+	 * The most common case are preemption fences, page table updates, TLB
+	 * flushes as well as explicit synced user submissions.
 	 *
-	 * The most common case are preemption fences as well as page table
-	 * updates and their TLB flushes.
+	 * Explicit synced user user submissions can be promoted to
+	 * DMA_RESV_USAGE_READ or DMA_RESV_USAGE_WRITE as needed using
+	 * dma_buf_import_sync_file() when implicit synchronization should
+	 * become necessary after initial adding of the fence.
 	 */
 	DMA_RESV_USAGE_BOOKKEEP
 };
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Christian König

Make it clear that DMA_RESV_USAGE_BOOKMARK can be used for explicit synced

DMA_RESV_USAGE_BOOKKEEP?

Quoted 13 lines

user space submissions as well and document the rules around adding the same fence with different usages.

---
 include/linux/dma-resv.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
include/linux/dma-resv.h +0 -0
index c8ccbc94d5d2..264e27e56dff 100644

include/linux/dma-resv.h struct dma_resv_list; · line 67

Quoted 6 lines
include/linux/dma-resv.h +3 -0
@@ -62,6 +62,11 @@ struct dma_resv_list;
  * For example when asking for WRITE fences then the KERNEL fences are returned
  * as well. Similar when asked for READ fences then both WRITE and KERNEL
  * fences are returned as well.
+ *
+ * Already used fences can be promoted in the sense that a fence with
+ * DMA_RESV_USAGE_BOOKMARK could become DMA_RESV_USAGE_READ by adding it again

Same here.

With that fixed,

Alex

Quoted 30 lines
include/linux/dma-resv.h +10 -4
+ * with this usage. But fences can never be degraded in the sense that a fence
+ * with DMA_RESV_USAGE_WRITE could become DMA_RESV_USAGE_READ.
  */
 enum dma_resv_usage {
        /**
@@ -98,10 +103,15 @@ enum dma_resv_usage {
         * @DMA_RESV_USAGE_BOOKKEEP: No implicit sync.
         *
         * This should be used by submissions which don't want to participate in
-        * implicit synchronization.
+        * any implicit synchronization.
+        *
+        * The most common case are preemption fences, page table updates, TLB
+        * flushes as well as explicit synced user submissions.
         *
-        * The most common case are preemption fences as well as page table
-        * updates and their TLB flushes.
+        * Explicit synced user user submissions can be promoted to
+        * DMA_RESV_USAGE_READ or DMA_RESV_USAGE_WRITE as needed using
+        * dma_buf_import_sync_file() when implicit synchronization should
+        * become necessary after initial adding of the fence.
         */
        DMA_RESV_USAGE_BOOKKEEP
 };
--

2.25.1

_______________________________________________
Linaro-mm-sig mailing list -- [email protected] To unsubscribe send an email to [email protected]

maintainer
#2 lore raw

Am 12.07.22 um 15:20 schrieb Alex Deucher:

Quoted 4 lines
Quoted 1 line · Christian König

Make it clear that DMA_RESV_USAGE_BOOKMARK can be used for explicit synced

DMA_RESV_USAGE_BOOKKEEP?

Crappy autocorrect and copy&paste. Thanks for pointing that out.

Christian.

Quoted 57 lines
Quoted 14 lines

user space submissions as well and document the rules around adding the same fence with different usages.

---
  include/linux/dma-resv.h | 16 +++++++++++++---
  1 file changed, 13 insertions(+), 3 deletions(-)
include/linux/dma-resv.h +0 -0
index c8ccbc94d5d2..264e27e56dff 100644

include/linux/dma-resv.h struct dma_resv_list; · line 67

Quoted 6 lines
include/linux/dma-resv.h +3 -0
@@ -62,6 +62,11 @@ struct dma_resv_list;
   * For example when asking for WRITE fences then the KERNEL fences are returned
   * as well. Similar when asked for READ fences then both WRITE and KERNEL
   * fences are returned as well.
+ *
+ * Already used fences can be promoted in the sense that a fence with
+ * DMA_RESV_USAGE_BOOKMARK could become DMA_RESV_USAGE_READ by adding it again

Same here.

With that fixed,

Alex

Quoted 30 lines
include/linux/dma-resv.h +10 -4
+ * with this usage. But fences can never be degraded in the sense that a fence
+ * with DMA_RESV_USAGE_WRITE could become DMA_RESV_USAGE_READ.
   */
  enum dma_resv_usage {
         /**
@@ -98,10 +103,15 @@ enum dma_resv_usage {
          * @DMA_RESV_USAGE_BOOKKEEP: No implicit sync.
          *
          * This should be used by submissions which don't want to participate in
-        * implicit synchronization.
+        * any implicit synchronization.
+        *
+        * The most common case are preemption fences, page table updates, TLB
+        * flushes as well as explicit synced user submissions.
          *
-        * The most common case are preemption fences as well as page table
-        * updates and their TLB flushes.
+        * Explicit synced user user submissions can be promoted to
+        * DMA_RESV_USAGE_READ or DMA_RESV_USAGE_WRITE as needed using
+        * dma_buf_import_sync_file() when implicit synchronization should
+        * become necessary after initial adding of the fence.
          */
         DMA_RESV_USAGE_BOOKKEEP
  };
--

2.25.1

_______________________________________________
Linaro-mm-sig mailing list -- [email protected] To unsubscribe send an email to [email protected]

Reviewed-by
#3 lore raw

With that changed

Thanks!

Quoted 69 lines · Christian König

Am 12.07.22 um 15:20 schrieb Alex Deucher:

Quoted 4 lines
Quoted 1 line · Christian König

Make it clear that DMA_RESV_USAGE_BOOKMARK can be used for explicit synced

DMA_RESV_USAGE_BOOKKEEP?

Crappy autocorrect and copy&paste. Thanks for pointing that out.

Christian.

Quoted 57 lines
Quoted 14 lines

user space submissions as well and document the rules around adding the same fence with different usages.

---
  include/linux/dma-resv.h | 16 +++++++++++++---
  1 file changed, 13 insertions(+), 3 deletions(-)
include/linux/dma-resv.h +0 -0
index c8ccbc94d5d2..264e27e56dff 100644

include/linux/dma-resv.h struct dma_resv_list; · line 67

Quoted 6 lines
include/linux/dma-resv.h +3 -0
@@ -62,6 +62,11 @@ struct dma_resv_list;
   * For example when asking for WRITE fences then the KERNEL fences are returned
   * as well. Similar when asked for READ fences then both WRITE and KERNEL
   * fences are returned as well.
+ *
+ * Already used fences can be promoted in the sense that a fence with
+ * DMA_RESV_USAGE_BOOKMARK could become DMA_RESV_USAGE_READ by adding it again

Same here.

With that fixed,

Alex

Quoted 30 lines
include/linux/dma-resv.h +10 -4
+ * with this usage. But fences can never be degraded in the sense that a fence
+ * with DMA_RESV_USAGE_WRITE could become DMA_RESV_USAGE_READ.
   */
  enum dma_resv_usage {
         /**
@@ -98,10 +103,15 @@ enum dma_resv_usage {
          * @DMA_RESV_USAGE_BOOKKEEP: No implicit sync.
          *
          * This should be used by submissions which don't want to participate in
-        * implicit synchronization.
+        * any implicit synchronization.
+        *
+        * The most common case are preemption fences, page table updates, TLB
+        * flushes as well as explicit synced user submissions.
          *
-        * The most common case are preemption fences as well as page table
-        * updates and their TLB flushes.
+        * Explicit synced user user submissions can be promoted to
+        * DMA_RESV_USAGE_READ or DMA_RESV_USAGE_WRITE as needed using
+        * dma_buf_import_sync_file() when implicit synchronization should
+        * become necessary after initial adding of the fence.
          */
         DMA_RESV_USAGE_BOOKKEEP
  };
--

2.25.1

_______________________________________________
Linaro-mm-sig mailing list -- [email protected] To unsubscribe send an email to [email protected]

Reviewed-by
#4 lore raw
Quoted 3 lines · Bas Nieuwenhuizen

With that changed

Yeah this is a nice clarification.

In case it hasn't landed yet or so.
-Daniel

Quoted 74 lines

Thanks!

Quoted 69 lines · Christian König

Am 12.07.22 um 15:20 schrieb Alex Deucher:

Quoted 4 lines
Quoted 1 line · Christian König

Make it clear that DMA_RESV_USAGE_BOOKMARK can be used for explicit synced

DMA_RESV_USAGE_BOOKKEEP?

Crappy autocorrect and copy&paste. Thanks for pointing that out.

Christian.

Quoted 57 lines
Quoted 14 lines

user space submissions as well and document the rules around adding the same fence with different usages.

---
  include/linux/dma-resv.h | 16 +++++++++++++---
  1 file changed, 13 insertions(+), 3 deletions(-)
include/linux/dma-resv.h +0 -0
index c8ccbc94d5d2..264e27e56dff 100644

include/linux/dma-resv.h struct dma_resv_list; · line 67

Quoted 6 lines
include/linux/dma-resv.h +3 -0
@@ -62,6 +62,11 @@ struct dma_resv_list;
   * For example when asking for WRITE fences then the KERNEL fences are returned
   * as well. Similar when asked for READ fences then both WRITE and KERNEL
   * fences are returned as well.
+ *
+ * Already used fences can be promoted in the sense that a fence with
+ * DMA_RESV_USAGE_BOOKMARK could become DMA_RESV_USAGE_READ by adding it again

Same here.

With that fixed,

Alex

Quoted 30 lines
include/linux/dma-resv.h +10 -4
+ * with this usage. But fences can never be degraded in the sense that a fence
+ * with DMA_RESV_USAGE_WRITE could become DMA_RESV_USAGE_READ.
   */
  enum dma_resv_usage {
         /**
@@ -98,10 +103,15 @@ enum dma_resv_usage {
          * @DMA_RESV_USAGE_BOOKKEEP: No implicit sync.
          *
          * This should be used by submissions which don't want to participate in
-        * implicit synchronization.
+        * any implicit synchronization.
+        *
+        * The most common case are preemption fences, page table updates, TLB
+        * flushes as well as explicit synced user submissions.
          *
-        * The most common case are preemption fences as well as page table
-        * updates and their TLB flushes.
+        * Explicit synced user user submissions can be promoted to
+        * DMA_RESV_USAGE_READ or DMA_RESV_USAGE_WRITE as needed using
+        * dma_buf_import_sync_file() when implicit synchronization should
+        * become necessary after initial adding of the fence.
          */
         DMA_RESV_USAGE_BOOKKEEP
  };
--

2.25.1

_______________________________________________
Linaro-mm-sig mailing list -- [email protected] To unsubscribe send an email to [email protected]

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch