All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-22  7:54 ` Daniel Vetter
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-22  7:54 UTC (permalink / raw)
  To: Intel Graphics Development
  Cc: DRI Development, Daniel Vetter, Desmond Cheong Zhi Xi,
	Emil Velikov, stable, Daniel Vetter, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter

This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.

Unfortunately this inverts the locking hierarchy, so back to the
drawing board. Full lockdep splat below:

======================================================
WARNING: possible circular locking dependency detected
5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
------------------------------------------------------
kms_frontbuffer/1087 is trying to acquire lock:
ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
but task is already holding lock:
ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
       __mutex_lock+0xab/0x970
       drm_client_modeset_probe+0x22e/0xca0
       __drm_fb_helper_initial_config_and_unlock+0x42/0x540
       intel_fbdev_initial_config+0xf/0x20 [i915]
       async_run_entry_fn+0x28/0x130
       process_one_work+0x26d/0x5c0
       worker_thread+0x37/0x380
       kthread+0x144/0x170
       ret_from_fork+0x1f/0x30
-> #1 (&client->modeset_mutex){+.+.}-{3:3}:
       __mutex_lock+0xab/0x970
       drm_client_modeset_commit_locked+0x1c/0x180
       drm_client_modeset_commit+0x1c/0x40
       __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
       drm_fb_helper_set_par+0x34/0x40
       intel_fbdev_set_par+0x11/0x40 [i915]
       fbcon_init+0x270/0x4f0
       visual_init+0xc6/0x130
       do_bind_con_driver+0x1e5/0x2d0
       do_take_over_console+0x10e/0x180
       do_fbcon_takeover+0x53/0xb0
       register_framebuffer+0x22d/0x310
       __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
       intel_fbdev_initial_config+0xf/0x20 [i915]
       async_run_entry_fn+0x28/0x130
       process_one_work+0x26d/0x5c0
       worker_thread+0x37/0x380
       kthread+0x144/0x170
       ret_from_fork+0x1f/0x30
-> #0 (&dev->master_mutex){+.+.}-{3:3}:
       __lock_acquire+0x151e/0x2590
       lock_acquire+0xd1/0x3d0
       __mutex_lock+0xab/0x970
       drm_is_current_master+0x1b/0x40
       drm_mode_getconnector+0x37e/0x4a0
       drm_ioctl_kernel+0xa8/0xf0
       drm_ioctl+0x1e8/0x390
       __x64_sys_ioctl+0x6a/0xa0
       do_syscall_64+0x39/0xb0
       entry_SYSCALL_64_after_hwframe+0x44/0xae
other info that might help us debug this:
Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
 Possible unsafe locking scenario:
       CPU0                    CPU1
       ----                    ----
  lock(&dev->mode_config.mutex);
                               lock(&client->modeset_mutex);
                               lock(&dev->mode_config.mutex);
  lock(&dev->master_mutex);
*** DEADLOCK ***
1 lock held by kms_frontbuffer/1087:
 #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
stack backtrace:
CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
Call Trace:
 dump_stack+0x7f/0xad
 check_noncircular+0x12e/0x150
 __lock_acquire+0x151e/0x2590
 lock_acquire+0xd1/0x3d0
 __mutex_lock+0xab/0x970
 drm_is_current_master+0x1b/0x40
 drm_mode_getconnector+0x37e/0x4a0
 drm_ioctl_kernel+0xa8/0xf0
 drm_ioctl+0x1e8/0x390
 __x64_sys_ioctl+0x6a/0xa0
 do_syscall_64+0x39/0xb0
 entry_SYSCALL_64_after_hwframe+0x44/0xae

daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
 1 file changed, 19 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 86d4b72e95cb..232abbba3686 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -61,35 +61,6 @@
  * trusted clients.
  */
 
-static bool drm_is_current_master_locked(struct drm_file *fpriv)
-{
-	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
-
-	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
-}
-
-/**
- * drm_is_current_master - checks whether @priv is the current master
- * @fpriv: DRM file private
- *
- * Checks whether @fpriv is current master on its device. This decides whether a
- * client is allowed to run DRM_MASTER IOCTLs.
- *
- * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
- * - the current master is assumed to own the non-shareable display hardware.
- */
-bool drm_is_current_master(struct drm_file *fpriv)
-{
-	bool ret;
-
-	mutex_lock(&fpriv->master->dev->master_mutex);
-	ret = drm_is_current_master_locked(fpriv);
-	mutex_unlock(&fpriv->master->dev->master_mutex);
-
-	return ret;
-}
-EXPORT_SYMBOL(drm_is_current_master);
-
 int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
 	struct drm_auth *auth = data;
@@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		goto out_unlock;
 
-	if (drm_is_current_master_locked(file_priv))
+	if (drm_is_current_master(file_priv))
 		goto out_unlock;
 
 	if (dev->master) {
@@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		goto out_unlock;
 
-	if (!drm_is_current_master_locked(file_priv)) {
+	if (!drm_is_current_master(file_priv)) {
 		ret = -EINVAL;
 		goto out_unlock;
 	}
@@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
 	if (file_priv->magic)
 		idr_remove(&file_priv->master->magic_map, file_priv->magic);
 
-	if (!drm_is_current_master_locked(file_priv))
+	if (!drm_is_current_master(file_priv))
 		goto out;
 
 	drm_legacy_lock_master_cleanup(dev, master);
@@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
 	mutex_unlock(&dev->master_mutex);
 }
 
+/**
+ * drm_is_current_master - checks whether @priv is the current master
+ * @fpriv: DRM file private
+ *
+ * Checks whether @fpriv is current master on its device. This decides whether a
+ * client is allowed to run DRM_MASTER IOCTLs.
+ *
+ * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
+ * - the current master is assumed to own the non-shareable display hardware.
+ */
+bool drm_is_current_master(struct drm_file *fpriv)
+{
+	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
+}
+EXPORT_SYMBOL(drm_is_current_master);
+
 /**
  * drm_master_get - reference a master pointer
  * @master: &struct drm_master
-- 
2.32.0.rc2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-22  7:54 ` Daniel Vetter
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-22  7:54 UTC (permalink / raw)
  To: Intel Graphics Development
  Cc: Daniel Vetter, Emil Velikov, stable, David Airlie,
	DRI Development, Thomas Zimmermann, Daniel Vetter,
	Desmond Cheong Zhi Xi

This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.

Unfortunately this inverts the locking hierarchy, so back to the
drawing board. Full lockdep splat below:

======================================================
WARNING: possible circular locking dependency detected
5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
------------------------------------------------------
kms_frontbuffer/1087 is trying to acquire lock:
ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
but task is already holding lock:
ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
       __mutex_lock+0xab/0x970
       drm_client_modeset_probe+0x22e/0xca0
       __drm_fb_helper_initial_config_and_unlock+0x42/0x540
       intel_fbdev_initial_config+0xf/0x20 [i915]
       async_run_entry_fn+0x28/0x130
       process_one_work+0x26d/0x5c0
       worker_thread+0x37/0x380
       kthread+0x144/0x170
       ret_from_fork+0x1f/0x30
-> #1 (&client->modeset_mutex){+.+.}-{3:3}:
       __mutex_lock+0xab/0x970
       drm_client_modeset_commit_locked+0x1c/0x180
       drm_client_modeset_commit+0x1c/0x40
       __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
       drm_fb_helper_set_par+0x34/0x40
       intel_fbdev_set_par+0x11/0x40 [i915]
       fbcon_init+0x270/0x4f0
       visual_init+0xc6/0x130
       do_bind_con_driver+0x1e5/0x2d0
       do_take_over_console+0x10e/0x180
       do_fbcon_takeover+0x53/0xb0
       register_framebuffer+0x22d/0x310
       __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
       intel_fbdev_initial_config+0xf/0x20 [i915]
       async_run_entry_fn+0x28/0x130
       process_one_work+0x26d/0x5c0
       worker_thread+0x37/0x380
       kthread+0x144/0x170
       ret_from_fork+0x1f/0x30
-> #0 (&dev->master_mutex){+.+.}-{3:3}:
       __lock_acquire+0x151e/0x2590
       lock_acquire+0xd1/0x3d0
       __mutex_lock+0xab/0x970
       drm_is_current_master+0x1b/0x40
       drm_mode_getconnector+0x37e/0x4a0
       drm_ioctl_kernel+0xa8/0xf0
       drm_ioctl+0x1e8/0x390
       __x64_sys_ioctl+0x6a/0xa0
       do_syscall_64+0x39/0xb0
       entry_SYSCALL_64_after_hwframe+0x44/0xae
other info that might help us debug this:
Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
 Possible unsafe locking scenario:
       CPU0                    CPU1
       ----                    ----
  lock(&dev->mode_config.mutex);
                               lock(&client->modeset_mutex);
                               lock(&dev->mode_config.mutex);
  lock(&dev->master_mutex);
*** DEADLOCK ***
1 lock held by kms_frontbuffer/1087:
 #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
stack backtrace:
CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
Call Trace:
 dump_stack+0x7f/0xad
 check_noncircular+0x12e/0x150
 __lock_acquire+0x151e/0x2590
 lock_acquire+0xd1/0x3d0
 __mutex_lock+0xab/0x970
 drm_is_current_master+0x1b/0x40
 drm_mode_getconnector+0x37e/0x4a0
 drm_ioctl_kernel+0xa8/0xf0
 drm_ioctl+0x1e8/0x390
 __x64_sys_ioctl+0x6a/0xa0
 do_syscall_64+0x39/0xb0
 entry_SYSCALL_64_after_hwframe+0x44/0xae

daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
 1 file changed, 19 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 86d4b72e95cb..232abbba3686 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -61,35 +61,6 @@
  * trusted clients.
  */
 
-static bool drm_is_current_master_locked(struct drm_file *fpriv)
-{
-	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
-
-	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
-}
-
-/**
- * drm_is_current_master - checks whether @priv is the current master
- * @fpriv: DRM file private
- *
- * Checks whether @fpriv is current master on its device. This decides whether a
- * client is allowed to run DRM_MASTER IOCTLs.
- *
- * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
- * - the current master is assumed to own the non-shareable display hardware.
- */
-bool drm_is_current_master(struct drm_file *fpriv)
-{
-	bool ret;
-
-	mutex_lock(&fpriv->master->dev->master_mutex);
-	ret = drm_is_current_master_locked(fpriv);
-	mutex_unlock(&fpriv->master->dev->master_mutex);
-
-	return ret;
-}
-EXPORT_SYMBOL(drm_is_current_master);
-
 int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
 	struct drm_auth *auth = data;
@@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		goto out_unlock;
 
-	if (drm_is_current_master_locked(file_priv))
+	if (drm_is_current_master(file_priv))
 		goto out_unlock;
 
 	if (dev->master) {
@@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		goto out_unlock;
 
-	if (!drm_is_current_master_locked(file_priv)) {
+	if (!drm_is_current_master(file_priv)) {
 		ret = -EINVAL;
 		goto out_unlock;
 	}
@@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
 	if (file_priv->magic)
 		idr_remove(&file_priv->master->magic_map, file_priv->magic);
 
-	if (!drm_is_current_master_locked(file_priv))
+	if (!drm_is_current_master(file_priv))
 		goto out;
 
 	drm_legacy_lock_master_cleanup(dev, master);
@@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
 	mutex_unlock(&dev->master_mutex);
 }
 
+/**
+ * drm_is_current_master - checks whether @priv is the current master
+ * @fpriv: DRM file private
+ *
+ * Checks whether @fpriv is current master on its device. This decides whether a
+ * client is allowed to run DRM_MASTER IOCTLs.
+ *
+ * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
+ * - the current master is assumed to own the non-shareable display hardware.
+ */
+bool drm_is_current_master(struct drm_file *fpriv)
+{
+	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
+}
+EXPORT_SYMBOL(drm_is_current_master);
+
 /**
  * drm_master_get - reference a master pointer
  * @master: &struct drm_master
-- 
2.32.0.rc2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Intel-gfx] [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-22  7:54 ` Daniel Vetter
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-22  7:54 UTC (permalink / raw)
  To: Intel Graphics Development
  Cc: Maxime Ripard, Daniel Vetter, stable, David Airlie,
	DRI Development, Thomas Zimmermann, Daniel Vetter,
	Desmond Cheong Zhi Xi

This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.

Unfortunately this inverts the locking hierarchy, so back to the
drawing board. Full lockdep splat below:

======================================================
WARNING: possible circular locking dependency detected
5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
------------------------------------------------------
kms_frontbuffer/1087 is trying to acquire lock:
ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
but task is already holding lock:
ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
       __mutex_lock+0xab/0x970
       drm_client_modeset_probe+0x22e/0xca0
       __drm_fb_helper_initial_config_and_unlock+0x42/0x540
       intel_fbdev_initial_config+0xf/0x20 [i915]
       async_run_entry_fn+0x28/0x130
       process_one_work+0x26d/0x5c0
       worker_thread+0x37/0x380
       kthread+0x144/0x170
       ret_from_fork+0x1f/0x30
-> #1 (&client->modeset_mutex){+.+.}-{3:3}:
       __mutex_lock+0xab/0x970
       drm_client_modeset_commit_locked+0x1c/0x180
       drm_client_modeset_commit+0x1c/0x40
       __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
       drm_fb_helper_set_par+0x34/0x40
       intel_fbdev_set_par+0x11/0x40 [i915]
       fbcon_init+0x270/0x4f0
       visual_init+0xc6/0x130
       do_bind_con_driver+0x1e5/0x2d0
       do_take_over_console+0x10e/0x180
       do_fbcon_takeover+0x53/0xb0
       register_framebuffer+0x22d/0x310
       __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
       intel_fbdev_initial_config+0xf/0x20 [i915]
       async_run_entry_fn+0x28/0x130
       process_one_work+0x26d/0x5c0
       worker_thread+0x37/0x380
       kthread+0x144/0x170
       ret_from_fork+0x1f/0x30
-> #0 (&dev->master_mutex){+.+.}-{3:3}:
       __lock_acquire+0x151e/0x2590
       lock_acquire+0xd1/0x3d0
       __mutex_lock+0xab/0x970
       drm_is_current_master+0x1b/0x40
       drm_mode_getconnector+0x37e/0x4a0
       drm_ioctl_kernel+0xa8/0xf0
       drm_ioctl+0x1e8/0x390
       __x64_sys_ioctl+0x6a/0xa0
       do_syscall_64+0x39/0xb0
       entry_SYSCALL_64_after_hwframe+0x44/0xae
other info that might help us debug this:
Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
 Possible unsafe locking scenario:
       CPU0                    CPU1
       ----                    ----
  lock(&dev->mode_config.mutex);
                               lock(&client->modeset_mutex);
                               lock(&dev->mode_config.mutex);
  lock(&dev->master_mutex);
*** DEADLOCK ***
1 lock held by kms_frontbuffer/1087:
 #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
stack backtrace:
CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
Call Trace:
 dump_stack+0x7f/0xad
 check_noncircular+0x12e/0x150
 __lock_acquire+0x151e/0x2590
 lock_acquire+0xd1/0x3d0
 __mutex_lock+0xab/0x970
 drm_is_current_master+0x1b/0x40
 drm_mode_getconnector+0x37e/0x4a0
 drm_ioctl_kernel+0xa8/0xf0
 drm_ioctl+0x1e8/0x390
 __x64_sys_ioctl+0x6a/0xa0
 do_syscall_64+0x39/0xb0
 entry_SYSCALL_64_after_hwframe+0x44/0xae

daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
 1 file changed, 19 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 86d4b72e95cb..232abbba3686 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -61,35 +61,6 @@
  * trusted clients.
  */
 
-static bool drm_is_current_master_locked(struct drm_file *fpriv)
-{
-	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
-
-	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
-}
-
-/**
- * drm_is_current_master - checks whether @priv is the current master
- * @fpriv: DRM file private
- *
- * Checks whether @fpriv is current master on its device. This decides whether a
- * client is allowed to run DRM_MASTER IOCTLs.
- *
- * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
- * - the current master is assumed to own the non-shareable display hardware.
- */
-bool drm_is_current_master(struct drm_file *fpriv)
-{
-	bool ret;
-
-	mutex_lock(&fpriv->master->dev->master_mutex);
-	ret = drm_is_current_master_locked(fpriv);
-	mutex_unlock(&fpriv->master->dev->master_mutex);
-
-	return ret;
-}
-EXPORT_SYMBOL(drm_is_current_master);
-
 int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
 	struct drm_auth *auth = data;
@@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		goto out_unlock;
 
-	if (drm_is_current_master_locked(file_priv))
+	if (drm_is_current_master(file_priv))
 		goto out_unlock;
 
 	if (dev->master) {
@@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		goto out_unlock;
 
-	if (!drm_is_current_master_locked(file_priv)) {
+	if (!drm_is_current_master(file_priv)) {
 		ret = -EINVAL;
 		goto out_unlock;
 	}
@@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
 	if (file_priv->magic)
 		idr_remove(&file_priv->master->magic_map, file_priv->magic);
 
-	if (!drm_is_current_master_locked(file_priv))
+	if (!drm_is_current_master(file_priv))
 		goto out;
 
 	drm_legacy_lock_master_cleanup(dev, master);
@@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
 	mutex_unlock(&dev->master_mutex);
 }
 
+/**
+ * drm_is_current_master - checks whether @priv is the current master
+ * @fpriv: DRM file private
+ *
+ * Checks whether @fpriv is current master on its device. This decides whether a
+ * client is allowed to run DRM_MASTER IOCTLs.
+ *
+ * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
+ * - the current master is assumed to own the non-shareable display hardware.
+ */
+bool drm_is_current_master(struct drm_file *fpriv)
+{
+	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
+}
+EXPORT_SYMBOL(drm_is_current_master);
+
 /**
  * drm_master_get - reference a master pointer
  * @master: &struct drm_master
-- 
2.32.0.rc2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
  2021-06-22  7:54 ` Daniel Vetter
  (?)
@ 2021-06-22  8:28   ` Petri Latvala
  -1 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2021-06-22  8:28 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Intel Graphics Development, Emil Velikov, stable, David Airlie,
	DRI Development, Thomas Zimmermann, Daniel Vetter,
	Desmond Cheong Zhi Xi

On Tue, Jun 22, 2021 at 09:54:09AM +0200, Daniel Vetter wrote:
> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> 
> Unfortunately this inverts the locking hierarchy, so back to the
> drawing board. Full lockdep splat below:
> 
> ======================================================
> WARNING: possible circular locking dependency detected
> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> ------------------------------------------------------
> kms_frontbuffer/1087 is trying to acquire lock:
> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> but task is already holding lock:
> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> which lock already depends on the new lock.
> the existing dependency chain (in reverse order) is:
> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>        __mutex_lock+0xab/0x970
>        drm_client_modeset_probe+0x22e/0xca0
>        __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>        intel_fbdev_initial_config+0xf/0x20 [i915]
>        async_run_entry_fn+0x28/0x130
>        process_one_work+0x26d/0x5c0
>        worker_thread+0x37/0x380
>        kthread+0x144/0x170
>        ret_from_fork+0x1f/0x30
> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>        __mutex_lock+0xab/0x970
>        drm_client_modeset_commit_locked+0x1c/0x180
>        drm_client_modeset_commit+0x1c/0x40
>        __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>        drm_fb_helper_set_par+0x34/0x40
>        intel_fbdev_set_par+0x11/0x40 [i915]
>        fbcon_init+0x270/0x4f0
>        visual_init+0xc6/0x130
>        do_bind_con_driver+0x1e5/0x2d0
>        do_take_over_console+0x10e/0x180
>        do_fbcon_takeover+0x53/0xb0
>        register_framebuffer+0x22d/0x310
>        __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>        intel_fbdev_initial_config+0xf/0x20 [i915]
>        async_run_entry_fn+0x28/0x130
>        process_one_work+0x26d/0x5c0
>        worker_thread+0x37/0x380
>        kthread+0x144/0x170
>        ret_from_fork+0x1f/0x30
> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>        __lock_acquire+0x151e/0x2590
>        lock_acquire+0xd1/0x3d0
>        __mutex_lock+0xab/0x970
>        drm_is_current_master+0x1b/0x40
>        drm_mode_getconnector+0x37e/0x4a0
>        drm_ioctl_kernel+0xa8/0xf0
>        drm_ioctl+0x1e8/0x390
>        __x64_sys_ioctl+0x6a/0xa0
>        do_syscall_64+0x39/0xb0
>        entry_SYSCALL_64_after_hwframe+0x44/0xae
> other info that might help us debug this:
> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>  Possible unsafe locking scenario:
>        CPU0                    CPU1
>        ----                    ----
>   lock(&dev->mode_config.mutex);
>                                lock(&client->modeset_mutex);
>                                lock(&dev->mode_config.mutex);
>   lock(&dev->master_mutex);
> *** DEADLOCK ***
> 1 lock held by kms_frontbuffer/1087:
>  #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> stack backtrace:
> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> Call Trace:
>  dump_stack+0x7f/0xad
>  check_noncircular+0x12e/0x150
>  __lock_acquire+0x151e/0x2590
>  lock_acquire+0xd1/0x3d0
>  __mutex_lock+0xab/0x970
>  drm_is_current_master+0x1b/0x40
>  drm_mode_getconnector+0x37e/0x4a0
>  drm_ioctl_kernel+0xa8/0xf0
>  drm_ioctl+0x1e8/0x390
>  __x64_sys_ioctl+0x6a/0xa0
>  do_syscall_64+0x39/0xb0
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>


You have your "dim fixes" command line in the commit message.

This goes through Intel's CI shortly, if it agrees with this then

Testcase: igt/debugfs_test/read_all_entries
Acked-by: Petri Latvala <petri.latvala@intel.com>


> ---
>  drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>  1 file changed, 19 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 86d4b72e95cb..232abbba3686 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -61,35 +61,6 @@
>   * trusted clients.
>   */
>  
> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> -{
> -	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> -
> -	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> -}
> -
> -/**
> - * drm_is_current_master - checks whether @priv is the current master
> - * @fpriv: DRM file private
> - *
> - * Checks whether @fpriv is current master on its device. This decides whether a
> - * client is allowed to run DRM_MASTER IOCTLs.
> - *
> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> - * - the current master is assumed to own the non-shareable display hardware.
> - */
> -bool drm_is_current_master(struct drm_file *fpriv)
> -{
> -	bool ret;
> -
> -	mutex_lock(&fpriv->master->dev->master_mutex);
> -	ret = drm_is_current_master_locked(fpriv);
> -	mutex_unlock(&fpriv->master->dev->master_mutex);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL(drm_is_current_master);
> -
>  int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>  {
>  	struct drm_auth *auth = data;
> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>  	if (ret)
>  		goto out_unlock;
>  
> -	if (drm_is_current_master_locked(file_priv))
> +	if (drm_is_current_master(file_priv))
>  		goto out_unlock;
>  
>  	if (dev->master) {
> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>  	if (ret)
>  		goto out_unlock;
>  
> -	if (!drm_is_current_master_locked(file_priv)) {
> +	if (!drm_is_current_master(file_priv)) {
>  		ret = -EINVAL;
>  		goto out_unlock;
>  	}
> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>  	if (file_priv->magic)
>  		idr_remove(&file_priv->master->magic_map, file_priv->magic);
>  
> -	if (!drm_is_current_master_locked(file_priv))
> +	if (!drm_is_current_master(file_priv))
>  		goto out;
>  
>  	drm_legacy_lock_master_cleanup(dev, master);
> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>  	mutex_unlock(&dev->master_mutex);
>  }
>  
> +/**
> + * drm_is_current_master - checks whether @priv is the current master
> + * @fpriv: DRM file private
> + *
> + * Checks whether @fpriv is current master on its device. This decides whether a
> + * client is allowed to run DRM_MASTER IOCTLs.
> + *
> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> + * - the current master is assumed to own the non-shareable display hardware.
> + */
> +bool drm_is_current_master(struct drm_file *fpriv)
> +{
> +	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> +}
> +EXPORT_SYMBOL(drm_is_current_master);
> +
>  /**
>   * drm_master_get - reference a master pointer
>   * @master: &struct drm_master
> -- 
> 2.32.0.rc2
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-22  8:28   ` Petri Latvala
  0 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2021-06-22  8:28 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: David Airlie, Intel Graphics Development, Emil Velikov,
	DRI Development, stable, Thomas Zimmermann, Daniel Vetter,
	Desmond Cheong Zhi Xi

On Tue, Jun 22, 2021 at 09:54:09AM +0200, Daniel Vetter wrote:
> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> 
> Unfortunately this inverts the locking hierarchy, so back to the
> drawing board. Full lockdep splat below:
> 
> ======================================================
> WARNING: possible circular locking dependency detected
> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> ------------------------------------------------------
> kms_frontbuffer/1087 is trying to acquire lock:
> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> but task is already holding lock:
> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> which lock already depends on the new lock.
> the existing dependency chain (in reverse order) is:
> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>        __mutex_lock+0xab/0x970
>        drm_client_modeset_probe+0x22e/0xca0
>        __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>        intel_fbdev_initial_config+0xf/0x20 [i915]
>        async_run_entry_fn+0x28/0x130
>        process_one_work+0x26d/0x5c0
>        worker_thread+0x37/0x380
>        kthread+0x144/0x170
>        ret_from_fork+0x1f/0x30
> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>        __mutex_lock+0xab/0x970
>        drm_client_modeset_commit_locked+0x1c/0x180
>        drm_client_modeset_commit+0x1c/0x40
>        __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>        drm_fb_helper_set_par+0x34/0x40
>        intel_fbdev_set_par+0x11/0x40 [i915]
>        fbcon_init+0x270/0x4f0
>        visual_init+0xc6/0x130
>        do_bind_con_driver+0x1e5/0x2d0
>        do_take_over_console+0x10e/0x180
>        do_fbcon_takeover+0x53/0xb0
>        register_framebuffer+0x22d/0x310
>        __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>        intel_fbdev_initial_config+0xf/0x20 [i915]
>        async_run_entry_fn+0x28/0x130
>        process_one_work+0x26d/0x5c0
>        worker_thread+0x37/0x380
>        kthread+0x144/0x170
>        ret_from_fork+0x1f/0x30
> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>        __lock_acquire+0x151e/0x2590
>        lock_acquire+0xd1/0x3d0
>        __mutex_lock+0xab/0x970
>        drm_is_current_master+0x1b/0x40
>        drm_mode_getconnector+0x37e/0x4a0
>        drm_ioctl_kernel+0xa8/0xf0
>        drm_ioctl+0x1e8/0x390
>        __x64_sys_ioctl+0x6a/0xa0
>        do_syscall_64+0x39/0xb0
>        entry_SYSCALL_64_after_hwframe+0x44/0xae
> other info that might help us debug this:
> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>  Possible unsafe locking scenario:
>        CPU0                    CPU1
>        ----                    ----
>   lock(&dev->mode_config.mutex);
>                                lock(&client->modeset_mutex);
>                                lock(&dev->mode_config.mutex);
>   lock(&dev->master_mutex);
> *** DEADLOCK ***
> 1 lock held by kms_frontbuffer/1087:
>  #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> stack backtrace:
> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> Call Trace:
>  dump_stack+0x7f/0xad
>  check_noncircular+0x12e/0x150
>  __lock_acquire+0x151e/0x2590
>  lock_acquire+0xd1/0x3d0
>  __mutex_lock+0xab/0x970
>  drm_is_current_master+0x1b/0x40
>  drm_mode_getconnector+0x37e/0x4a0
>  drm_ioctl_kernel+0xa8/0xf0
>  drm_ioctl+0x1e8/0x390
>  __x64_sys_ioctl+0x6a/0xa0
>  do_syscall_64+0x39/0xb0
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>


You have your "dim fixes" command line in the commit message.

This goes through Intel's CI shortly, if it agrees with this then

Testcase: igt/debugfs_test/read_all_entries
Acked-by: Petri Latvala <petri.latvala@intel.com>


> ---
>  drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>  1 file changed, 19 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 86d4b72e95cb..232abbba3686 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -61,35 +61,6 @@
>   * trusted clients.
>   */
>  
> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> -{
> -	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> -
> -	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> -}
> -
> -/**
> - * drm_is_current_master - checks whether @priv is the current master
> - * @fpriv: DRM file private
> - *
> - * Checks whether @fpriv is current master on its device. This decides whether a
> - * client is allowed to run DRM_MASTER IOCTLs.
> - *
> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> - * - the current master is assumed to own the non-shareable display hardware.
> - */
> -bool drm_is_current_master(struct drm_file *fpriv)
> -{
> -	bool ret;
> -
> -	mutex_lock(&fpriv->master->dev->master_mutex);
> -	ret = drm_is_current_master_locked(fpriv);
> -	mutex_unlock(&fpriv->master->dev->master_mutex);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL(drm_is_current_master);
> -
>  int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>  {
>  	struct drm_auth *auth = data;
> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>  	if (ret)
>  		goto out_unlock;
>  
> -	if (drm_is_current_master_locked(file_priv))
> +	if (drm_is_current_master(file_priv))
>  		goto out_unlock;
>  
>  	if (dev->master) {
> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>  	if (ret)
>  		goto out_unlock;
>  
> -	if (!drm_is_current_master_locked(file_priv)) {
> +	if (!drm_is_current_master(file_priv)) {
>  		ret = -EINVAL;
>  		goto out_unlock;
>  	}
> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>  	if (file_priv->magic)
>  		idr_remove(&file_priv->master->magic_map, file_priv->magic);
>  
> -	if (!drm_is_current_master_locked(file_priv))
> +	if (!drm_is_current_master(file_priv))
>  		goto out;
>  
>  	drm_legacy_lock_master_cleanup(dev, master);
> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>  	mutex_unlock(&dev->master_mutex);
>  }
>  
> +/**
> + * drm_is_current_master - checks whether @priv is the current master
> + * @fpriv: DRM file private
> + *
> + * Checks whether @fpriv is current master on its device. This decides whether a
> + * client is allowed to run DRM_MASTER IOCTLs.
> + *
> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> + * - the current master is assumed to own the non-shareable display hardware.
> + */
> +bool drm_is_current_master(struct drm_file *fpriv)
> +{
> +	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> +}
> +EXPORT_SYMBOL(drm_is_current_master);
> +
>  /**
>   * drm_master_get - reference a master pointer
>   * @master: &struct drm_master
> -- 
> 2.32.0.rc2
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Intel-gfx] [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-22  8:28   ` Petri Latvala
  0 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2021-06-22  8:28 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: David Airlie, Intel Graphics Development, DRI Development,
	stable, Thomas Zimmermann, Daniel Vetter, Desmond Cheong Zhi Xi

On Tue, Jun 22, 2021 at 09:54:09AM +0200, Daniel Vetter wrote:
> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> 
> Unfortunately this inverts the locking hierarchy, so back to the
> drawing board. Full lockdep splat below:
> 
> ======================================================
> WARNING: possible circular locking dependency detected
> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> ------------------------------------------------------
> kms_frontbuffer/1087 is trying to acquire lock:
> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> but task is already holding lock:
> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> which lock already depends on the new lock.
> the existing dependency chain (in reverse order) is:
> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>        __mutex_lock+0xab/0x970
>        drm_client_modeset_probe+0x22e/0xca0
>        __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>        intel_fbdev_initial_config+0xf/0x20 [i915]
>        async_run_entry_fn+0x28/0x130
>        process_one_work+0x26d/0x5c0
>        worker_thread+0x37/0x380
>        kthread+0x144/0x170
>        ret_from_fork+0x1f/0x30
> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>        __mutex_lock+0xab/0x970
>        drm_client_modeset_commit_locked+0x1c/0x180
>        drm_client_modeset_commit+0x1c/0x40
>        __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>        drm_fb_helper_set_par+0x34/0x40
>        intel_fbdev_set_par+0x11/0x40 [i915]
>        fbcon_init+0x270/0x4f0
>        visual_init+0xc6/0x130
>        do_bind_con_driver+0x1e5/0x2d0
>        do_take_over_console+0x10e/0x180
>        do_fbcon_takeover+0x53/0xb0
>        register_framebuffer+0x22d/0x310
>        __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>        intel_fbdev_initial_config+0xf/0x20 [i915]
>        async_run_entry_fn+0x28/0x130
>        process_one_work+0x26d/0x5c0
>        worker_thread+0x37/0x380
>        kthread+0x144/0x170
>        ret_from_fork+0x1f/0x30
> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>        __lock_acquire+0x151e/0x2590
>        lock_acquire+0xd1/0x3d0
>        __mutex_lock+0xab/0x970
>        drm_is_current_master+0x1b/0x40
>        drm_mode_getconnector+0x37e/0x4a0
>        drm_ioctl_kernel+0xa8/0xf0
>        drm_ioctl+0x1e8/0x390
>        __x64_sys_ioctl+0x6a/0xa0
>        do_syscall_64+0x39/0xb0
>        entry_SYSCALL_64_after_hwframe+0x44/0xae
> other info that might help us debug this:
> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>  Possible unsafe locking scenario:
>        CPU0                    CPU1
>        ----                    ----
>   lock(&dev->mode_config.mutex);
>                                lock(&client->modeset_mutex);
>                                lock(&dev->mode_config.mutex);
>   lock(&dev->master_mutex);
> *** DEADLOCK ***
> 1 lock held by kms_frontbuffer/1087:
>  #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> stack backtrace:
> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> Call Trace:
>  dump_stack+0x7f/0xad
>  check_noncircular+0x12e/0x150
>  __lock_acquire+0x151e/0x2590
>  lock_acquire+0xd1/0x3d0
>  __mutex_lock+0xab/0x970
>  drm_is_current_master+0x1b/0x40
>  drm_mode_getconnector+0x37e/0x4a0
>  drm_ioctl_kernel+0xa8/0xf0
>  drm_ioctl+0x1e8/0x390
>  __x64_sys_ioctl+0x6a/0xa0
>  do_syscall_64+0x39/0xb0
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>


You have your "dim fixes" command line in the commit message.

This goes through Intel's CI shortly, if it agrees with this then

Testcase: igt/debugfs_test/read_all_entries
Acked-by: Petri Latvala <petri.latvala@intel.com>


> ---
>  drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>  1 file changed, 19 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 86d4b72e95cb..232abbba3686 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -61,35 +61,6 @@
>   * trusted clients.
>   */
>  
> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> -{
> -	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> -
> -	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> -}
> -
> -/**
> - * drm_is_current_master - checks whether @priv is the current master
> - * @fpriv: DRM file private
> - *
> - * Checks whether @fpriv is current master on its device. This decides whether a
> - * client is allowed to run DRM_MASTER IOCTLs.
> - *
> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> - * - the current master is assumed to own the non-shareable display hardware.
> - */
> -bool drm_is_current_master(struct drm_file *fpriv)
> -{
> -	bool ret;
> -
> -	mutex_lock(&fpriv->master->dev->master_mutex);
> -	ret = drm_is_current_master_locked(fpriv);
> -	mutex_unlock(&fpriv->master->dev->master_mutex);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL(drm_is_current_master);
> -
>  int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>  {
>  	struct drm_auth *auth = data;
> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>  	if (ret)
>  		goto out_unlock;
>  
> -	if (drm_is_current_master_locked(file_priv))
> +	if (drm_is_current_master(file_priv))
>  		goto out_unlock;
>  
>  	if (dev->master) {
> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>  	if (ret)
>  		goto out_unlock;
>  
> -	if (!drm_is_current_master_locked(file_priv)) {
> +	if (!drm_is_current_master(file_priv)) {
>  		ret = -EINVAL;
>  		goto out_unlock;
>  	}
> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>  	if (file_priv->magic)
>  		idr_remove(&file_priv->master->magic_map, file_priv->magic);
>  
> -	if (!drm_is_current_master_locked(file_priv))
> +	if (!drm_is_current_master(file_priv))
>  		goto out;
>  
>  	drm_legacy_lock_master_cleanup(dev, master);
> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>  	mutex_unlock(&dev->master_mutex);
>  }
>  
> +/**
> + * drm_is_current_master - checks whether @priv is the current master
> + * @fpriv: DRM file private
> + *
> + * Checks whether @fpriv is current master on its device. This decides whether a
> + * client is allowed to run DRM_MASTER IOCTLs.
> + *
> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> + * - the current master is assumed to own the non-shareable display hardware.
> + */
> +bool drm_is_current_master(struct drm_file *fpriv)
> +{
> +	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> +}
> +EXPORT_SYMBOL(drm_is_current_master);
> +
>  /**
>   * drm_master_get - reference a master pointer
>   * @master: &struct drm_master
> -- 
> 2.32.0.rc2
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Revert "drm: add a locked version of drm_is_current_master"
  2021-06-22  7:54 ` Daniel Vetter
                   ` (2 preceding siblings ...)
  (?)
@ 2021-06-22  9:03 ` Patchwork
  -1 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2021-06-22  9:03 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

== Series Details ==

Series: Revert "drm: add a locked version of drm_is_current_master"
URL   : https://patchwork.freedesktop.org/series/91758/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
44a4f4b18c74 Revert "drm: add a locked version of drm_is_current_master"
-:92: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#92: 
daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f

-:92: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")'
#92: 
daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f

-:193: WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address mismatch: 'From: Daniel Vetter <daniel.vetter@ffwll.ch>' != 'Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>'

total: 1 errors, 2 warnings, 0 checks, 81 lines checked


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Intel-gfx] ✓ Fi.CI.BAT: success for Revert "drm: add a locked version of drm_is_current_master"
  2021-06-22  7:54 ` Daniel Vetter
                   ` (3 preceding siblings ...)
  (?)
@ 2021-06-22  9:34 ` Patchwork
  -1 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2021-06-22  9:34 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 30282 bytes --]

== Series Details ==

Series: Revert "drm: add a locked version of drm_is_current_master"
URL   : https://patchwork.freedesktop.org/series/91758/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10259 -> Patchwork_20424
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/index.html

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_20424:

### IGT changes ###

#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@gem_exec_suspend@basic-s3:
    - {fi-dg1-1}:         NOTRUN -> [FAIL][1] +65 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-dg1-1/igt@gem_exec_suspend@basic-s3.html

  * igt@i915_selftest@live@gt_lrc:
    - {fi-dg1-1}:         NOTRUN -> [DMESG-FAIL][2]
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-dg1-1/igt@i915_selftest@live@gt_lrc.html

  * igt@kms_addfb_basic@invalid-get-prop:
    - {fi-dg1-1}:         NOTRUN -> [WARN][3] +6 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-dg1-1/igt@kms_addfb_basic@invalid-get-prop.html

  * igt@prime_vgem@basic-fence-flip:
    - {fi-dg1-1}:         NOTRUN -> [SKIP][4] +41 similar issues
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-dg1-1/igt@prime_vgem@basic-fence-flip.html

  
Known issues
------------

  Here are the changes found in Patchwork_20424 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@cs-compute:
    - fi-elk-e7500:       NOTRUN -> [SKIP][5] ([fdo#109271]) +49 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-elk-e7500/igt@amdgpu/amd_basic@cs-compute.html

  * igt@amdgpu/amd_basic@query-info:
    - fi-glk-dsi:         NOTRUN -> [SKIP][6] ([fdo#109271]) +28 similar issues
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-glk-dsi/igt@amdgpu/amd_basic@query-info.html

  * igt@amdgpu/amd_basic@semaphore:
    - fi-kbl-guc:         NOTRUN -> [SKIP][7] ([fdo#109271]) +59 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-guc/igt@amdgpu/amd_basic@semaphore.html
    - fi-bdw-5557u:       NOTRUN -> [SKIP][8] ([fdo#109271]) +27 similar issues
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bdw-5557u/igt@amdgpu/amd_basic@semaphore.html
    - fi-kbl-7500u:       NOTRUN -> [SKIP][9] ([fdo#109271]) +28 similar issues
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-7500u/igt@amdgpu/amd_basic@semaphore.html
    - fi-hsw-4770:        NOTRUN -> [SKIP][10] ([fdo#109271] / [fdo#109315]) +17 similar issues
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-hsw-4770/igt@amdgpu/amd_basic@semaphore.html

  * igt@amdgpu/amd_basic@userptr:
    - fi-cfl-8700k:       NOTRUN -> [SKIP][11] ([fdo#109271]) +26 similar issues
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8700k/igt@amdgpu/amd_basic@userptr.html

  * igt@amdgpu/amd_cs_nop@fork-compute0:
    - fi-icl-y:           NOTRUN -> [SKIP][12] ([fdo#109315]) +17 similar issues
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-icl-y/igt@amdgpu/amd_cs_nop@fork-compute0.html

  * igt@amdgpu/amd_cs_nop@nop-compute0:
    - fi-ilk-650:         NOTRUN -> [SKIP][13] ([fdo#109271]) +35 similar issues
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-ilk-650/igt@amdgpu/amd_cs_nop@nop-compute0.html

  * igt@amdgpu/amd_cs_nop@sync-compute0:
    - fi-kbl-r:           NOTRUN -> [SKIP][14] ([fdo#109271]) +21 similar issues
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-r/igt@amdgpu/amd_cs_nop@sync-compute0.html
    - fi-cml-u2:          NOTRUN -> [SKIP][15] ([fdo#109315]) +17 similar issues
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-u2/igt@amdgpu/amd_cs_nop@sync-compute0.html

  * igt@amdgpu/amd_cs_nop@sync-gfx0:
    - fi-cfl-guc:         NOTRUN -> [SKIP][16] ([fdo#109271]) +26 similar issues
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-guc/igt@amdgpu/amd_cs_nop@sync-gfx0.html

  * igt@amdgpu/amd_prime@amd-to-i915:
    - fi-kbl-x1275:       NOTRUN -> [SKIP][17] ([fdo#109271]) +26 similar issues
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-x1275/igt@amdgpu/amd_prime@amd-to-i915.html
    - fi-ivb-3770:        NOTRUN -> [SKIP][18] ([fdo#109271]) +31 similar issues
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-ivb-3770/igt@amdgpu/amd_prime@amd-to-i915.html

  * igt@amdgpu/amd_prime@i915-to-amd:
    - fi-snb-2520m:       NOTRUN -> [SKIP][19] ([fdo#109271]) +37 similar issues
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-snb-2520m/igt@amdgpu/amd_prime@i915-to-amd.html
    - fi-cml-s:           NOTRUN -> [SKIP][20] ([fdo#109315]) +17 similar issues
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-s/igt@amdgpu/amd_prime@i915-to-amd.html

  * igt@core_hotunplug@unbind-rebind:
    - fi-hsw-4770:        NOTRUN -> [WARN][21] ([i915#2283])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-hsw-4770/igt@core_hotunplug@unbind-rebind.html
    - fi-bdw-5557u:       NOTRUN -> [WARN][22] ([i915#2283])
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bdw-5557u/igt@core_hotunplug@unbind-rebind.html

  * igt@fbdev@nullptr:
    - fi-bdw-gvtdvm:      NOTRUN -> [SKIP][23] ([fdo#109271]) +5 similar issues
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bdw-gvtdvm/igt@fbdev@nullptr.html

  * igt@gem_exec_fence@basic-busy@bcs0:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][24] ([fdo#109271]) +6 similar issues
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-soraka/igt@gem_exec_fence@basic-busy@bcs0.html
    - fi-apl-guc:         NOTRUN -> [SKIP][25] ([fdo#109271]) +1 similar issue
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-apl-guc/igt@gem_exec_fence@basic-busy@bcs0.html
    - fi-cml-s:           NOTRUN -> [SKIP][26] ([i915#1208]) +1 similar issue
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-s/igt@gem_exec_fence@basic-busy@bcs0.html
    - fi-cml-u2:          NOTRUN -> [SKIP][27] ([i915#1208]) +1 similar issue
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-u2/igt@gem_exec_fence@basic-busy@bcs0.html

  * igt@gem_exec_gttfill@basic:
    - fi-bsw-n3050:       NOTRUN -> [SKIP][28] ([fdo#109271])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bsw-n3050/igt@gem_exec_gttfill@basic.html

  * igt@gem_exec_suspend@basic-s0:
    - fi-bdw-gvtdvm:      NOTRUN -> [INCOMPLETE][29] ([i915#146])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bdw-gvtdvm/igt@gem_exec_suspend@basic-s0.html

  * igt@gem_exec_suspend@basic-s3:
    - fi-bwr-2160:        NOTRUN -> [SKIP][30] ([fdo#109271]) +60 similar issues
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bwr-2160/igt@gem_exec_suspend@basic-s3.html
    - fi-bsw-n3050:       NOTRUN -> [INCOMPLETE][31] ([i915#3159])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bsw-n3050/igt@gem_exec_suspend@basic-s3.html

  * igt@gem_huc_copy@huc-copy:
    - fi-skl-6600u:       NOTRUN -> [SKIP][32] ([fdo#109271] / [i915#2190])
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-6600u/igt@gem_huc_copy@huc-copy.html
    - fi-pnv-d510:        NOTRUN -> [SKIP][33] ([fdo#109271]) +53 similar issues
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-pnv-d510/igt@gem_huc_copy@huc-copy.html
    - fi-skl-6700k2:      NOTRUN -> [SKIP][34] ([fdo#109271] / [i915#2190])
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-6700k2/igt@gem_huc_copy@huc-copy.html
    - fi-kbl-soraka:      NOTRUN -> [SKIP][35] ([fdo#109271] / [i915#2190])
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-soraka/igt@gem_huc_copy@huc-copy.html
    - fi-kbl-x1275:       NOTRUN -> [SKIP][36] ([fdo#109271] / [i915#2190])
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-x1275/igt@gem_huc_copy@huc-copy.html
    - fi-kbl-r:           NOTRUN -> [SKIP][37] ([fdo#109271] / [i915#2190])
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-r/igt@gem_huc_copy@huc-copy.html
    - fi-skl-guc:         NOTRUN -> [SKIP][38] ([fdo#109271] / [i915#2190])
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-guc/igt@gem_huc_copy@huc-copy.html
    - fi-kbl-8809g:       NOTRUN -> [SKIP][39] ([fdo#109271] / [i915#2190])
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-8809g/igt@gem_huc_copy@huc-copy.html
    - fi-bxt-dsi:         NOTRUN -> [SKIP][40] ([fdo#109271] / [i915#2190])
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bxt-dsi/igt@gem_huc_copy@huc-copy.html
    - fi-cfl-8700k:       NOTRUN -> [SKIP][41] ([fdo#109271] / [i915#2190])
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8700k/igt@gem_huc_copy@huc-copy.html
    - fi-cml-u2:          NOTRUN -> [SKIP][42] ([i915#2190])
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-u2/igt@gem_huc_copy@huc-copy.html
    - fi-cfl-guc:         NOTRUN -> [SKIP][43] ([fdo#109271] / [i915#2190])
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-guc/igt@gem_huc_copy@huc-copy.html
    - fi-cml-s:           NOTRUN -> [SKIP][44] ([i915#2190])
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-s/igt@gem_huc_copy@huc-copy.html
    - fi-glk-dsi:         NOTRUN -> [SKIP][45] ([fdo#109271] / [i915#2190])
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-glk-dsi/igt@gem_huc_copy@huc-copy.html
    - fi-kbl-7500u:       NOTRUN -> [SKIP][46] ([fdo#109271] / [i915#2190])
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-7500u/igt@gem_huc_copy@huc-copy.html
    - fi-kbl-guc:         NOTRUN -> [SKIP][47] ([fdo#109271] / [i915#2190])
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-guc/igt@gem_huc_copy@huc-copy.html
    - fi-kbl-7567u:       NOTRUN -> [SKIP][48] ([fdo#109271] / [i915#2190])
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-7567u/igt@gem_huc_copy@huc-copy.html
    - fi-icl-y:           NOTRUN -> [SKIP][49] ([i915#2190])
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-icl-y/igt@gem_huc_copy@huc-copy.html
    - fi-cfl-8109u:       NOTRUN -> [SKIP][50] ([fdo#109271] / [i915#2190])
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8109u/igt@gem_huc_copy@huc-copy.html

  * igt@gem_softpin@allocator-basic-reserve:
    - fi-hsw-4770:        NOTRUN -> [SKIP][51] ([fdo#109271]) +4 similar issues
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-hsw-4770/igt@gem_softpin@allocator-basic-reserve.html

  * igt@i915_hangman@error-state-basic:
    - fi-apl-guc:         NOTRUN -> [DMESG-WARN][52] ([i915#1610])
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-apl-guc/igt@i915_hangman@error-state-basic.html

  * igt@i915_pm_backlight@basic-brightness:
    - fi-hsw-4770:        NOTRUN -> [SKIP][53] ([fdo#109271] / [i915#3012])
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-hsw-4770/igt@i915_pm_backlight@basic-brightness.html

  * igt@i915_pm_rpm@basic-rte:
    - fi-kbl-8809g:       NOTRUN -> [SKIP][54] ([fdo#109271]) +37 similar issues
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-8809g/igt@i915_pm_rpm@basic-rte.html

  * igt@i915_selftest@live@gt_heartbeat:
    - fi-skl-guc:         NOTRUN -> [DMESG-FAIL][55] ([i915#2291] / [i915#541])
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-guc/igt@i915_selftest@live@gt_heartbeat.html

  * igt@i915_selftest@live@gt_pm:
    - fi-kbl-soraka:      NOTRUN -> [DMESG-FAIL][56] ([i915#1886] / [i915#2291])
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

  * igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
    - fi-snb-2600:        NOTRUN -> [SKIP][57] ([fdo#109271]) +37 similar issues
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-snb-2600/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html

  * igt@kms_chamelium@common-hpd-after-suspend:
    - fi-skl-guc:         NOTRUN -> [SKIP][58] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-guc/igt@kms_chamelium@common-hpd-after-suspend.html

  * igt@kms_chamelium@dp-crc-fast:
    - fi-hsw-4770:        NOTRUN -> [SKIP][59] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-hsw-4770/igt@kms_chamelium@dp-crc-fast.html
    - fi-icl-y:           NOTRUN -> [SKIP][60] ([fdo#109284] / [fdo#111827]) +8 similar issues
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-icl-y/igt@kms_chamelium@dp-crc-fast.html
    - fi-ilk-650:         NOTRUN -> [SKIP][61] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-ilk-650/igt@kms_chamelium@dp-crc-fast.html
    - fi-cfl-8700k:       NOTRUN -> [SKIP][62] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8700k/igt@kms_chamelium@dp-crc-fast.html

  * igt@kms_chamelium@dp-edid-read:
    - fi-cfl-guc:         NOTRUN -> [SKIP][63] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-guc/igt@kms_chamelium@dp-edid-read.html
    - fi-kbl-soraka:      NOTRUN -> [SKIP][64] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-soraka/igt@kms_chamelium@dp-edid-read.html

  * igt@kms_chamelium@dp-hpd-fast:
    - fi-cml-s:           NOTRUN -> [SKIP][65] ([fdo#109284] / [fdo#111827]) +8 similar issues
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-s/igt@kms_chamelium@dp-hpd-fast.html
    - fi-skl-6700k2:      NOTRUN -> [SKIP][66] ([fdo#109271]) +31 similar issues
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-6700k2/igt@kms_chamelium@dp-hpd-fast.html
    - fi-ivb-3770:        NOTRUN -> [SKIP][67] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-ivb-3770/igt@kms_chamelium@dp-hpd-fast.html
    - fi-cml-u2:          NOTRUN -> [SKIP][68] ([fdo#109284] / [fdo#111827]) +8 similar issues
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-u2/igt@kms_chamelium@dp-hpd-fast.html
    - fi-bxt-dsi:         NOTRUN -> [SKIP][69] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bxt-dsi/igt@kms_chamelium@dp-hpd-fast.html

  * igt@kms_chamelium@hdmi-crc-fast:
    - fi-kbl-x1275:       NOTRUN -> [SKIP][70] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-x1275/igt@kms_chamelium@hdmi-crc-fast.html
    - fi-snb-2600:        NOTRUN -> [SKIP][71] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-snb-2600/igt@kms_chamelium@hdmi-crc-fast.html

  * igt@kms_chamelium@hdmi-edid-read:
    - fi-kbl-8809g:       NOTRUN -> [SKIP][72] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-8809g/igt@kms_chamelium@hdmi-edid-read.html
    - fi-kbl-r:           NOTRUN -> [SKIP][73] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-r/igt@kms_chamelium@hdmi-edid-read.html
    - fi-kbl-7567u:       NOTRUN -> [SKIP][74] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-7567u/igt@kms_chamelium@hdmi-edid-read.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-glk-dsi:         NOTRUN -> [SKIP][75] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-glk-dsi/igt@kms_chamelium@hdmi-hpd-fast.html
    - fi-snb-2520m:       NOTRUN -> [SKIP][76] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-snb-2520m/igt@kms_chamelium@hdmi-hpd-fast.html
    - fi-kbl-guc:         NOTRUN -> [SKIP][77] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-guc/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_chamelium@vga-edid-read:
    - fi-skl-6600u:       NOTRUN -> [SKIP][78] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-6600u/igt@kms_chamelium@vga-edid-read.html
    - fi-bdw-5557u:       NOTRUN -> [SKIP][79] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bdw-5557u/igt@kms_chamelium@vga-edid-read.html
    - fi-bsw-nick:        NOTRUN -> [SKIP][80] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bsw-nick/igt@kms_chamelium@vga-edid-read.html

  * igt@kms_chamelium@vga-hpd-fast:
    - fi-cfl-8109u:       NOTRUN -> [SKIP][81] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8109u/igt@kms_chamelium@vga-hpd-fast.html

  * igt@kms_force_connector_basic@force-load-detect:
    - fi-bxt-dsi:         NOTRUN -> [SKIP][82] ([fdo#109271]) +28 similar issues
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bxt-dsi/igt@kms_force_connector_basic@force-load-detect.html
    - fi-cml-u2:          NOTRUN -> [SKIP][83] ([fdo#109285])
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-u2/igt@kms_force_connector_basic@force-load-detect.html
    - fi-cml-s:           NOTRUN -> [SKIP][84] ([fdo#109285])
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-s/igt@kms_force_connector_basic@force-load-detect.html
    - fi-icl-y:           NOTRUN -> [SKIP][85] ([fdo#109285])
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-icl-y/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
    - fi-hsw-4770:        NOTRUN -> [SKIP][86] ([fdo#109271] / [i915#533])
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-hsw-4770/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-kbl-7500u:       NOTRUN -> [SKIP][87] ([fdo#109271] / [i915#533])
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-7500u/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-kbl-guc:         NOTRUN -> [SKIP][88] ([fdo#109271] / [i915#533])
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-guc/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-cml-u2:          NOTRUN -> [SKIP][89] ([fdo#109278] / [i915#533])
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-u2/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-skl-6600u:       NOTRUN -> [SKIP][90] ([fdo#109271] / [i915#533])
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-6600u/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-bxt-dsi:         NOTRUN -> [SKIP][91] ([fdo#109271] / [i915#533])
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bxt-dsi/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-cml-s:           NOTRUN -> [SKIP][92] ([fdo#109278] / [i915#533])
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-s/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-skl-6700k2:      NOTRUN -> [SKIP][93] ([fdo#109271] / [i915#533])
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-6700k2/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-cfl-8109u:       NOTRUN -> [SKIP][94] ([fdo#109271] / [i915#533])
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8109u/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-kbl-r:           NOTRUN -> [SKIP][95] ([fdo#109271] / [i915#533])
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-r/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-kbl-7567u:       NOTRUN -> [SKIP][96] ([fdo#109271] / [i915#533])
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-7567u/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-skl-guc:         NOTRUN -> [SKIP][97] ([fdo#109271] / [i915#533])
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-guc/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-cfl-8700k:       NOTRUN -> [SKIP][98] ([fdo#109271] / [i915#533])
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8700k/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-kbl-soraka:      NOTRUN -> [SKIP][99] ([fdo#109271] / [i915#533])
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-soraka/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-cfl-guc:         NOTRUN -> [SKIP][100] ([fdo#109271] / [i915#533])
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-guc/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-kbl-x1275:       NOTRUN -> [SKIP][101] ([fdo#109271] / [i915#533])
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-x1275/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-glk-dsi:         NOTRUN -> [SKIP][102] ([fdo#109271] / [i915#533])
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-glk-dsi/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-icl-y:           NOTRUN -> [SKIP][103] ([fdo#109278])
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-icl-y/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html
    - fi-kbl-8809g:       NOTRUN -> [SKIP][104] ([fdo#109271] / [i915#533])
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-8809g/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html

  * igt@kms_pipe_crc_basic@read-crc-pipe-c:
    - fi-kbl-7567u:       NOTRUN -> [SKIP][105] ([fdo#109271]) +59 similar issues
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-7567u/igt@kms_pipe_crc_basic@read-crc-pipe-c.html

  * igt@kms_psr@primary_mmap_gtt:
    - fi-skl-guc:         NOTRUN -> [SKIP][106] ([fdo#109271]) +26 similar issues
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-guc/igt@kms_psr@primary_mmap_gtt.html
    - fi-icl-y:           NOTRUN -> [SKIP][107] ([fdo#110189]) +3 similar issues
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-icl-y/igt@kms_psr@primary_mmap_gtt.html
    - fi-cfl-8109u:       NOTRUN -> [SKIP][108] ([fdo#109271]) +26 similar issues
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8109u/igt@kms_psr@primary_mmap_gtt.html
    - fi-hsw-4770:        NOTRUN -> [SKIP][109] ([fdo#109271] / [i915#1072]) +3 similar issues
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-hsw-4770/igt@kms_psr@primary_mmap_gtt.html

  * igt@kms_psr@primary_page_flip:
    - fi-bsw-nick:        NOTRUN -> [SKIP][110] ([fdo#109271]) +63 similar issues
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bsw-nick/igt@kms_psr@primary_page_flip.html

  * igt@prime_vgem@basic-userptr:
    - fi-skl-6600u:       NOTRUN -> [SKIP][111] ([fdo#109271]) +21 similar issues
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-skl-6600u/igt@prime_vgem@basic-userptr.html
    - fi-cml-s:           NOTRUN -> [SKIP][112] ([i915#3301])
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-s/igt@prime_vgem@basic-userptr.html
    - fi-icl-y:           NOTRUN -> [SKIP][113] ([i915#3301])
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-icl-y/igt@prime_vgem@basic-userptr.html
    - fi-cml-u2:          NOTRUN -> [SKIP][114] ([i915#3301])
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-u2/igt@prime_vgem@basic-userptr.html

  
#### Possible fixes ####

  * igt@debugfs_test@read_all_entries:
    - fi-cml-s:           [DMESG-WARN][115] ([i915#3660]) -> [PASS][116]
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-cml-s/igt@debugfs_test@read_all_entries.html
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cml-s/igt@debugfs_test@read_all_entries.html
    - {fi-dg1-1}:         [DMESG-WARN][117] ([i915#3660]) -> [PASS][118]
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-dg1-1/igt@debugfs_test@read_all_entries.html
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-dg1-1/igt@debugfs_test@read_all_entries.html
    - fi-glk-dsi:         [DMESG-WARN][119] ([i915#3660]) -> [PASS][120]
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-glk-dsi/igt@debugfs_test@read_all_entries.html
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-glk-dsi/igt@debugfs_test@read_all_entries.html
    - fi-ivb-3770:        [DMESG-WARN][121] ([i915#3660]) -> [PASS][122]
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-ivb-3770/igt@debugfs_test@read_all_entries.html
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-ivb-3770/igt@debugfs_test@read_all_entries.html
    - fi-bdw-gvtdvm:      [DMESG-WARN][123] ([i915#3660]) -> [PASS][124]
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-bdw-gvtdvm/igt@debugfs_test@read_all_entries.html
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-bdw-gvtdvm/igt@debugfs_test@read_all_entries.html
    - fi-kbl-7500u:       [DMESG-WARN][125] ([i915#262] / [i915#3660]) -> [PASS][126]
   [125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-kbl-7500u/igt@debugfs_test@read_all_entries.html
   [126]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-kbl-7500u/igt@debugfs_test@read_all_entries.html
    - {fi-ehl-2}:         [DMESG-WARN][127] ([i915#3660]) -> [PASS][128]
   [127]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-ehl-2/igt@debugfs_test@read_all_entries.html
   [128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-ehl-2/igt@debugfs_test@read_all_entries.html
    - fi-snb-2520m:       [DMESG-WARN][129] ([i915#3660]) -> [PASS][130]
   [129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-snb-2520m/igt@debugfs_test@read_all_entries.html
   [130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-snb-2520m/igt@debugfs_test@read_all_entries.html
    - fi-cfl-8109u:       [DMESG-WARN][131] ([i915#262] / [i915#3660]) -> [PASS][132]
   [131]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-cfl-8109u/igt@debugfs_test@read_all_entries.html
   [132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-cfl-8109u/igt@debugfs_test@read_all_entries.html
    - {fi-hsw-gt1}:       [DMESG-WARN][133] ([i915#3660]) -> [PASS][134]
   [133]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-hsw-gt1/igt@debugfs_test@read_all_entries.html
   [134]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-hsw-gt1/igt@debugfs_test@read_all_entries.html
    - {fi-jsl-1}:         [DMESG-WARN][135] ([i915#3660]) -> [PASS][136]
   [135]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-jsl-1/igt@debugfs_test@read_all_entries.html
   [136]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-jsl-1/igt@debugfs_test@read_all_entries.html
    - fi-pnv-d510:        [DMESG-WARN][137] ([i915#3660]) -> [PASS][138]
   [137]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-pnv-d510/igt@debugfs_test@read_all_entries.html
   [138]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-pnv-d510/igt@debugfs_test@read_all_entries.html
    - fi-ilk-650:         [DMESG-WARN][139] ([i915#3660]) -> [PASS][140]
   [139]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-ilk-650/igt@debugfs_test@read_all_entries.html
   [140]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-ilk-650/igt@debugfs_test@read_all_entries.html
    - {fi-ehl-1}:         [DMESG-WARN][141] ([i915#3660]) -> [PASS][142]
   [141]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-ehl-1/igt@debugfs_test@read_all_entries.html
   [142]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-ehl-1/igt@debugfs_test@read_all_entries.html
    - fi-elk-e7500:       [DMESG-WARN][143] ([i915#3660]) -> [PASS][144]
   [143]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-elk-e7500/igt@debugfs_test@read_all_entries.html
   [144]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-elk-e7500/igt@debugfs_test@read_all_entries.html
    - fi-snb-2600:        [DMESG-WARN][145] ([i915#3660]) -> [PASS][146]
   [145]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-snb-2600/igt@debugfs_test@read_all_entries.html
   [146]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/fi-snb-2600/igt@debugfs_test@read_all_entries.html
    - fi-kbl-guc:         [DMESG-WARN][147] ([i915#262] / [i915#3660]) -> [PASS][148]
   [147]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10259/fi-kbl-guc/igt@debugfs_test@read_all_entries.htm

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/index.html

[-- Attachment #1.2: Type: text/html, Size: 33435 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Intel-gfx] ✗ Fi.CI.IGT: failure for Revert "drm: add a locked version of drm_is_current_master"
  2021-06-22  7:54 ` Daniel Vetter
                   ` (4 preceding siblings ...)
  (?)
@ 2021-06-22 10:51 ` Patchwork
  -1 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2021-06-22 10:51 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 30282 bytes --]

== Series Details ==

Series: Revert "drm: add a locked version of drm_is_current_master"
URL   : https://patchwork.freedesktop.org/series/91758/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10259_full -> Patchwork_20424_full
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_20424_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_20424_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_20424_full:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_mmap_gtt@basic-small-bo-tiledy:
    - shard-glk:          NOTRUN -> [FAIL][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk5/igt@gem_mmap_gtt@basic-small-bo-tiledy.html

  * igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs:
    - shard-skl:          NOTRUN -> [INCOMPLETE][2]
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl7/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs}:
    - shard-tglb:         NOTRUN -> [SKIP][3] +100 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb1/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs.html

  * {igt@kms_ccs@pipe-a-random-ccs-data-y_tiled_gen12_rc_ccs_cc}:
    - shard-skl:          NOTRUN -> [FAIL][4] +4 similar issues
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl2/igt@kms_ccs@pipe-a-random-ccs-data-y_tiled_gen12_rc_ccs_cc.html

  
Known issues
------------

  Here are the changes found in Patchwork_20424_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@feature_discovery@chamelium:
    - shard-tglb:         NOTRUN -> [SKIP][5] ([fdo#111827])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb1/igt@feature_discovery@chamelium.html
    - shard-iclb:         NOTRUN -> [SKIP][6] ([fdo#111827])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb6/igt@feature_discovery@chamelium.html

  * igt@feature_discovery@display-3x:
    - shard-iclb:         NOTRUN -> [SKIP][7] ([i915#1839]) +3 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb7/igt@feature_discovery@display-3x.html

  * igt@feature_discovery@display-4x:
    - shard-tglb:         NOTRUN -> [SKIP][8] ([i915#1839]) +3 similar issues
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@feature_discovery@display-4x.html

  * igt@gem_create@create-massive:
    - shard-iclb:         NOTRUN -> [DMESG-WARN][9] ([i915#3002]) +1 similar issue
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@gem_create@create-massive.html
    - shard-snb:          NOTRUN -> [DMESG-WARN][10] ([i915#3002]) +1 similar issue
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-snb6/igt@gem_create@create-massive.html

  * igt@gem_ctx_param@set-priority-not-supported:
    - shard-tglb:         NOTRUN -> [SKIP][11] ([fdo#109314])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb7/igt@gem_ctx_param@set-priority-not-supported.html
    - shard-iclb:         NOTRUN -> [SKIP][12] ([fdo#109314])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb2/igt@gem_ctx_param@set-priority-not-supported.html

  * igt@gem_ctx_persistence@legacy-engines-mixed:
    - shard-snb:          NOTRUN -> [SKIP][13] ([fdo#109271] / [i915#1099]) +13 similar issues
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-snb5/igt@gem_ctx_persistence@legacy-engines-mixed.html

  * igt@gem_ctx_sseu@invalid-sseu:
    - shard-tglb:         NOTRUN -> [SKIP][14] ([i915#280]) +3 similar issues
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb7/igt@gem_ctx_sseu@invalid-sseu.html

  * igt@gem_eio@unwedge-stress:
    - shard-tglb:         NOTRUN -> [TIMEOUT][15] ([i915#2369] / [i915#3063])
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb7/igt@gem_eio@unwedge-stress.html
    - shard-iclb:         NOTRUN -> [TIMEOUT][16] ([i915#2369] / [i915#2481] / [i915#3070])
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb1/igt@gem_eio@unwedge-stress.html
    - shard-snb:          NOTRUN -> [FAIL][17] ([i915#3354])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-snb6/igt@gem_eio@unwedge-stress.html

  * igt@gem_exec_fair@basic-deadline:
    - shard-kbl:          NOTRUN -> [FAIL][18] ([i915#2846])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl2/igt@gem_exec_fair@basic-deadline.html
    - shard-skl:          NOTRUN -> [FAIL][19] ([i915#2846])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl1/igt@gem_exec_fair@basic-deadline.html
    - shard-glk:          NOTRUN -> [FAIL][20] ([i915#2846])
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk4/igt@gem_exec_fair@basic-deadline.html
    - shard-apl:          NOTRUN -> [FAIL][21] ([i915#2846])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl7/igt@gem_exec_fair@basic-deadline.html

  * igt@gem_exec_fair@basic-none-rrul@rcs0:
    - shard-iclb:         NOTRUN -> [FAIL][22] ([i915#2852])
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb7/igt@gem_exec_fair@basic-none-rrul@rcs0.html

  * igt@gem_exec_fair@basic-none-vip@rcs0:
    - shard-tglb:         NOTRUN -> [FAIL][23] ([i915#2842]) +16 similar issues
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb8/igt@gem_exec_fair@basic-none-vip@rcs0.html

  * igt@gem_exec_fair@basic-pace-solo@rcs0:
    - shard-iclb:         NOTRUN -> [FAIL][24] ([i915#2842]) +12 similar issues
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb6/igt@gem_exec_fair@basic-pace-solo@rcs0.html
    - shard-glk:          NOTRUN -> [FAIL][25] ([i915#2842]) +7 similar issues
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk3/igt@gem_exec_fair@basic-pace-solo@rcs0.html

  * igt@gem_exec_fair@basic-pace@vcs0:
    - shard-kbl:          NOTRUN -> [FAIL][26] ([i915#2842])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl4/igt@gem_exec_fair@basic-pace@vcs0.html

  * igt@gem_exec_fair@basic-throttle@rcs0:
    - shard-iclb:         NOTRUN -> [FAIL][27] ([i915#2849])
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb4/igt@gem_exec_fair@basic-throttle@rcs0.html

  * igt@gem_exec_flush@basic-batch-kernel-default-cmd:
    - shard-iclb:         NOTRUN -> [SKIP][28] ([fdo#109313])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb5/igt@gem_exec_flush@basic-batch-kernel-default-cmd.html
    - shard-tglb:         NOTRUN -> [SKIP][29] ([fdo#109313])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb2/igt@gem_exec_flush@basic-batch-kernel-default-cmd.html

  * igt@gem_exec_params@no-blt:
    - shard-tglb:         NOTRUN -> [SKIP][30] ([fdo#109283]) +3 similar issues
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb7/igt@gem_exec_params@no-blt.html

  * igt@gem_exec_params@no-vebox:
    - shard-iclb:         NOTRUN -> [SKIP][31] ([fdo#109283]) +3 similar issues
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb2/igt@gem_exec_params@no-vebox.html

  * igt@gem_exec_params@secure-non-root:
    - shard-tglb:         NOTRUN -> [SKIP][32] ([fdo#112283]) +2 similar issues
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb1/igt@gem_exec_params@secure-non-root.html

  * igt@gem_exec_reloc@basic-wide-active@bcs0:
    - shard-apl:          NOTRUN -> [FAIL][33] ([i915#3633]) +3 similar issues
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl6/igt@gem_exec_reloc@basic-wide-active@bcs0.html
    - shard-glk:          NOTRUN -> [FAIL][34] ([i915#3633]) +3 similar issues
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk5/igt@gem_exec_reloc@basic-wide-active@bcs0.html
    - shard-skl:          NOTRUN -> [FAIL][35] ([i915#3633]) +3 similar issues
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl7/igt@gem_exec_reloc@basic-wide-active@bcs0.html
    - shard-tglb:         NOTRUN -> [FAIL][36] ([i915#3633]) +4 similar issues
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@gem_exec_reloc@basic-wide-active@bcs0.html

  * igt@gem_exec_reloc@basic-wide-active@rcs0:
    - shard-snb:          NOTRUN -> [FAIL][37] ([i915#3633]) +2 similar issues
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-snb2/igt@gem_exec_reloc@basic-wide-active@rcs0.html
    - shard-iclb:         NOTRUN -> [FAIL][38] ([i915#3633]) +3 similar issues
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@gem_exec_reloc@basic-wide-active@rcs0.html
    - shard-kbl:          NOTRUN -> [FAIL][39] ([i915#3633]) +4 similar issues
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl3/igt@gem_exec_reloc@basic-wide-active@rcs0.html

  * igt@gem_exec_whisper@basic-queues-forked-all:
    - shard-glk:          NOTRUN -> [DMESG-WARN][40] ([i915#118] / [i915#95]) +3 similar issues
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk5/igt@gem_exec_whisper@basic-queues-forked-all.html

  * igt@gem_huc_copy@huc-copy:
    - shard-tglb:         NOTRUN -> [SKIP][41] ([i915#2190])
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@gem_huc_copy@huc-copy.html
    - shard-apl:          NOTRUN -> [SKIP][42] ([fdo#109271] / [i915#2190])
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl7/igt@gem_huc_copy@huc-copy.html
    - shard-glk:          NOTRUN -> [SKIP][43] ([fdo#109271] / [i915#2190])
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk4/igt@gem_huc_copy@huc-copy.html
    - shard-iclb:         NOTRUN -> [SKIP][44] ([i915#2190])
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb6/igt@gem_huc_copy@huc-copy.html
    - shard-kbl:          NOTRUN -> [SKIP][45] ([fdo#109271] / [i915#2190])
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl2/igt@gem_huc_copy@huc-copy.html
    - shard-skl:          NOTRUN -> [SKIP][46] ([fdo#109271] / [i915#2190])
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl1/igt@gem_huc_copy@huc-copy.html

  * igt@gem_media_vme:
    - shard-tglb:         NOTRUN -> [SKIP][47] ([i915#284])
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb1/igt@gem_media_vme.html

  * igt@gem_pread@exhaustion:
    - shard-tglb:         NOTRUN -> [WARN][48] ([i915#2658]) +1 similar issue
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@gem_pread@exhaustion.html
    - shard-glk:          NOTRUN -> [WARN][49] ([i915#2658]) +1 similar issue
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk5/igt@gem_pread@exhaustion.html
    - shard-apl:          NOTRUN -> [WARN][50] ([i915#2658]) +1 similar issue
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl1/igt@gem_pread@exhaustion.html
    - shard-iclb:         NOTRUN -> [WARN][51] ([i915#2658]) +1 similar issue
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb5/igt@gem_pread@exhaustion.html

  * igt@gem_pwrite@basic-exhaustion:
    - shard-skl:          NOTRUN -> [WARN][52] ([i915#2658]) +1 similar issue
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl2/igt@gem_pwrite@basic-exhaustion.html
    - shard-kbl:          NOTRUN -> [WARN][53] ([i915#2658]) +1 similar issue
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl1/igt@gem_pwrite@basic-exhaustion.html

  * igt@gem_render_copy@x-tiled-to-vebox-yf-tiled:
    - shard-kbl:          NOTRUN -> [SKIP][54] ([fdo#109271]) +816 similar issues
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl1/igt@gem_render_copy@x-tiled-to-vebox-yf-tiled.html

  * igt@gem_render_copy@yf-tiled-mc-ccs-to-vebox-yf-tiled:
    - shard-iclb:         NOTRUN -> [SKIP][55] ([i915#768]) +18 similar issues
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb2/igt@gem_render_copy@yf-tiled-mc-ccs-to-vebox-yf-tiled.html

  * igt@gem_softpin@evict-snoop:
    - shard-iclb:         NOTRUN -> [SKIP][56] ([fdo#109312]) +1 similar issue
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@gem_softpin@evict-snoop.html

  * igt@gem_softpin@evict-snoop-interruptible:
    - shard-tglb:         NOTRUN -> [SKIP][57] ([fdo#109312]) +1 similar issue
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@gem_softpin@evict-snoop-interruptible.html

  * igt@gem_userptr_blits@coherency-sync:
    - shard-tglb:         NOTRUN -> [SKIP][58] ([fdo#110542])
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb3/igt@gem_userptr_blits@coherency-sync.html
    - shard-iclb:         NOTRUN -> [SKIP][59] ([fdo#109290])
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb8/igt@gem_userptr_blits@coherency-sync.html

  * igt@gem_userptr_blits@dmabuf-sync:
    - shard-kbl:          NOTRUN -> [SKIP][60] ([fdo#109271] / [i915#3323])
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl1/igt@gem_userptr_blits@dmabuf-sync.html
    - shard-iclb:         NOTRUN -> [SKIP][61] ([i915#3323])
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb2/igt@gem_userptr_blits@dmabuf-sync.html
    - shard-apl:          NOTRUN -> [SKIP][62] ([fdo#109271] / [i915#3323])
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl8/igt@gem_userptr_blits@dmabuf-sync.html
    - shard-skl:          NOTRUN -> [SKIP][63] ([fdo#109271] / [i915#3323])
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl3/igt@gem_userptr_blits@dmabuf-sync.html
    - shard-glk:          NOTRUN -> [SKIP][64] ([fdo#109271] / [i915#3323])
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk2/igt@gem_userptr_blits@dmabuf-sync.html
    - shard-tglb:         NOTRUN -> [SKIP][65] ([i915#3323])
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb3/igt@gem_userptr_blits@dmabuf-sync.html

  * igt@gem_userptr_blits@input-checking:
    - shard-skl:          NOTRUN -> [DMESG-WARN][66] ([i915#3002]) +1 similar issue
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl7/igt@gem_userptr_blits@input-checking.html
    - shard-tglb:         NOTRUN -> [DMESG-WARN][67] ([i915#3002]) +1 similar issue
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@gem_userptr_blits@input-checking.html
    - shard-apl:          NOTRUN -> [DMESG-WARN][68] ([i915#3002]) +1 similar issue
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl6/igt@gem_userptr_blits@input-checking.html
    - shard-glk:          NOTRUN -> [DMESG-WARN][69] ([i915#3002]) +1 similar issue
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk5/igt@gem_userptr_blits@input-checking.html
    - shard-kbl:          NOTRUN -> [DMESG-WARN][70] ([i915#3002])
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl3/igt@gem_userptr_blits@input-checking.html

  * igt@gem_userptr_blits@unsync-unmap-cycles:
    - shard-tglb:         NOTRUN -> [SKIP][71] ([i915#3297]) +10 similar issues
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb3/igt@gem_userptr_blits@unsync-unmap-cycles.html
    - shard-iclb:         NOTRUN -> [SKIP][72] ([i915#3297]) +10 similar issues
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@gem_userptr_blits@unsync-unmap-cycles.html

  * igt@gem_userptr_blits@vma-merge:
    - shard-snb:          NOTRUN -> [FAIL][73] ([i915#2724])
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-snb7/igt@gem_userptr_blits@vma-merge.html
    - shard-iclb:         NOTRUN -> [FAIL][74] ([i915#3318])
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb1/igt@gem_userptr_blits@vma-merge.html
    - shard-glk:          NOTRUN -> [FAIL][75] ([i915#3318])
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk7/igt@gem_userptr_blits@vma-merge.html
    - shard-tglb:         NOTRUN -> [FAIL][76] ([i915#3318])
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb8/igt@gem_userptr_blits@vma-merge.html
    - shard-skl:          NOTRUN -> [FAIL][77] ([i915#3318])
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl5/igt@gem_userptr_blits@vma-merge.html

  * igt@gen3_render_linear_blits:
    - shard-tglb:         NOTRUN -> [SKIP][78] ([fdo#109289]) +22 similar issues
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@gen3_render_linear_blits.html

  * igt@gen7_exec_parse@bitmasks:
    - shard-iclb:         NOTRUN -> [SKIP][79] ([fdo#109289]) +23 similar issues
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb7/igt@gen7_exec_parse@bitmasks.html

  * igt@gen9_exec_parse@allowed-all:
    - shard-iclb:         NOTRUN -> [SKIP][80] ([fdo#112306]) +15 similar issues
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb8/igt@gen9_exec_parse@allowed-all.html

  * igt@gen9_exec_parse@allowed-single:
    - shard-skl:          NOTRUN -> [DMESG-WARN][81] ([i915#1436] / [i915#716])
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl2/igt@gen9_exec_parse@allowed-single.html

  * igt@gen9_exec_parse@bb-large:
    - shard-skl:          NOTRUN -> [FAIL][82] ([i915#3296])
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl2/igt@gen9_exec_parse@bb-large.html
    - shard-apl:          NOTRUN -> [FAIL][83] ([i915#3296])
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl8/igt@gen9_exec_parse@bb-large.html
    - shard-kbl:          NOTRUN -> [FAIL][84] ([i915#3296])
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl1/igt@gen9_exec_parse@bb-large.html

  * igt@gen9_exec_parse@bb-oversize:
    - shard-tglb:         NOTRUN -> [SKIP][85] ([i915#2527]) +1 similar issue
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@gen9_exec_parse@bb-oversize.html
    - shard-iclb:         NOTRUN -> [SKIP][86] ([i915#2527]) +1 similar issue
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@gen9_exec_parse@bb-oversize.html

  * igt@gen9_exec_parse@bb-start-param:
    - shard-tglb:         NOTRUN -> [SKIP][87] ([fdo#112306]) +15 similar issues
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb7/igt@gen9_exec_parse@bb-start-param.html

  * igt@gen9_exec_parse@shadow-peek:
    - shard-tglb:         NOTRUN -> [SKIP][88] ([i915#2856])
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb1/igt@gen9_exec_parse@shadow-peek.html
    - shard-iclb:         NOTRUN -> [SKIP][89] ([i915#2856])
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@gen9_exec_parse@shadow-peek.html

  * igt@i915_pm_dc@dc3co-vpb-simulation:
    - shard-tglb:         NOTRUN -> [SKIP][90] ([i915#1904])
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@i915_pm_dc@dc3co-vpb-simulation.html

  * igt@i915_pm_dc@dc6-dpms:
    - shard-kbl:          NOTRUN -> [FAIL][91] ([i915#454])
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl1/igt@i915_pm_dc@dc6-dpms.html
    - shard-skl:          NOTRUN -> [FAIL][92] ([i915#454])
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl3/igt@i915_pm_dc@dc6-dpms.html

  * igt@i915_pm_dc@dc6-psr:
    - shard-tglb:         NOTRUN -> [FAIL][93] ([i915#454]) +1 similar issue
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@i915_pm_dc@dc6-psr.html

  * igt@i915_pm_dc@dc9-dpms:
    - shard-tglb:         NOTRUN -> [SKIP][94] ([i915#3288])
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb3/igt@i915_pm_dc@dc9-dpms.html
    - shard-iclb:         NOTRUN -> [FAIL][95] ([i915#3343])
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb8/igt@i915_pm_dc@dc9-dpms.html

  * igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-dp:
    - shard-kbl:          NOTRUN -> [SKIP][96] ([fdo#109271] / [i915#1937])
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl3/igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-dp.html
    - shard-apl:          NOTRUN -> [SKIP][97] ([fdo#109271] / [i915#1937])
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl3/igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-dp.html

  * igt@i915_pm_lpsp@screens-disabled:
    - shard-tglb:         NOTRUN -> [SKIP][98] ([i915#1902])
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb8/igt@i915_pm_lpsp@screens-disabled.html
    - shard-iclb:         NOTRUN -> [SKIP][99] ([i915#1902])
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb2/igt@i915_pm_lpsp@screens-disabled.html

  * igt@i915_pm_rc6_residency@media-rc6-accuracy:
    - shard-tglb:         NOTRUN -> [SKIP][100] ([fdo#109289] / [fdo#111719])
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@i915_pm_rc6_residency@media-rc6-accuracy.html

  * igt@i915_pm_rc6_residency@rc6-fence:
    - shard-tglb:         NOTRUN -> [WARN][101] ([i915#2681])
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@i915_pm_rc6_residency@rc6-fence.html
    - shard-iclb:         NOTRUN -> [WARN][102] ([i915#2684])
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb8/igt@i915_pm_rc6_residency@rc6-fence.html

  * igt@i915_pm_rc6_residency@rc6-idle:
    - shard-tglb:         NOTRUN -> [WARN][103] ([i915#2681] / [i915#2684])
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb8/igt@i915_pm_rc6_residency@rc6-idle.html
    - shard-iclb:         NOTRUN -> [WARN][104] ([i915#1804] / [i915#2684])
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb4/igt@i915_pm_rc6_residency@rc6-idle.html

  * igt@i915_pm_rpm@dpms-mode-unset-non-lpsp:
    - shard-tglb:         NOTRUN -> [SKIP][105] ([fdo#111644] / [i915#1397] / [i915#2411]) +3 similar issues
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb3/igt@i915_pm_rpm@dpms-mode-unset-non-lpsp.html

  * igt@i915_pm_rpm@gem-execbuf-stress-pc8:
    - shard-iclb:         NOTRUN -> [SKIP][106] ([fdo#109293] / [fdo#109506]) +2 similar issues
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@i915_pm_rpm@gem-execbuf-stress-pc8.html

  * igt@i915_pm_rpm@modeset-non-lpsp:
    - shard-iclb:         NOTRUN -> [SKIP][107] ([fdo#110892]) +3 similar issues
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb4/igt@i915_pm_rpm@modeset-non-lpsp.html

  * igt@i915_pm_rpm@modeset-pc8-residency-stress:
    - shard-tglb:         NOTRUN -> [SKIP][108] ([fdo#109506] / [i915#2411]) +2 similar issues
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb2/igt@i915_pm_rpm@modeset-pc8-residency-stress.html

  * igt@i915_pm_sseu@full-enable:
    - shard-tglb:         NOTRUN -> [SKIP][109] ([fdo#109288])
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@i915_pm_sseu@full-enable.html
    - shard-iclb:         NOTRUN -> [SKIP][110] ([fdo#109288])
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb5/igt@i915_pm_sseu@full-enable.html

  * igt@i915_query@query-topology-known-pci-ids:
    - shard-tglb:         NOTRUN -> [SKIP][111] ([fdo#109303])
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb3/igt@i915_query@query-topology-known-pci-ids.html
    - shard-iclb:         NOTRUN -> [SKIP][112] ([fdo#109303])
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@i915_query@query-topology-known-pci-ids.html

  * igt@i915_query@query-topology-unsupported:
    - shard-iclb:         NOTRUN -> [SKIP][113] ([fdo#109302])
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb6/igt@i915_query@query-topology-unsupported.html
    - shard-tglb:         NOTRUN -> [SKIP][114] ([fdo#109302])
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@i915_query@query-topology-unsupported.html

  * igt@i915_selftest@live@gt_lrc:
    - shard-tglb:         NOTRUN -> [DMESG-FAIL][115] ([i915#2373])
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb7/igt@i915_selftest@live@gt_lrc.html

  * igt@i915_selftest@live@gt_pm:
    - shard-tglb:         NOTRUN -> [DMESG-FAIL][116] ([i915#1759] / [i915#2291])
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb7/igt@i915_selftest@live@gt_pm.html
    - shard-skl:          NOTRUN -> [DMESG-FAIL][117] ([i915#1886] / [i915#2291])
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl4/igt@i915_selftest@live@gt_pm.html

  * igt@kms_atomic@plane-primary-overlay-mutable-zpos:
    - shard-tglb:         NOTRUN -> [SKIP][118] ([i915#404])
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@kms_atomic@plane-primary-overlay-mutable-zpos.html
    - shard-iclb:         NOTRUN -> [SKIP][119] ([i915#404])
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb5/igt@kms_atomic@plane-primary-overlay-mutable-zpos.html

  * igt@kms_atomic_transition@plane-all-modeset-transition-fencing:
    - shard-iclb:         NOTRUN -> [SKIP][120] ([i915#1769]) +1 similar issue
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@kms_atomic_transition@plane-all-modeset-transition-fencing.html
    - shard-tglb:         NOTRUN -> [SKIP][121] ([i915#1769]) +1 similar issue
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb5/igt@kms_atomic_transition@plane-all-modeset-transition-fencing.html

  * igt@kms_big_fb@linear-16bpp-rotate-90:
    - shard-iclb:         NOTRUN -> [SKIP][122] ([fdo#110725] / [fdo#111614]) +18 similar issues
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb3/igt@kms_big_fb@linear-16bpp-rotate-90.html

  * igt@kms_big_fb@linear-8bpp-rotate-270:
    - shard-tglb:         NOTRUN -> [SKIP][123] ([fdo#111614]) +19 similar issues
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@kms_big_fb@linear-8bpp-rotate-270.html

  * igt@kms_big_fb@yf-tiled-8bpp-rotate-270:
    - shard-iclb:         NOTRUN -> [SKIP][124] ([fdo#110723]) +6 similar issues
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb2/igt@kms_big_fb@yf-tiled-8bpp-rotate-270.html

  * igt@kms_big_fb@yf-tiled-8bpp-rotate-90:
    - shard-tglb:         NOTRUN -> [SKIP][125] ([fdo#111615]) +25 similar issues
   [125]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb1/igt@kms_big_fb@yf-tiled-8bpp-rotate-90.html

  * igt@kms_big_joiner@basic:
    - shard-tglb:         NOTRUN -> [SKIP][126] ([i915#2705]) +1 similar issue
   [126]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@kms_big_joiner@basic.html
    - shard-iclb:         NOTRUN -> [SKIP][127] ([i915#2705]) +1 similar issue
   [127]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb4/igt@kms_big_joiner@basic.html

  * igt@kms_chamelium@hdmi-hpd-enable-disable-mode:
    - shard-iclb:         NOTRUN -> [SKIP][128] ([fdo#109284] / [fdo#111827]) +75 similar issues
   [128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb2/igt@kms_chamelium@hdmi-hpd-enable-disable-mode.html

  * igt@kms_chamelium@hdmi-hpd-storm:
    - shard-kbl:          NOTRUN -> [SKIP][129] ([fdo#109271] / [fdo#111827]) +79 similar issues
   [129]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-kbl1/igt@kms_chamelium@hdmi-hpd-storm.html

  * igt@kms_chamelium@vga-hpd:
    - shard-apl:          NOTRUN -> [SKIP][130] ([fdo#109271] / [fdo#111827]) +57 similar issues
   [130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-apl6/igt@kms_chamelium@vga-hpd.html

  * igt@kms_color@pipe-b-ctm-blue-to-red:
    - shard-skl:          NOTRUN -> [DMESG-WARN][131] ([i915#1982])
   [131]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-skl5/igt@kms_color@pipe-b-ctm-blue-to-red.html

  * igt@kms_color@pipe-d-ctm-0-25:
    - shard-iclb:         NOTRUN -> [SKIP][132] ([fdo#109278] / [i915#1149]) +9 similar issues
   [132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-iclb4/igt@kms_color@pipe-d-ctm-0-25.html

  * igt@kms_color_chamelium@pipe-b-ctm-0-5:
    - shard-glk:          NOTRUN -> [SKIP][133] ([fdo#109271] / [fdo#111827]) +81 similar issues
   [133]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-glk5/igt@kms_color_chamelium@pipe-b-ctm-0-5.html

  * igt@kms_color_chamelium@pipe-b-ctm-0-75:
    - shard-tglb:         NOTRUN -> [SKIP][134] ([fdo#109284] / [fdo#111827]) +89 similar issues
   [134]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/shard-tglb6/igt@kms_

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20424/index.html

[-- Attachment #1.2: Type: text/html, Size: 34158 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
  2021-06-22  7:54 ` Daniel Vetter
  (?)
@ 2021-06-23  8:09   ` Desmond Cheong Zhi Xi
  -1 siblings, 0 replies; 22+ messages in thread
From: Desmond Cheong Zhi Xi @ 2021-06-23  8:09 UTC (permalink / raw)
  To: Daniel Vetter, Intel Graphics Development
  Cc: DRI Development, Emil Velikov, stable, Daniel Vetter,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter

On 22/6/21 3:54 pm, Daniel Vetter wrote:
> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> 
> Unfortunately this inverts the locking hierarchy, so back to the
> drawing board. Full lockdep splat below:
> 
> ======================================================
> WARNING: possible circular locking dependency detected
> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> ------------------------------------------------------
> kms_frontbuffer/1087 is trying to acquire lock:
> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> but task is already holding lock:
> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> which lock already depends on the new lock.
> the existing dependency chain (in reverse order) is:
> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>         __mutex_lock+0xab/0x970
>         drm_client_modeset_probe+0x22e/0xca0
>         __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>         intel_fbdev_initial_config+0xf/0x20 [i915]
>         async_run_entry_fn+0x28/0x130
>         process_one_work+0x26d/0x5c0
>         worker_thread+0x37/0x380
>         kthread+0x144/0x170
>         ret_from_fork+0x1f/0x30
> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>         __mutex_lock+0xab/0x970
>         drm_client_modeset_commit_locked+0x1c/0x180
>         drm_client_modeset_commit+0x1c/0x40
>         __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>         drm_fb_helper_set_par+0x34/0x40
>         intel_fbdev_set_par+0x11/0x40 [i915]
>         fbcon_init+0x270/0x4f0
>         visual_init+0xc6/0x130
>         do_bind_con_driver+0x1e5/0x2d0
>         do_take_over_console+0x10e/0x180
>         do_fbcon_takeover+0x53/0xb0
>         register_framebuffer+0x22d/0x310
>         __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>         intel_fbdev_initial_config+0xf/0x20 [i915]
>         async_run_entry_fn+0x28/0x130
>         process_one_work+0x26d/0x5c0
>         worker_thread+0x37/0x380
>         kthread+0x144/0x170
>         ret_from_fork+0x1f/0x30
> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>         __lock_acquire+0x151e/0x2590
>         lock_acquire+0xd1/0x3d0
>         __mutex_lock+0xab/0x970
>         drm_is_current_master+0x1b/0x40
>         drm_mode_getconnector+0x37e/0x4a0
>         drm_ioctl_kernel+0xa8/0xf0
>         drm_ioctl+0x1e8/0x390
>         __x64_sys_ioctl+0x6a/0xa0
>         do_syscall_64+0x39/0xb0
>         entry_SYSCALL_64_after_hwframe+0x44/0xae
> other info that might help us debug this:
> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>   Possible unsafe locking scenario:
>         CPU0                    CPU1
>         ----                    ----
>    lock(&dev->mode_config.mutex);
>                                 lock(&client->modeset_mutex);
>                                 lock(&dev->mode_config.mutex);
>    lock(&dev->master_mutex);
> *** DEADLOCK ***

Hi Daniel,

Just a thought.

Since &dev->mode_config.mutex is the modeset BKL and its scope isn't 
clear, keeping the dependency as is would mean that any lock that 
depends on &dev->mode_config.mutex would also depend on 
&client->modeset_mutex. Seems like this might be vulnerable to more 
circular dependencies.

Would it make sense to invert the locking dependency for 
&client->modeset_mutex and &dev->mode_config.mutex to become 
&dev->mode_config.mutex --> &client->modeset_mutex? Something like this:

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..859f99d97cde 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  		goto out;
  	}

+	mutex_lock(&dev->mode_config.mutex);
  	mutex_lock(&client->modeset_mutex);

-	mutex_lock(&dev->mode_config.mutex);
  	for (i = 0; i < connector_count; i++)
  		total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], 
width, height);
  	if (!total_modes_count)
@@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  		drm_client_pick_crtcs(client, connectors, connector_count,
  				      crtcs, modes, 0, width, height);
  	}
-	mutex_unlock(&dev->mode_config.mutex);

  	drm_client_modeset_release(client);

@@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  	}

  	mutex_unlock(&client->modeset_mutex);
+	mutex_unlock(&dev->mode_config.mutex);
  out:
  	kfree(crtcs);
  	kfree(modes);
diff --git a/drivers/gpu/drm/drm_fb_helper.c 
b/drivers/gpu/drm/drm_fb_helper.c
index f6baa2046124..74302d110609 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct 
fb_var_screeninfo *var,
  	struct drm_mode_set *modeset;
  	int ret = 0;

-	mutex_lock(&client->modeset_mutex);
  	drm_modeset_lock_all(fb_helper->dev);
+	mutex_lock(&client->modeset_mutex);
  	drm_client_for_each_modeset(modeset, client) {
  		modeset->x = var->xoffset;
  		modeset->y = var->yoffset;
@@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct 
fb_var_screeninfo *var,
  			}
  		}
  	}
-	drm_modeset_unlock_all(fb_helper->dev);
  	mutex_unlock(&client->modeset_mutex);
+	drm_modeset_unlock_all(fb_helper->dev);

  	return ret;
  }

> 1 lock held by kms_frontbuffer/1087:
>   #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> stack backtrace:
> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> Call Trace:
>   dump_stack+0x7f/0xad
>   check_noncircular+0x12e/0x150
>   __lock_acquire+0x151e/0x2590
>   lock_acquire+0xd1/0x3d0
>   __mutex_lock+0xab/0x970
>   drm_is_current_master+0x1b/0x40
>   drm_mode_getconnector+0x37e/0x4a0
>   drm_ioctl_kernel+0xa8/0xf0
>   drm_ioctl+0x1e8/0x390
>   __x64_sys_ioctl+0x6a/0xa0
>   do_syscall_64+0x39/0xb0
>   entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>   drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>   1 file changed, 19 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 86d4b72e95cb..232abbba3686 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -61,35 +61,6 @@
>    * trusted clients.
>    */
>   
> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> -{
> -	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> -
> -	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> -}
> -
> -/**
> - * drm_is_current_master - checks whether @priv is the current master
> - * @fpriv: DRM file private
> - *
> - * Checks whether @fpriv is current master on its device. This decides whether a
> - * client is allowed to run DRM_MASTER IOCTLs.
> - *
> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> - * - the current master is assumed to own the non-shareable display hardware.
> - */
> -bool drm_is_current_master(struct drm_file *fpriv)
> -{
> -	bool ret;
> -
> -	mutex_lock(&fpriv->master->dev->master_mutex);
> -	ret = drm_is_current_master_locked(fpriv);
> -	mutex_unlock(&fpriv->master->dev->master_mutex);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL(drm_is_current_master);
> -
>   int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>   {
>   	struct drm_auth *auth = data;
> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>   	if (ret)
>   		goto out_unlock;
>   
> -	if (drm_is_current_master_locked(file_priv))
> +	if (drm_is_current_master(file_priv))
>   		goto out_unlock;
>   
>   	if (dev->master) {
> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>   	if (ret)
>   		goto out_unlock;
>   
> -	if (!drm_is_current_master_locked(file_priv)) {
> +	if (!drm_is_current_master(file_priv)) {
>   		ret = -EINVAL;
>   		goto out_unlock;
>   	}
> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>   	if (file_priv->magic)
>   		idr_remove(&file_priv->master->magic_map, file_priv->magic);
>   
> -	if (!drm_is_current_master_locked(file_priv))
> +	if (!drm_is_current_master(file_priv))
>   		goto out;
>   
>   	drm_legacy_lock_master_cleanup(dev, master);
> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>   	mutex_unlock(&dev->master_mutex);
>   }
>   
> +/**
> + * drm_is_current_master - checks whether @priv is the current master
> + * @fpriv: DRM file private
> + *
> + * Checks whether @fpriv is current master on its device. This decides whether a
> + * client is allowed to run DRM_MASTER IOCTLs.
> + *
> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> + * - the current master is assumed to own the non-shareable display hardware.
> + */
> +bool drm_is_current_master(struct drm_file *fpriv)
> +{
> +	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> +}
> +EXPORT_SYMBOL(drm_is_current_master);
> +
>   /**
>    * drm_master_get - reference a master pointer
>    * @master: &struct drm_master
> 


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-23  8:09   ` Desmond Cheong Zhi Xi
  0 siblings, 0 replies; 22+ messages in thread
From: Desmond Cheong Zhi Xi @ 2021-06-23  8:09 UTC (permalink / raw)
  To: Daniel Vetter, Intel Graphics Development
  Cc: David Airlie, Emil Velikov, stable, DRI Development,
	Thomas Zimmermann, Daniel Vetter

On 22/6/21 3:54 pm, Daniel Vetter wrote:
> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> 
> Unfortunately this inverts the locking hierarchy, so back to the
> drawing board. Full lockdep splat below:
> 
> ======================================================
> WARNING: possible circular locking dependency detected
> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> ------------------------------------------------------
> kms_frontbuffer/1087 is trying to acquire lock:
> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> but task is already holding lock:
> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> which lock already depends on the new lock.
> the existing dependency chain (in reverse order) is:
> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>         __mutex_lock+0xab/0x970
>         drm_client_modeset_probe+0x22e/0xca0
>         __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>         intel_fbdev_initial_config+0xf/0x20 [i915]
>         async_run_entry_fn+0x28/0x130
>         process_one_work+0x26d/0x5c0
>         worker_thread+0x37/0x380
>         kthread+0x144/0x170
>         ret_from_fork+0x1f/0x30
> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>         __mutex_lock+0xab/0x970
>         drm_client_modeset_commit_locked+0x1c/0x180
>         drm_client_modeset_commit+0x1c/0x40
>         __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>         drm_fb_helper_set_par+0x34/0x40
>         intel_fbdev_set_par+0x11/0x40 [i915]
>         fbcon_init+0x270/0x4f0
>         visual_init+0xc6/0x130
>         do_bind_con_driver+0x1e5/0x2d0
>         do_take_over_console+0x10e/0x180
>         do_fbcon_takeover+0x53/0xb0
>         register_framebuffer+0x22d/0x310
>         __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>         intel_fbdev_initial_config+0xf/0x20 [i915]
>         async_run_entry_fn+0x28/0x130
>         process_one_work+0x26d/0x5c0
>         worker_thread+0x37/0x380
>         kthread+0x144/0x170
>         ret_from_fork+0x1f/0x30
> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>         __lock_acquire+0x151e/0x2590
>         lock_acquire+0xd1/0x3d0
>         __mutex_lock+0xab/0x970
>         drm_is_current_master+0x1b/0x40
>         drm_mode_getconnector+0x37e/0x4a0
>         drm_ioctl_kernel+0xa8/0xf0
>         drm_ioctl+0x1e8/0x390
>         __x64_sys_ioctl+0x6a/0xa0
>         do_syscall_64+0x39/0xb0
>         entry_SYSCALL_64_after_hwframe+0x44/0xae
> other info that might help us debug this:
> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>   Possible unsafe locking scenario:
>         CPU0                    CPU1
>         ----                    ----
>    lock(&dev->mode_config.mutex);
>                                 lock(&client->modeset_mutex);
>                                 lock(&dev->mode_config.mutex);
>    lock(&dev->master_mutex);
> *** DEADLOCK ***

Hi Daniel,

Just a thought.

Since &dev->mode_config.mutex is the modeset BKL and its scope isn't 
clear, keeping the dependency as is would mean that any lock that 
depends on &dev->mode_config.mutex would also depend on 
&client->modeset_mutex. Seems like this might be vulnerable to more 
circular dependencies.

Would it make sense to invert the locking dependency for 
&client->modeset_mutex and &dev->mode_config.mutex to become 
&dev->mode_config.mutex --> &client->modeset_mutex? Something like this:

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..859f99d97cde 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  		goto out;
  	}

+	mutex_lock(&dev->mode_config.mutex);
  	mutex_lock(&client->modeset_mutex);

-	mutex_lock(&dev->mode_config.mutex);
  	for (i = 0; i < connector_count; i++)
  		total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], 
width, height);
  	if (!total_modes_count)
@@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  		drm_client_pick_crtcs(client, connectors, connector_count,
  				      crtcs, modes, 0, width, height);
  	}
-	mutex_unlock(&dev->mode_config.mutex);

  	drm_client_modeset_release(client);

@@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  	}

  	mutex_unlock(&client->modeset_mutex);
+	mutex_unlock(&dev->mode_config.mutex);
  out:
  	kfree(crtcs);
  	kfree(modes);
diff --git a/drivers/gpu/drm/drm_fb_helper.c 
b/drivers/gpu/drm/drm_fb_helper.c
index f6baa2046124..74302d110609 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct 
fb_var_screeninfo *var,
  	struct drm_mode_set *modeset;
  	int ret = 0;

-	mutex_lock(&client->modeset_mutex);
  	drm_modeset_lock_all(fb_helper->dev);
+	mutex_lock(&client->modeset_mutex);
  	drm_client_for_each_modeset(modeset, client) {
  		modeset->x = var->xoffset;
  		modeset->y = var->yoffset;
@@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct 
fb_var_screeninfo *var,
  			}
  		}
  	}
-	drm_modeset_unlock_all(fb_helper->dev);
  	mutex_unlock(&client->modeset_mutex);
+	drm_modeset_unlock_all(fb_helper->dev);

  	return ret;
  }

> 1 lock held by kms_frontbuffer/1087:
>   #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> stack backtrace:
> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> Call Trace:
>   dump_stack+0x7f/0xad
>   check_noncircular+0x12e/0x150
>   __lock_acquire+0x151e/0x2590
>   lock_acquire+0xd1/0x3d0
>   __mutex_lock+0xab/0x970
>   drm_is_current_master+0x1b/0x40
>   drm_mode_getconnector+0x37e/0x4a0
>   drm_ioctl_kernel+0xa8/0xf0
>   drm_ioctl+0x1e8/0x390
>   __x64_sys_ioctl+0x6a/0xa0
>   do_syscall_64+0x39/0xb0
>   entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>   drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>   1 file changed, 19 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 86d4b72e95cb..232abbba3686 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -61,35 +61,6 @@
>    * trusted clients.
>    */
>   
> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> -{
> -	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> -
> -	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> -}
> -
> -/**
> - * drm_is_current_master - checks whether @priv is the current master
> - * @fpriv: DRM file private
> - *
> - * Checks whether @fpriv is current master on its device. This decides whether a
> - * client is allowed to run DRM_MASTER IOCTLs.
> - *
> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> - * - the current master is assumed to own the non-shareable display hardware.
> - */
> -bool drm_is_current_master(struct drm_file *fpriv)
> -{
> -	bool ret;
> -
> -	mutex_lock(&fpriv->master->dev->master_mutex);
> -	ret = drm_is_current_master_locked(fpriv);
> -	mutex_unlock(&fpriv->master->dev->master_mutex);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL(drm_is_current_master);
> -
>   int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>   {
>   	struct drm_auth *auth = data;
> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>   	if (ret)
>   		goto out_unlock;
>   
> -	if (drm_is_current_master_locked(file_priv))
> +	if (drm_is_current_master(file_priv))
>   		goto out_unlock;
>   
>   	if (dev->master) {
> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>   	if (ret)
>   		goto out_unlock;
>   
> -	if (!drm_is_current_master_locked(file_priv)) {
> +	if (!drm_is_current_master(file_priv)) {
>   		ret = -EINVAL;
>   		goto out_unlock;
>   	}
> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>   	if (file_priv->magic)
>   		idr_remove(&file_priv->master->magic_map, file_priv->magic);
>   
> -	if (!drm_is_current_master_locked(file_priv))
> +	if (!drm_is_current_master(file_priv))
>   		goto out;
>   
>   	drm_legacy_lock_master_cleanup(dev, master);
> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>   	mutex_unlock(&dev->master_mutex);
>   }
>   
> +/**
> + * drm_is_current_master - checks whether @priv is the current master
> + * @fpriv: DRM file private
> + *
> + * Checks whether @fpriv is current master on its device. This decides whether a
> + * client is allowed to run DRM_MASTER IOCTLs.
> + *
> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> + * - the current master is assumed to own the non-shareable display hardware.
> + */
> +bool drm_is_current_master(struct drm_file *fpriv)
> +{
> +	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> +}
> +EXPORT_SYMBOL(drm_is_current_master);
> +
>   /**
>    * drm_master_get - reference a master pointer
>    * @master: &struct drm_master
> 


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [Intel-gfx] [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-23  8:09   ` Desmond Cheong Zhi Xi
  0 siblings, 0 replies; 22+ messages in thread
From: Desmond Cheong Zhi Xi @ 2021-06-23  8:09 UTC (permalink / raw)
  To: Daniel Vetter, Intel Graphics Development
  Cc: Maxime Ripard, David Airlie, stable, DRI Development,
	Thomas Zimmermann, Daniel Vetter

On 22/6/21 3:54 pm, Daniel Vetter wrote:
> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> 
> Unfortunately this inverts the locking hierarchy, so back to the
> drawing board. Full lockdep splat below:
> 
> ======================================================
> WARNING: possible circular locking dependency detected
> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> ------------------------------------------------------
> kms_frontbuffer/1087 is trying to acquire lock:
> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> but task is already holding lock:
> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> which lock already depends on the new lock.
> the existing dependency chain (in reverse order) is:
> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>         __mutex_lock+0xab/0x970
>         drm_client_modeset_probe+0x22e/0xca0
>         __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>         intel_fbdev_initial_config+0xf/0x20 [i915]
>         async_run_entry_fn+0x28/0x130
>         process_one_work+0x26d/0x5c0
>         worker_thread+0x37/0x380
>         kthread+0x144/0x170
>         ret_from_fork+0x1f/0x30
> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>         __mutex_lock+0xab/0x970
>         drm_client_modeset_commit_locked+0x1c/0x180
>         drm_client_modeset_commit+0x1c/0x40
>         __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>         drm_fb_helper_set_par+0x34/0x40
>         intel_fbdev_set_par+0x11/0x40 [i915]
>         fbcon_init+0x270/0x4f0
>         visual_init+0xc6/0x130
>         do_bind_con_driver+0x1e5/0x2d0
>         do_take_over_console+0x10e/0x180
>         do_fbcon_takeover+0x53/0xb0
>         register_framebuffer+0x22d/0x310
>         __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>         intel_fbdev_initial_config+0xf/0x20 [i915]
>         async_run_entry_fn+0x28/0x130
>         process_one_work+0x26d/0x5c0
>         worker_thread+0x37/0x380
>         kthread+0x144/0x170
>         ret_from_fork+0x1f/0x30
> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>         __lock_acquire+0x151e/0x2590
>         lock_acquire+0xd1/0x3d0
>         __mutex_lock+0xab/0x970
>         drm_is_current_master+0x1b/0x40
>         drm_mode_getconnector+0x37e/0x4a0
>         drm_ioctl_kernel+0xa8/0xf0
>         drm_ioctl+0x1e8/0x390
>         __x64_sys_ioctl+0x6a/0xa0
>         do_syscall_64+0x39/0xb0
>         entry_SYSCALL_64_after_hwframe+0x44/0xae
> other info that might help us debug this:
> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>   Possible unsafe locking scenario:
>         CPU0                    CPU1
>         ----                    ----
>    lock(&dev->mode_config.mutex);
>                                 lock(&client->modeset_mutex);
>                                 lock(&dev->mode_config.mutex);
>    lock(&dev->master_mutex);
> *** DEADLOCK ***

Hi Daniel,

Just a thought.

Since &dev->mode_config.mutex is the modeset BKL and its scope isn't 
clear, keeping the dependency as is would mean that any lock that 
depends on &dev->mode_config.mutex would also depend on 
&client->modeset_mutex. Seems like this might be vulnerable to more 
circular dependencies.

Would it make sense to invert the locking dependency for 
&client->modeset_mutex and &dev->mode_config.mutex to become 
&dev->mode_config.mutex --> &client->modeset_mutex? Something like this:

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..859f99d97cde 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  		goto out;
  	}

+	mutex_lock(&dev->mode_config.mutex);
  	mutex_lock(&client->modeset_mutex);

-	mutex_lock(&dev->mode_config.mutex);
  	for (i = 0; i < connector_count; i++)
  		total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], 
width, height);
  	if (!total_modes_count)
@@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  		drm_client_pick_crtcs(client, connectors, connector_count,
  				      crtcs, modes, 0, width, height);
  	}
-	mutex_unlock(&dev->mode_config.mutex);

  	drm_client_modeset_release(client);

@@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev 
*client, unsigned int width,
  	}

  	mutex_unlock(&client->modeset_mutex);
+	mutex_unlock(&dev->mode_config.mutex);
  out:
  	kfree(crtcs);
  	kfree(modes);
diff --git a/drivers/gpu/drm/drm_fb_helper.c 
b/drivers/gpu/drm/drm_fb_helper.c
index f6baa2046124..74302d110609 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct 
fb_var_screeninfo *var,
  	struct drm_mode_set *modeset;
  	int ret = 0;

-	mutex_lock(&client->modeset_mutex);
  	drm_modeset_lock_all(fb_helper->dev);
+	mutex_lock(&client->modeset_mutex);
  	drm_client_for_each_modeset(modeset, client) {
  		modeset->x = var->xoffset;
  		modeset->y = var->yoffset;
@@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct 
fb_var_screeninfo *var,
  			}
  		}
  	}
-	drm_modeset_unlock_all(fb_helper->dev);
  	mutex_unlock(&client->modeset_mutex);
+	drm_modeset_unlock_all(fb_helper->dev);

  	return ret;
  }

> 1 lock held by kms_frontbuffer/1087:
>   #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> stack backtrace:
> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> Call Trace:
>   dump_stack+0x7f/0xad
>   check_noncircular+0x12e/0x150
>   __lock_acquire+0x151e/0x2590
>   lock_acquire+0xd1/0x3d0
>   __mutex_lock+0xab/0x970
>   drm_is_current_master+0x1b/0x40
>   drm_mode_getconnector+0x37e/0x4a0
>   drm_ioctl_kernel+0xa8/0xf0
>   drm_ioctl+0x1e8/0x390
>   __x64_sys_ioctl+0x6a/0xa0
>   do_syscall_64+0x39/0xb0
>   entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>   drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>   1 file changed, 19 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 86d4b72e95cb..232abbba3686 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -61,35 +61,6 @@
>    * trusted clients.
>    */
>   
> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> -{
> -	lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> -
> -	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> -}
> -
> -/**
> - * drm_is_current_master - checks whether @priv is the current master
> - * @fpriv: DRM file private
> - *
> - * Checks whether @fpriv is current master on its device. This decides whether a
> - * client is allowed to run DRM_MASTER IOCTLs.
> - *
> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> - * - the current master is assumed to own the non-shareable display hardware.
> - */
> -bool drm_is_current_master(struct drm_file *fpriv)
> -{
> -	bool ret;
> -
> -	mutex_lock(&fpriv->master->dev->master_mutex);
> -	ret = drm_is_current_master_locked(fpriv);
> -	mutex_unlock(&fpriv->master->dev->master_mutex);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL(drm_is_current_master);
> -
>   int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>   {
>   	struct drm_auth *auth = data;
> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>   	if (ret)
>   		goto out_unlock;
>   
> -	if (drm_is_current_master_locked(file_priv))
> +	if (drm_is_current_master(file_priv))
>   		goto out_unlock;
>   
>   	if (dev->master) {
> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>   	if (ret)
>   		goto out_unlock;
>   
> -	if (!drm_is_current_master_locked(file_priv)) {
> +	if (!drm_is_current_master(file_priv)) {
>   		ret = -EINVAL;
>   		goto out_unlock;
>   	}
> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>   	if (file_priv->magic)
>   		idr_remove(&file_priv->master->magic_map, file_priv->magic);
>   
> -	if (!drm_is_current_master_locked(file_priv))
> +	if (!drm_is_current_master(file_priv))
>   		goto out;
>   
>   	drm_legacy_lock_master_cleanup(dev, master);
> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>   	mutex_unlock(&dev->master_mutex);
>   }
>   
> +/**
> + * drm_is_current_master - checks whether @priv is the current master
> + * @fpriv: DRM file private
> + *
> + * Checks whether @fpriv is current master on its device. This decides whether a
> + * client is allowed to run DRM_MASTER IOCTLs.
> + *
> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> + * - the current master is assumed to own the non-shareable display hardware.
> + */
> +bool drm_is_current_master(struct drm_file *fpriv)
> +{
> +	return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> +}
> +EXPORT_SYMBOL(drm_is_current_master);
> +
>   /**
>    * drm_master_get - reference a master pointer
>    * @master: &struct drm_master
> 

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
  2021-06-23  8:09   ` Desmond Cheong Zhi Xi
  (?)
@ 2021-06-23  8:14     ` Daniel Vetter
  -1 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-23  8:14 UTC (permalink / raw)
  To: Desmond Cheong Zhi Xi
  Cc: Intel Graphics Development, DRI Development, Emil Velikov,
	stable, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie

On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
<desmondcheongzx@gmail.com> wrote:
>
> On 22/6/21 3:54 pm, Daniel Vetter wrote:
> > This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> >
> > Unfortunately this inverts the locking hierarchy, so back to the
> > drawing board. Full lockdep splat below:
> >
> > ======================================================
> > WARNING: possible circular locking dependency detected
> > 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> > ------------------------------------------------------
> > kms_frontbuffer/1087 is trying to acquire lock:
> > ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> > but task is already holding lock:
> > ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> > which lock already depends on the new lock.
> > the existing dependency chain (in reverse order) is:
> > -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
> >         __mutex_lock+0xab/0x970
> >         drm_client_modeset_probe+0x22e/0xca0
> >         __drm_fb_helper_initial_config_and_unlock+0x42/0x540
> >         intel_fbdev_initial_config+0xf/0x20 [i915]
> >         async_run_entry_fn+0x28/0x130
> >         process_one_work+0x26d/0x5c0
> >         worker_thread+0x37/0x380
> >         kthread+0x144/0x170
> >         ret_from_fork+0x1f/0x30
> > -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
> >         __mutex_lock+0xab/0x970
> >         drm_client_modeset_commit_locked+0x1c/0x180
> >         drm_client_modeset_commit+0x1c/0x40
> >         __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
> >         drm_fb_helper_set_par+0x34/0x40
> >         intel_fbdev_set_par+0x11/0x40 [i915]
> >         fbcon_init+0x270/0x4f0
> >         visual_init+0xc6/0x130
> >         do_bind_con_driver+0x1e5/0x2d0
> >         do_take_over_console+0x10e/0x180
> >         do_fbcon_takeover+0x53/0xb0
> >         register_framebuffer+0x22d/0x310
> >         __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
> >         intel_fbdev_initial_config+0xf/0x20 [i915]
> >         async_run_entry_fn+0x28/0x130
> >         process_one_work+0x26d/0x5c0
> >         worker_thread+0x37/0x380
> >         kthread+0x144/0x170
> >         ret_from_fork+0x1f/0x30
> > -> #0 (&dev->master_mutex){+.+.}-{3:3}:
> >         __lock_acquire+0x151e/0x2590
> >         lock_acquire+0xd1/0x3d0
> >         __mutex_lock+0xab/0x970
> >         drm_is_current_master+0x1b/0x40
> >         drm_mode_getconnector+0x37e/0x4a0
> >         drm_ioctl_kernel+0xa8/0xf0
> >         drm_ioctl+0x1e8/0x390
> >         __x64_sys_ioctl+0x6a/0xa0
> >         do_syscall_64+0x39/0xb0
> >         entry_SYSCALL_64_after_hwframe+0x44/0xae
> > other info that might help us debug this:
> > Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
> >   Possible unsafe locking scenario:
> >         CPU0                    CPU1
> >         ----                    ----
> >    lock(&dev->mode_config.mutex);
> >                                 lock(&client->modeset_mutex);
> >                                 lock(&dev->mode_config.mutex);
> >    lock(&dev->master_mutex);
> > *** DEADLOCK ***
>
> Hi Daniel,
>
> Just a thought.
>
> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
> clear, keeping the dependency as is would mean that any lock that
> depends on &dev->mode_config.mutex would also depend on
> &client->modeset_mutex. Seems like this might be vulnerable to more
> circular dependencies.
>
> Would it make sense to invert the locking dependency for
> &client->modeset_mutex and &dev->mode_config.mutex to become
> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:

This isn't the problem I think, the problem is the inversion against
master_mutex. fbdev emulation code holds master mutex while doing
modesets, whereas getconnector checks for master status while holding
a modeset mutex. I think just pulling the drm_is_current_master check
out of getconnector should be fine to break the loop here?

Wrt changing the layering here: drm_client sits on top of the
lower-level modeset interfaces. So drm_client locks should defintiely
be outside of modeset locks, not the other way round. Also I'm not
sure why you're focusing on the client lock here, that's just a lock
that sits in the middle of the chain but otherwise doesn't matter. If
you flip these these two intermediate chain links are flipped, but the
overall chain is still closed. Heck you could completely remove
client->modeset_mutex, and the bug is still the same.

Cheers, Daniel


>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c
> b/drivers/gpu/drm/drm_client_modeset.c
> index ced09c7c06f9..859f99d97cde 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>                 goto out;
>         }
>
> +       mutex_lock(&dev->mode_config.mutex);
>         mutex_lock(&client->modeset_mutex);
>
> -       mutex_lock(&dev->mode_config.mutex);
>         for (i = 0; i < connector_count; i++)
>                 total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
> width, height);
>         if (!total_modes_count)
> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>                 drm_client_pick_crtcs(client, connectors, connector_count,
>                                       crtcs, modes, 0, width, height);
>         }
> -       mutex_unlock(&dev->mode_config.mutex);
>
>         drm_client_modeset_release(client);
>
> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>         }
>
>         mutex_unlock(&client->modeset_mutex);
> +       mutex_unlock(&dev->mode_config.mutex);
>   out:
>         kfree(crtcs);
>         kfree(modes);
> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> b/drivers/gpu/drm/drm_fb_helper.c
> index f6baa2046124..74302d110609 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
> fb_var_screeninfo *var,
>         struct drm_mode_set *modeset;
>         int ret = 0;
>
> -       mutex_lock(&client->modeset_mutex);
>         drm_modeset_lock_all(fb_helper->dev);
> +       mutex_lock(&client->modeset_mutex);
>         drm_client_for_each_modeset(modeset, client) {
>                 modeset->x = var->xoffset;
>                 modeset->y = var->yoffset;
> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
> fb_var_screeninfo *var,
>                         }
>                 }
>         }
> -       drm_modeset_unlock_all(fb_helper->dev);
>         mutex_unlock(&client->modeset_mutex);
> +       drm_modeset_unlock_all(fb_helper->dev);
>
>         return ret;
>   }
>
> > 1 lock held by kms_frontbuffer/1087:
> >   #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> > stack backtrace:
> > CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> > Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> > Call Trace:
> >   dump_stack+0x7f/0xad
> >   check_noncircular+0x12e/0x150
> >   __lock_acquire+0x151e/0x2590
> >   lock_acquire+0xd1/0x3d0
> >   __mutex_lock+0xab/0x970
> >   drm_is_current_master+0x1b/0x40
> >   drm_mode_getconnector+0x37e/0x4a0
> >   drm_ioctl_kernel+0xa8/0xf0
> >   drm_ioctl+0x1e8/0x390
> >   __x64_sys_ioctl+0x6a/0xa0
> >   do_syscall_64+0x39/0xb0
> >   entry_SYSCALL_64_after_hwframe+0x44/0xae
> >
> > daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> > Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> > Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> > Cc: Emil Velikov <emil.l.velikov@gmail.com>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >   drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
> >   1 file changed, 19 insertions(+), 32 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> > index 86d4b72e95cb..232abbba3686 100644
> > --- a/drivers/gpu/drm/drm_auth.c
> > +++ b/drivers/gpu/drm/drm_auth.c
> > @@ -61,35 +61,6 @@
> >    * trusted clients.
> >    */
> >
> > -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> > -{
> > -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> > -
> > -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> > -}
> > -
> > -/**
> > - * drm_is_current_master - checks whether @priv is the current master
> > - * @fpriv: DRM file private
> > - *
> > - * Checks whether @fpriv is current master on its device. This decides whether a
> > - * client is allowed to run DRM_MASTER IOCTLs.
> > - *
> > - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> > - * - the current master is assumed to own the non-shareable display hardware.
> > - */
> > -bool drm_is_current_master(struct drm_file *fpriv)
> > -{
> > -     bool ret;
> > -
> > -     mutex_lock(&fpriv->master->dev->master_mutex);
> > -     ret = drm_is_current_master_locked(fpriv);
> > -     mutex_unlock(&fpriv->master->dev->master_mutex);
> > -
> > -     return ret;
> > -}
> > -EXPORT_SYMBOL(drm_is_current_master);
> > -
> >   int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
> >   {
> >       struct drm_auth *auth = data;
> > @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
> >       if (ret)
> >               goto out_unlock;
> >
> > -     if (drm_is_current_master_locked(file_priv))
> > +     if (drm_is_current_master(file_priv))
> >               goto out_unlock;
> >
> >       if (dev->master) {
> > @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
> >       if (ret)
> >               goto out_unlock;
> >
> > -     if (!drm_is_current_master_locked(file_priv)) {
> > +     if (!drm_is_current_master(file_priv)) {
> >               ret = -EINVAL;
> >               goto out_unlock;
> >       }
> > @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
> >       if (file_priv->magic)
> >               idr_remove(&file_priv->master->magic_map, file_priv->magic);
> >
> > -     if (!drm_is_current_master_locked(file_priv))
> > +     if (!drm_is_current_master(file_priv))
> >               goto out;
> >
> >       drm_legacy_lock_master_cleanup(dev, master);
> > @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
> >       mutex_unlock(&dev->master_mutex);
> >   }
> >
> > +/**
> > + * drm_is_current_master - checks whether @priv is the current master
> > + * @fpriv: DRM file private
> > + *
> > + * Checks whether @fpriv is current master on its device. This decides whether a
> > + * client is allowed to run DRM_MASTER IOCTLs.
> > + *
> > + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> > + * - the current master is assumed to own the non-shareable display hardware.
> > + */
> > +bool drm_is_current_master(struct drm_file *fpriv)
> > +{
> > +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> > +}
> > +EXPORT_SYMBOL(drm_is_current_master);
> > +
> >   /**
> >    * drm_master_get - reference a master pointer
> >    * @master: &struct drm_master
> >
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-23  8:14     ` Daniel Vetter
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-23  8:14 UTC (permalink / raw)
  To: Desmond Cheong Zhi Xi
  Cc: David Airlie, Emil Velikov, Intel Graphics Development, stable,
	DRI Development, Thomas Zimmermann, Daniel Vetter

On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
<desmondcheongzx@gmail.com> wrote:
>
> On 22/6/21 3:54 pm, Daniel Vetter wrote:
> > This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> >
> > Unfortunately this inverts the locking hierarchy, so back to the
> > drawing board. Full lockdep splat below:
> >
> > ======================================================
> > WARNING: possible circular locking dependency detected
> > 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> > ------------------------------------------------------
> > kms_frontbuffer/1087 is trying to acquire lock:
> > ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> > but task is already holding lock:
> > ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> > which lock already depends on the new lock.
> > the existing dependency chain (in reverse order) is:
> > -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
> >         __mutex_lock+0xab/0x970
> >         drm_client_modeset_probe+0x22e/0xca0
> >         __drm_fb_helper_initial_config_and_unlock+0x42/0x540
> >         intel_fbdev_initial_config+0xf/0x20 [i915]
> >         async_run_entry_fn+0x28/0x130
> >         process_one_work+0x26d/0x5c0
> >         worker_thread+0x37/0x380
> >         kthread+0x144/0x170
> >         ret_from_fork+0x1f/0x30
> > -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
> >         __mutex_lock+0xab/0x970
> >         drm_client_modeset_commit_locked+0x1c/0x180
> >         drm_client_modeset_commit+0x1c/0x40
> >         __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
> >         drm_fb_helper_set_par+0x34/0x40
> >         intel_fbdev_set_par+0x11/0x40 [i915]
> >         fbcon_init+0x270/0x4f0
> >         visual_init+0xc6/0x130
> >         do_bind_con_driver+0x1e5/0x2d0
> >         do_take_over_console+0x10e/0x180
> >         do_fbcon_takeover+0x53/0xb0
> >         register_framebuffer+0x22d/0x310
> >         __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
> >         intel_fbdev_initial_config+0xf/0x20 [i915]
> >         async_run_entry_fn+0x28/0x130
> >         process_one_work+0x26d/0x5c0
> >         worker_thread+0x37/0x380
> >         kthread+0x144/0x170
> >         ret_from_fork+0x1f/0x30
> > -> #0 (&dev->master_mutex){+.+.}-{3:3}:
> >         __lock_acquire+0x151e/0x2590
> >         lock_acquire+0xd1/0x3d0
> >         __mutex_lock+0xab/0x970
> >         drm_is_current_master+0x1b/0x40
> >         drm_mode_getconnector+0x37e/0x4a0
> >         drm_ioctl_kernel+0xa8/0xf0
> >         drm_ioctl+0x1e8/0x390
> >         __x64_sys_ioctl+0x6a/0xa0
> >         do_syscall_64+0x39/0xb0
> >         entry_SYSCALL_64_after_hwframe+0x44/0xae
> > other info that might help us debug this:
> > Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
> >   Possible unsafe locking scenario:
> >         CPU0                    CPU1
> >         ----                    ----
> >    lock(&dev->mode_config.mutex);
> >                                 lock(&client->modeset_mutex);
> >                                 lock(&dev->mode_config.mutex);
> >    lock(&dev->master_mutex);
> > *** DEADLOCK ***
>
> Hi Daniel,
>
> Just a thought.
>
> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
> clear, keeping the dependency as is would mean that any lock that
> depends on &dev->mode_config.mutex would also depend on
> &client->modeset_mutex. Seems like this might be vulnerable to more
> circular dependencies.
>
> Would it make sense to invert the locking dependency for
> &client->modeset_mutex and &dev->mode_config.mutex to become
> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:

This isn't the problem I think, the problem is the inversion against
master_mutex. fbdev emulation code holds master mutex while doing
modesets, whereas getconnector checks for master status while holding
a modeset mutex. I think just pulling the drm_is_current_master check
out of getconnector should be fine to break the loop here?

Wrt changing the layering here: drm_client sits on top of the
lower-level modeset interfaces. So drm_client locks should defintiely
be outside of modeset locks, not the other way round. Also I'm not
sure why you're focusing on the client lock here, that's just a lock
that sits in the middle of the chain but otherwise doesn't matter. If
you flip these these two intermediate chain links are flipped, but the
overall chain is still closed. Heck you could completely remove
client->modeset_mutex, and the bug is still the same.

Cheers, Daniel


>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c
> b/drivers/gpu/drm/drm_client_modeset.c
> index ced09c7c06f9..859f99d97cde 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>                 goto out;
>         }
>
> +       mutex_lock(&dev->mode_config.mutex);
>         mutex_lock(&client->modeset_mutex);
>
> -       mutex_lock(&dev->mode_config.mutex);
>         for (i = 0; i < connector_count; i++)
>                 total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
> width, height);
>         if (!total_modes_count)
> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>                 drm_client_pick_crtcs(client, connectors, connector_count,
>                                       crtcs, modes, 0, width, height);
>         }
> -       mutex_unlock(&dev->mode_config.mutex);
>
>         drm_client_modeset_release(client);
>
> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>         }
>
>         mutex_unlock(&client->modeset_mutex);
> +       mutex_unlock(&dev->mode_config.mutex);
>   out:
>         kfree(crtcs);
>         kfree(modes);
> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> b/drivers/gpu/drm/drm_fb_helper.c
> index f6baa2046124..74302d110609 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
> fb_var_screeninfo *var,
>         struct drm_mode_set *modeset;
>         int ret = 0;
>
> -       mutex_lock(&client->modeset_mutex);
>         drm_modeset_lock_all(fb_helper->dev);
> +       mutex_lock(&client->modeset_mutex);
>         drm_client_for_each_modeset(modeset, client) {
>                 modeset->x = var->xoffset;
>                 modeset->y = var->yoffset;
> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
> fb_var_screeninfo *var,
>                         }
>                 }
>         }
> -       drm_modeset_unlock_all(fb_helper->dev);
>         mutex_unlock(&client->modeset_mutex);
> +       drm_modeset_unlock_all(fb_helper->dev);
>
>         return ret;
>   }
>
> > 1 lock held by kms_frontbuffer/1087:
> >   #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> > stack backtrace:
> > CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> > Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> > Call Trace:
> >   dump_stack+0x7f/0xad
> >   check_noncircular+0x12e/0x150
> >   __lock_acquire+0x151e/0x2590
> >   lock_acquire+0xd1/0x3d0
> >   __mutex_lock+0xab/0x970
> >   drm_is_current_master+0x1b/0x40
> >   drm_mode_getconnector+0x37e/0x4a0
> >   drm_ioctl_kernel+0xa8/0xf0
> >   drm_ioctl+0x1e8/0x390
> >   __x64_sys_ioctl+0x6a/0xa0
> >   do_syscall_64+0x39/0xb0
> >   entry_SYSCALL_64_after_hwframe+0x44/0xae
> >
> > daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> > Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> > Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> > Cc: Emil Velikov <emil.l.velikov@gmail.com>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >   drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
> >   1 file changed, 19 insertions(+), 32 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> > index 86d4b72e95cb..232abbba3686 100644
> > --- a/drivers/gpu/drm/drm_auth.c
> > +++ b/drivers/gpu/drm/drm_auth.c
> > @@ -61,35 +61,6 @@
> >    * trusted clients.
> >    */
> >
> > -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> > -{
> > -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> > -
> > -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> > -}
> > -
> > -/**
> > - * drm_is_current_master - checks whether @priv is the current master
> > - * @fpriv: DRM file private
> > - *
> > - * Checks whether @fpriv is current master on its device. This decides whether a
> > - * client is allowed to run DRM_MASTER IOCTLs.
> > - *
> > - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> > - * - the current master is assumed to own the non-shareable display hardware.
> > - */
> > -bool drm_is_current_master(struct drm_file *fpriv)
> > -{
> > -     bool ret;
> > -
> > -     mutex_lock(&fpriv->master->dev->master_mutex);
> > -     ret = drm_is_current_master_locked(fpriv);
> > -     mutex_unlock(&fpriv->master->dev->master_mutex);
> > -
> > -     return ret;
> > -}
> > -EXPORT_SYMBOL(drm_is_current_master);
> > -
> >   int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
> >   {
> >       struct drm_auth *auth = data;
> > @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
> >       if (ret)
> >               goto out_unlock;
> >
> > -     if (drm_is_current_master_locked(file_priv))
> > +     if (drm_is_current_master(file_priv))
> >               goto out_unlock;
> >
> >       if (dev->master) {
> > @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
> >       if (ret)
> >               goto out_unlock;
> >
> > -     if (!drm_is_current_master_locked(file_priv)) {
> > +     if (!drm_is_current_master(file_priv)) {
> >               ret = -EINVAL;
> >               goto out_unlock;
> >       }
> > @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
> >       if (file_priv->magic)
> >               idr_remove(&file_priv->master->magic_map, file_priv->magic);
> >
> > -     if (!drm_is_current_master_locked(file_priv))
> > +     if (!drm_is_current_master(file_priv))
> >               goto out;
> >
> >       drm_legacy_lock_master_cleanup(dev, master);
> > @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
> >       mutex_unlock(&dev->master_mutex);
> >   }
> >
> > +/**
> > + * drm_is_current_master - checks whether @priv is the current master
> > + * @fpriv: DRM file private
> > + *
> > + * Checks whether @fpriv is current master on its device. This decides whether a
> > + * client is allowed to run DRM_MASTER IOCTLs.
> > + *
> > + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> > + * - the current master is assumed to own the non-shareable display hardware.
> > + */
> > +bool drm_is_current_master(struct drm_file *fpriv)
> > +{
> > +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> > +}
> > +EXPORT_SYMBOL(drm_is_current_master);
> > +
> >   /**
> >    * drm_master_get - reference a master pointer
> >    * @master: &struct drm_master
> >
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Intel-gfx] [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-23  8:14     ` Daniel Vetter
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-23  8:14 UTC (permalink / raw)
  To: Desmond Cheong Zhi Xi
  Cc: Maxime Ripard, David Airlie, Intel Graphics Development, stable,
	DRI Development, Thomas Zimmermann, Daniel Vetter

On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
<desmondcheongzx@gmail.com> wrote:
>
> On 22/6/21 3:54 pm, Daniel Vetter wrote:
> > This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> >
> > Unfortunately this inverts the locking hierarchy, so back to the
> > drawing board. Full lockdep splat below:
> >
> > ======================================================
> > WARNING: possible circular locking dependency detected
> > 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> > ------------------------------------------------------
> > kms_frontbuffer/1087 is trying to acquire lock:
> > ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> > but task is already holding lock:
> > ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> > which lock already depends on the new lock.
> > the existing dependency chain (in reverse order) is:
> > -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
> >         __mutex_lock+0xab/0x970
> >         drm_client_modeset_probe+0x22e/0xca0
> >         __drm_fb_helper_initial_config_and_unlock+0x42/0x540
> >         intel_fbdev_initial_config+0xf/0x20 [i915]
> >         async_run_entry_fn+0x28/0x130
> >         process_one_work+0x26d/0x5c0
> >         worker_thread+0x37/0x380
> >         kthread+0x144/0x170
> >         ret_from_fork+0x1f/0x30
> > -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
> >         __mutex_lock+0xab/0x970
> >         drm_client_modeset_commit_locked+0x1c/0x180
> >         drm_client_modeset_commit+0x1c/0x40
> >         __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
> >         drm_fb_helper_set_par+0x34/0x40
> >         intel_fbdev_set_par+0x11/0x40 [i915]
> >         fbcon_init+0x270/0x4f0
> >         visual_init+0xc6/0x130
> >         do_bind_con_driver+0x1e5/0x2d0
> >         do_take_over_console+0x10e/0x180
> >         do_fbcon_takeover+0x53/0xb0
> >         register_framebuffer+0x22d/0x310
> >         __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
> >         intel_fbdev_initial_config+0xf/0x20 [i915]
> >         async_run_entry_fn+0x28/0x130
> >         process_one_work+0x26d/0x5c0
> >         worker_thread+0x37/0x380
> >         kthread+0x144/0x170
> >         ret_from_fork+0x1f/0x30
> > -> #0 (&dev->master_mutex){+.+.}-{3:3}:
> >         __lock_acquire+0x151e/0x2590
> >         lock_acquire+0xd1/0x3d0
> >         __mutex_lock+0xab/0x970
> >         drm_is_current_master+0x1b/0x40
> >         drm_mode_getconnector+0x37e/0x4a0
> >         drm_ioctl_kernel+0xa8/0xf0
> >         drm_ioctl+0x1e8/0x390
> >         __x64_sys_ioctl+0x6a/0xa0
> >         do_syscall_64+0x39/0xb0
> >         entry_SYSCALL_64_after_hwframe+0x44/0xae
> > other info that might help us debug this:
> > Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
> >   Possible unsafe locking scenario:
> >         CPU0                    CPU1
> >         ----                    ----
> >    lock(&dev->mode_config.mutex);
> >                                 lock(&client->modeset_mutex);
> >                                 lock(&dev->mode_config.mutex);
> >    lock(&dev->master_mutex);
> > *** DEADLOCK ***
>
> Hi Daniel,
>
> Just a thought.
>
> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
> clear, keeping the dependency as is would mean that any lock that
> depends on &dev->mode_config.mutex would also depend on
> &client->modeset_mutex. Seems like this might be vulnerable to more
> circular dependencies.
>
> Would it make sense to invert the locking dependency for
> &client->modeset_mutex and &dev->mode_config.mutex to become
> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:

This isn't the problem I think, the problem is the inversion against
master_mutex. fbdev emulation code holds master mutex while doing
modesets, whereas getconnector checks for master status while holding
a modeset mutex. I think just pulling the drm_is_current_master check
out of getconnector should be fine to break the loop here?

Wrt changing the layering here: drm_client sits on top of the
lower-level modeset interfaces. So drm_client locks should defintiely
be outside of modeset locks, not the other way round. Also I'm not
sure why you're focusing on the client lock here, that's just a lock
that sits in the middle of the chain but otherwise doesn't matter. If
you flip these these two intermediate chain links are flipped, but the
overall chain is still closed. Heck you could completely remove
client->modeset_mutex, and the bug is still the same.

Cheers, Daniel


>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c
> b/drivers/gpu/drm/drm_client_modeset.c
> index ced09c7c06f9..859f99d97cde 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>                 goto out;
>         }
>
> +       mutex_lock(&dev->mode_config.mutex);
>         mutex_lock(&client->modeset_mutex);
>
> -       mutex_lock(&dev->mode_config.mutex);
>         for (i = 0; i < connector_count; i++)
>                 total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
> width, height);
>         if (!total_modes_count)
> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>                 drm_client_pick_crtcs(client, connectors, connector_count,
>                                       crtcs, modes, 0, width, height);
>         }
> -       mutex_unlock(&dev->mode_config.mutex);
>
>         drm_client_modeset_release(client);
>
> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
> *client, unsigned int width,
>         }
>
>         mutex_unlock(&client->modeset_mutex);
> +       mutex_unlock(&dev->mode_config.mutex);
>   out:
>         kfree(crtcs);
>         kfree(modes);
> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> b/drivers/gpu/drm/drm_fb_helper.c
> index f6baa2046124..74302d110609 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
> fb_var_screeninfo *var,
>         struct drm_mode_set *modeset;
>         int ret = 0;
>
> -       mutex_lock(&client->modeset_mutex);
>         drm_modeset_lock_all(fb_helper->dev);
> +       mutex_lock(&client->modeset_mutex);
>         drm_client_for_each_modeset(modeset, client) {
>                 modeset->x = var->xoffset;
>                 modeset->y = var->yoffset;
> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
> fb_var_screeninfo *var,
>                         }
>                 }
>         }
> -       drm_modeset_unlock_all(fb_helper->dev);
>         mutex_unlock(&client->modeset_mutex);
> +       drm_modeset_unlock_all(fb_helper->dev);
>
>         return ret;
>   }
>
> > 1 lock held by kms_frontbuffer/1087:
> >   #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> > stack backtrace:
> > CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> > Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> > Call Trace:
> >   dump_stack+0x7f/0xad
> >   check_noncircular+0x12e/0x150
> >   __lock_acquire+0x151e/0x2590
> >   lock_acquire+0xd1/0x3d0
> >   __mutex_lock+0xab/0x970
> >   drm_is_current_master+0x1b/0x40
> >   drm_mode_getconnector+0x37e/0x4a0
> >   drm_ioctl_kernel+0xa8/0xf0
> >   drm_ioctl+0x1e8/0x390
> >   __x64_sys_ioctl+0x6a/0xa0
> >   do_syscall_64+0x39/0xb0
> >   entry_SYSCALL_64_after_hwframe+0x44/0xae
> >
> > daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> > Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> > Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> > Cc: Emil Velikov <emil.l.velikov@gmail.com>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >   drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
> >   1 file changed, 19 insertions(+), 32 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> > index 86d4b72e95cb..232abbba3686 100644
> > --- a/drivers/gpu/drm/drm_auth.c
> > +++ b/drivers/gpu/drm/drm_auth.c
> > @@ -61,35 +61,6 @@
> >    * trusted clients.
> >    */
> >
> > -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> > -{
> > -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> > -
> > -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> > -}
> > -
> > -/**
> > - * drm_is_current_master - checks whether @priv is the current master
> > - * @fpriv: DRM file private
> > - *
> > - * Checks whether @fpriv is current master on its device. This decides whether a
> > - * client is allowed to run DRM_MASTER IOCTLs.
> > - *
> > - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> > - * - the current master is assumed to own the non-shareable display hardware.
> > - */
> > -bool drm_is_current_master(struct drm_file *fpriv)
> > -{
> > -     bool ret;
> > -
> > -     mutex_lock(&fpriv->master->dev->master_mutex);
> > -     ret = drm_is_current_master_locked(fpriv);
> > -     mutex_unlock(&fpriv->master->dev->master_mutex);
> > -
> > -     return ret;
> > -}
> > -EXPORT_SYMBOL(drm_is_current_master);
> > -
> >   int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
> >   {
> >       struct drm_auth *auth = data;
> > @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
> >       if (ret)
> >               goto out_unlock;
> >
> > -     if (drm_is_current_master_locked(file_priv))
> > +     if (drm_is_current_master(file_priv))
> >               goto out_unlock;
> >
> >       if (dev->master) {
> > @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
> >       if (ret)
> >               goto out_unlock;
> >
> > -     if (!drm_is_current_master_locked(file_priv)) {
> > +     if (!drm_is_current_master(file_priv)) {
> >               ret = -EINVAL;
> >               goto out_unlock;
> >       }
> > @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
> >       if (file_priv->magic)
> >               idr_remove(&file_priv->master->magic_map, file_priv->magic);
> >
> > -     if (!drm_is_current_master_locked(file_priv))
> > +     if (!drm_is_current_master(file_priv))
> >               goto out;
> >
> >       drm_legacy_lock_master_cleanup(dev, master);
> > @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
> >       mutex_unlock(&dev->master_mutex);
> >   }
> >
> > +/**
> > + * drm_is_current_master - checks whether @priv is the current master
> > + * @fpriv: DRM file private
> > + *
> > + * Checks whether @fpriv is current master on its device. This decides whether a
> > + * client is allowed to run DRM_MASTER IOCTLs.
> > + *
> > + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> > + * - the current master is assumed to own the non-shareable display hardware.
> > + */
> > +bool drm_is_current_master(struct drm_file *fpriv)
> > +{
> > +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> > +}
> > +EXPORT_SYMBOL(drm_is_current_master);
> > +
> >   /**
> >    * drm_master_get - reference a master pointer
> >    * @master: &struct drm_master
> >
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
  2021-06-23  8:14     ` Daniel Vetter
  (?)
@ 2021-06-23  9:51       ` Desmond Cheong Zhi Xi
  -1 siblings, 0 replies; 22+ messages in thread
From: Desmond Cheong Zhi Xi @ 2021-06-23  9:51 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Intel Graphics Development, DRI Development, Emil Velikov,
	stable, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie

On 23/6/21 4:14 pm, Daniel Vetter wrote:
> On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
> <desmondcheongzx@gmail.com> wrote:
>>
>> On 22/6/21 3:54 pm, Daniel Vetter wrote:
>>> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
>>>
>>> Unfortunately this inverts the locking hierarchy, so back to the
>>> drawing board. Full lockdep splat below:
>>>
>>> ======================================================
>>> WARNING: possible circular locking dependency detected
>>> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
>>> ------------------------------------------------------
>>> kms_frontbuffer/1087 is trying to acquire lock:
>>> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
>>> but task is already holding lock:
>>> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
>>> which lock already depends on the new lock.
>>> the existing dependency chain (in reverse order) is:
>>> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>>>          __mutex_lock+0xab/0x970
>>>          drm_client_modeset_probe+0x22e/0xca0
>>>          __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>>>          intel_fbdev_initial_config+0xf/0x20 [i915]
>>>          async_run_entry_fn+0x28/0x130
>>>          process_one_work+0x26d/0x5c0
>>>          worker_thread+0x37/0x380
>>>          kthread+0x144/0x170
>>>          ret_from_fork+0x1f/0x30
>>> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>>>          __mutex_lock+0xab/0x970
>>>          drm_client_modeset_commit_locked+0x1c/0x180
>>>          drm_client_modeset_commit+0x1c/0x40
>>>          __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>>>          drm_fb_helper_set_par+0x34/0x40
>>>          intel_fbdev_set_par+0x11/0x40 [i915]
>>>          fbcon_init+0x270/0x4f0
>>>          visual_init+0xc6/0x130
>>>          do_bind_con_driver+0x1e5/0x2d0
>>>          do_take_over_console+0x10e/0x180
>>>          do_fbcon_takeover+0x53/0xb0
>>>          register_framebuffer+0x22d/0x310
>>>          __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>>>          intel_fbdev_initial_config+0xf/0x20 [i915]
>>>          async_run_entry_fn+0x28/0x130
>>>          process_one_work+0x26d/0x5c0
>>>          worker_thread+0x37/0x380
>>>          kthread+0x144/0x170
>>>          ret_from_fork+0x1f/0x30
>>> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>>>          __lock_acquire+0x151e/0x2590
>>>          lock_acquire+0xd1/0x3d0
>>>          __mutex_lock+0xab/0x970
>>>          drm_is_current_master+0x1b/0x40
>>>          drm_mode_getconnector+0x37e/0x4a0
>>>          drm_ioctl_kernel+0xa8/0xf0
>>>          drm_ioctl+0x1e8/0x390
>>>          __x64_sys_ioctl+0x6a/0xa0
>>>          do_syscall_64+0x39/0xb0
>>>          entry_SYSCALL_64_after_hwframe+0x44/0xae
>>> other info that might help us debug this:
>>> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>>>    Possible unsafe locking scenario:
>>>          CPU0                    CPU1
>>>          ----                    ----
>>>     lock(&dev->mode_config.mutex);
>>>                                  lock(&client->modeset_mutex);
>>>                                  lock(&dev->mode_config.mutex);
>>>     lock(&dev->master_mutex);
>>> *** DEADLOCK ***
>>
>> Hi Daniel,
>>
>> Just a thought.
>>
>> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
>> clear, keeping the dependency as is would mean that any lock that
>> depends on &dev->mode_config.mutex would also depend on
>> &client->modeset_mutex. Seems like this might be vulnerable to more
>> circular dependencies.
>>
>> Would it make sense to invert the locking dependency for
>> &client->modeset_mutex and &dev->mode_config.mutex to become
>> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:
> 
> This isn't the problem I think, the problem is the inversion against
> master_mutex. fbdev emulation code holds master mutex while doing
> modesets, whereas getconnector checks for master status while holding
> a modeset mutex. I think just pulling the drm_is_current_master check
> out of getconnector should be fine to break the loop here?
> 
> Wrt changing the layering here: drm_client sits on top of the
> lower-level modeset interfaces. So drm_client locks should defintiely
> be outside of modeset locks, not the other way round. Also I'm not
> sure why you're focusing on the client lock here, that's just a lock
> that sits in the middle of the chain but otherwise doesn't matter. If
> you flip these these two intermediate chain links are flipped, but the
> overall chain is still closed. Heck you could completely remove
> client->modeset_mutex, and the bug is still the same.
> 
> Cheers, Daniel
> 

Right, scrap that thought then.

I was initially confused by the lockdep splat report because I was on 
the wrong drm-misc branch. Pulling drm_is_current_master out from the 
&dev->mode_config.mutex lock makes sense to me now. Thanks.

Best wishes,
Desmond

> 
>>
>> diff --git a/drivers/gpu/drm/drm_client_modeset.c
>> b/drivers/gpu/drm/drm_client_modeset.c
>> index ced09c7c06f9..859f99d97cde 100644
>> --- a/drivers/gpu/drm/drm_client_modeset.c
>> +++ b/drivers/gpu/drm/drm_client_modeset.c
>> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>                  goto out;
>>          }
>>
>> +       mutex_lock(&dev->mode_config.mutex);
>>          mutex_lock(&client->modeset_mutex);
>>
>> -       mutex_lock(&dev->mode_config.mutex);
>>          for (i = 0; i < connector_count; i++)
>>                  total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
>> width, height);
>>          if (!total_modes_count)
>> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>                  drm_client_pick_crtcs(client, connectors, connector_count,
>>                                        crtcs, modes, 0, width, height);
>>          }
>> -       mutex_unlock(&dev->mode_config.mutex);
>>
>>          drm_client_modeset_release(client);
>>
>> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>          }
>>
>>          mutex_unlock(&client->modeset_mutex);
>> +       mutex_unlock(&dev->mode_config.mutex);
>>    out:
>>          kfree(crtcs);
>>          kfree(modes);
>> diff --git a/drivers/gpu/drm/drm_fb_helper.c
>> b/drivers/gpu/drm/drm_fb_helper.c
>> index f6baa2046124..74302d110609 100644
>> --- a/drivers/gpu/drm/drm_fb_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
>> fb_var_screeninfo *var,
>>          struct drm_mode_set *modeset;
>>          int ret = 0;
>>
>> -       mutex_lock(&client->modeset_mutex);
>>          drm_modeset_lock_all(fb_helper->dev);
>> +       mutex_lock(&client->modeset_mutex);
>>          drm_client_for_each_modeset(modeset, client) {
>>                  modeset->x = var->xoffset;
>>                  modeset->y = var->yoffset;
>> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
>> fb_var_screeninfo *var,
>>                          }
>>                  }
>>          }
>> -       drm_modeset_unlock_all(fb_helper->dev);
>>          mutex_unlock(&client->modeset_mutex);
>> +       drm_modeset_unlock_all(fb_helper->dev);
>>
>>          return ret;
>>    }
>>
>>> 1 lock held by kms_frontbuffer/1087:
>>>    #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
>>> stack backtrace:
>>> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
>>> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
>>> Call Trace:
>>>    dump_stack+0x7f/0xad
>>>    check_noncircular+0x12e/0x150
>>>    __lock_acquire+0x151e/0x2590
>>>    lock_acquire+0xd1/0x3d0
>>>    __mutex_lock+0xab/0x970
>>>    drm_is_current_master+0x1b/0x40
>>>    drm_mode_getconnector+0x37e/0x4a0
>>>    drm_ioctl_kernel+0xa8/0xf0
>>>    drm_ioctl+0x1e8/0x390
>>>    __x64_sys_ioctl+0x6a/0xa0
>>>    do_syscall_64+0x39/0xb0
>>>    entry_SYSCALL_64_after_hwframe+0x44/0xae
>>>
>>> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
>>> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
>>> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
>>> Cc: Emil Velikov <emil.l.velikov@gmail.com>
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> Cc: Maxime Ripard <mripard@kernel.org>
>>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>>> Cc: David Airlie <airlied@linux.ie>
>>> Cc: Daniel Vetter <daniel@ffwll.ch>
>>> ---
>>>    drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>>>    1 file changed, 19 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
>>> index 86d4b72e95cb..232abbba3686 100644
>>> --- a/drivers/gpu/drm/drm_auth.c
>>> +++ b/drivers/gpu/drm/drm_auth.c
>>> @@ -61,35 +61,6 @@
>>>     * trusted clients.
>>>     */
>>>
>>> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
>>> -{
>>> -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
>>> -
>>> -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
>>> -}
>>> -
>>> -/**
>>> - * drm_is_current_master - checks whether @priv is the current master
>>> - * @fpriv: DRM file private
>>> - *
>>> - * Checks whether @fpriv is current master on its device. This decides whether a
>>> - * client is allowed to run DRM_MASTER IOCTLs.
>>> - *
>>> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
>>> - * - the current master is assumed to own the non-shareable display hardware.
>>> - */
>>> -bool drm_is_current_master(struct drm_file *fpriv)
>>> -{
>>> -     bool ret;
>>> -
>>> -     mutex_lock(&fpriv->master->dev->master_mutex);
>>> -     ret = drm_is_current_master_locked(fpriv);
>>> -     mutex_unlock(&fpriv->master->dev->master_mutex);
>>> -
>>> -     return ret;
>>> -}
>>> -EXPORT_SYMBOL(drm_is_current_master);
>>> -
>>>    int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>>>    {
>>>        struct drm_auth *auth = data;
>>> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>>>        if (ret)
>>>                goto out_unlock;
>>>
>>> -     if (drm_is_current_master_locked(file_priv))
>>> +     if (drm_is_current_master(file_priv))
>>>                goto out_unlock;
>>>
>>>        if (dev->master) {
>>> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>>>        if (ret)
>>>                goto out_unlock;
>>>
>>> -     if (!drm_is_current_master_locked(file_priv)) {
>>> +     if (!drm_is_current_master(file_priv)) {
>>>                ret = -EINVAL;
>>>                goto out_unlock;
>>>        }
>>> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>>>        if (file_priv->magic)
>>>                idr_remove(&file_priv->master->magic_map, file_priv->magic);
>>>
>>> -     if (!drm_is_current_master_locked(file_priv))
>>> +     if (!drm_is_current_master(file_priv))
>>>                goto out;
>>>
>>>        drm_legacy_lock_master_cleanup(dev, master);
>>> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>>>        mutex_unlock(&dev->master_mutex);
>>>    }
>>>
>>> +/**
>>> + * drm_is_current_master - checks whether @priv is the current master
>>> + * @fpriv: DRM file private
>>> + *
>>> + * Checks whether @fpriv is current master on its device. This decides whether a
>>> + * client is allowed to run DRM_MASTER IOCTLs.
>>> + *
>>> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
>>> + * - the current master is assumed to own the non-shareable display hardware.
>>> + */
>>> +bool drm_is_current_master(struct drm_file *fpriv)
>>> +{
>>> +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
>>> +}
>>> +EXPORT_SYMBOL(drm_is_current_master);
>>> +
>>>    /**
>>>     * drm_master_get - reference a master pointer
>>>     * @master: &struct drm_master
>>>
>>
> 
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-23  9:51       ` Desmond Cheong Zhi Xi
  0 siblings, 0 replies; 22+ messages in thread
From: Desmond Cheong Zhi Xi @ 2021-06-23  9:51 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: David Airlie, Emil Velikov, Intel Graphics Development, stable,
	DRI Development, Thomas Zimmermann, Daniel Vetter

On 23/6/21 4:14 pm, Daniel Vetter wrote:
> On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
> <desmondcheongzx@gmail.com> wrote:
>>
>> On 22/6/21 3:54 pm, Daniel Vetter wrote:
>>> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
>>>
>>> Unfortunately this inverts the locking hierarchy, so back to the
>>> drawing board. Full lockdep splat below:
>>>
>>> ======================================================
>>> WARNING: possible circular locking dependency detected
>>> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
>>> ------------------------------------------------------
>>> kms_frontbuffer/1087 is trying to acquire lock:
>>> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
>>> but task is already holding lock:
>>> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
>>> which lock already depends on the new lock.
>>> the existing dependency chain (in reverse order) is:
>>> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>>>          __mutex_lock+0xab/0x970
>>>          drm_client_modeset_probe+0x22e/0xca0
>>>          __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>>>          intel_fbdev_initial_config+0xf/0x20 [i915]
>>>          async_run_entry_fn+0x28/0x130
>>>          process_one_work+0x26d/0x5c0
>>>          worker_thread+0x37/0x380
>>>          kthread+0x144/0x170
>>>          ret_from_fork+0x1f/0x30
>>> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>>>          __mutex_lock+0xab/0x970
>>>          drm_client_modeset_commit_locked+0x1c/0x180
>>>          drm_client_modeset_commit+0x1c/0x40
>>>          __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>>>          drm_fb_helper_set_par+0x34/0x40
>>>          intel_fbdev_set_par+0x11/0x40 [i915]
>>>          fbcon_init+0x270/0x4f0
>>>          visual_init+0xc6/0x130
>>>          do_bind_con_driver+0x1e5/0x2d0
>>>          do_take_over_console+0x10e/0x180
>>>          do_fbcon_takeover+0x53/0xb0
>>>          register_framebuffer+0x22d/0x310
>>>          __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>>>          intel_fbdev_initial_config+0xf/0x20 [i915]
>>>          async_run_entry_fn+0x28/0x130
>>>          process_one_work+0x26d/0x5c0
>>>          worker_thread+0x37/0x380
>>>          kthread+0x144/0x170
>>>          ret_from_fork+0x1f/0x30
>>> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>>>          __lock_acquire+0x151e/0x2590
>>>          lock_acquire+0xd1/0x3d0
>>>          __mutex_lock+0xab/0x970
>>>          drm_is_current_master+0x1b/0x40
>>>          drm_mode_getconnector+0x37e/0x4a0
>>>          drm_ioctl_kernel+0xa8/0xf0
>>>          drm_ioctl+0x1e8/0x390
>>>          __x64_sys_ioctl+0x6a/0xa0
>>>          do_syscall_64+0x39/0xb0
>>>          entry_SYSCALL_64_after_hwframe+0x44/0xae
>>> other info that might help us debug this:
>>> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>>>    Possible unsafe locking scenario:
>>>          CPU0                    CPU1
>>>          ----                    ----
>>>     lock(&dev->mode_config.mutex);
>>>                                  lock(&client->modeset_mutex);
>>>                                  lock(&dev->mode_config.mutex);
>>>     lock(&dev->master_mutex);
>>> *** DEADLOCK ***
>>
>> Hi Daniel,
>>
>> Just a thought.
>>
>> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
>> clear, keeping the dependency as is would mean that any lock that
>> depends on &dev->mode_config.mutex would also depend on
>> &client->modeset_mutex. Seems like this might be vulnerable to more
>> circular dependencies.
>>
>> Would it make sense to invert the locking dependency for
>> &client->modeset_mutex and &dev->mode_config.mutex to become
>> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:
> 
> This isn't the problem I think, the problem is the inversion against
> master_mutex. fbdev emulation code holds master mutex while doing
> modesets, whereas getconnector checks for master status while holding
> a modeset mutex. I think just pulling the drm_is_current_master check
> out of getconnector should be fine to break the loop here?
> 
> Wrt changing the layering here: drm_client sits on top of the
> lower-level modeset interfaces. So drm_client locks should defintiely
> be outside of modeset locks, not the other way round. Also I'm not
> sure why you're focusing on the client lock here, that's just a lock
> that sits in the middle of the chain but otherwise doesn't matter. If
> you flip these these two intermediate chain links are flipped, but the
> overall chain is still closed. Heck you could completely remove
> client->modeset_mutex, and the bug is still the same.
> 
> Cheers, Daniel
> 

Right, scrap that thought then.

I was initially confused by the lockdep splat report because I was on 
the wrong drm-misc branch. Pulling drm_is_current_master out from the 
&dev->mode_config.mutex lock makes sense to me now. Thanks.

Best wishes,
Desmond

> 
>>
>> diff --git a/drivers/gpu/drm/drm_client_modeset.c
>> b/drivers/gpu/drm/drm_client_modeset.c
>> index ced09c7c06f9..859f99d97cde 100644
>> --- a/drivers/gpu/drm/drm_client_modeset.c
>> +++ b/drivers/gpu/drm/drm_client_modeset.c
>> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>                  goto out;
>>          }
>>
>> +       mutex_lock(&dev->mode_config.mutex);
>>          mutex_lock(&client->modeset_mutex);
>>
>> -       mutex_lock(&dev->mode_config.mutex);
>>          for (i = 0; i < connector_count; i++)
>>                  total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
>> width, height);
>>          if (!total_modes_count)
>> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>                  drm_client_pick_crtcs(client, connectors, connector_count,
>>                                        crtcs, modes, 0, width, height);
>>          }
>> -       mutex_unlock(&dev->mode_config.mutex);
>>
>>          drm_client_modeset_release(client);
>>
>> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>          }
>>
>>          mutex_unlock(&client->modeset_mutex);
>> +       mutex_unlock(&dev->mode_config.mutex);
>>    out:
>>          kfree(crtcs);
>>          kfree(modes);
>> diff --git a/drivers/gpu/drm/drm_fb_helper.c
>> b/drivers/gpu/drm/drm_fb_helper.c
>> index f6baa2046124..74302d110609 100644
>> --- a/drivers/gpu/drm/drm_fb_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
>> fb_var_screeninfo *var,
>>          struct drm_mode_set *modeset;
>>          int ret = 0;
>>
>> -       mutex_lock(&client->modeset_mutex);
>>          drm_modeset_lock_all(fb_helper->dev);
>> +       mutex_lock(&client->modeset_mutex);
>>          drm_client_for_each_modeset(modeset, client) {
>>                  modeset->x = var->xoffset;
>>                  modeset->y = var->yoffset;
>> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
>> fb_var_screeninfo *var,
>>                          }
>>                  }
>>          }
>> -       drm_modeset_unlock_all(fb_helper->dev);
>>          mutex_unlock(&client->modeset_mutex);
>> +       drm_modeset_unlock_all(fb_helper->dev);
>>
>>          return ret;
>>    }
>>
>>> 1 lock held by kms_frontbuffer/1087:
>>>    #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
>>> stack backtrace:
>>> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
>>> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
>>> Call Trace:
>>>    dump_stack+0x7f/0xad
>>>    check_noncircular+0x12e/0x150
>>>    __lock_acquire+0x151e/0x2590
>>>    lock_acquire+0xd1/0x3d0
>>>    __mutex_lock+0xab/0x970
>>>    drm_is_current_master+0x1b/0x40
>>>    drm_mode_getconnector+0x37e/0x4a0
>>>    drm_ioctl_kernel+0xa8/0xf0
>>>    drm_ioctl+0x1e8/0x390
>>>    __x64_sys_ioctl+0x6a/0xa0
>>>    do_syscall_64+0x39/0xb0
>>>    entry_SYSCALL_64_after_hwframe+0x44/0xae
>>>
>>> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
>>> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
>>> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
>>> Cc: Emil Velikov <emil.l.velikov@gmail.com>
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> Cc: Maxime Ripard <mripard@kernel.org>
>>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>>> Cc: David Airlie <airlied@linux.ie>
>>> Cc: Daniel Vetter <daniel@ffwll.ch>
>>> ---
>>>    drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>>>    1 file changed, 19 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
>>> index 86d4b72e95cb..232abbba3686 100644
>>> --- a/drivers/gpu/drm/drm_auth.c
>>> +++ b/drivers/gpu/drm/drm_auth.c
>>> @@ -61,35 +61,6 @@
>>>     * trusted clients.
>>>     */
>>>
>>> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
>>> -{
>>> -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
>>> -
>>> -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
>>> -}
>>> -
>>> -/**
>>> - * drm_is_current_master - checks whether @priv is the current master
>>> - * @fpriv: DRM file private
>>> - *
>>> - * Checks whether @fpriv is current master on its device. This decides whether a
>>> - * client is allowed to run DRM_MASTER IOCTLs.
>>> - *
>>> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
>>> - * - the current master is assumed to own the non-shareable display hardware.
>>> - */
>>> -bool drm_is_current_master(struct drm_file *fpriv)
>>> -{
>>> -     bool ret;
>>> -
>>> -     mutex_lock(&fpriv->master->dev->master_mutex);
>>> -     ret = drm_is_current_master_locked(fpriv);
>>> -     mutex_unlock(&fpriv->master->dev->master_mutex);
>>> -
>>> -     return ret;
>>> -}
>>> -EXPORT_SYMBOL(drm_is_current_master);
>>> -
>>>    int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>>>    {
>>>        struct drm_auth *auth = data;
>>> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>>>        if (ret)
>>>                goto out_unlock;
>>>
>>> -     if (drm_is_current_master_locked(file_priv))
>>> +     if (drm_is_current_master(file_priv))
>>>                goto out_unlock;
>>>
>>>        if (dev->master) {
>>> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>>>        if (ret)
>>>                goto out_unlock;
>>>
>>> -     if (!drm_is_current_master_locked(file_priv)) {
>>> +     if (!drm_is_current_master(file_priv)) {
>>>                ret = -EINVAL;
>>>                goto out_unlock;
>>>        }
>>> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>>>        if (file_priv->magic)
>>>                idr_remove(&file_priv->master->magic_map, file_priv->magic);
>>>
>>> -     if (!drm_is_current_master_locked(file_priv))
>>> +     if (!drm_is_current_master(file_priv))
>>>                goto out;
>>>
>>>        drm_legacy_lock_master_cleanup(dev, master);
>>> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>>>        mutex_unlock(&dev->master_mutex);
>>>    }
>>>
>>> +/**
>>> + * drm_is_current_master - checks whether @priv is the current master
>>> + * @fpriv: DRM file private
>>> + *
>>> + * Checks whether @fpriv is current master on its device. This decides whether a
>>> + * client is allowed to run DRM_MASTER IOCTLs.
>>> + *
>>> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
>>> + * - the current master is assumed to own the non-shareable display hardware.
>>> + */
>>> +bool drm_is_current_master(struct drm_file *fpriv)
>>> +{
>>> +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
>>> +}
>>> +EXPORT_SYMBOL(drm_is_current_master);
>>> +
>>>    /**
>>>     * drm_master_get - reference a master pointer
>>>     * @master: &struct drm_master
>>>
>>
> 
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Intel-gfx] [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-23  9:51       ` Desmond Cheong Zhi Xi
  0 siblings, 0 replies; 22+ messages in thread
From: Desmond Cheong Zhi Xi @ 2021-06-23  9:51 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Maxime Ripard, David Airlie, Intel Graphics Development, stable,
	DRI Development, Thomas Zimmermann, Daniel Vetter

On 23/6/21 4:14 pm, Daniel Vetter wrote:
> On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
> <desmondcheongzx@gmail.com> wrote:
>>
>> On 22/6/21 3:54 pm, Daniel Vetter wrote:
>>> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
>>>
>>> Unfortunately this inverts the locking hierarchy, so back to the
>>> drawing board. Full lockdep splat below:
>>>
>>> ======================================================
>>> WARNING: possible circular locking dependency detected
>>> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
>>> ------------------------------------------------------
>>> kms_frontbuffer/1087 is trying to acquire lock:
>>> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
>>> but task is already holding lock:
>>> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
>>> which lock already depends on the new lock.
>>> the existing dependency chain (in reverse order) is:
>>> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
>>>          __mutex_lock+0xab/0x970
>>>          drm_client_modeset_probe+0x22e/0xca0
>>>          __drm_fb_helper_initial_config_and_unlock+0x42/0x540
>>>          intel_fbdev_initial_config+0xf/0x20 [i915]
>>>          async_run_entry_fn+0x28/0x130
>>>          process_one_work+0x26d/0x5c0
>>>          worker_thread+0x37/0x380
>>>          kthread+0x144/0x170
>>>          ret_from_fork+0x1f/0x30
>>> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
>>>          __mutex_lock+0xab/0x970
>>>          drm_client_modeset_commit_locked+0x1c/0x180
>>>          drm_client_modeset_commit+0x1c/0x40
>>>          __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
>>>          drm_fb_helper_set_par+0x34/0x40
>>>          intel_fbdev_set_par+0x11/0x40 [i915]
>>>          fbcon_init+0x270/0x4f0
>>>          visual_init+0xc6/0x130
>>>          do_bind_con_driver+0x1e5/0x2d0
>>>          do_take_over_console+0x10e/0x180
>>>          do_fbcon_takeover+0x53/0xb0
>>>          register_framebuffer+0x22d/0x310
>>>          __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
>>>          intel_fbdev_initial_config+0xf/0x20 [i915]
>>>          async_run_entry_fn+0x28/0x130
>>>          process_one_work+0x26d/0x5c0
>>>          worker_thread+0x37/0x380
>>>          kthread+0x144/0x170
>>>          ret_from_fork+0x1f/0x30
>>> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
>>>          __lock_acquire+0x151e/0x2590
>>>          lock_acquire+0xd1/0x3d0
>>>          __mutex_lock+0xab/0x970
>>>          drm_is_current_master+0x1b/0x40
>>>          drm_mode_getconnector+0x37e/0x4a0
>>>          drm_ioctl_kernel+0xa8/0xf0
>>>          drm_ioctl+0x1e8/0x390
>>>          __x64_sys_ioctl+0x6a/0xa0
>>>          do_syscall_64+0x39/0xb0
>>>          entry_SYSCALL_64_after_hwframe+0x44/0xae
>>> other info that might help us debug this:
>>> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
>>>    Possible unsafe locking scenario:
>>>          CPU0                    CPU1
>>>          ----                    ----
>>>     lock(&dev->mode_config.mutex);
>>>                                  lock(&client->modeset_mutex);
>>>                                  lock(&dev->mode_config.mutex);
>>>     lock(&dev->master_mutex);
>>> *** DEADLOCK ***
>>
>> Hi Daniel,
>>
>> Just a thought.
>>
>> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
>> clear, keeping the dependency as is would mean that any lock that
>> depends on &dev->mode_config.mutex would also depend on
>> &client->modeset_mutex. Seems like this might be vulnerable to more
>> circular dependencies.
>>
>> Would it make sense to invert the locking dependency for
>> &client->modeset_mutex and &dev->mode_config.mutex to become
>> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:
> 
> This isn't the problem I think, the problem is the inversion against
> master_mutex. fbdev emulation code holds master mutex while doing
> modesets, whereas getconnector checks for master status while holding
> a modeset mutex. I think just pulling the drm_is_current_master check
> out of getconnector should be fine to break the loop here?
> 
> Wrt changing the layering here: drm_client sits on top of the
> lower-level modeset interfaces. So drm_client locks should defintiely
> be outside of modeset locks, not the other way round. Also I'm not
> sure why you're focusing on the client lock here, that's just a lock
> that sits in the middle of the chain but otherwise doesn't matter. If
> you flip these these two intermediate chain links are flipped, but the
> overall chain is still closed. Heck you could completely remove
> client->modeset_mutex, and the bug is still the same.
> 
> Cheers, Daniel
> 

Right, scrap that thought then.

I was initially confused by the lockdep splat report because I was on 
the wrong drm-misc branch. Pulling drm_is_current_master out from the 
&dev->mode_config.mutex lock makes sense to me now. Thanks.

Best wishes,
Desmond

> 
>>
>> diff --git a/drivers/gpu/drm/drm_client_modeset.c
>> b/drivers/gpu/drm/drm_client_modeset.c
>> index ced09c7c06f9..859f99d97cde 100644
>> --- a/drivers/gpu/drm/drm_client_modeset.c
>> +++ b/drivers/gpu/drm/drm_client_modeset.c
>> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>                  goto out;
>>          }
>>
>> +       mutex_lock(&dev->mode_config.mutex);
>>          mutex_lock(&client->modeset_mutex);
>>
>> -       mutex_lock(&dev->mode_config.mutex);
>>          for (i = 0; i < connector_count; i++)
>>                  total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
>> width, height);
>>          if (!total_modes_count)
>> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>                  drm_client_pick_crtcs(client, connectors, connector_count,
>>                                        crtcs, modes, 0, width, height);
>>          }
>> -       mutex_unlock(&dev->mode_config.mutex);
>>
>>          drm_client_modeset_release(client);
>>
>> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
>> *client, unsigned int width,
>>          }
>>
>>          mutex_unlock(&client->modeset_mutex);
>> +       mutex_unlock(&dev->mode_config.mutex);
>>    out:
>>          kfree(crtcs);
>>          kfree(modes);
>> diff --git a/drivers/gpu/drm/drm_fb_helper.c
>> b/drivers/gpu/drm/drm_fb_helper.c
>> index f6baa2046124..74302d110609 100644
>> --- a/drivers/gpu/drm/drm_fb_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
>> fb_var_screeninfo *var,
>>          struct drm_mode_set *modeset;
>>          int ret = 0;
>>
>> -       mutex_lock(&client->modeset_mutex);
>>          drm_modeset_lock_all(fb_helper->dev);
>> +       mutex_lock(&client->modeset_mutex);
>>          drm_client_for_each_modeset(modeset, client) {
>>                  modeset->x = var->xoffset;
>>                  modeset->y = var->yoffset;
>> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
>> fb_var_screeninfo *var,
>>                          }
>>                  }
>>          }
>> -       drm_modeset_unlock_all(fb_helper->dev);
>>          mutex_unlock(&client->modeset_mutex);
>> +       drm_modeset_unlock_all(fb_helper->dev);
>>
>>          return ret;
>>    }
>>
>>> 1 lock held by kms_frontbuffer/1087:
>>>    #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
>>> stack backtrace:
>>> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
>>> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
>>> Call Trace:
>>>    dump_stack+0x7f/0xad
>>>    check_noncircular+0x12e/0x150
>>>    __lock_acquire+0x151e/0x2590
>>>    lock_acquire+0xd1/0x3d0
>>>    __mutex_lock+0xab/0x970
>>>    drm_is_current_master+0x1b/0x40
>>>    drm_mode_getconnector+0x37e/0x4a0
>>>    drm_ioctl_kernel+0xa8/0xf0
>>>    drm_ioctl+0x1e8/0x390
>>>    __x64_sys_ioctl+0x6a/0xa0
>>>    do_syscall_64+0x39/0xb0
>>>    entry_SYSCALL_64_after_hwframe+0x44/0xae
>>>
>>> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
>>> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
>>> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
>>> Cc: Emil Velikov <emil.l.velikov@gmail.com>
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> Cc: Maxime Ripard <mripard@kernel.org>
>>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>>> Cc: David Airlie <airlied@linux.ie>
>>> Cc: Daniel Vetter <daniel@ffwll.ch>
>>> ---
>>>    drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
>>>    1 file changed, 19 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
>>> index 86d4b72e95cb..232abbba3686 100644
>>> --- a/drivers/gpu/drm/drm_auth.c
>>> +++ b/drivers/gpu/drm/drm_auth.c
>>> @@ -61,35 +61,6 @@
>>>     * trusted clients.
>>>     */
>>>
>>> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
>>> -{
>>> -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
>>> -
>>> -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
>>> -}
>>> -
>>> -/**
>>> - * drm_is_current_master - checks whether @priv is the current master
>>> - * @fpriv: DRM file private
>>> - *
>>> - * Checks whether @fpriv is current master on its device. This decides whether a
>>> - * client is allowed to run DRM_MASTER IOCTLs.
>>> - *
>>> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
>>> - * - the current master is assumed to own the non-shareable display hardware.
>>> - */
>>> -bool drm_is_current_master(struct drm_file *fpriv)
>>> -{
>>> -     bool ret;
>>> -
>>> -     mutex_lock(&fpriv->master->dev->master_mutex);
>>> -     ret = drm_is_current_master_locked(fpriv);
>>> -     mutex_unlock(&fpriv->master->dev->master_mutex);
>>> -
>>> -     return ret;
>>> -}
>>> -EXPORT_SYMBOL(drm_is_current_master);
>>> -
>>>    int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
>>>    {
>>>        struct drm_auth *auth = data;
>>> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
>>>        if (ret)
>>>                goto out_unlock;
>>>
>>> -     if (drm_is_current_master_locked(file_priv))
>>> +     if (drm_is_current_master(file_priv))
>>>                goto out_unlock;
>>>
>>>        if (dev->master) {
>>> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>>>        if (ret)
>>>                goto out_unlock;
>>>
>>> -     if (!drm_is_current_master_locked(file_priv)) {
>>> +     if (!drm_is_current_master(file_priv)) {
>>>                ret = -EINVAL;
>>>                goto out_unlock;
>>>        }
>>> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
>>>        if (file_priv->magic)
>>>                idr_remove(&file_priv->master->magic_map, file_priv->magic);
>>>
>>> -     if (!drm_is_current_master_locked(file_priv))
>>> +     if (!drm_is_current_master(file_priv))
>>>                goto out;
>>>
>>>        drm_legacy_lock_master_cleanup(dev, master);
>>> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
>>>        mutex_unlock(&dev->master_mutex);
>>>    }
>>>
>>> +/**
>>> + * drm_is_current_master - checks whether @priv is the current master
>>> + * @fpriv: DRM file private
>>> + *
>>> + * Checks whether @fpriv is current master on its device. This decides whether a
>>> + * client is allowed to run DRM_MASTER IOCTLs.
>>> + *
>>> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
>>> + * - the current master is assumed to own the non-shareable display hardware.
>>> + */
>>> +bool drm_is_current_master(struct drm_file *fpriv)
>>> +{
>>> +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
>>> +}
>>> +EXPORT_SYMBOL(drm_is_current_master);
>>> +
>>>    /**
>>>     * drm_master_get - reference a master pointer
>>>     * @master: &struct drm_master
>>>
>>
> 
> 

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BUILD: failure for Revert "drm: add a locked version of drm_is_current_master" (rev2)
  2021-06-22  7:54 ` Daniel Vetter
                   ` (6 preceding siblings ...)
  (?)
@ 2021-06-23 10:21 ` Patchwork
  -1 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2021-06-23 10:21 UTC (permalink / raw)
  To: Desmond Cheong Zhi Xi; +Cc: intel-gfx

== Series Details ==

Series: Revert "drm: add a locked version of drm_is_current_master" (rev2)
URL   : https://patchwork.freedesktop.org/series/91758/
State : failure

== Summary ==

Applying: Revert "drm: add a locked version of drm_is_current_master"
error: git diff header lacks filename information when removing 1 leading pathname component (line 2)
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Revert "drm: add a locked version of drm_is_current_master"
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
  2021-06-23  9:51       ` Desmond Cheong Zhi Xi
  (?)
@ 2021-06-23 11:25         ` Daniel Vetter
  -1 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-23 11:25 UTC (permalink / raw)
  To: Desmond Cheong Zhi Xi
  Cc: Intel Graphics Development, DRI Development, Emil Velikov,
	stable, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie

On Wed, Jun 23, 2021 at 11:51 AM Desmond Cheong Zhi Xi
<desmondcheongzx@gmail.com> wrote:
>
> On 23/6/21 4:14 pm, Daniel Vetter wrote:
> > On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
> > <desmondcheongzx@gmail.com> wrote:
> >>
> >> On 22/6/21 3:54 pm, Daniel Vetter wrote:
> >>> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> >>>
> >>> Unfortunately this inverts the locking hierarchy, so back to the
> >>> drawing board. Full lockdep splat below:
> >>>
> >>> ======================================================
> >>> WARNING: possible circular locking dependency detected
> >>> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> >>> ------------------------------------------------------
> >>> kms_frontbuffer/1087 is trying to acquire lock:
> >>> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> >>> but task is already holding lock:
> >>> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> >>> which lock already depends on the new lock.
> >>> the existing dependency chain (in reverse order) is:
> >>> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_client_modeset_probe+0x22e/0xca0
> >>>          __drm_fb_helper_initial_config_and_unlock+0x42/0x540
> >>>          intel_fbdev_initial_config+0xf/0x20 [i915]
> >>>          async_run_entry_fn+0x28/0x130
> >>>          process_one_work+0x26d/0x5c0
> >>>          worker_thread+0x37/0x380
> >>>          kthread+0x144/0x170
> >>>          ret_from_fork+0x1f/0x30
> >>> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_client_modeset_commit_locked+0x1c/0x180
> >>>          drm_client_modeset_commit+0x1c/0x40
> >>>          __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
> >>>          drm_fb_helper_set_par+0x34/0x40
> >>>          intel_fbdev_set_par+0x11/0x40 [i915]
> >>>          fbcon_init+0x270/0x4f0
> >>>          visual_init+0xc6/0x130
> >>>          do_bind_con_driver+0x1e5/0x2d0
> >>>          do_take_over_console+0x10e/0x180
> >>>          do_fbcon_takeover+0x53/0xb0
> >>>          register_framebuffer+0x22d/0x310
> >>>          __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
> >>>          intel_fbdev_initial_config+0xf/0x20 [i915]
> >>>          async_run_entry_fn+0x28/0x130
> >>>          process_one_work+0x26d/0x5c0
> >>>          worker_thread+0x37/0x380
> >>>          kthread+0x144/0x170
> >>>          ret_from_fork+0x1f/0x30
> >>> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
> >>>          __lock_acquire+0x151e/0x2590
> >>>          lock_acquire+0xd1/0x3d0
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_is_current_master+0x1b/0x40
> >>>          drm_mode_getconnector+0x37e/0x4a0
> >>>          drm_ioctl_kernel+0xa8/0xf0
> >>>          drm_ioctl+0x1e8/0x390
> >>>          __x64_sys_ioctl+0x6a/0xa0
> >>>          do_syscall_64+0x39/0xb0
> >>>          entry_SYSCALL_64_after_hwframe+0x44/0xae
> >>> other info that might help us debug this:
> >>> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
> >>>    Possible unsafe locking scenario:
> >>>          CPU0                    CPU1
> >>>          ----                    ----
> >>>     lock(&dev->mode_config.mutex);
> >>>                                  lock(&client->modeset_mutex);
> >>>                                  lock(&dev->mode_config.mutex);
> >>>     lock(&dev->master_mutex);
> >>> *** DEADLOCK ***
> >>
> >> Hi Daniel,
> >>
> >> Just a thought.
> >>
> >> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
> >> clear, keeping the dependency as is would mean that any lock that
> >> depends on &dev->mode_config.mutex would also depend on
> >> &client->modeset_mutex. Seems like this might be vulnerable to more
> >> circular dependencies.
> >>
> >> Would it make sense to invert the locking dependency for
> >> &client->modeset_mutex and &dev->mode_config.mutex to become
> >> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:
> >
> > This isn't the problem I think, the problem is the inversion against
> > master_mutex. fbdev emulation code holds master mutex while doing
> > modesets, whereas getconnector checks for master status while holding
> > a modeset mutex. I think just pulling the drm_is_current_master check
> > out of getconnector should be fine to break the loop here?
> >
> > Wrt changing the layering here: drm_client sits on top of the
> > lower-level modeset interfaces. So drm_client locks should defintiely
> > be outside of modeset locks, not the other way round. Also I'm not
> > sure why you're focusing on the client lock here, that's just a lock
> > that sits in the middle of the chain but otherwise doesn't matter. If
> > you flip these these two intermediate chain links are flipped, but the
> > overall chain is still closed. Heck you could completely remove
> > client->modeset_mutex, and the bug is still the same.
> >
> > Cheers, Daniel
> >
>
> Right, scrap that thought then.
>
> I was initially confused by the lockdep splat report because I was on
> the wrong drm-misc branch. Pulling drm_is_current_master out from the
> &dev->mode_config.mutex lock makes sense to me now. Thanks.

The other thing which is confusing is the possible locking scenario
lockdep prints out. That one is just plain wrong anytime there's more
than 2 locks involved. Well, incomplete at least, you need a thread
for each link in the closed chain. So I tend to just ignore that.
-Daniel

>
> Best wishes,
> Desmond
>
> >
> >>
> >> diff --git a/drivers/gpu/drm/drm_client_modeset.c
> >> b/drivers/gpu/drm/drm_client_modeset.c
> >> index ced09c7c06f9..859f99d97cde 100644
> >> --- a/drivers/gpu/drm/drm_client_modeset.c
> >> +++ b/drivers/gpu/drm/drm_client_modeset.c
> >> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>                  goto out;
> >>          }
> >>
> >> +       mutex_lock(&dev->mode_config.mutex);
> >>          mutex_lock(&client->modeset_mutex);
> >>
> >> -       mutex_lock(&dev->mode_config.mutex);
> >>          for (i = 0; i < connector_count; i++)
> >>                  total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
> >> width, height);
> >>          if (!total_modes_count)
> >> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>                  drm_client_pick_crtcs(client, connectors, connector_count,
> >>                                        crtcs, modes, 0, width, height);
> >>          }
> >> -       mutex_unlock(&dev->mode_config.mutex);
> >>
> >>          drm_client_modeset_release(client);
> >>
> >> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>          }
> >>
> >>          mutex_unlock(&client->modeset_mutex);
> >> +       mutex_unlock(&dev->mode_config.mutex);
> >>    out:
> >>          kfree(crtcs);
> >>          kfree(modes);
> >> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> >> b/drivers/gpu/drm/drm_fb_helper.c
> >> index f6baa2046124..74302d110609 100644
> >> --- a/drivers/gpu/drm/drm_fb_helper.c
> >> +++ b/drivers/gpu/drm/drm_fb_helper.c
> >> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
> >> fb_var_screeninfo *var,
> >>          struct drm_mode_set *modeset;
> >>          int ret = 0;
> >>
> >> -       mutex_lock(&client->modeset_mutex);
> >>          drm_modeset_lock_all(fb_helper->dev);
> >> +       mutex_lock(&client->modeset_mutex);
> >>          drm_client_for_each_modeset(modeset, client) {
> >>                  modeset->x = var->xoffset;
> >>                  modeset->y = var->yoffset;
> >> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
> >> fb_var_screeninfo *var,
> >>                          }
> >>                  }
> >>          }
> >> -       drm_modeset_unlock_all(fb_helper->dev);
> >>          mutex_unlock(&client->modeset_mutex);
> >> +       drm_modeset_unlock_all(fb_helper->dev);
> >>
> >>          return ret;
> >>    }
> >>
> >>> 1 lock held by kms_frontbuffer/1087:
> >>>    #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> >>> stack backtrace:
> >>> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> >>> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> >>> Call Trace:
> >>>    dump_stack+0x7f/0xad
> >>>    check_noncircular+0x12e/0x150
> >>>    __lock_acquire+0x151e/0x2590
> >>>    lock_acquire+0xd1/0x3d0
> >>>    __mutex_lock+0xab/0x970
> >>>    drm_is_current_master+0x1b/0x40
> >>>    drm_mode_getconnector+0x37e/0x4a0
> >>>    drm_ioctl_kernel+0xa8/0xf0
> >>>    drm_ioctl+0x1e8/0x390
> >>>    __x64_sys_ioctl+0x6a/0xa0
> >>>    do_syscall_64+0x39/0xb0
> >>>    entry_SYSCALL_64_after_hwframe+0x44/0xae
> >>>
> >>> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> >>> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> >>> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> >>> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> >>> Cc: stable@vger.kernel.org
> >>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> >>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >>> Cc: Maxime Ripard <mripard@kernel.org>
> >>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> >>> Cc: David Airlie <airlied@linux.ie>
> >>> Cc: Daniel Vetter <daniel@ffwll.ch>
> >>> ---
> >>>    drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
> >>>    1 file changed, 19 insertions(+), 32 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> >>> index 86d4b72e95cb..232abbba3686 100644
> >>> --- a/drivers/gpu/drm/drm_auth.c
> >>> +++ b/drivers/gpu/drm/drm_auth.c
> >>> @@ -61,35 +61,6 @@
> >>>     * trusted clients.
> >>>     */
> >>>
> >>> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> >>> -{
> >>> -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> >>> -
> >>> -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> >>> -}
> >>> -
> >>> -/**
> >>> - * drm_is_current_master - checks whether @priv is the current master
> >>> - * @fpriv: DRM file private
> >>> - *
> >>> - * Checks whether @fpriv is current master on its device. This decides whether a
> >>> - * client is allowed to run DRM_MASTER IOCTLs.
> >>> - *
> >>> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> >>> - * - the current master is assumed to own the non-shareable display hardware.
> >>> - */
> >>> -bool drm_is_current_master(struct drm_file *fpriv)
> >>> -{
> >>> -     bool ret;
> >>> -
> >>> -     mutex_lock(&fpriv->master->dev->master_mutex);
> >>> -     ret = drm_is_current_master_locked(fpriv);
> >>> -     mutex_unlock(&fpriv->master->dev->master_mutex);
> >>> -
> >>> -     return ret;
> >>> -}
> >>> -EXPORT_SYMBOL(drm_is_current_master);
> >>> -
> >>>    int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
> >>>    {
> >>>        struct drm_auth *auth = data;
> >>> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
> >>>        if (ret)
> >>>                goto out_unlock;
> >>>
> >>> -     if (drm_is_current_master_locked(file_priv))
> >>> +     if (drm_is_current_master(file_priv))
> >>>                goto out_unlock;
> >>>
> >>>        if (dev->master) {
> >>> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
> >>>        if (ret)
> >>>                goto out_unlock;
> >>>
> >>> -     if (!drm_is_current_master_locked(file_priv)) {
> >>> +     if (!drm_is_current_master(file_priv)) {
> >>>                ret = -EINVAL;
> >>>                goto out_unlock;
> >>>        }
> >>> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
> >>>        if (file_priv->magic)
> >>>                idr_remove(&file_priv->master->magic_map, file_priv->magic);
> >>>
> >>> -     if (!drm_is_current_master_locked(file_priv))
> >>> +     if (!drm_is_current_master(file_priv))
> >>>                goto out;
> >>>
> >>>        drm_legacy_lock_master_cleanup(dev, master);
> >>> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
> >>>        mutex_unlock(&dev->master_mutex);
> >>>    }
> >>>
> >>> +/**
> >>> + * drm_is_current_master - checks whether @priv is the current master
> >>> + * @fpriv: DRM file private
> >>> + *
> >>> + * Checks whether @fpriv is current master on its device. This decides whether a
> >>> + * client is allowed to run DRM_MASTER IOCTLs.
> >>> + *
> >>> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> >>> + * - the current master is assumed to own the non-shareable display hardware.
> >>> + */
> >>> +bool drm_is_current_master(struct drm_file *fpriv)
> >>> +{
> >>> +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> >>> +}
> >>> +EXPORT_SYMBOL(drm_is_current_master);
> >>> +
> >>>    /**
> >>>     * drm_master_get - reference a master pointer
> >>>     * @master: &struct drm_master
> >>>
> >>
> >
> >
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-23 11:25         ` Daniel Vetter
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-23 11:25 UTC (permalink / raw)
  To: Desmond Cheong Zhi Xi
  Cc: David Airlie, Emil Velikov, Intel Graphics Development, stable,
	DRI Development, Thomas Zimmermann, Daniel Vetter

On Wed, Jun 23, 2021 at 11:51 AM Desmond Cheong Zhi Xi
<desmondcheongzx@gmail.com> wrote:
>
> On 23/6/21 4:14 pm, Daniel Vetter wrote:
> > On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
> > <desmondcheongzx@gmail.com> wrote:
> >>
> >> On 22/6/21 3:54 pm, Daniel Vetter wrote:
> >>> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> >>>
> >>> Unfortunately this inverts the locking hierarchy, so back to the
> >>> drawing board. Full lockdep splat below:
> >>>
> >>> ======================================================
> >>> WARNING: possible circular locking dependency detected
> >>> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> >>> ------------------------------------------------------
> >>> kms_frontbuffer/1087 is trying to acquire lock:
> >>> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> >>> but task is already holding lock:
> >>> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> >>> which lock already depends on the new lock.
> >>> the existing dependency chain (in reverse order) is:
> >>> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_client_modeset_probe+0x22e/0xca0
> >>>          __drm_fb_helper_initial_config_and_unlock+0x42/0x540
> >>>          intel_fbdev_initial_config+0xf/0x20 [i915]
> >>>          async_run_entry_fn+0x28/0x130
> >>>          process_one_work+0x26d/0x5c0
> >>>          worker_thread+0x37/0x380
> >>>          kthread+0x144/0x170
> >>>          ret_from_fork+0x1f/0x30
> >>> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_client_modeset_commit_locked+0x1c/0x180
> >>>          drm_client_modeset_commit+0x1c/0x40
> >>>          __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
> >>>          drm_fb_helper_set_par+0x34/0x40
> >>>          intel_fbdev_set_par+0x11/0x40 [i915]
> >>>          fbcon_init+0x270/0x4f0
> >>>          visual_init+0xc6/0x130
> >>>          do_bind_con_driver+0x1e5/0x2d0
> >>>          do_take_over_console+0x10e/0x180
> >>>          do_fbcon_takeover+0x53/0xb0
> >>>          register_framebuffer+0x22d/0x310
> >>>          __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
> >>>          intel_fbdev_initial_config+0xf/0x20 [i915]
> >>>          async_run_entry_fn+0x28/0x130
> >>>          process_one_work+0x26d/0x5c0
> >>>          worker_thread+0x37/0x380
> >>>          kthread+0x144/0x170
> >>>          ret_from_fork+0x1f/0x30
> >>> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
> >>>          __lock_acquire+0x151e/0x2590
> >>>          lock_acquire+0xd1/0x3d0
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_is_current_master+0x1b/0x40
> >>>          drm_mode_getconnector+0x37e/0x4a0
> >>>          drm_ioctl_kernel+0xa8/0xf0
> >>>          drm_ioctl+0x1e8/0x390
> >>>          __x64_sys_ioctl+0x6a/0xa0
> >>>          do_syscall_64+0x39/0xb0
> >>>          entry_SYSCALL_64_after_hwframe+0x44/0xae
> >>> other info that might help us debug this:
> >>> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
> >>>    Possible unsafe locking scenario:
> >>>          CPU0                    CPU1
> >>>          ----                    ----
> >>>     lock(&dev->mode_config.mutex);
> >>>                                  lock(&client->modeset_mutex);
> >>>                                  lock(&dev->mode_config.mutex);
> >>>     lock(&dev->master_mutex);
> >>> *** DEADLOCK ***
> >>
> >> Hi Daniel,
> >>
> >> Just a thought.
> >>
> >> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
> >> clear, keeping the dependency as is would mean that any lock that
> >> depends on &dev->mode_config.mutex would also depend on
> >> &client->modeset_mutex. Seems like this might be vulnerable to more
> >> circular dependencies.
> >>
> >> Would it make sense to invert the locking dependency for
> >> &client->modeset_mutex and &dev->mode_config.mutex to become
> >> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:
> >
> > This isn't the problem I think, the problem is the inversion against
> > master_mutex. fbdev emulation code holds master mutex while doing
> > modesets, whereas getconnector checks for master status while holding
> > a modeset mutex. I think just pulling the drm_is_current_master check
> > out of getconnector should be fine to break the loop here?
> >
> > Wrt changing the layering here: drm_client sits on top of the
> > lower-level modeset interfaces. So drm_client locks should defintiely
> > be outside of modeset locks, not the other way round. Also I'm not
> > sure why you're focusing on the client lock here, that's just a lock
> > that sits in the middle of the chain but otherwise doesn't matter. If
> > you flip these these two intermediate chain links are flipped, but the
> > overall chain is still closed. Heck you could completely remove
> > client->modeset_mutex, and the bug is still the same.
> >
> > Cheers, Daniel
> >
>
> Right, scrap that thought then.
>
> I was initially confused by the lockdep splat report because I was on
> the wrong drm-misc branch. Pulling drm_is_current_master out from the
> &dev->mode_config.mutex lock makes sense to me now. Thanks.

The other thing which is confusing is the possible locking scenario
lockdep prints out. That one is just plain wrong anytime there's more
than 2 locks involved. Well, incomplete at least, you need a thread
for each link in the closed chain. So I tend to just ignore that.
-Daniel

>
> Best wishes,
> Desmond
>
> >
> >>
> >> diff --git a/drivers/gpu/drm/drm_client_modeset.c
> >> b/drivers/gpu/drm/drm_client_modeset.c
> >> index ced09c7c06f9..859f99d97cde 100644
> >> --- a/drivers/gpu/drm/drm_client_modeset.c
> >> +++ b/drivers/gpu/drm/drm_client_modeset.c
> >> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>                  goto out;
> >>          }
> >>
> >> +       mutex_lock(&dev->mode_config.mutex);
> >>          mutex_lock(&client->modeset_mutex);
> >>
> >> -       mutex_lock(&dev->mode_config.mutex);
> >>          for (i = 0; i < connector_count; i++)
> >>                  total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
> >> width, height);
> >>          if (!total_modes_count)
> >> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>                  drm_client_pick_crtcs(client, connectors, connector_count,
> >>                                        crtcs, modes, 0, width, height);
> >>          }
> >> -       mutex_unlock(&dev->mode_config.mutex);
> >>
> >>          drm_client_modeset_release(client);
> >>
> >> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>          }
> >>
> >>          mutex_unlock(&client->modeset_mutex);
> >> +       mutex_unlock(&dev->mode_config.mutex);
> >>    out:
> >>          kfree(crtcs);
> >>          kfree(modes);
> >> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> >> b/drivers/gpu/drm/drm_fb_helper.c
> >> index f6baa2046124..74302d110609 100644
> >> --- a/drivers/gpu/drm/drm_fb_helper.c
> >> +++ b/drivers/gpu/drm/drm_fb_helper.c
> >> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
> >> fb_var_screeninfo *var,
> >>          struct drm_mode_set *modeset;
> >>          int ret = 0;
> >>
> >> -       mutex_lock(&client->modeset_mutex);
> >>          drm_modeset_lock_all(fb_helper->dev);
> >> +       mutex_lock(&client->modeset_mutex);
> >>          drm_client_for_each_modeset(modeset, client) {
> >>                  modeset->x = var->xoffset;
> >>                  modeset->y = var->yoffset;
> >> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
> >> fb_var_screeninfo *var,
> >>                          }
> >>                  }
> >>          }
> >> -       drm_modeset_unlock_all(fb_helper->dev);
> >>          mutex_unlock(&client->modeset_mutex);
> >> +       drm_modeset_unlock_all(fb_helper->dev);
> >>
> >>          return ret;
> >>    }
> >>
> >>> 1 lock held by kms_frontbuffer/1087:
> >>>    #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> >>> stack backtrace:
> >>> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> >>> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> >>> Call Trace:
> >>>    dump_stack+0x7f/0xad
> >>>    check_noncircular+0x12e/0x150
> >>>    __lock_acquire+0x151e/0x2590
> >>>    lock_acquire+0xd1/0x3d0
> >>>    __mutex_lock+0xab/0x970
> >>>    drm_is_current_master+0x1b/0x40
> >>>    drm_mode_getconnector+0x37e/0x4a0
> >>>    drm_ioctl_kernel+0xa8/0xf0
> >>>    drm_ioctl+0x1e8/0x390
> >>>    __x64_sys_ioctl+0x6a/0xa0
> >>>    do_syscall_64+0x39/0xb0
> >>>    entry_SYSCALL_64_after_hwframe+0x44/0xae
> >>>
> >>> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> >>> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> >>> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> >>> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> >>> Cc: stable@vger.kernel.org
> >>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> >>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >>> Cc: Maxime Ripard <mripard@kernel.org>
> >>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> >>> Cc: David Airlie <airlied@linux.ie>
> >>> Cc: Daniel Vetter <daniel@ffwll.ch>
> >>> ---
> >>>    drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
> >>>    1 file changed, 19 insertions(+), 32 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> >>> index 86d4b72e95cb..232abbba3686 100644
> >>> --- a/drivers/gpu/drm/drm_auth.c
> >>> +++ b/drivers/gpu/drm/drm_auth.c
> >>> @@ -61,35 +61,6 @@
> >>>     * trusted clients.
> >>>     */
> >>>
> >>> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> >>> -{
> >>> -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> >>> -
> >>> -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> >>> -}
> >>> -
> >>> -/**
> >>> - * drm_is_current_master - checks whether @priv is the current master
> >>> - * @fpriv: DRM file private
> >>> - *
> >>> - * Checks whether @fpriv is current master on its device. This decides whether a
> >>> - * client is allowed to run DRM_MASTER IOCTLs.
> >>> - *
> >>> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> >>> - * - the current master is assumed to own the non-shareable display hardware.
> >>> - */
> >>> -bool drm_is_current_master(struct drm_file *fpriv)
> >>> -{
> >>> -     bool ret;
> >>> -
> >>> -     mutex_lock(&fpriv->master->dev->master_mutex);
> >>> -     ret = drm_is_current_master_locked(fpriv);
> >>> -     mutex_unlock(&fpriv->master->dev->master_mutex);
> >>> -
> >>> -     return ret;
> >>> -}
> >>> -EXPORT_SYMBOL(drm_is_current_master);
> >>> -
> >>>    int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
> >>>    {
> >>>        struct drm_auth *auth = data;
> >>> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
> >>>        if (ret)
> >>>                goto out_unlock;
> >>>
> >>> -     if (drm_is_current_master_locked(file_priv))
> >>> +     if (drm_is_current_master(file_priv))
> >>>                goto out_unlock;
> >>>
> >>>        if (dev->master) {
> >>> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
> >>>        if (ret)
> >>>                goto out_unlock;
> >>>
> >>> -     if (!drm_is_current_master_locked(file_priv)) {
> >>> +     if (!drm_is_current_master(file_priv)) {
> >>>                ret = -EINVAL;
> >>>                goto out_unlock;
> >>>        }
> >>> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
> >>>        if (file_priv->magic)
> >>>                idr_remove(&file_priv->master->magic_map, file_priv->magic);
> >>>
> >>> -     if (!drm_is_current_master_locked(file_priv))
> >>> +     if (!drm_is_current_master(file_priv))
> >>>                goto out;
> >>>
> >>>        drm_legacy_lock_master_cleanup(dev, master);
> >>> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
> >>>        mutex_unlock(&dev->master_mutex);
> >>>    }
> >>>
> >>> +/**
> >>> + * drm_is_current_master - checks whether @priv is the current master
> >>> + * @fpriv: DRM file private
> >>> + *
> >>> + * Checks whether @fpriv is current master on its device. This decides whether a
> >>> + * client is allowed to run DRM_MASTER IOCTLs.
> >>> + *
> >>> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> >>> + * - the current master is assumed to own the non-shareable display hardware.
> >>> + */
> >>> +bool drm_is_current_master(struct drm_file *fpriv)
> >>> +{
> >>> +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> >>> +}
> >>> +EXPORT_SYMBOL(drm_is_current_master);
> >>> +
> >>>    /**
> >>>     * drm_master_get - reference a master pointer
> >>>     * @master: &struct drm_master
> >>>
> >>
> >
> >
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Intel-gfx] [PATCH] Revert "drm: add a locked version of drm_is_current_master"
@ 2021-06-23 11:25         ` Daniel Vetter
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Vetter @ 2021-06-23 11:25 UTC (permalink / raw)
  To: Desmond Cheong Zhi Xi
  Cc: Maxime Ripard, David Airlie, Intel Graphics Development, stable,
	DRI Development, Thomas Zimmermann, Daniel Vetter

On Wed, Jun 23, 2021 at 11:51 AM Desmond Cheong Zhi Xi
<desmondcheongzx@gmail.com> wrote:
>
> On 23/6/21 4:14 pm, Daniel Vetter wrote:
> > On Wed, Jun 23, 2021 at 10:09 AM Desmond Cheong Zhi Xi
> > <desmondcheongzx@gmail.com> wrote:
> >>
> >> On 22/6/21 3:54 pm, Daniel Vetter wrote:
> >>> This reverts commit 1815d9c86e3090477fbde066ff314a7e9721ee0f.
> >>>
> >>> Unfortunately this inverts the locking hierarchy, so back to the
> >>> drawing board. Full lockdep splat below:
> >>>
> >>> ======================================================
> >>> WARNING: possible circular locking dependency detected
> >>> 5.13.0-rc7-CI-CI_DRM_10254+ #1 Not tainted
> >>> ------------------------------------------------------
> >>> kms_frontbuffer/1087 is trying to acquire lock:
> >>> ffff88810dcd01a8 (&dev->master_mutex){+.+.}-{3:3}, at: drm_is_current_master+0x1b/0x40
> >>> but task is already holding lock:
> >>> ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> >>> which lock already depends on the new lock.
> >>> the existing dependency chain (in reverse order) is:
> >>> -> #2 (&dev->mode_config.mutex){+.+.}-{3:3}:
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_client_modeset_probe+0x22e/0xca0
> >>>          __drm_fb_helper_initial_config_and_unlock+0x42/0x540
> >>>          intel_fbdev_initial_config+0xf/0x20 [i915]
> >>>          async_run_entry_fn+0x28/0x130
> >>>          process_one_work+0x26d/0x5c0
> >>>          worker_thread+0x37/0x380
> >>>          kthread+0x144/0x170
> >>>          ret_from_fork+0x1f/0x30
> >>> -> #1 (&client->modeset_mutex){+.+.}-{3:3}:
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_client_modeset_commit_locked+0x1c/0x180
> >>>          drm_client_modeset_commit+0x1c/0x40
> >>>          __drm_fb_helper_restore_fbdev_mode_unlocked+0x88/0xb0
> >>>          drm_fb_helper_set_par+0x34/0x40
> >>>          intel_fbdev_set_par+0x11/0x40 [i915]
> >>>          fbcon_init+0x270/0x4f0
> >>>          visual_init+0xc6/0x130
> >>>          do_bind_con_driver+0x1e5/0x2d0
> >>>          do_take_over_console+0x10e/0x180
> >>>          do_fbcon_takeover+0x53/0xb0
> >>>          register_framebuffer+0x22d/0x310
> >>>          __drm_fb_helper_initial_config_and_unlock+0x36c/0x540
> >>>          intel_fbdev_initial_config+0xf/0x20 [i915]
> >>>          async_run_entry_fn+0x28/0x130
> >>>          process_one_work+0x26d/0x5c0
> >>>          worker_thread+0x37/0x380
> >>>          kthread+0x144/0x170
> >>>          ret_from_fork+0x1f/0x30
> >>> -> #0 (&dev->master_mutex){+.+.}-{3:3}:
> >>>          __lock_acquire+0x151e/0x2590
> >>>          lock_acquire+0xd1/0x3d0
> >>>          __mutex_lock+0xab/0x970
> >>>          drm_is_current_master+0x1b/0x40
> >>>          drm_mode_getconnector+0x37e/0x4a0
> >>>          drm_ioctl_kernel+0xa8/0xf0
> >>>          drm_ioctl+0x1e8/0x390
> >>>          __x64_sys_ioctl+0x6a/0xa0
> >>>          do_syscall_64+0x39/0xb0
> >>>          entry_SYSCALL_64_after_hwframe+0x44/0xae
> >>> other info that might help us debug this:
> >>> Chain exists of: &dev->master_mutex --> &client->modeset_mutex --> &dev->mode_config.mutex
> >>>    Possible unsafe locking scenario:
> >>>          CPU0                    CPU1
> >>>          ----                    ----
> >>>     lock(&dev->mode_config.mutex);
> >>>                                  lock(&client->modeset_mutex);
> >>>                                  lock(&dev->mode_config.mutex);
> >>>     lock(&dev->master_mutex);
> >>> *** DEADLOCK ***
> >>
> >> Hi Daniel,
> >>
> >> Just a thought.
> >>
> >> Since &dev->mode_config.mutex is the modeset BKL and its scope isn't
> >> clear, keeping the dependency as is would mean that any lock that
> >> depends on &dev->mode_config.mutex would also depend on
> >> &client->modeset_mutex. Seems like this might be vulnerable to more
> >> circular dependencies.
> >>
> >> Would it make sense to invert the locking dependency for
> >> &client->modeset_mutex and &dev->mode_config.mutex to become
> >> &dev->mode_config.mutex --> &client->modeset_mutex? Something like this:
> >
> > This isn't the problem I think, the problem is the inversion against
> > master_mutex. fbdev emulation code holds master mutex while doing
> > modesets, whereas getconnector checks for master status while holding
> > a modeset mutex. I think just pulling the drm_is_current_master check
> > out of getconnector should be fine to break the loop here?
> >
> > Wrt changing the layering here: drm_client sits on top of the
> > lower-level modeset interfaces. So drm_client locks should defintiely
> > be outside of modeset locks, not the other way round. Also I'm not
> > sure why you're focusing on the client lock here, that's just a lock
> > that sits in the middle of the chain but otherwise doesn't matter. If
> > you flip these these two intermediate chain links are flipped, but the
> > overall chain is still closed. Heck you could completely remove
> > client->modeset_mutex, and the bug is still the same.
> >
> > Cheers, Daniel
> >
>
> Right, scrap that thought then.
>
> I was initially confused by the lockdep splat report because I was on
> the wrong drm-misc branch. Pulling drm_is_current_master out from the
> &dev->mode_config.mutex lock makes sense to me now. Thanks.

The other thing which is confusing is the possible locking scenario
lockdep prints out. That one is just plain wrong anytime there's more
than 2 locks involved. Well, incomplete at least, you need a thread
for each link in the closed chain. So I tend to just ignore that.
-Daniel

>
> Best wishes,
> Desmond
>
> >
> >>
> >> diff --git a/drivers/gpu/drm/drm_client_modeset.c
> >> b/drivers/gpu/drm/drm_client_modeset.c
> >> index ced09c7c06f9..859f99d97cde 100644
> >> --- a/drivers/gpu/drm/drm_client_modeset.c
> >> +++ b/drivers/gpu/drm/drm_client_modeset.c
> >> @@ -811,9 +811,9 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>                  goto out;
> >>          }
> >>
> >> +       mutex_lock(&dev->mode_config.mutex);
> >>          mutex_lock(&client->modeset_mutex);
> >>
> >> -       mutex_lock(&dev->mode_config.mutex);
> >>          for (i = 0; i < connector_count; i++)
> >>                  total_modes_count += connectors[i]->funcs->fill_modes(connectors[i],
> >> width, height);
> >>          if (!total_modes_count)
> >> @@ -838,7 +838,6 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>                  drm_client_pick_crtcs(client, connectors, connector_count,
> >>                                        crtcs, modes, 0, width, height);
> >>          }
> >> -       mutex_unlock(&dev->mode_config.mutex);
> >>
> >>          drm_client_modeset_release(client);
> >>
> >> @@ -869,6 +868,7 @@ int drm_client_modeset_probe(struct drm_client_dev
> >> *client, unsigned int width,
> >>          }
> >>
> >>          mutex_unlock(&client->modeset_mutex);
> >> +       mutex_unlock(&dev->mode_config.mutex);
> >>    out:
> >>          kfree(crtcs);
> >>          kfree(modes);
> >> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> >> b/drivers/gpu/drm/drm_fb_helper.c
> >> index f6baa2046124..74302d110609 100644
> >> --- a/drivers/gpu/drm/drm_fb_helper.c
> >> +++ b/drivers/gpu/drm/drm_fb_helper.c
> >> @@ -1443,8 +1443,8 @@ static int pan_display_legacy(struct
> >> fb_var_screeninfo *var,
> >>          struct drm_mode_set *modeset;
> >>          int ret = 0;
> >>
> >> -       mutex_lock(&client->modeset_mutex);
> >>          drm_modeset_lock_all(fb_helper->dev);
> >> +       mutex_lock(&client->modeset_mutex);
> >>          drm_client_for_each_modeset(modeset, client) {
> >>                  modeset->x = var->xoffset;
> >>                  modeset->y = var->yoffset;
> >> @@ -1457,8 +1457,8 @@ static int pan_display_legacy(struct
> >> fb_var_screeninfo *var,
> >>                          }
> >>                  }
> >>          }
> >> -       drm_modeset_unlock_all(fb_helper->dev);
> >>          mutex_unlock(&client->modeset_mutex);
> >> +       drm_modeset_unlock_all(fb_helper->dev);
> >>
> >>          return ret;
> >>    }
> >>
> >>> 1 lock held by kms_frontbuffer/1087:
> >>>    #0: ffff88810dcd0488 (&dev->mode_config.mutex){+.+.}-{3:3}, at: drm_mode_getconnector+0x1c6/0x4a0
> >>> stack backtrace:
> >>> CPU: 7 PID: 1087 Comm: kms_frontbuffer Not tainted 5.13.0-rc7-CI-CI_DRM_10254+ #1
> >>> Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP TLC, BIOS ICLSFWR1.R00.3234.A01.1906141750 06/14/2019
> >>> Call Trace:
> >>>    dump_stack+0x7f/0xad
> >>>    check_noncircular+0x12e/0x150
> >>>    __lock_acquire+0x151e/0x2590
> >>>    lock_acquire+0xd1/0x3d0
> >>>    __mutex_lock+0xab/0x970
> >>>    drm_is_current_master+0x1b/0x40
> >>>    drm_mode_getconnector+0x37e/0x4a0
> >>>    drm_ioctl_kernel+0xa8/0xf0
> >>>    drm_ioctl+0x1e8/0x390
> >>>    __x64_sys_ioctl+0x6a/0xa0
> >>>    do_syscall_64+0x39/0xb0
> >>>    entry_SYSCALL_64_after_hwframe+0x44/0xae
> >>>
> >>> daniel@phenom:~/linux/drm-misc-fixes$ dim fixes 1815d9c86e3090477fbde066ff314a7e9721ee0f
> >>> Fixes: 1815d9c86e30 ("drm: add a locked version of drm_is_current_master")
> >>> Cc: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> >>> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> >>> Cc: stable@vger.kernel.org
> >>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> >>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >>> Cc: Maxime Ripard <mripard@kernel.org>
> >>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> >>> Cc: David Airlie <airlied@linux.ie>
> >>> Cc: Daniel Vetter <daniel@ffwll.ch>
> >>> ---
> >>>    drivers/gpu/drm/drm_auth.c | 51 ++++++++++++++------------------------
> >>>    1 file changed, 19 insertions(+), 32 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> >>> index 86d4b72e95cb..232abbba3686 100644
> >>> --- a/drivers/gpu/drm/drm_auth.c
> >>> +++ b/drivers/gpu/drm/drm_auth.c
> >>> @@ -61,35 +61,6 @@
> >>>     * trusted clients.
> >>>     */
> >>>
> >>> -static bool drm_is_current_master_locked(struct drm_file *fpriv)
> >>> -{
> >>> -     lockdep_assert_held_once(&fpriv->master->dev->master_mutex);
> >>> -
> >>> -     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> >>> -}
> >>> -
> >>> -/**
> >>> - * drm_is_current_master - checks whether @priv is the current master
> >>> - * @fpriv: DRM file private
> >>> - *
> >>> - * Checks whether @fpriv is current master on its device. This decides whether a
> >>> - * client is allowed to run DRM_MASTER IOCTLs.
> >>> - *
> >>> - * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> >>> - * - the current master is assumed to own the non-shareable display hardware.
> >>> - */
> >>> -bool drm_is_current_master(struct drm_file *fpriv)
> >>> -{
> >>> -     bool ret;
> >>> -
> >>> -     mutex_lock(&fpriv->master->dev->master_mutex);
> >>> -     ret = drm_is_current_master_locked(fpriv);
> >>> -     mutex_unlock(&fpriv->master->dev->master_mutex);
> >>> -
> >>> -     return ret;
> >>> -}
> >>> -EXPORT_SYMBOL(drm_is_current_master);
> >>> -
> >>>    int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
> >>>    {
> >>>        struct drm_auth *auth = data;
> >>> @@ -252,7 +223,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
> >>>        if (ret)
> >>>                goto out_unlock;
> >>>
> >>> -     if (drm_is_current_master_locked(file_priv))
> >>> +     if (drm_is_current_master(file_priv))
> >>>                goto out_unlock;
> >>>
> >>>        if (dev->master) {
> >>> @@ -301,7 +272,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
> >>>        if (ret)
> >>>                goto out_unlock;
> >>>
> >>> -     if (!drm_is_current_master_locked(file_priv)) {
> >>> +     if (!drm_is_current_master(file_priv)) {
> >>>                ret = -EINVAL;
> >>>                goto out_unlock;
> >>>        }
> >>> @@ -350,7 +321,7 @@ void drm_master_release(struct drm_file *file_priv)
> >>>        if (file_priv->magic)
> >>>                idr_remove(&file_priv->master->magic_map, file_priv->magic);
> >>>
> >>> -     if (!drm_is_current_master_locked(file_priv))
> >>> +     if (!drm_is_current_master(file_priv))
> >>>                goto out;
> >>>
> >>>        drm_legacy_lock_master_cleanup(dev, master);
> >>> @@ -371,6 +342,22 @@ void drm_master_release(struct drm_file *file_priv)
> >>>        mutex_unlock(&dev->master_mutex);
> >>>    }
> >>>
> >>> +/**
> >>> + * drm_is_current_master - checks whether @priv is the current master
> >>> + * @fpriv: DRM file private
> >>> + *
> >>> + * Checks whether @fpriv is current master on its device. This decides whether a
> >>> + * client is allowed to run DRM_MASTER IOCTLs.
> >>> + *
> >>> + * Most of the modern IOCTL which require DRM_MASTER are for kernel modesetting
> >>> + * - the current master is assumed to own the non-shareable display hardware.
> >>> + */
> >>> +bool drm_is_current_master(struct drm_file *fpriv)
> >>> +{
> >>> +     return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
> >>> +}
> >>> +EXPORT_SYMBOL(drm_is_current_master);
> >>> +
> >>>    /**
> >>>     * drm_master_get - reference a master pointer
> >>>     * @master: &struct drm_master
> >>>
> >>
> >
> >
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2021-06-23 11:25 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  7:54 [PATCH] Revert "drm: add a locked version of drm_is_current_master" Daniel Vetter
2021-06-22  7:54 ` [Intel-gfx] " Daniel Vetter
2021-06-22  7:54 ` Daniel Vetter
2021-06-22  8:28 ` Petri Latvala
2021-06-22  8:28   ` [Intel-gfx] " Petri Latvala
2021-06-22  8:28   ` Petri Latvala
2021-06-22  9:03 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-06-22  9:34 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-06-22 10:51 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-23  8:09 ` [PATCH] " Desmond Cheong Zhi Xi
2021-06-23  8:09   ` [Intel-gfx] " Desmond Cheong Zhi Xi
2021-06-23  8:09   ` Desmond Cheong Zhi Xi
2021-06-23  8:14   ` Daniel Vetter
2021-06-23  8:14     ` [Intel-gfx] " Daniel Vetter
2021-06-23  8:14     ` Daniel Vetter
2021-06-23  9:51     ` Desmond Cheong Zhi Xi
2021-06-23  9:51       ` [Intel-gfx] " Desmond Cheong Zhi Xi
2021-06-23  9:51       ` Desmond Cheong Zhi Xi
2021-06-23 11:25       ` Daniel Vetter
2021-06-23 11:25         ` [Intel-gfx] " Daniel Vetter
2021-06-23 11:25         ` Daniel Vetter
2021-06-23 10:21 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Revert "drm: add a locked version of drm_is_current_master" (rev2) Patchwork

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.