diff options
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/lockless_allocator.c | 13 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c index 944b4b0f..2a569efd 100644 --- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c | |||
@@ -66,12 +66,16 @@ static u64 nvgpu_lockless_alloc(struct nvgpu_allocator *a, u64 len) | |||
66 | if (ret == head) { | 66 | if (ret == head) { |
67 | addr = pa->base + head * pa->blk_size; | 67 | addr = pa->base + head * pa->blk_size; |
68 | atomic_inc(&pa->nr_allocs); | 68 | atomic_inc(&pa->nr_allocs); |
69 | alloc_dbg(a, "Alloc node # %d @ addr 0x%llx\n", head, | ||
70 | addr); | ||
71 | break; | 69 | break; |
72 | } | 70 | } |
73 | head = ACCESS_ONCE(pa->head); | 71 | head = ACCESS_ONCE(pa->head); |
74 | } | 72 | } |
73 | |||
74 | if (addr) | ||
75 | alloc_dbg(a, "Alloc node # %d @ addr 0x%llx\n", head, addr); | ||
76 | else | ||
77 | alloc_dbg(a, "Alloc failed!\n"); | ||
78 | |||
75 | return addr; | 79 | return addr; |
76 | } | 80 | } |
77 | 81 | ||
@@ -81,7 +85,9 @@ static void nvgpu_lockless_free(struct nvgpu_allocator *a, u64 addr) | |||
81 | int head, ret; | 85 | int head, ret; |
82 | u64 cur_idx; | 86 | u64 cur_idx; |
83 | 87 | ||
84 | cur_idx = addr - pa->base; | 88 | cur_idx = (addr - pa->base) / pa->blk_size; |
89 | |||
90 | alloc_dbg(a, "Free node # %llu @ addr 0x%llx\n", cur_idx, addr); | ||
85 | 91 | ||
86 | while (1) { | 92 | while (1) { |
87 | head = ACCESS_ONCE(pa->head); | 93 | head = ACCESS_ONCE(pa->head); |
@@ -89,7 +95,6 @@ static void nvgpu_lockless_free(struct nvgpu_allocator *a, u64 addr) | |||
89 | ret = cmpxchg(&pa->head, head, cur_idx); | 95 | ret = cmpxchg(&pa->head, head, cur_idx); |
90 | if (ret == head) { | 96 | if (ret == head) { |
91 | atomic_dec(&pa->nr_allocs); | 97 | atomic_dec(&pa->nr_allocs); |
92 | alloc_dbg(a, "Free node # %llu\n", cur_idx); | ||
93 | break; | 98 | break; |
94 | } | 99 | } |
95 | } | 100 | } |
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) | |||
51 | 51 | ||
52 | if (f->allocator) { | 52 | if (f->allocator) { |
53 | if (nvgpu_alloc_initialized(f->allocator)) | 53 | if (nvgpu_alloc_initialized(f->allocator)) |
54 | nvgpu_free(f->allocator, (size_t)f); | 54 | nvgpu_free(f->allocator, (u64)(uintptr_t)f); |
55 | } else | 55 | } else |
56 | nvgpu_kfree(g, f); | 56 | nvgpu_kfree(g, f); |
57 | } | 57 | } |