回复: [PATCH] drm/amdgpu: fix losting fence signal

Zhou, David(ChunMing) David1.Zhou at amd.com
Wed Jun 22 12:29:56 UTC 2016


David Mao reported amd_sched_process doesn't balance with cs_ioctl, you should see that thread.

Regards,
David Zhou

Sent from my Huawei Mobile

-------- 原始邮件 --------
主题:Re: [PATCH] drm/amdgpu: fix losting fence signal
发件人:Christian K鰊ig
收件人:"Zhou, David(ChunMing)" ,amd-gfx at lists.freedesktop.org
抄送:"Mao, David"

Am 22.06.2016 um 08:58 schrieb Chunming Zhou:
> Change-Id: Ibfb7e8af796cc178dfb40d8aaabda472de3c5eda
> Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>

NAK, this could lead to a situation where we try to signal a fence twice.

Why do you think that we would loose fences otherwise?

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index 17bd5af..6a69336 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -192,9 +192,10 @@ static void amdgpu_fence_schedule_fallback(struct amdgpu_ring *ring)
>   void amdgpu_fence_process(struct amdgpu_ring *ring)
>   {
>        struct amdgpu_fence_driver *drv = &ring->fence_drv;
> -     uint32_t seq, last_seq;
> +     uint32_t seq, last_seq, old_seq;
>        int r;
>
> +     old_seq = atomic_read(&ring->fence_drv.last_seq);
>        do {
>                last_seq = atomic_read(&ring->fence_drv.last_seq);
>                seq = amdgpu_fence_read(ring);
> @@ -204,10 +205,10 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>        if (seq != ring->fence_drv.sync_seq)
>                amdgpu_fence_schedule_fallback(ring);
>
> -     while (last_seq != seq) {
> +     while (old_seq != seq) {
>                struct fence *fence, **ptr;
>
> -             ptr = &drv->fences[++last_seq & drv->num_fences_mask];
> +             ptr = &drv->fences[++old_seq & drv->num_fences_mask];
>
>                /* There is always exactly one thread signaling this fence slot */
>                fence = rcu_dereference_protected(*ptr, 1);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160622/c0f5b964/attachment-0001.html>


More information about the amd-gfx mailing list