diff mbox series

[v5,1/6] drm/amd/display: wait for fence without holding reservation lock

Message ID 1555599624-12285-1-git-send-email-andrey.grodzovsky@amd.com (mailing list archive)
State New, archived
Headers show
Series [v5,1/6] drm/amd/display: wait for fence without holding reservation lock | expand

Commit Message

Andrey Grodzovsky April 18, 2019, 3 p.m. UTC
From: Christian König <ckoenig.leichtzumerken@gmail.com>

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>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Dieter Nützel April 23, 2019, 2:35 a.m. UTC | #1
Hello Andrey,

this series can't apply (brake on #3) on top of amd-staging-drm-next.
v2 works (Thu, 11 Apr 2019).

Dieter

Am 18.04.2019 17:00, schrieb Andrey Grodzovsky:
> From: Christian König <ckoenig.leichtzumerken@gmail.com>
> 
> 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>
> ---
>  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 380a7f9..ad4f0e5 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4814,23 +4814,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);
Andrey Grodzovsky April 23, 2019, 2:02 p.m. UTC | #2
This series is on top of drm-misc because of panfrost and lima drovers 
which are missing form amd-staging-drm-next. Once i land it in drm-misc 
I will merge and p[ush it into drm-next.

Andrey

On 4/22/19 10:35 PM, Dieter Nützel wrote:
> Hello Andrey,
>
> this series can't apply (brake on #3) on top of amd-staging-drm-next.
> v2 works (Thu, 11 Apr 2019).
>
> Dieter
>
> Am 18.04.2019 17:00, schrieb Andrey Grodzovsky:
>> From: Christian König <ckoenig.leichtzumerken@gmail.com>
>>
>> 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>
>> ---
>>  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 380a7f9..ad4f0e5 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -4814,23 +4814,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);
diff mbox series

Patch

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 380a7f9..ad4f0e5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4814,23 +4814,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);