Skip to contentSkip to conversation

drm/amdgpu/userq: move comment to definition for amdgpu_userq_ensure_ev_fence

PATCH In review Sunil Khatri 3 participants 3 messages Apr 8

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

PATCH 1/1 drm/amdgpu/userq: move comment to definition for amdgpu_userq_ensure_ev_fence

Move the comment for the caller to the definition for amdgpu_userq_ensure_ev_fence.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +7 -7
index ae973c611972..b921346faa99 100644
@@ -460,6 +460,13 @@ static void amdgpu_userq_cleanup(struct amdgpu_usermode_queue *queue)
 	up_read(&adev->reset_domain->sem);
 }
 
+/*
+ * There could be a situation that we are creating a new queue while
+ * the other queues under this UQ_mgr are suspended. So if there is any
+ * resume work pending, wait for it to get done.
+ *
+ * This will also make sure we have a valid eviction fence ready to be used.
+ */
 void
 amdgpu_userq_ensure_ev_fence(struct amdgpu_userq_mgr *uq_mgr,
 			     struct amdgpu_eviction_fence_mgr *evf_mgr)
@@ -786,13 +793,6 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
 		goto clean_mapping;
 	}
 
-	/*
-	 * There could be a situation that we are creating a new queue while
-	 * the other queues under this UQ_mgr are suspended. So if there is any
-	 * resume work pending, wait for it to get done.
-	 *
-	 * This will also make sure we have a valid eviction fence ready to be used.
-	 */
 	amdgpu_userq_ensure_ev_fence(&fpriv->userq_mgr, &fpriv->evf_mgr);
 
 	r = uq_funcs->mqd_create(queue, &args->in);
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 13 lines · Sunil Khatri

Move the comment for the caller to the definition for amdgpu_userq_ensure_ev_fence.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0 -0
index ae973c611972..b921346faa99 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_cleanup(struct amdgpu_usermode_queue *queue) · line 466

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +4 -0
@@ -460,6 +460,13 @@ static void amdgpu_userq_cleanup(struct amdgpu_usermode_queue *queue)
 	up_read(&adev->reset_domain->sem);
 }
 
+/*
+ * There could be a situation that we are creating a new queue while
+ * the other queues under this UQ_mgr are suspended. So if there is any
+ * resume work pending, wait for it to get done.

This is actually not necessary here.

drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_cleanup(struct amdgpu_usermode_queue *queue) · line 469

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +3 -0
+ *
+ * This will also make sure we have a valid eviction fence ready to be used.
+ */

That's the important part, maybe even extend that a bit:

/* This will make sure that we have a valid and not signaled eviction fence and user queues are ready to be used. */

Then using kerneldoc format would be even better then just a comment.

Thanks,
Christian.

Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0 -7
 void
 amdgpu_userq_ensure_ev_fence(struct amdgpu_userq_mgr *uq_mgr,
 			     struct amdgpu_eviction_fence_mgr *evf_mgr)
@@ -786,13 +793,6 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
 		goto clean_mapping;
 	}
 
-	/*
-	 * There could be a situation that we are creating a new queue while
-	 * the other queues under this UQ_mgr are suspended. So if there is any
-	 * resume work pending, wait for it to get done.
-	 *
-	 * This will also make sure we have a valid eviction fence ready to be used.
-	 */
 	amdgpu_userq_ensure_ev_fence(&fpriv->userq_mgr, &fpriv->evf_mgr);
 
 	r = uq_funcs->mqd_create(queue, &args->in);
#2 lore raw
Quoted 24 lines · Christian König
Quoted 13 lines · Sunil Khatri

Move the comment for the caller to the definition for amdgpu_userq_ensure_ev_fence.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0 -0
index ae973c611972..b921346faa99 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_cleanup(struct amdgpu_usermode_queue *queue) · line 466

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +4 -0
@@ -460,6 +460,13 @@ static void amdgpu_userq_cleanup(struct amdgpu_usermode_queue *queue)
  	up_read(&adev->reset_domain->sem);
  }
 
+/*
+ * There could be a situation that we are creating a new queue while
+ * the other queues under this UQ_mgr are suspended. So if there is any
+ * resume work pending, wait for it to get done.

This is actually not necessary here.

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_cleanup(struct amdgpu_usermode_queue *queue) · line 469

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +3 -0
+ *
+ * This will also make sure we have a valid eviction fence ready to be used.
+ */

That's the important part, maybe even extend that a bit:

/* This will make sure that we have a valid and not signaled eviction fence and user queues are ready to be used. */

Then using kerneldoc format would be even better then just a comment.

Sure, will do that way.

Regards
Sunil khatri

Quoted 21 lines

Thanks,
Christian.

Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0 -7
  void
  amdgpu_userq_ensure_ev_fence(struct amdgpu_userq_mgr *uq_mgr,
  			     struct amdgpu_eviction_fence_mgr *evf_mgr)
@@ -786,13 +793,6 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
  		goto clean_mapping;
  	}
 
-	/*
-	 * There could be a situation that we are creating a new queue while
-	 * the other queues under this UQ_mgr are suspended. So if there is any
-	 * resume work pending, wait for it to get done.
-	 *
-	 * This will also make sure we have a valid eviction fence ready to be used.
-	 */
  	amdgpu_userq_ensure_ev_fence(&fpriv->userq_mgr, &fpriv->evf_mgr);
 
  	r = uq_funcs->mqd_create(queue, &args->in);