From 61ef5a58744d22e65d3ad7c3a04a2521d0ccb6af Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 15 Aug 2017 11:16:07 -0700 Subject: gpu: nvgpu: Deterministic submit fix Fix some simple pointer arithmetic errors in the deterministic submit path. The lockless allocator was doing a subtraction to determine the correct offset of the element to free. However, this subtraction was using the base address and a numeric offset - not a pointer offset. Thus the difference computed was in bytes not in elements of the block size. The fix is simple: just divide by the block size. Also this modifies the debugging statement a bit so that a bit more information is printed at more useful times. Lastly, a pointer to numeric cast was fixed in the fence code. Change-Id: I514724205f1b73805b21e979481a13ac689f3482 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1538905 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker Reviewed-by: Aingara Paramakuru Reviewed-by: svc-mobile-coverity Reviewed-by: Konsta Holtta GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/fence_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index 51363059..8ad24c44 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c @@ -51,7 +51,7 @@ static void gk20a_fence_free(struct kref *ref) if (f->allocator) { if (nvgpu_alloc_initialized(f->allocator)) - nvgpu_free(f->allocator, (size_t)f); + nvgpu_free(f->allocator, (u64)(uintptr_t)f); } else nvgpu_kfree(g, f); } -- cgit v1.2.2