aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drm_modeset_lock.h
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-27 13:09:33 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-08-08 11:47:01 -0400
commitcb597bb3a2fbfc871cc1c703fb330d247bd21394 (patch)
tree4bedf2841031c958813a71d8358ec1aa6178a76d /include/drm/drm_modeset_lock.h
parent3d30a59bfcb7c96d4aacdb053c2ccc49394b2311 (diff)
drm: trylock modest locking for fbdev panics
In the fbdev code we want to do trylocks only to avoid deadlocks and other ugly issues. Thus far we've only grabbed the overall modeset lock, but that already failed to exclude a pile of potential concurrent operations. With proper atomic support this will be worse. So add a trylock mode to the modeset locking code which attempts all locks only with trylocks, if possible. We need to track this in the locking functions themselves and can't restrict this to drivers since driver-private w/w mutexes must be treated the same way. There's still the issue that other driver private locks aren't handled here at all, but well can't have everything. With this we will at least not regress, even once atomic allows lots of concurrent kms activity. Aside: We should move the acquire context to stack-based allocation in the callers to get rid of that awful WARN_ON(kmalloc_failed) control flow which just blows up when memory is short. But that's material for separate patches. v2: - Fix logic inversion fumble in the fb helper. - Add proper kerneldoc. Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm/drm_modeset_lock.h')
-rw-r--r--include/drm/drm_modeset_lock.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index d38e1508f11a..a3f736d24382 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -53,6 +53,11 @@ struct drm_modeset_acquire_ctx {
53 * list of held locks (drm_modeset_lock) 53 * list of held locks (drm_modeset_lock)
54 */ 54 */
55 struct list_head locked; 55 struct list_head locked;
56
57 /**
58 * Trylock mode, use only for panic handlers!
59 */
60 bool trylock_only;
56}; 61};
57 62
58/** 63/**
@@ -123,6 +128,7 @@ struct drm_device;
123struct drm_crtc; 128struct drm_crtc;
124 129
125void drm_modeset_lock_all(struct drm_device *dev); 130void drm_modeset_lock_all(struct drm_device *dev);
131int __drm_modeset_lock_all(struct drm_device *dev, bool trylock);
126void drm_modeset_unlock_all(struct drm_device *dev); 132void drm_modeset_unlock_all(struct drm_device *dev);
127void drm_modeset_lock_crtc(struct drm_crtc *crtc); 133void drm_modeset_lock_crtc(struct drm_crtc *crtc);
128void drm_modeset_unlock_crtc(struct drm_crtc *crtc); 134void drm_modeset_unlock_crtc(struct drm_crtc *crtc);