summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/dma.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/dma.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c
index b62c4593..9e9d1007 100644
--- a/drivers/gpu/nvgpu/common/linux/dma.c
+++ b/drivers/gpu/nvgpu/common/linux/dma.c
@@ -514,7 +514,6 @@ static void nvgpu_dma_free_sys(struct gk20a *g, struct nvgpu_mem *mem)
514static void nvgpu_dma_free_vid(struct gk20a *g, struct nvgpu_mem *mem) 514static void nvgpu_dma_free_vid(struct gk20a *g, struct nvgpu_mem *mem)
515{ 515{
516#if defined(CONFIG_GK20A_VIDMEM) 516#if defined(CONFIG_GK20A_VIDMEM)
517 bool was_empty;
518 size_t mem_size = mem->size; 517 size_t mem_size = mem->size;
519 518
520 dma_dbg_free(g, mem->size, mem->priv.flags, "vidmem"); 519 dma_dbg_free(g, mem->size, mem->priv.flags, "vidmem");
@@ -523,18 +522,19 @@ static void nvgpu_dma_free_vid(struct gk20a *g, struct nvgpu_mem *mem)
523 WARN_ON(mem->priv.flags != NVGPU_DMA_NO_KERNEL_MAPPING); 522 WARN_ON(mem->priv.flags != NVGPU_DMA_NO_KERNEL_MAPPING);
524 523
525 if (mem->mem_flags & NVGPU_MEM_FLAG_USER_MEM) { 524 if (mem->mem_flags & NVGPU_MEM_FLAG_USER_MEM) {
526 nvgpu_mutex_acquire(&g->mm.vidmem.clear_list_mutex); 525 int err = nvgpu_vidmem_clear_list_enqueue(g, mem);
527 was_empty = nvgpu_list_empty(&g->mm.vidmem.clear_list_head); 526
528 nvgpu_list_add_tail(&mem->clear_list_entry, 527 /*
529 &g->mm.vidmem.clear_list_head); 528 * If there's an error here then that means we can't clear the
530 atomic64_add(mem->aligned_size, 529 * vidmem. That's too bad; however, we still own the nvgpu_mem
531 &g->mm.vidmem.bytes_pending.atomic_var); 530 * buf so we have to free that.
532 nvgpu_mutex_release(&g->mm.vidmem.clear_list_mutex); 531 *
533 532 * We don't need to worry about the vidmem allocator itself
534 if (was_empty) { 533 * since when that gets cleaned up in the driver shutdown path
535 cancel_work_sync(&g->mm.vidmem.clear_mem_worker); 534 * all the outstanding allocs are force freed.
536 schedule_work(&g->mm.vidmem.clear_mem_worker); 535 */
537 } 536 if (err)
537 nvgpu_kfree(g, mem);
538 } else { 538 } else {
539 nvgpu_memset(g, mem, 0, 0, mem->aligned_size); 539 nvgpu_memset(g, mem, 0, 0, mem->aligned_size);
540 nvgpu_free(mem->allocator, 540 nvgpu_free(mem->allocator,