* [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone!
@ 2017-09-12 13:37 Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 1/6] drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2 Maarten Lankhorst
` (7 more replies)
0 siblings, 8 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 13:37 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
drm_atomic_commit could previous have always failed when waits failed,
but locking was always done uninterruptibly. Add infrastructure to make
it possible for callers to choose interruptible locking, and convert the
5 most common ioctl's to use it.
All other atomic helpers can be converted when additional tests are added
to kms_atomic_interruptible.
Changes since last version:
- Small fixes to the preparation patch
- Convert setcrtc as well.
Maarten Lankhorst (6):
drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible
waiting, v2.
drm/atomic: Convert atomic ioctl locking to interruptible.
drm/legacy: Convert cursor ioctl locking to interruptible.
drm/legacy: Convert setplane ioctl locking to interruptible.
drm/atomic: Convert pageflip ioctl locking to interruptible.
drm/crtc: Convert setcrtc ioctl locking to interruptible.
drivers/gpu/drm/drm_atomic.c | 7 +--
drivers/gpu/drm/drm_crtc.c | 7 +--
drivers/gpu/drm/drm_debugfs_crc.c | 2 +-
drivers/gpu/drm/drm_modeset_lock.c | 96 +++++++++++++++++++-------------------
drivers/gpu/drm/drm_plane.c | 21 +++++----
include/drm/drm_modeset_lock.h | 12 +++--
6 files changed, 77 insertions(+), 68 deletions(-)
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 1/6] drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2.
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
@ 2017-09-12 13:37 ` Maarten Lankhorst
2017-09-12 13:56 ` Emil Velikov
2017-09-12 13:37 ` [PATCH v2 2/6] drm/atomic: Convert atomic ioctl locking to interruptible Maarten Lankhorst
` (6 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 13:37 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
When we want to make drm_atomic_commit interruptible, there are a lot of
places that call the lock function, which we don't have control over.
Rather than trying to convert every single one, it's easier to toggle
interruptible waiting per acquire_ctx. If drm_modeset_acquire_init is
called with DRM_MODESET_ACQUIRE_INTERRUPTIBLE, then we will perform
interruptible waits in drm_modeset_lock and drm_modeset_backoff.
Changes since v1:
- Fix locking example in drm_modeset_lock.c to be compatible
with interruptible waiting (xexaxo) and make it default.
Uninterruptible waiting shouldn't happen except in corner cases,
but the example will still apply if the flag is removed.
- Add drm_modeset_lock_single_interruptible() to documentation.
- Fix dead link to removed drm_modeset_lock_interruptible() in
drm_modeset_lock().
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> #v1
Cc: Emil Velikov <emil.l.velikov@gmail.com>
---
drivers/gpu/drm/drm_debugfs_crc.c | 2 +-
drivers/gpu/drm/drm_modeset_lock.c | 96 +++++++++++++++++++-------------------
include/drm/drm_modeset_lock.h | 12 +++--
3 files changed, 57 insertions(+), 53 deletions(-)
diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index f9e26dda56d6..9dd879589a2c 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -155,7 +155,7 @@ static int crtc_crc_open(struct inode *inode, struct file *filep)
int ret = 0;
if (drm_drv_uses_atomic_modeset(crtc->dev)) {
- ret = drm_modeset_lock_interruptible(&crtc->mutex, NULL);
+ ret = drm_modeset_lock_single_interruptible(&crtc->mutex);
if (ret)
return ret;
diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
index af4e906c630d..e123497da0ca 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -39,23 +39,28 @@
*
* The basic usage pattern is to::
*
- * drm_modeset_acquire_init(&ctx)
+ * drm_modeset_acquire_init(ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE)
* retry:
* foreach (lock in random_ordered_set_of_locks) {
- * ret = drm_modeset_lock(lock, &ctx)
+ * ret = drm_modeset_lock(lock, ctx)
* if (ret == -EDEADLK) {
- * drm_modeset_backoff(&ctx);
- * goto retry;
+ * ret = drm_modeset_backoff(ctx);
+ * if (!ret)
+ * goto retry;
* }
+ * if (ret)
+ * goto out;
* }
* ... do stuff ...
- * drm_modeset_drop_locks(&ctx);
- * drm_modeset_acquire_fini(&ctx);
+ * out:
+ * drm_modeset_drop_locks(ctx);
+ * drm_modeset_acquire_fini(ctx);
*
* If all that is needed is a single modeset lock, then the &struct
* drm_modeset_acquire_ctx is not needed and the locking can be simplified
- * by passing a NULL instead of ctx in the drm_modeset_lock()
- * call and, when done, by calling drm_modeset_unlock().
+ * by passing a NULL instead of ctx in the drm_modeset_lock() call or
+ * calling drm_modeset_lock_single_interruptible(). To unlock afterwards
+ * call drm_modeset_unlock().
*
* On top of these per-object locks using &ww_mutex there's also an overall
* &drm_mode_config.mutex, for protecting everything else. Mostly this means
@@ -178,7 +183,11 @@ EXPORT_SYMBOL(drm_warn_on_modeset_not_all_locked);
/**
* drm_modeset_acquire_init - initialize acquire context
* @ctx: the acquire context
- * @flags: for future
+ * @flags: 0 or %DRM_MODESET_ACQUIRE_INTERRUPTIBLE
+ *
+ * When passing %DRM_MODESET_ACQUIRE_INTERRUPTIBLE to @flags,
+ * all calls to drm_modeset_lock() will perform an interruptible
+ * wait.
*/
void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
uint32_t flags)
@@ -186,6 +195,9 @@ void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
memset(ctx, 0, sizeof(*ctx));
ww_acquire_init(&ctx->ww_ctx, &crtc_ww_class);
INIT_LIST_HEAD(&ctx->locked);
+
+ if (flags & DRM_MODESET_ACQUIRE_INTERRUPTIBLE)
+ ctx->interruptible = true;
}
EXPORT_SYMBOL(drm_modeset_acquire_init);
@@ -261,8 +273,19 @@ static inline int modeset_lock(struct drm_modeset_lock *lock,
return ret;
}
-static int modeset_backoff(struct drm_modeset_acquire_ctx *ctx,
- bool interruptible)
+/**
+ * drm_modeset_backoff - deadlock avoidance backoff
+ * @ctx: the acquire context
+ *
+ * If deadlock is detected (ie. drm_modeset_lock() returns -EDEADLK),
+ * you must call this function to drop all currently held locks and
+ * block until the contended lock becomes available.
+ *
+ * This function returns 0 on success, or -ERESTARTSYS if this context
+ * is initialized with %DRM_MODESET_ACQUIRE_INTERRUPTIBLE and the
+ * wait has been interrupted.
+ */
+int drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx)
{
struct drm_modeset_lock *contended = ctx->contended;
@@ -273,35 +296,10 @@ static int modeset_backoff(struct drm_modeset_acquire_ctx *ctx,
drm_modeset_drop_locks(ctx);
- return modeset_lock(contended, ctx, interruptible, true);
-}
-
-/**
- * drm_modeset_backoff - deadlock avoidance backoff
- * @ctx: the acquire context
- *
- * If deadlock is detected (ie. drm_modeset_lock() returns -EDEADLK),
- * you must call this function to drop all currently held locks and
- * block until the contended lock becomes available.
- */
-void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx)
-{
- modeset_backoff(ctx, false);
+ return modeset_lock(contended, ctx, ctx->interruptible, true);
}
EXPORT_SYMBOL(drm_modeset_backoff);
-/**
- * drm_modeset_backoff_interruptible - deadlock avoidance backoff
- * @ctx: the acquire context
- *
- * Interruptible version of drm_modeset_backoff()
- */
-int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx)
-{
- return modeset_backoff(ctx, true);
-}
-EXPORT_SYMBOL(drm_modeset_backoff_interruptible);
-
/**
* drm_modeset_lock_init - initialize lock
* @lock: lock to init
@@ -324,14 +322,18 @@ EXPORT_SYMBOL(drm_modeset_lock_init);
* deadlock scenario has been detected and it is an error to attempt
* to take any more locks without first calling drm_modeset_backoff().
*
+ * If the @ctx is not NULL and initialized with
+ * %DRM_MODESET_ACQUIRE_INTERRUPTIBLE, this function will fail with
+ * -ERESTARTSYS when interrupted.
+ *
* If @ctx is NULL then the function call behaves like a normal,
- * non-nesting mutex_lock() call.
+ * uninterruptible non-nesting mutex_lock() call.
*/
int drm_modeset_lock(struct drm_modeset_lock *lock,
struct drm_modeset_acquire_ctx *ctx)
{
if (ctx)
- return modeset_lock(lock, ctx, false, false);
+ return modeset_lock(lock, ctx, ctx->interruptible, false);
ww_mutex_lock(&lock->mutex, NULL);
return 0;
@@ -339,21 +341,19 @@ int drm_modeset_lock(struct drm_modeset_lock *lock,
EXPORT_SYMBOL(drm_modeset_lock);
/**
- * drm_modeset_lock_interruptible - take modeset lock
+ * drm_modeset_lock_single_interruptible - take a single modeset lock
* @lock: lock to take
- * @ctx: acquire ctx
*
- * Interruptible version of drm_modeset_lock()
+ * This function behaves as drm_modeset_lock() with a NULL context,
+ * but performs interruptible waits.
+ *
+ * This function returns 0 on success, or -ERESTARTSYS when interrupted.
*/
-int drm_modeset_lock_interruptible(struct drm_modeset_lock *lock,
- struct drm_modeset_acquire_ctx *ctx)
+int drm_modeset_lock_single_interruptible(struct drm_modeset_lock *lock)
{
- if (ctx)
- return modeset_lock(lock, ctx, true, false);
-
return ww_mutex_lock_interruptible(&lock->mutex, NULL);
}
-EXPORT_SYMBOL(drm_modeset_lock_interruptible);
+EXPORT_SYMBOL(drm_modeset_lock_single_interruptible);
/**
* drm_modeset_unlock - drop modeset lock
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index 4b27c2bb955c..a685d1bb21f2 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -34,6 +34,7 @@ struct drm_modeset_lock;
* @contended: used internally for -EDEADLK handling
* @locked: list of held locks
* @trylock_only: trylock mode used in atomic contexts/panic notifiers
+ * @interruptible: whether interruptible locking should be used.
*
* Each thread competing for a set of locks must use one acquire
* ctx. And if any lock fxn returns -EDEADLK, it must backoff and
@@ -59,6 +60,9 @@ struct drm_modeset_acquire_ctx {
* Trylock mode, use only for panic handlers!
*/
bool trylock_only;
+
+ /* Perform interruptible waits on this context. */
+ bool interruptible;
};
/**
@@ -82,12 +86,13 @@ struct drm_modeset_lock {
struct list_head head;
};
+#define DRM_MODESET_ACQUIRE_INTERRUPTIBLE BIT(0)
+
void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
uint32_t flags);
void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx);
void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx);
-void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);
-int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx);
+int drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);
void drm_modeset_lock_init(struct drm_modeset_lock *lock);
@@ -111,8 +116,7 @@ static inline bool drm_modeset_is_locked(struct drm_modeset_lock *lock)
int drm_modeset_lock(struct drm_modeset_lock *lock,
struct drm_modeset_acquire_ctx *ctx);
-int drm_modeset_lock_interruptible(struct drm_modeset_lock *lock,
- struct drm_modeset_acquire_ctx *ctx);
+int __must_check drm_modeset_lock_single_interruptible(struct drm_modeset_lock *lock);
void drm_modeset_unlock(struct drm_modeset_lock *lock);
struct drm_device;
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 2/6] drm/atomic: Convert atomic ioctl locking to interruptible.
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 1/6] drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2 Maarten Lankhorst
@ 2017-09-12 13:37 ` Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 3/6] drm/legacy: Convert cursor " Maarten Lankhorst
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 13:37 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
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>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
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 75f5f74de9bf..366c56fe5f58 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -2234,7 +2234,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)
@@ -2347,8 +2347,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.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 3/6] drm/legacy: Convert cursor ioctl locking to interruptible.
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 1/6] drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2 Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 2/6] drm/atomic: Convert atomic ioctl locking to interruptible Maarten Lankhorst
@ 2017-09-12 13:37 ` Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 4/6] drm/legacy: Convert setplane " Maarten Lankhorst
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 13:37 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
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>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/drm_plane.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 7a00351d5b5d..eef58595101c 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -834,7 +834,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
return -ENOENT;
}
- drm_modeset_acquire_init(&ctx, 0);
+ drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
retry:
ret = drm_modeset_lock(&crtc->mutex, &ctx);
if (ret)
@@ -876,8 +876,9 @@ static int drm_mode_cursor_common(struct drm_device *dev,
}
out:
if (ret == -EDEADLK) {
- drm_modeset_backoff(&ctx);
- goto retry;
+ ret = drm_modeset_backoff(&ctx);
+ if (!ret)
+ goto retry;
}
drm_modeset_drop_locks(&ctx);
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 4/6] drm/legacy: Convert setplane ioctl locking to interruptible.
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
` (2 preceding siblings ...)
2017-09-12 13:37 ` [PATCH v2 3/6] drm/legacy: Convert cursor " Maarten Lankhorst
@ 2017-09-12 13:37 ` Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 5/6] drm/atomic: Convert pageflip " Maarten Lankhorst
` (3 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 13:37 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
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>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/drm_plane.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index eef58595101c..803d67c22da2 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -667,7 +667,7 @@ static int setplane_internal(struct drm_plane *plane,
struct drm_modeset_acquire_ctx ctx;
int ret;
- drm_modeset_acquire_init(&ctx, 0);
+ drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
retry:
ret = drm_modeset_lock_all_ctx(plane->dev, &ctx);
if (ret)
@@ -678,8 +678,9 @@ static int setplane_internal(struct drm_plane *plane,
fail:
if (ret == -EDEADLK) {
- drm_modeset_backoff(&ctx);
- goto retry;
+ ret = drm_modeset_backoff(&ctx);
+ if (!ret)
+ goto retry;
}
drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 5/6] drm/atomic: Convert pageflip ioctl locking to interruptible.
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
` (3 preceding siblings ...)
2017-09-12 13:37 ` [PATCH v2 4/6] drm/legacy: Convert setplane " Maarten Lankhorst
@ 2017-09-12 13:37 ` Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 6/6] drm/crtc: Convert setcrtc " Maarten Lankhorst
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 13:37 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
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>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/drm_plane.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 803d67c22da2..72cba9805edc 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -987,7 +987,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
return -EINVAL;
}
- drm_modeset_acquire_init(&ctx, 0);
+ drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
retry:
ret = drm_modeset_lock(&crtc->mutex, &ctx);
if (ret)
@@ -1076,8 +1076,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
crtc->primary->old_fb = NULL;
if (ret == -EDEADLK) {
- drm_modeset_backoff(&ctx);
- goto retry;
+ ret = drm_modeset_backoff(&ctx);
+ if (!ret)
+ goto retry;
}
drm_modeset_drop_locks(&ctx);
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 6/6] drm/crtc: Convert setcrtc ioctl locking to interruptible.
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
` (4 preceding siblings ...)
2017-09-12 13:37 ` [PATCH v2 5/6] drm/atomic: Convert pageflip " Maarten Lankhorst
@ 2017-09-12 13:37 ` Maarten Lankhorst
2017-09-12 14:43 ` ✓ Fi.CI.BAT: success for drm/atomic: Interruptible locks for everyone! (rev3) Patchwork
2017-09-12 17:45 ` ✓ Fi.CI.IGT: " Patchwork
7 siblings, 0 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 13:37 UTC (permalink / raw)
To: dri-devel; +Cc: Daniel Vetter, intel-gfx
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>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/drm_crtc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 5af25ce5bf7c..68b4e976d5e0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -577,7 +577,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
mutex_lock(&crtc->dev->mode_config.mutex);
- drm_modeset_acquire_init(&ctx, 0);
+ drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
retry:
ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
if (ret)
@@ -717,8 +717,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
kfree(connector_set);
drm_mode_destroy(dev, mode);
if (ret == -EDEADLK) {
- drm_modeset_backoff(&ctx);
- goto retry;
+ ret = drm_modeset_backoff(&ctx);
+ if (!ret)
+ goto retry;
}
drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/6] drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2.
2017-09-12 13:37 ` [PATCH v2 1/6] drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2 Maarten Lankhorst
@ 2017-09-12 13:56 ` Emil Velikov
2017-09-13 7:56 ` Maarten Lankhorst
0 siblings, 1 reply; 13+ messages in thread
From: Emil Velikov @ 2017-09-12 13:56 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx, ML dri-devel
On 12 September 2017 at 14:37, Maarten Lankhorst
<maarten.lankhorst@linux.intel.com> wrote:
> When we want to make drm_atomic_commit interruptible, there are a lot of
> places that call the lock function, which we don't have control over.
>
> Rather than trying to convert every single one, it's easier to toggle
> interruptible waiting per acquire_ctx. If drm_modeset_acquire_init is
> called with DRM_MODESET_ACQUIRE_INTERRUPTIBLE, then we will perform
> interruptible waits in drm_modeset_lock and drm_modeset_backoff.
>
> Changes since v1:
> - Fix locking example in drm_modeset_lock.c to be compatible
> with interruptible waiting (xexaxo) and make it default.
> Uninterruptible waiting shouldn't happen except in corner cases,
> but the example will still apply if the flag is removed.
> - Add drm_modeset_lock_single_interruptible() to documentation.
> - Fix dead link to removed drm_modeset_lock_interruptible() in
> drm_modeset_lock().
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> #v1
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
Thanks for the documentation updates/fixes Maarten. FWIW the series is
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* ✓ Fi.CI.BAT: success for drm/atomic: Interruptible locks for everyone! (rev3)
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
` (5 preceding siblings ...)
2017-09-12 13:37 ` [PATCH v2 6/6] drm/crtc: Convert setcrtc " Maarten Lankhorst
@ 2017-09-12 14:43 ` Patchwork
2017-09-12 17:45 ` ✓ Fi.CI.IGT: " Patchwork
7 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2017-09-12 14:43 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: drm/atomic: Interruptible locks for everyone! (rev3)
URL : https://patchwork.freedesktop.org/series/27987/
State : success
== Summary ==
Series 27987v3 drm/atomic: Interruptible locks for everyone!
https://patchwork.freedesktop.org/api/1.0/series/27987/revisions/3/mbox/
Test chamelium:
Subgroup dp-crc-fast:
fail -> PASS (fi-kbl-7500u) fdo#102514
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-atomic:
pass -> FAIL (fi-snb-2600) fdo#100215
fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:453s
fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:457s
fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:377s
fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:538s
fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:267s
fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:510s
fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:506s
fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:503s
fi-cfl-s total:289 pass:250 dwarn:4 dfail:0 fail:0 skip:35 time:452s
fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:449s
fi-glk-2a total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:604s
fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:433s
fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:418s
fi-ilk-650 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:438s
fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:481s
fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:466s
fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:490s
fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:579s
fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:588s
fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:547s
fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:455s
fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:526s
fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:505s
fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:459s
fi-skl-x1585l total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:474s
fi-snb-2520m total:289 pass:251 dwarn:0 dfail:0 fail:0 skip:38 time:584s
fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:1 skip:39 time:428s
694f07d3df18c02da3f526ae0e1238eb12534e1e drm-tip: 2017y-09m-12d-09h-59m-00s UTC integration manifest
0d3eb880f5d1 drm/crtc: Convert setcrtc ioctl locking to interruptible.
e665e1385f27 drm/atomic: Convert pageflip ioctl locking to interruptible.
ffd30c21b012 drm/legacy: Convert setplane ioctl locking to interruptible.
25bbdbdb7620 drm/legacy: Convert cursor ioctl locking to interruptible.
e02fa2a74d3f drm/atomic: Convert atomic ioctl locking to interruptible.
1d4e5aee5d7b drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5659/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread
* ✓ Fi.CI.IGT: success for drm/atomic: Interruptible locks for everyone! (rev3)
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
` (6 preceding siblings ...)
2017-09-12 14:43 ` ✓ Fi.CI.BAT: success for drm/atomic: Interruptible locks for everyone! (rev3) Patchwork
@ 2017-09-12 17:45 ` Patchwork
7 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2017-09-12 17:45 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
== Series Details ==
Series: drm/atomic: Interruptible locks for everyone! (rev3)
URL : https://patchwork.freedesktop.org/series/27987/
State : success
== Summary ==
Test perf:
Subgroup polling:
pass -> FAIL (shard-hsw) fdo#102252
Test gem_eio:
Subgroup in-flight:
pass -> FAIL (shard-hsw) fdo#102616
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102616 https://bugs.freedesktop.org/show_bug.cgi?id=102616
shard-hsw total:2301 pass:1236 dwarn:0 dfail:0 fail:13 skip:1052 time:9411s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5659/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/6] drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2.
2017-09-12 13:56 ` Emil Velikov
@ 2017-09-13 7:56 ` Maarten Lankhorst
0 siblings, 0 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-13 7:56 UTC (permalink / raw)
To: Emil Velikov; +Cc: intel-gfx, ML dri-devel
Op 12-09-17 om 15:56 schreef Emil Velikov:
> On 12 September 2017 at 14:37, Maarten Lankhorst
> <maarten.lankhorst@linux.intel.com> wrote:
>> When we want to make drm_atomic_commit interruptible, there are a lot of
>> places that call the lock function, which we don't have control over.
>>
>> Rather than trying to convert every single one, it's easier to toggle
>> interruptible waiting per acquire_ctx. If drm_modeset_acquire_init is
>> called with DRM_MODESET_ACQUIRE_INTERRUPTIBLE, then we will perform
>> interruptible waits in drm_modeset_lock and drm_modeset_backoff.
>>
>> Changes since v1:
>> - Fix locking example in drm_modeset_lock.c to be compatible
>> with interruptible waiting (xexaxo) and make it default.
>> Uninterruptible waiting shouldn't happen except in corner cases,
>> but the example will still apply if the flag is removed.
>> - Add drm_modeset_lock_single_interruptible() to documentation.
>> - Fix dead link to removed drm_modeset_lock_interruptible() in
>> drm_modeset_lock().
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> #v1
>> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Thanks for the documentation updates/fixes Maarten. FWIW the series is
> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
>
> -Emil
Thanks, applied. :)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone!
2017-09-12 12:41 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
@ 2017-09-12 13:36 ` Maarten Lankhorst
0 siblings, 0 replies; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 13:36 UTC (permalink / raw)
To: Intel Graphics Development
Op 12-09-17 om 14:41 schreef Maarten Lankhorst:
> drm_atomic_commit could previous have always failed when waits failed,
> but locking was always done uninterruptibly. Add infrastructure to make
> it possible for callers to choose interruptible locking, and convert the
> 5 most common ioctl's to use it.
>
> All other atomic helpers can be converted when additional tests are added
> to kms_atomic_interruptible.
>
> Changes since last version:
> - Small fixes to the preparation patch
> - Convert setcrtc as well.
>
> Maarten Lankhorst (6):
> drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible
> waiting, v2.
> drm/atomic: Convert atomic ioctl locking to interruptible.
> drm/legacy: Convert cursor ioctl locking to interruptible.
> drm/legacy: Convert setplane ioctl locking to interruptible.
> drm/atomic: Convert pageflip ioctl locking to interruptible.
> drm/crtc: Convert setcrtc ioctl locking to interruptible.
>
> drivers/gpu/drm/drm_atomic.c | 7 +--
> drivers/gpu/drm/drm_crtc.c | 7 +--
> drivers/gpu/drm/drm_debugfs_crc.c | 2 +-
> drivers/gpu/drm/drm_modeset_lock.c | 96 +++++++++++++++++++-------------------
> drivers/gpu/drm/drm_plane.c | 21 +++++----
> include/drm/drm_modeset_lock.h | 12 +++--
> 6 files changed, 77 insertions(+), 68 deletions(-)
>
Please ignore this series, should have been sent to dri-devel with intel-gfx to cc. I'm resending.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone!
@ 2017-09-12 12:41 Maarten Lankhorst
2017-09-12 13:36 ` Maarten Lankhorst
0 siblings, 1 reply; 13+ messages in thread
From: Maarten Lankhorst @ 2017-09-12 12:41 UTC (permalink / raw)
To: intel-gfx
drm_atomic_commit could previous have always failed when waits failed,
but locking was always done uninterruptibly. Add infrastructure to make
it possible for callers to choose interruptible locking, and convert the
5 most common ioctl's to use it.
All other atomic helpers can be converted when additional tests are added
to kms_atomic_interruptible.
Changes since last version:
- Small fixes to the preparation patch
- Convert setcrtc as well.
Maarten Lankhorst (6):
drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible
waiting, v2.
drm/atomic: Convert atomic ioctl locking to interruptible.
drm/legacy: Convert cursor ioctl locking to interruptible.
drm/legacy: Convert setplane ioctl locking to interruptible.
drm/atomic: Convert pageflip ioctl locking to interruptible.
drm/crtc: Convert setcrtc ioctl locking to interruptible.
drivers/gpu/drm/drm_atomic.c | 7 +--
drivers/gpu/drm/drm_crtc.c | 7 +--
drivers/gpu/drm/drm_debugfs_crc.c | 2 +-
drivers/gpu/drm/drm_modeset_lock.c | 96 +++++++++++++++++++-------------------
drivers/gpu/drm/drm_plane.c | 21 +++++----
include/drm/drm_modeset_lock.h | 12 +++--
6 files changed, 77 insertions(+), 68 deletions(-)
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-09-13 7:56 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-12 13:37 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 1/6] drm/atomic: Prepare drm_modeset_lock infrastructure for interruptible waiting, v2 Maarten Lankhorst
2017-09-12 13:56 ` Emil Velikov
2017-09-13 7:56 ` Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 2/6] drm/atomic: Convert atomic ioctl locking to interruptible Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 3/6] drm/legacy: Convert cursor " Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 4/6] drm/legacy: Convert setplane " Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 5/6] drm/atomic: Convert pageflip " Maarten Lankhorst
2017-09-12 13:37 ` [PATCH v2 6/6] drm/crtc: Convert setcrtc " Maarten Lankhorst
2017-09-12 14:43 ` ✓ Fi.CI.BAT: success for drm/atomic: Interruptible locks for everyone! (rev3) Patchwork
2017-09-12 17:45 ` ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2017-09-12 12:41 [PATCH v2 0/6] drm/atomic: Interruptible locks for everyone! Maarten Lankhorst
2017-09-12 13:36 ` Maarten Lankhorst
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.