Skip to contentSkip to conversation

drm/amdkfd: Use QUEUE_IS_ACTIVE macro in mqd v10

PATCH In review Yong Zhao 2 participants 5 messages Nov 12, 2019 4 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Yong Zhao

author
#0 lore raw

PATCH 1/2 drm/amdkfd: Use QUEUE_IS_ACTIVE macro in mqd v10

This is done for other GFX in commit bb2d2128a54c4. Port it to GFX10.

Change-Id I9e04872be3af0e90f5f6930226896b1ea545f3d9
---
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +2 -9
index 954dc8ac4ff1..46ddb33b624a 100644
@@ -213,10 +213,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd,
 	update_cu_mask(mm, mqd, q);
 	set_priority(m, q);
 
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 }
 
 static int destroy_mqd(struct mqd_manager *mm, void *mqd,
@@ -348,11 +345,7 @@ static void update_mqd_sdma(struct mqd_manager *mm, void *mqd,
 	m->sdma_queue_id = q->sdma_queue_id;
 	m->sdmax_rlcx_dummy_reg = SDMA_RLC_DUMMY_DEFAULT;
 
-
-	q->is_active = (q->queue_size > 0 &&
-			q->queue_address != 0 &&
-			q->queue_percent > 0 &&
-			!q->is_evicted);
+	q->is_active = QUEUE_IS_ACTIVE(*q);
 }
 
 /*
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

PATCH 2/2 drm/amdkfd: Stop using GFP_NOIO explicitly for GFX10

Adapt the change from 1cd106ecfc1f04

The change is:

drm/amdkfd: Stop using GFP_NOIO explicitly

This is no longer needed with the memalloc_nofs_save/restore in dqm_lock/unlock

Change-Id I42450b2c149d2b1842be99a8f355c829a0079e7c
---
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -1
index 46ddb33b624a..579c5ffcfa79 100644
@@ -393,7 +393,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
 	if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
 		return NULL;
 
-	mqd = kzalloc(sizeof(*mqd), GFP_NOIO);
+	mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
 	if (!mqd)
 		return NULL;
 
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1 -1
index be27ff01cdb8..22a819c888d8 100644
@@ -92,7 +92,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
 	 * instead of sub-allocation function.
 	 */
 	if (kfd->cwsr_enabled && (q->type == KFD_QUEUE_TYPE_COMPUTE)) {
-		mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_NOIO);
+		mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
 		if (!mqd_mem_obj)
 			return NULL;
 		retval = amdgpu_amdkfd_alloc_gtt_mem(kfd->kgd,
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#4 lore raw

Re: [PATCH 2/2] drm/amdkfd: Stop using GFP_NOIO explicitly for GFX10

Quoted 11 lines · Yong Zhao

Adapt the change from 1cd106ecfc1f04

The change is:

drm/amdkfd: Stop using GFP_NOIO explicitly

This is no longer needed with the memalloc_nofs_save/restore in dqm_lock/unlock

Change-Id I42450b2c149d2b1842be99a8f355c829a0079e7c

The series is

Quoted 23 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 2 +-
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c  | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -1
index 46ddb33b624a..579c5ffcfa79 100644
@@ -393,7 +393,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
  	if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
  		return NULL;
 
-	mqd = kzalloc(sizeof(*mqd), GFP_NOIO);
+	mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
  	if (!mqd)
  		return NULL;
 
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0 -0
index be27ff01cdb8..22a819c888d8 100644

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd, · line 98

Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1 -1
@@ -92,7 +92,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
  	 * instead of sub-allocation function.
  	 */
  	if (kfd->cwsr_enabled && (q->type == KFD_QUEUE_TYPE_COMPUTE)) {
-		mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_NOIO);
+		mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
  		if (!mqd_mem_obj)
  			return NULL;
  		retval = amdgpu_amdkfd_alloc_gtt_mem(kfd->kgd,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 4e5a3723-4b61-e76c-dc96-dafdec51f099-5C7GfCeVMHo@public.gmane.org

author
#6 lore raw

Re: [PATCH 2/2] drm/amdkfd: Stop using GFP_NOIO explicitly for GFX10

Hi Felix,

See one thing inline I am not too sure.

Yong

Quoted 38 lines · Felix Kuehling
Quoted 11 lines · Yong Zhao

Adapt the change from 1cd106ecfc1f04

The change is:

     drm/amdkfd: Stop using GFP_NOIO explicitly

     This is no longer needed with the memalloc_nofs_save/restore in dqm_lock/unlock

Change-Id I42450b2c149d2b1842be99a8f355c829a0079e7c

The series is

Quoted 20 lines

---
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c  | 2 +-

  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -0
index 46ddb33b624a..579c5ffcfa79 100644
@@ -393,7 +393,7 @@ struct mqd_manager *mqd_manager_init_v10(enum 
 KFD_MQD_TYPE type,
       if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
           return NULL;
   -    mqd = kzalloc(sizeof(*mqd), GFP_NOIO);
+    mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
       if (!mqd)
           return NULL;

  diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c index be27ff01cdb8..22a819c888d8 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c

Quoted 8 lines

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c static struct kfd_mem_obj *allocate_mqd(struct · line 96

Quoted 8 lines

+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -1
@@ -92,7 +92,7 @@ static struct kfd_mem_obj *allocate_mqd(struct 
 kfd_dev *kfd,
        * instead of sub-allocation function.
        */
       if (kfd->cwsr_enabled && (q->type == KFD_QUEUE_TYPE_COMPUTE)) {
-        mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_NOIO);
+        mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);

[yz] This should be kept probably. With the latest code, allocate_mqd() is called outside of the dqm. So now the situation is different from the original one.

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +0 -0
           if (!mqd_mem_obj)
               return NULL;

          retval = amdgpu_amdkfd_alloc_gtt_mem(kfd->kgd,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): e585e540-5edf-52b1-4fcf-48f1e98a2dd2-5C7GfCeVMHo@public.gmane.org

#8 lore raw

Re: [PATCH 2/2] drm/amdkfd: Stop using GFP_NOIO explicitly for GFX10

Quoted 46 lines · Yong Zhao

Hi Felix,

See one thing inline I am not too sure.

Yong

Quoted 39 lines · Felix Kuehling
Quoted 11 lines · Yong Zhao

Adapt the change from 1cd106ecfc1f04

The change is:

     drm/amdkfd: Stop using GFP_NOIO explicitly

     This is no longer needed with the memalloc_nofs_save/restore in dqm_lock/unlock

Change-Id I42450b2c149d2b1842be99a8f355c829a0079e7c

The series is

Quoted 21 lines

---
  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c  | 2 +-

  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 -0
index 46ddb33b624a..579c5ffcfa79 100644
@@ -393,7 +393,7 @@ struct mqd_manager *mqd_manager_init_v10(enum 
 KFD_MQD_TYPE type,
       if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
           return NULL;
   -    mqd = kzalloc(sizeof(*mqd), GFP_NOIO);
+    mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
       if (!mqd)
           return NULL;

  diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c index be27ff01cdb8..22a819c888d8 100644

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0 -0
Quoted 8 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c static struct kfd_mem_obj *allocate_mqd(struct · line 96

Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1 -1
@@ -92,7 +92,7 @@ static struct kfd_mem_obj *allocate_mqd(struct 
 kfd_dev *kfd,
        * instead of sub-allocation function.
        */
       if (kfd->cwsr_enabled && (q->type == KFD_QUEUE_TYPE_COMPUTE)) {
-        mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_NOIO);
+        mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);

[yz] This should be kept probably. With the latest code, allocate_mqd() is called outside of the dqm. So now the situation is different from the original one.

Memory allocations outside the DQM lock are not problematic. Only memory allocations under the DQM lock need to be careful to avoid FS reclaim, because that can lead to deadlocks with MMU notifiers. GFP_NOIO is no longer needed for that.

Regards,
  Felix

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0 -0
           if (!mqd_mem_obj)
               return NULL;

          retval = amdgpu_amdkfd_alloc_gtt_mem(kfd->kgd,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx