Skip to content

Commit

Permalink
drm/amdkfd: Locking PM mutex while allocating IB buffer
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Goz <ben.goz@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
  • Loading branch information
Ben Goz authored and Oded Gabbay committed May 1, 2018
1 parent ccb76b1 commit bfdcbfd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,24 @@ static int pm_allocate_runlist_ib(struct packet_manager *pm,

pm_calc_rlib_size(pm, rl_buffer_size, is_over_subscription);

mutex_lock(&pm->lock);

retval = kfd_gtt_sa_allocate(pm->dqm->dev, *rl_buffer_size,
&pm->ib_buffer_obj);

if (retval) {
pr_err("Failed to allocate runlist IB\n");
return retval;
goto out;
}

*(void **)rl_buffer = pm->ib_buffer_obj->cpu_ptr;
*rl_gpu_buffer = pm->ib_buffer_obj->gpu_addr;

memset(*rl_buffer, 0, *rl_buffer_size);
pm->allocated = true;

out:
mutex_unlock(&pm->lock);
return retval;
}

Expand Down

0 comments on commit bfdcbfd

Please sign in to comment.