diff options
author | Arto Merilainen <amerilainen@nvidia.com> | 2014-04-08 07:28:10 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:09:01 -0400 |
commit | ef4ed26f8b1dd9545b7922def3bfec425cfa0562 (patch) | |
tree | d72db3df12902774062368ca3e639e12b1a15df2 | |
parent | c38dae5b522a9b2ce5996d82968d846187f3e152 (diff) |
gpu: nvgpu: Remove redundant locked variable
Queue locked variable holds entirely redundant information about the
queue status and having the variable causes a race between lock() and
unlock() functions. This patch removes the locked variable.
Bug 1495617
Change-Id: I05682bfe7a23acc77c2bfe405938ace7d2b3d081
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/393431
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prashant Malani <pmalani@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.h | 1 |
2 files changed, 3 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index c4bfe527..e9e0c26f 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | |||
@@ -1270,15 +1270,10 @@ static int pmu_queue_lock(struct pmu_gk20a *pmu, | |||
1270 | 1270 | ||
1271 | if (PMU_IS_SW_COMMAND_QUEUE(queue->id)) { | 1271 | if (PMU_IS_SW_COMMAND_QUEUE(queue->id)) { |
1272 | mutex_lock(&queue->mutex); | 1272 | mutex_lock(&queue->mutex); |
1273 | queue->locked = true; | ||
1274 | return 0; | 1273 | return 0; |
1275 | } | 1274 | } |
1276 | 1275 | ||
1277 | err = pmu_mutex_acquire(pmu, queue->mutex_id, | 1276 | err = pmu_mutex_acquire(pmu, queue->mutex_id, &queue->mutex_lock); |
1278 | &queue->mutex_lock); | ||
1279 | if (err == 0) | ||
1280 | queue->locked = true; | ||
1281 | |||
1282 | return err; | 1277 | return err; |
1283 | } | 1278 | } |
1284 | 1279 | ||
@@ -1292,18 +1287,11 @@ static int pmu_queue_unlock(struct pmu_gk20a *pmu, | |||
1292 | 1287 | ||
1293 | if (PMU_IS_SW_COMMAND_QUEUE(queue->id)) { | 1288 | if (PMU_IS_SW_COMMAND_QUEUE(queue->id)) { |
1294 | mutex_unlock(&queue->mutex); | 1289 | mutex_unlock(&queue->mutex); |
1295 | queue->locked = false; | ||
1296 | return 0; | 1290 | return 0; |
1297 | } | 1291 | } |
1298 | 1292 | ||
1299 | if (queue->locked) { | 1293 | err = pmu_mutex_release(pmu, queue->mutex_id, &queue->mutex_lock); |
1300 | err = pmu_mutex_release(pmu, queue->mutex_id, | 1294 | return err; |
1301 | &queue->mutex_lock); | ||
1302 | if (err == 0) | ||
1303 | queue->locked = false; | ||
1304 | } | ||
1305 | |||
1306 | return 0; | ||
1307 | } | 1295 | } |
1308 | 1296 | ||
1309 | /* called by pmu_read_message, no lock */ | 1297 | /* called by pmu_read_message, no lock */ |
@@ -1327,8 +1315,6 @@ static bool pmu_queue_has_room(struct pmu_gk20a *pmu, | |||
1327 | u32 head, tail, free; | 1315 | u32 head, tail, free; |
1328 | bool rewind = false; | 1316 | bool rewind = false; |
1329 | 1317 | ||
1330 | BUG_ON(!queue->locked); | ||
1331 | |||
1332 | size = ALIGN(size, QUEUE_ALIGNMENT); | 1318 | size = ALIGN(size, QUEUE_ALIGNMENT); |
1333 | 1319 | ||
1334 | pmu_queue_head(pmu, queue, &head, QUEUE_GET); | 1320 | pmu_queue_head(pmu, queue, &head, QUEUE_GET); |
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h index c1b8ff1f..de519bf6 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h | |||
@@ -862,7 +862,6 @@ struct pmu_queue { | |||
862 | /* open-flag */ | 862 | /* open-flag */ |
863 | u32 oflag; | 863 | u32 oflag; |
864 | bool opened; /* opened implies locked */ | 864 | bool opened; /* opened implies locked */ |
865 | bool locked; /* check free space after setting locked but before setting opened */ | ||
866 | }; | 865 | }; |
867 | 866 | ||
868 | 867 | ||