Commit d091bc0a authored by Oak Zeng's avatar Oak Zeng Committed by Alex Deucher

Revert "drm/amdkfd: Fix a circular lock dependency"

This reverts commit 06b89b38.
This fix is not proper. allocate_mqd can't be moved before
allocate_sdma_queue as it depends on q->properties->sdma_id
set in later.
Signed-off-by: default avatarOak Zeng <Oak.Zeng@amd.com>
Reviewed-by: default avatarPhilip Yang <philip.yang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 70d488fb
...@@ -274,12 +274,6 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -274,12 +274,6 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,
print_queue(q); print_queue(q);
mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
q->properties.type)];
q->mqd_mem_obj = mqd_mgr->allocate_mqd(mqd_mgr->dev, &q->properties);
if (!q->mqd_mem_obj)
return -ENOMEM;
dqm_lock(dqm); dqm_lock(dqm);
if (dqm->total_queue_count >= max_num_of_queues_per_device) { if (dqm->total_queue_count >= max_num_of_queues_per_device) {
...@@ -305,6 +299,8 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -305,6 +299,8 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,
q->properties.tba_addr = qpd->tba_addr; q->properties.tba_addr = qpd->tba_addr;
q->properties.tma_addr = qpd->tma_addr; q->properties.tma_addr = qpd->tma_addr;
mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type(
q->properties.type)];
if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) { if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) {
retval = allocate_hqd(dqm, q); retval = allocate_hqd(dqm, q);
if (retval) if (retval)
...@@ -323,6 +319,11 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -323,6 +319,11 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,
if (retval) if (retval)
goto out_deallocate_hqd; goto out_deallocate_hqd;
q->mqd_mem_obj = mqd_mgr->allocate_mqd(mqd_mgr->dev, &q->properties);
if (!q->mqd_mem_obj) {
retval = -ENOMEM;
goto out_deallocate_doorbell;
}
mqd_mgr->init_mqd(mqd_mgr, &q->mqd, q->mqd_mem_obj, mqd_mgr->init_mqd(mqd_mgr, &q->mqd, q->mqd_mem_obj,
&q->gart_mqd_addr, &q->properties); &q->gart_mqd_addr, &q->properties);
if (q->properties.is_active) { if (q->properties.is_active) {
...@@ -334,7 +335,7 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -334,7 +335,7 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,
retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe,
q->queue, &q->properties, current->mm); q->queue, &q->properties, current->mm);
if (retval) if (retval)
goto out_deallocate_doorbell; goto out_free_mqd;
} }
list_add(&q->list, &qpd->queues_list); list_add(&q->list, &qpd->queues_list);
...@@ -354,9 +355,10 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -354,9 +355,10 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,
dqm->total_queue_count++; dqm->total_queue_count++;
pr_debug("Total of %d queues are accountable so far\n", pr_debug("Total of %d queues are accountable so far\n",
dqm->total_queue_count); dqm->total_queue_count);
dqm_unlock(dqm); goto out_unlock;
return retval;
out_free_mqd:
mqd_mgr->free_mqd(mqd_mgr, q->mqd, q->mqd_mem_obj);
out_deallocate_doorbell: out_deallocate_doorbell:
deallocate_doorbell(qpd, q); deallocate_doorbell(qpd, q);
out_deallocate_hqd: out_deallocate_hqd:
...@@ -370,7 +372,6 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, ...@@ -370,7 +372,6 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm,
deallocate_vmid(dqm, qpd, q); deallocate_vmid(dqm, qpd, q);
out_unlock: out_unlock:
dqm_unlock(dqm); dqm_unlock(dqm);
mqd_mgr->free_mqd(mqd_mgr, q->mqd, q->mqd_mem_obj);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment