diff options
author | Alex Waterman <alexw@nvidia.com> | 2015-01-22 15:48:10 -0500 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-04-04 21:04:19 -0400 |
commit | 4f693d032aa29a5b832d0fcdd48f087dc416bfcb (patch) | |
tree | 52c5e1f6c544f26152087b0d8f219fa7d95c7b7e /drivers | |
parent | 9148a1e62757bebf27eb38ba7e866c0ee5e0e6f3 (diff) |
gpu: nvgpu: Change va_node free behavior
Decrement the ref count on all mapped_buffers belonging to a va_node
when a va_node is freed. This prevents userspace from leaking some
mapped_buffers in some cases.
This does prevent userspace from keeping a buffer around after freeing
a space allocation if the buffer in question is not otherwise ref
counted. Not sure if this is a bad thing for userspace or not.
Bug 1600686
Change-Id: I659ccbda5935d44086fd367bd2110f7d0f066194
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/676629
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index b01efd41..71b14d5b 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GK20A memory management | 2 | * GK20A memory management |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -2474,12 +2474,13 @@ int gk20a_vm_free_space(struct gk20a_as_share *as_share, | |||
2474 | if (va_node) { | 2474 | if (va_node) { |
2475 | struct mapped_buffer_node *buffer, *n; | 2475 | struct mapped_buffer_node *buffer, *n; |
2476 | 2476 | ||
2477 | /* there is no need to unallocate the buffers in va. Just | 2477 | /* Decrement the ref count on all buffers in this va_node. This |
2478 | * convert them into normal buffers */ | 2478 | * allows userspace to let the kernel free mappings that are |
2479 | 2479 | * only used by this va_node. */ | |
2480 | list_for_each_entry_safe(buffer, n, | 2480 | list_for_each_entry_safe(buffer, n, |
2481 | &va_node->va_buffers_list, va_buffers_list) { | 2481 | &va_node->va_buffers_list, va_buffers_list) { |
2482 | list_del_init(&buffer->va_buffers_list); | 2482 | list_del_init(&buffer->va_buffers_list); |
2483 | kref_put(&buffer->ref, gk20a_vm_unmap_locked_kref); | ||
2483 | } | 2484 | } |
2484 | 2485 | ||
2485 | list_del(&va_node->reserved_va_list); | 2486 | list_del(&va_node->reserved_va_list); |