diff options
author | Alex Waterman <alexw@nvidia.com> | 2016-09-14 20:07:05 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-09-20 17:56:45 -0400 |
commit | f5224bde147537f55cc0d6e90761471ab802cf19 (patch) | |
tree | aa3b3acb037d489a3d158de1707389b5af0a4d33 | |
parent | 9b7b5c3affdac7babeee111a2493baa90aace806 (diff) |
gpu: nvgpu: Fix rmb()s in allocators
Fix the rmb() location of the rmb() in the buddy and bitmap allocators.
The previous fix was not quite right. The rmb() needs to be after the
init value is read so that any subsequent reads occur after the init
value is read. If this is not done then subsequent reads could be loaded
before the value of init is checked and possibly be invalid.
Bug 1811382
Change-Id: I6d1fa25cc16c5e19fd2769d489878afa2f8e3e35
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1221061
(cherry picked from commit f2ddb6c56e554c39733c8fc9ae870dfc12e47b44)
Reviewed-on: http://git-master/r/1223458
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c index 2291a953..a2aa85fa 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c | |||
@@ -41,9 +41,10 @@ static u64 gk20a_bitmap_alloc_base(struct gk20a_allocator *a) | |||
41 | static int gk20a_bitmap_alloc_inited(struct gk20a_allocator *a) | 41 | static int gk20a_bitmap_alloc_inited(struct gk20a_allocator *a) |
42 | { | 42 | { |
43 | struct gk20a_bitmap_allocator *ba = a->priv; | 43 | struct gk20a_bitmap_allocator *ba = a->priv; |
44 | int inited = ba->inited; | ||
44 | 45 | ||
45 | rmb(); | 46 | rmb(); |
46 | return ba->inited; | 47 | return inited; |
47 | } | 48 | } |
48 | 49 | ||
49 | static u64 gk20a_bitmap_alloc_end(struct gk20a_allocator *a) | 50 | static u64 gk20a_bitmap_alloc_end(struct gk20a_allocator *a) |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c index ee5e69d2..f9fb48b5 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c | |||
@@ -1077,9 +1077,10 @@ static u64 gk20a_buddy_alloc_base(struct gk20a_allocator *a) | |||
1077 | static int gk20a_buddy_alloc_inited(struct gk20a_allocator *a) | 1077 | static int gk20a_buddy_alloc_inited(struct gk20a_allocator *a) |
1078 | { | 1078 | { |
1079 | struct gk20a_buddy_allocator *ba = a->priv; | 1079 | struct gk20a_buddy_allocator *ba = a->priv; |
1080 | int inited = ba->initialized; | ||
1080 | 1081 | ||
1081 | rmb(); | 1082 | rmb(); |
1082 | return ba->initialized; | 1083 | return inited; |
1083 | } | 1084 | } |
1084 | 1085 | ||
1085 | static u64 gk20a_buddy_alloc_end(struct gk20a_allocator *a) | 1086 | static u64 gk20a_buddy_alloc_end(struct gk20a_allocator *a) |