Message ID | 1421139316-3534-1-git-send-email-oded.gabbay@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Jan 13, 2015 at 3:55 AM, Oded Gabbay <oded.gabbay@amd.com> wrote: > From: Ben Goz <ben.goz@amd.com> > > This patch rewrites destroy_queue_nocpsch() as the current logic that is > implemented in the function is completely flawed. > > This function is used only in non-HWS mode. > > Signed-off-by: Ben Goz <ben.goz@amd.com> > Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> > --- > .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 36 +++++++++++----------- > 1 file changed, 18 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c > index 3d5f71a..c83f011 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c > @@ -294,7 +294,8 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm, > struct queue *q) > { > int retval; > - struct mqd_manager *mqd, *mqd_sdma; > + struct mqd_manager *mqd; > + > BUG_ON(!dqm || !q || !q->mqd || !qpd); > > retval = 0; > @@ -302,33 +303,32 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm, > pr_debug("kfd: In Func %s\n", __func__); > > mutex_lock(&dqm->lock); > - mqd = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE); > - if (mqd == NULL) { > - retval = -ENOMEM; > - goto out; > - } > > - mqd_sdma = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_SDMA); > - if (mqd_sdma == NULL) { > - mutex_unlock(&dqm->lock); > - return -ENOMEM; > + if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) { > + mqd = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE); > + if (mqd == NULL) { > + retval = -ENOMEM; > + goto out; > + } > + deallocate_hqd(dqm, q); > + } else if (q->properties.type == KFD_QUEUE_TYPE_SDMA) { > + mqd = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_SDMA); > + if (mqd == NULL) { > + retval = -ENOMEM; > + goto out; > + } > + dqm->sdma_queue_count--; > + deallocate_sdma_queue(dqm, q->sdma_id); > } > > retval = mqd->destroy_mqd(mqd, q->mqd, > - KFD_PREEMPT_TYPE_WAVEFRONT, > + KFD_PREEMPT_TYPE_WAVEFRONT_RESET, > QUEUE_PREEMPT_DEFAULT_TIMEOUT_MS, > q->pipe, q->queue); > > if (retval != 0) > goto out; > > - if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) > - deallocate_hqd(dqm, q); > - else if (q->properties.type == KFD_QUEUE_TYPE_SDMA) { > - dqm->sdma_queue_count--; > - deallocate_sdma_queue(dqm, q->sdma_id); > - } > - > mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); > > list_del(&q->list); > -- > 1.9.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index 3d5f71a..c83f011 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -294,7 +294,8 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm, struct queue *q) { int retval; - struct mqd_manager *mqd, *mqd_sdma; + struct mqd_manager *mqd; + BUG_ON(!dqm || !q || !q->mqd || !qpd); retval = 0; @@ -302,33 +303,32 @@ static int destroy_queue_nocpsch(struct device_queue_manager *dqm, pr_debug("kfd: In Func %s\n", __func__); mutex_lock(&dqm->lock); - mqd = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE); - if (mqd == NULL) { - retval = -ENOMEM; - goto out; - } - mqd_sdma = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_SDMA); - if (mqd_sdma == NULL) { - mutex_unlock(&dqm->lock); - return -ENOMEM; + if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) { + mqd = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE); + if (mqd == NULL) { + retval = -ENOMEM; + goto out; + } + deallocate_hqd(dqm, q); + } else if (q->properties.type == KFD_QUEUE_TYPE_SDMA) { + mqd = dqm->get_mqd_manager(dqm, KFD_MQD_TYPE_SDMA); + if (mqd == NULL) { + retval = -ENOMEM; + goto out; + } + dqm->sdma_queue_count--; + deallocate_sdma_queue(dqm, q->sdma_id); } retval = mqd->destroy_mqd(mqd, q->mqd, - KFD_PREEMPT_TYPE_WAVEFRONT, + KFD_PREEMPT_TYPE_WAVEFRONT_RESET, QUEUE_PREEMPT_DEFAULT_TIMEOUT_MS, q->pipe, q->queue); if (retval != 0) goto out; - if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) - deallocate_hqd(dqm, q); - else if (q->properties.type == KFD_QUEUE_TYPE_SDMA) { - dqm->sdma_queue_count--; - deallocate_sdma_queue(dqm, q->sdma_id); - } - mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); list_del(&q->list);