All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emily Deng <Emily.Deng-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Emily Deng <Emily.Deng-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH] drm/amdgpu: add rcu_barrier after entity fini
Date: Thu, 17 May 2018 11:05:26 +0800	[thread overview]
Message-ID: <1526526326-5130-1-git-send-email-Emily.Deng@amd.com> (raw)

To free the fence from the amdgpu_fence_slab, need twice call_rcu, to avoid
the amdgpu_fence_slab_fini call kmem_cache_destroy(amdgpu_fence_slab) before
kmem_cache_free(amdgpu_fence_slab, fence), add rcu_barrier after drm_sched_entity_fini.

The kmem_cache_free(amdgpu_fence_slab, fence)'s call trace as below:
1.drm_sched_entity_fini ->
drm_sched_entity_cleanup ->
dma_fence_put(entity->last_scheduled) ->
drm_sched_fence_release_finished ->
drm_sched_fence_release_scheduled ->
call_rcu(&fence->finished.rcu, drm_sched_fence_free)

2.drm_sched_fence_free ->
dma_fence_put(fence->parent) ->
amdgpu_fence_release ->
call_rcu(&f->rcu, amdgpu_fence_free) ->
kmem_cache_free(amdgpu_fence_slab, fence);

Change-Id: I8dcadd3372f97e72461bf46b41cc26d90f09b8df
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index cc3b067..07b2e10 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -134,6 +134,7 @@ static void amdgpu_ttm_global_fini(struct amdgpu_device *adev)
 	if (adev->mman.mem_global_referenced) {
 		drm_sched_entity_fini(adev->mman.entity.sched,
 				      &adev->mman.entity);
+		rcu_barrier();
 		mutex_destroy(&adev->mman.gtt_window_lock);
 		drm_global_item_unref(&adev->mman.bo_global_ref.ref);
 		drm_global_item_unref(&adev->mman.mem_global_ref);
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2018-05-17  3:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17  3:05 Emily Deng [this message]
     [not found] ` <1526526326-5130-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org>
2018-05-17  3:32   ` [PATCH] drm/amdgpu: add rcu_barrier after entity fini Zhou, David(ChunMing)
2018-05-17  7:42   ` Michel Dänzer
2018-05-17  8:39   ` Christian König
     [not found]     ` <a2990863-eea0-ecdd-0e86-f208fd91d59c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-17 10:01       ` Deng, Emily
2018-05-17 10:03 Emily Deng
     [not found] ` <1526551432-12599-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org>
2018-05-17 11:07   ` Christian König
     [not found]     ` <ec5de5ac-f9b8-53e5-0db4-3e0791469b40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-18  3:20       ` Deng, Emily
     [not found]         ` <CY4PR12MB112526B02190A3D892CCB84F8F900-rpdhrqHFk07v2MZdTKcfDgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-05-18  9:41           ` Deng, Emily
     [not found]             ` <BN6PR12MB11210121E65A155D901B94AE8F900-/b2+HYfkarSgw6z4+5+8kgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-05-18  9:45               ` Christian König
     [not found]                 ` <3f9070bd-ebce-77d4-5979-6ce383885064-5C7GfCeVMHo@public.gmane.org>
2018-05-18  9:56                   ` Deng, Emily
     [not found]                     ` <BN6PR12MB1121DDBFDB283E01AC198B038F900-/b2+HYfkarSgw6z4+5+8kgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-05-18 10:35                       ` Christian König
     [not found]                         ` <bc3fbefd-957a-9b89-8096-22b44f6dc3d2-5C7GfCeVMHo@public.gmane.org>
2018-05-21  7:54                           ` Deng, Emily
2018-05-21  8:08 Emily Deng
     [not found] ` <1526890130-673-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org>
2018-05-23  5:25   ` Deng, Emily
     [not found]     ` <CY4PR12MB1125509E5759D4FDB7C097998F6B0-rpdhrqHFk07v2MZdTKcfDgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-05-23  7:32       ` Christian König
     [not found]         ` <c19068bf-4c4d-bb74-f31c-f5b71a2f8333-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-23  7:47           ` Deng, Emily

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526526326-5130-1-git-send-email-Emily.Deng@amd.com \
    --to=emily.deng-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.