diff options
author | Christian König <christian.koenig@amd.com> | 2016-10-28 11:04:07 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-10-31 12:43:20 -0400 |
commit | c24784f01549ecdf23fc00d0588423bcf8956714 (patch) | |
tree | 14de2bb1c8f9ecd2d38c230c286c13e59d4dcbad /drivers/gpu/drm/amd/scheduler/sched_fence.c | |
parent | 91efdb2718e0c5ff014f0cf98cac99f088a9a4d2 (diff) |
drm/amd: fix scheduler fence teardown order v2
Some fences might be alive even after we have stopped the scheduler leading
to warnings about leaked objects from the SLUB allocator.
Fix this by allocating/freeing the SLUB allocator from the module
init/fini functions just like we do it for hw fences.
v2: make variable static, add link to bug
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=97500
Reported-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/gpu/drm/amd/scheduler/sched_fence.c')
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/sched_fence.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/scheduler/sched_fence.c b/drivers/gpu/drm/amd/scheduler/sched_fence.c index 3653b5a40494..88fc2d662579 100644 --- a/drivers/gpu/drm/amd/scheduler/sched_fence.c +++ b/drivers/gpu/drm/amd/scheduler/sched_fence.c | |||
@@ -27,6 +27,25 @@ | |||
27 | #include <drm/drmP.h> | 27 | #include <drm/drmP.h> |
28 | #include "gpu_scheduler.h" | 28 | #include "gpu_scheduler.h" |
29 | 29 | ||
30 | static struct kmem_cache *sched_fence_slab; | ||
31 | |||
32 | int amd_sched_fence_slab_init(void) | ||
33 | { | ||
34 | sched_fence_slab = kmem_cache_create( | ||
35 | "amd_sched_fence", sizeof(struct amd_sched_fence), 0, | ||
36 | SLAB_HWCACHE_ALIGN, NULL); | ||
37 | if (!sched_fence_slab) | ||
38 | return -ENOMEM; | ||
39 | |||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | void amd_sched_fence_slab_fini(void) | ||
44 | { | ||
45 | rcu_barrier(); | ||
46 | kmem_cache_destroy(sched_fence_slab); | ||
47 | } | ||
48 | |||
30 | struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *entity, | 49 | struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *entity, |
31 | void *owner) | 50 | void *owner) |
32 | { | 51 | { |