Skip to content

Commit 2c7f037

Browse files
thomashvmwsashalevin
authored andcommitted
drm/vmwgfx: Fix a couple of lock dependency violations
[ Upstream commit 5151adb ] Experimental lockdep annotation added to the TTM lock has unveiled a couple of lock dependency violations in the vmwgfx driver. In both cases it turns out that the device_private::reservation_sem is not needed so the offending code is moved out of that lock. Cc: <stable@vger.kernel.org> Acked-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent c95800d commit 2c7f037

2 files changed

Lines changed: 6 additions & 16 deletions

File tree

‎drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,13 +2778,11 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data,
27782778
NULL, arg->command_size, arg->throttle_us,
27792779
(void __user *)(unsigned long)arg->fence_rep,
27802780
NULL);
2781-
2781+
ttm_read_unlock(&dev_priv->reservation_sem);
27822782
if (unlikely(ret != 0))
2783-
goto out_unlock;
2783+
return ret;
27842784

27852785
vmw_kms_cursor_post_execbuf(dev_priv);
27862786

2787-
out_unlock:
2788-
ttm_read_unlock(&dev_priv->reservation_sem);
2789-
return ret;
2787+
return 0;
27902788
}

‎drivers/gpu/drm/vmwgfx/vmwgfx_kms.c‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,23 +2033,17 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
20332033
int i;
20342034
struct drm_mode_config *mode_config = &dev->mode_config;
20352035

2036-
ret = ttm_read_lock(&dev_priv->reservation_sem, true);
2037-
if (unlikely(ret != 0))
2038-
return ret;
2039-
20402036
if (!arg->num_outputs) {
20412037
struct drm_vmw_rect def_rect = {0, 0, 800, 600};
20422038
vmw_du_update_layout(dev_priv, 1, &def_rect);
2043-
goto out_unlock;
2039+
return 0;
20442040
}
20452041

20462042
rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect);
20472043
rects = kcalloc(arg->num_outputs, sizeof(struct drm_vmw_rect),
20482044
GFP_KERNEL);
2049-
if (unlikely(!rects)) {
2050-
ret = -ENOMEM;
2051-
goto out_unlock;
2052-
}
2045+
if (unlikely(!rects))
2046+
return -ENOMEM;
20532047

20542048
user_rects = (void __user *)(unsigned long)arg->rects;
20552049
ret = copy_from_user(rects, user_rects, rects_size);
@@ -2074,7 +2068,5 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
20742068

20752069
out_free:
20762070
kfree(rects);
2077-
out_unlock:
2078-
ttm_read_unlock(&dev_priv->reservation_sem);
20792071
return ret;
20802072
}

0 commit comments

Comments
 (0)