diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2016-08-19 04:50:08 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-09-08 12:43:49 -0400 |
commit | f31e575ed6b048f2139eab0433cce7f18e670b28 (patch) | |
tree | db83180df4339c446b0246c589bf0cb2d4e096d0 /drivers | |
parent | dc3976e4c3daeaa00fd41e1f402d53bfcb908311 (diff) |
gpu: nvgpu: remove blocking wait for vidmem allocation
We have blocking 1sec wait for vidmem allocation
Remove this blocking wait and just return proper error
code to the caller
In case we have some buffers to be cleaned up in the
list (clear_list_head), return EAGAIN so that caller
can retry
Otherwise return ENOMEM indicating that no memory is
available right now
Jira DNVGPU-84
Change-Id: Ife2b17c989fc80e568f03bb18ad75b93a25be962
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1204969
(cherry picked from commit 2bacdf0bc6d5b1cdcb8be37e574ca5f4f0663cae)
Reviewed-on: http://git-master/r/1213451
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index e1f135e7..d26855f4 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -2981,7 +2981,7 @@ int gk20a_gmmu_alloc_attr_vid_at(struct gk20a *g, enum dma_attr attr, | |||
2981 | #if defined(CONFIG_GK20A_VIDMEM) | 2981 | #if defined(CONFIG_GK20A_VIDMEM) |
2982 | u64 addr; | 2982 | u64 addr; |
2983 | int err; | 2983 | int err; |
2984 | unsigned long end_jiffies = jiffies + msecs_to_jiffies(1000); | 2984 | bool clear_list_empty; |
2985 | struct gk20a_allocator *vidmem_alloc = g->mm.vidmem.cleared ? | 2985 | struct gk20a_allocator *vidmem_alloc = g->mm.vidmem.cleared ? |
2986 | &g->mm.vidmem.allocator : | 2986 | &g->mm.vidmem.allocator : |
2987 | &g->mm.vidmem.bootstrap_allocator; | 2987 | &g->mm.vidmem.bootstrap_allocator; |
@@ -2995,16 +2995,17 @@ int gk20a_gmmu_alloc_attr_vid_at(struct gk20a *g, enum dma_attr attr, | |||
2995 | * are not done anyway */ | 2995 | * are not done anyway */ |
2996 | WARN_ON(attr != 0 && attr != DMA_ATTR_NO_KERNEL_MAPPING); | 2996 | WARN_ON(attr != 0 && attr != DMA_ATTR_NO_KERNEL_MAPPING); |
2997 | 2997 | ||
2998 | do { | 2998 | addr = __gk20a_gmmu_alloc(vidmem_alloc, at, size); |
2999 | addr = __gk20a_gmmu_alloc(vidmem_alloc, at, size); | 2999 | if (!addr) { |
3000 | if (!addr) /* Possible OOM */ | 3000 | mutex_lock(&g->mm.vidmem.clear_list_mutex); |
3001 | usleep_range(100, 300); | 3001 | clear_list_empty = list_empty(&g->mm.vidmem.clear_list_head); |
3002 | else | 3002 | mutex_unlock(&g->mm.vidmem.clear_list_mutex); |
3003 | break; | ||
3004 | } while (time_before(jiffies, end_jiffies)); | ||
3005 | 3003 | ||
3006 | if (!addr) | 3004 | if (clear_list_empty) |
3007 | return -ENOMEM; | 3005 | return -ENOMEM; |
3006 | else | ||
3007 | return -EAGAIN; | ||
3008 | } | ||
3008 | 3009 | ||
3009 | if (at) | 3010 | if (at) |
3010 | mem->fixed = true; | 3011 | mem->fixed = true; |