From 2889093618a41a04d1a21af75a3d40834a6b1c47 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 31 Aug 2016 16:31:09 -0700 Subject: gpu: nvgpu: Add barriers for init test Make sure that all writes have been commited before allowing the variable storing the init status to be seen as non-zero. Pair this with a read memory barrier where the check for the status is done. Bug 1799159 Change-Id: I938dffdfc2f39187b0dad11b7e283381560961b4 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1211523 (cherry picked from commit 6dd673d24a93c05834c9d96d2022b359ced5b73b) Reviewed-on: http://git-master/r/1223456 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c | 2 ++ drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c index 29f52081..2291a953 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_bitmap.c @@ -42,6 +42,7 @@ static int gk20a_bitmap_alloc_inited(struct gk20a_allocator *a) { struct gk20a_bitmap_allocator *ba = a->priv; + rmb(); return ba->inited; } @@ -405,6 +406,7 @@ int gk20a_bitmap_allocator_init(struct gk20a_allocator *__a, if (!a->bitmap) goto fail; + wmb(); a->inited = true; gk20a_init_alloc_debug(__a); diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c index 70a10c24..ee5e69d2 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_buddy.c @@ -1078,6 +1078,7 @@ static int gk20a_buddy_alloc_inited(struct gk20a_allocator *a) { struct gk20a_buddy_allocator *ba = a->priv; + rmb(); return ba->initialized; } @@ -1284,6 +1285,7 @@ int __gk20a_buddy_allocator_init(struct gk20a_allocator *__a, if (err) goto fail; + wmb(); a->initialized = 1; gk20a_init_alloc_debug(__a); -- cgit v1.2.2