AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 1/9] drm/amdgpu:cleanup hw fence get&put
Date: Wed, 25 Oct 2017 17:22:15 +0800	[thread overview]
Message-ID: <1508923343-24404-2-git-send-email-Monk.Liu@amd.com> (raw)
In-Reply-To: <1508923343-24404-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>

In amdgpu_fence_process it shouldn't put the signaled hw fence and set
RCU pointer to NULL, instead the more reasonable sequence is just leave
the RCU be there untouched, and:
1) Either driver_fini() should put this RCU fence or
2) New hw fence emitting should take the RCU slot and put the old hw fence.

mapping between get & put on hw fence is:

Get						Put
fence_emit:fence_init	--->	free_job:put job->fence
	       		--->	run_job:put job->fence //GPU RESET case

fence_emit:rcu_assign_pointer	---> fence_driver_fini:put ring->fence_drv.fences[j]
				---> fence_emit:put(old) //after fence_wait(old)

run_job:job->fence=fence_get()	--> sched_main:put(fence)
				--> job_recovery:put(fence) //for GPU RESET case

sched_main:parent=fence_get()	--> sched_fence_free:put(fence->parent)
sched_job_recovery:parent=fence_get() --> sched_hw_job_reset:put(s_job->s_fence->parent) // for GPU RESET case

Change-Id: I623167c1e3143233f4e1be7a400a9b698b4a1355
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index f43319c..d7374cf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -161,6 +161,8 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f)
 		dma_fence_wait(old, false);
 	}
 
+	dma_fence_put(old);
+
 	rcu_assign_pointer(*ptr, dma_fence_get(&fence->base));
 
 	*f = &fence->base;
@@ -246,7 +248,6 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
 
 		/* There is always exactly one thread signaling this fence slot */
 		fence = rcu_dereference_protected(*ptr, 1);
-		RCU_INIT_POINTER(*ptr, NULL);
 
 		if (!fence)
 			continue;
@@ -257,7 +258,6 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
 		else
 			BUG();
 
-		dma_fence_put(fence);
 	} while (last_seq != seq);
 }
 
-- 
2.7.4

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

  parent reply	other threads:[~2017-10-25  9:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25  9:22 [PATCH 0/9] *** patch series for new gpu recover*** Monk Liu
     [not found] ` <1508923343-24404-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-25  9:22   ` Monk Liu [this message]
     [not found]     ` <1508923343-24404-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-25 11:38       ` [PATCH 1/9] drm/amdgpu:cleanup hw fence get&put Christian König
2017-10-25  9:22   ` [PATCH 2/9] amd/scheduler:imple job skip feature Monk Liu
     [not found]     ` <1508923343-24404-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26  7:06       ` Christian König
     [not found]         ` <79a7f228-3d63-e043-58c1-2986379b6296-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-26  8:11           ` Liu, Monk
2017-10-25  9:22   ` [PATCH 3/9] drm/amdgpu:implement new GPU recover(v2) Monk Liu
     [not found]     ` <1508923343-24404-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26  7:11       ` Christian König
2017-10-25  9:22   ` [PATCH 4/9] drm/amdgpu:replace deprecated gpu reset Monk Liu
     [not found]     ` <1508923343-24404-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26  7:13       ` Christian König
     [not found]         ` <13ad16b1-6357-1f0e-3cdd-ddc42d4462b0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-26  8:13           ` Liu, Monk
     [not found]             ` <BLUPR12MB04499B9B8F278BE639D144A184450-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-26  8:16               ` Christian König
2017-10-25  9:22   ` [PATCH 5/9] drm/amdgpu:cleanup in_sriov_reset and lock_reset Monk Liu
     [not found]     ` <1508923343-24404-6-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26  7:14       ` Christian König
2017-10-25  9:22   ` [PATCH 6/9] drm/amdgpu:cleanup ucode_init_bo Monk Liu
     [not found]     ` <1508923343-24404-7-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26  7:17       ` Christian König
2017-10-25  9:22   ` [PATCH 7/9] drm/amdgpu:block kms open during gpu_reset Monk Liu
     [not found]     ` <1508923343-24404-8-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26  7:18       ` Christian König
     [not found]         ` <46bc9872-0bd7-c2b7-4879-6cab5789f252-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-26  8:17           ` Liu, Monk
     [not found]             ` <BLUPR12MB0449D707ECAE76FFAA13C46684450-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-26 10:54               ` Christian König
     [not found]                 ` <06a765e3-971e-698c-6d07-1dee69c1e0c8-5C7GfCeVMHo@public.gmane.org>
2017-10-26 11:08                   ` Liu, Monk
     [not found]                     ` <BLUPR12MB044997E32FD02ACDBD978C7084450-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-26 15:15                       ` Christian König
     [not found]                         ` <46a5317f-e606-5cfe-82c9-46df64818435-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-30  3:47                           ` Liu, Monk
     [not found]                             ` <BLUPR12MB0449DD842E46A942CF53484084590-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-30  7:37                               ` Christian König
     [not found]                                 ` <f2213f71-9280-bb51-5283-5349878956f7-5C7GfCeVMHo@public.gmane.org>
2017-10-30  7:54                                   ` Liu, Monk
     [not found]                                     ` <SN1PR12MB04629FAC65DFD5F133D2E34484590-z7L1TMIYDg7VaWpRXmIMygdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-30  9:20                                       ` Christian König
2017-10-25  9:22   ` [PATCH 8/9] drm/amdgpu/sriov:fix memory leak in psp_load_fw Monk Liu
     [not found]     ` <1508923343-24404-9-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26  7:21       ` Christian König
2017-10-25  9:22   ` [PATCH 9/9] drm/amdgpu:fix random missing of FLR NOTIFY Monk Liu
     [not found]     ` <1508923343-24404-10-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-26  7:22       ` Christian König

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=1508923343-24404-2-git-send-email-Monk.Liu@amd.com \
    --to=monk.liu-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox