diff mbox

[2/5] drm/atomic: Convert atomic ioctl locking to interruptible.

Message ID 20170727125840.19618-3-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maarten Lankhorst July 27, 2017, 12:58 p.m. UTC
Pass DRM_MODESET_ACQUIRE_INTERRUPTIBLE to acquire_init, and
handle drm_modeset_backoff which can now fail by returning the error.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/drm_atomic.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Daniel Vetter July 27, 2017, 3:27 p.m. UTC | #1
On Thu, Jul 27, 2017 at 02:58:37PM +0200, Maarten Lankhorst wrote:
> Pass DRM_MODESET_ACQUIRE_INTERRUPTIBLE to acquire_init, and
> handle drm_modeset_backoff which can now fail by returning the error.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Requires a testcase, with that addressed:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

I think the test should be:

1. On thread stuck on a blocking plane update (using a vgem fence that
doesn't get signalled).

2. Second thread does a blocking plane update on that the same plane.

3. Gets interrupted by a signal, and we confirm that we receive that
signal before we've unblocked the first thread.

This would give us positive confirmation that interruptible actually
works.

Cheers, Daniel
> ---
>  drivers/gpu/drm/drm_atomic.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 01192dd3ed79..4a1ff90fd73e 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -2217,7 +2217,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  			(arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
>  		return -EINVAL;
>  
> -	drm_modeset_acquire_init(&ctx, 0);
> +	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
>  
>  	state = drm_atomic_state_alloc(dev);
>  	if (!state)
> @@ -2327,8 +2327,9 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  
>  	if (ret == -EDEADLK) {
>  		drm_atomic_state_clear(state);
> -		drm_modeset_backoff(&ctx);
> -		goto retry;
> +		ret = drm_modeset_backoff(&ctx);
> +		if (!ret)
> +			goto retry;
>  	}
>  
>  	drm_atomic_state_put(state);
> -- 
> 2.11.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 01192dd3ed79..4a1ff90fd73e 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -2217,7 +2217,7 @@  int drm_mode_atomic_ioctl(struct drm_device *dev,
 			(arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
 		return -EINVAL;
 
-	drm_modeset_acquire_init(&ctx, 0);
+	drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 
 	state = drm_atomic_state_alloc(dev);
 	if (!state)
@@ -2327,8 +2327,9 @@  int drm_mode_atomic_ioctl(struct drm_device *dev,
 
 	if (ret == -EDEADLK) {
 		drm_atomic_state_clear(state);
-		drm_modeset_backoff(&ctx);
-		goto retry;
+		ret = drm_modeset_backoff(&ctx);
+		if (!ret)
+			goto retry;
 	}
 
 	drm_atomic_state_put(state);