diff options
author | Ben Goz <ben.goz@amd.com> | 2018-05-01 17:56:10 -0400 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@gmail.com> | 2018-05-01 17:56:10 -0400 |
commit | bfdcbfd25516eba6cd7b9862779a325ec26006ad (patch) | |
tree | 5a2e426e38249de1b337621577f295167cb15877 | |
parent | ccb76b149e1c849c0aee6b5043aed74d41064ad6 (diff) |
drm/amdkfd: Locking PM mutex while allocating IB buffer
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>
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c index 91f0350b6180..c317feb43f69 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c | |||
@@ -94,12 +94,14 @@ static int pm_allocate_runlist_ib(struct packet_manager *pm, | |||
94 | 94 | ||
95 | pm_calc_rlib_size(pm, rl_buffer_size, is_over_subscription); | 95 | pm_calc_rlib_size(pm, rl_buffer_size, is_over_subscription); |
96 | 96 | ||
97 | mutex_lock(&pm->lock); | ||
98 | |||
97 | retval = kfd_gtt_sa_allocate(pm->dqm->dev, *rl_buffer_size, | 99 | retval = kfd_gtt_sa_allocate(pm->dqm->dev, *rl_buffer_size, |
98 | &pm->ib_buffer_obj); | 100 | &pm->ib_buffer_obj); |
99 | 101 | ||
100 | if (retval) { | 102 | if (retval) { |
101 | pr_err("Failed to allocate runlist IB\n"); | 103 | pr_err("Failed to allocate runlist IB\n"); |
102 | return retval; | 104 | goto out; |
103 | } | 105 | } |
104 | 106 | ||
105 | *(void **)rl_buffer = pm->ib_buffer_obj->cpu_ptr; | 107 | *(void **)rl_buffer = pm->ib_buffer_obj->cpu_ptr; |
@@ -107,6 +109,9 @@ static int pm_allocate_runlist_ib(struct packet_manager *pm, | |||
107 | 109 | ||
108 | memset(*rl_buffer, 0, *rl_buffer_size); | 110 | memset(*rl_buffer, 0, *rl_buffer_size); |
109 | pm->allocated = true; | 111 | pm->allocated = true; |
112 | |||
113 | out: | ||
114 | mutex_unlock(&pm->lock); | ||
110 | return retval; | 115 | return retval; |
111 | } | 116 | } |
112 | 117 | ||