AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Kazlauskas, Nicholas" <Nicholas.Kazlauskas-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Wentland, Harry" <Harry.Wentland-5C7GfCeVMHo@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/amd/display: wait for fence without holding reservation lock
Date: Tue, 2 Apr 2019 14:45:24 +0000	[thread overview]
Message-ID: <133d9999-e170-8d18-69b7-15a78648e6f9@amd.com> (raw)
In-Reply-To: <9f78fcd2-2753-7145-03f9-cee3f4da9938-5C7GfCeVMHo@public.gmane.org>

On 4/2/19 10:41 AM, Kazlauskas, Nicholas wrote:
> On 4/2/19 10:28 AM, Christian König wrote:
>> Don't block others while waiting for the fences to finish, concurrent
>> submission is perfectly valid in this case and holding the lock can
>> prevent killed applications from terminating.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
> 
> Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
> 
> I do recall having the discussion about this a while back with you and
> Andrey.
> 
> I highly doubt that the flags would ever really change here (if they're
> even capable) between the wait and the lock so I think this is fine.
> 
> I think there's a bigger problem with that and how they could
> potentially change between atomic check and atomic commit tail anyway
> (and doing something bad after we think it's passed validation).
> 
> But this is mostly a theoretical concern I think rather than a practical
> one.
> 
> Thanks.
> 
> Nicholas Kazlauskas

...and waiting for the fence isn't really analogous to ensuring that 
they can't change in the first place I suppose.

This looks fine.

Nicholas Kazlauskas


> 
> 
>> ---
>>    drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 ++++++++-----
>>    1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 697af51d403a..9426e701a7b6 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -5129,23 +5129,26 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
>>    			continue;
>>    		}
>>    
>> +		abo = gem_to_amdgpu_bo(fb->obj[0]);
>> +
>> +		/* Wait for all fences on this FB */
>> +		r = reservation_object_wait_timeout_rcu(abo->tbo.resv, true,
>> +							false,
>> +							MAX_SCHEDULE_TIMEOUT);
>> +		WARN_ON(r < 0);
>> +
>>    		/*
>>    		 * TODO This might fail and hence better not used, wait
>>    		 * explicitly on fences instead
>>    		 * and in general should be called for
>>    		 * blocking commit to as per framework helpers
>>    		 */
>> -		abo = gem_to_amdgpu_bo(fb->obj[0]);
>>    		r = amdgpu_bo_reserve(abo, true);
>>    		if (unlikely(r != 0)) {
>>    			DRM_ERROR("failed to reserve buffer before flip\n");
>>    			WARN_ON(1);
>>    		}
>>    
>> -		/* Wait for all fences on this FB */
>> -		WARN_ON(reservation_object_wait_timeout_rcu(abo->tbo.resv, true, false,
>> -									    MAX_SCHEDULE_TIMEOUT) < 0);
>> -
>>    		amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
>>    
>>    		amdgpu_bo_unreserve(abo);
>>
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> 

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

      parent reply	other threads:[~2019-04-02 14:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 14:28 [PATCH] drm/amd/display: wait for fence without holding reservation lock Christian König
     [not found] ` <20190402142813.8381-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2019-04-02 14:41   ` Kazlauskas, Nicholas
     [not found]     ` <9f78fcd2-2753-7145-03f9-cee3f4da9938-5C7GfCeVMHo@public.gmane.org>
2019-04-02 14:45       ` Kazlauskas, Nicholas [this message]

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=133d9999-e170-8d18-69b7-15a78648e6f9@amd.com \
    --to=nicholas.kazlauskas-5c7gfcevmho@public.gmane.org \
    --cc=Harry.Wentland-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@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