Skip to contentSkip to conversation

drm: Take mode_config.mutex in setcrtc ioctl

PATCH In review Daniel Vetter 4 participants 7 messages Apr 6, 2017 – Apr 7, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Take mode_config.mutex in setcrtc ioctl

Legacy drivers insist that we really take all the locks in this path, and the harm in doing so is minimal.

Fixes 2ceb585a956c ("drm: Add explicit acquire ctx handling around ->set_config")
Cc Harry Wentland <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/drm_crtc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_crtc.c +2 -0
index d69e180fc563..42257f373c59 100644
@@ -576,6 +576,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	}
 	DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
+	mutex_lock(crtc->dev->mode.config.mutex);
 	drm_modeset_acquire_init(&ctx, 0);
 retry:
 	ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
@@ -721,6 +722,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	}
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
+	mutex_unlock(crtc->dev->mode.config.mutex);
 
 	return ret;
 }
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 14 lines · Daniel Vetter

Legacy drivers insist that we really take all the locks in this path, and the harm in doing so is minimal.

Fixes 2ceb585a956c ("drm: Add explicit acquire ctx handling around ->set_config")
Cc Harry Wentland <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Alex Deucher <[email protected]>
Quoted 25 lines
---
 drivers/gpu/drm/drm_crtc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_crtc.c +2 -1
index d69e180fc563..42257f373c59 100644
@@ -576,6 +576,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        }
        DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
+       mutex_lock(crtc->dev->mode.config.mutex);
        drm_modeset_acquire_init(&ctx, 0);
 retry:
        ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
@@ -721,6 +722,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        }
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);
+       mutex_unlock(crtc->dev->mode.config.mutex);
 
        return ret;
 }
--
Quoted 2 lines

2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

PATCH 1/1 drm: Take mode_config.mutex in setcrtc ioctl

In reply to Daniel Vetter

Legacy drivers insist that we really take all the locks in this path, and the harm in doing so is minimal.

v2: Like git add, it exists :(

Fixes 2ceb585a956c ("drm: Add explicit acquire ctx handling around ->set_config")
Cc Harry Wentland <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/drm_crtc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_crtc.c +2 -0
index d69e180fc563..5af25ce5bf7c 100644
@@ -576,6 +576,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	}
 	DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
+	mutex_lock(&crtc->dev->mode_config.mutex);
 	drm_modeset_acquire_init(&ctx, 0);
 retry:
 	ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
@@ -721,6 +722,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 	}
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
+	mutex_unlock(&crtc->dev->mode_config.mutex);
 
 	return ret;
 }
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 5 lines · Daniel Vetter

Legacy drivers insist that we really take all the locks in this path, and the harm in doing so is minimal.

v2: Like git add, it exists :(

Quoted 11 lines
Fixes 2ceb585a956c ("drm: Add explicit acquire ctx handling around ->set_config")
Cc Harry Wentland <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Alex Deucher <[email protected]>

This actually matches what I tested locally.

Quoted 25 lines
---
 drivers/gpu/drm/drm_crtc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_crtc.c +2 -1
index d69e180fc563..5af25ce5bf7c 100644
@@ -576,6 +576,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        }
        DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
+       mutex_lock(&crtc->dev->mode_config.mutex);
        drm_modeset_acquire_init(&ctx, 0);
 retry:
        ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
@@ -721,6 +722,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        }
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);
+       mutex_unlock(&crtc->dev->mode_config.mutex);
 
        return ret;
 }
--
Quoted 2 lines

2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 18 lines · Alex Deucher
Quoted 5 lines · Daniel Vetter

Legacy drivers insist that we really take all the locks in this path, and the harm in doing so is minimal.

v2: Like git add, it exists :(

Quoted 11 lines
Fixes 2ceb585a956c ("drm: Add explicit acquire ctx handling around ->set_config")
Cc Harry Wentland <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Alex Deucher <[email protected]>
Quoted 3 lines

This actually matches what I tested locally.

Thanks for quickly testing this, applied.
-Daniel

Quoted 28 lines
Quoted 28 lines
---
 drivers/gpu/drm/drm_crtc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_crtc.c +2 -1
index d69e180fc563..5af25ce5bf7c 100644
@@ -576,6 +576,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        }
        DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
+       mutex_lock(&crtc->dev->mode_config.mutex);
        drm_modeset_acquire_init(&ctx, 0);
 retry:
        ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
@@ -721,6 +722,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        }
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);
+       mutex_unlock(&crtc->dev->mode_config.mutex);
 
        return ret;
 }
--

2.11.0

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

✗ Fi.CI.BAT: failure for drm: Take mode_config.mutex in setcrtc ioctl (rev2)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: drm: Take mode_config.mutex in setcrtc ioctl (rev2)
URL : https://patchwork.freedesktop.org/series/22605/
State : failure

== Summary ==

Series 22605v2 drm: Take mode_config.mutex in setcrtc ioctl
https://patchwork.freedesktop.org/api/1.0/series/22605/revisions/2/mbox/

Test core_auth:

        Subgroup basic-auth:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test core_prop_blob:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test drv_getparams_basic:
        Subgroup basic-eu-total:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-subslice-total:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test drv_hangman:
        Subgroup error-state-basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_basic:
        Subgroup bad-close:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup create-close:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup create-fd-close:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_busy:
        Subgroup basic-busy-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-hang-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_close_race:
        Subgroup basic-process:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-threads:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_cpu_reloc:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_cs_tlb:
        Subgroup basic-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_create:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-files:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_exec:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_param:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_switch:
        Subgroup basic-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-default-heavy:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_exec_basic:
        Subgroup basic-blt:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-bsd:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-default:
                pass       -> INCOMPLETE (fi-ivb-3770)
fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 434s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time: 423s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time: 569s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 505s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 546s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time: 489s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 487s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 407s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 403s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 432s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 494s
fi-ivb-3770      total:27   pass:0    dwarn:24  dfail:0   fail:0   skip:2   time: 0s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 451s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time: 566s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 458s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time: 573s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 463s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 494s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time: 434s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 528s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 410s

e087f8395ca39c6988de8680bd6f80a20b08c0f4 drm-tip: 2017y-04m-06d-13h-28m-42s UTC integration manifest 09c592e drm: Take mode_config.mutex in setcrtc ioctl

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4426/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: ✗ Fi.CI.BAT: failure for drm: Take mode_config.mutex in setcrtc ioctl (rev2)

Quoted 67 lines · Patchwork

== Series Details ==

Series: drm: Take mode_config.mutex in setcrtc ioctl (rev2)
URL : https://patchwork.freedesktop.org/series/22605/
State : failure

== Summary ==

Series 22605v2 drm: Take mode_config.mutex in setcrtc ioctl
https://patchwork.freedesktop.org/api/1.0/series/22605/revisions/2/mbox/

Test core_auth:

        Subgroup basic-auth:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test core_prop_blob:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test drv_getparams_basic:
        Subgroup basic-eu-total:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-subslice-total:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test drv_hangman:
        Subgroup error-state-basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_basic:
        Subgroup bad-close:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup create-close:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup create-fd-close:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_busy:
        Subgroup basic-busy-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-hang-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_close_race:
        Subgroup basic-process:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-threads:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_cpu_reloc:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_cs_tlb:
        Subgroup basic-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_create:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-files:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_exec:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_param:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_ctx_switch:
        Subgroup basic-default:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-default-heavy:
Quoted 8 lines
                pass       -> DMESG-WARN (fi-ivb-3770)
Test gem_exec_basic:
        Subgroup basic-blt:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-bsd:
                pass       -> DMESG-WARN (fi-ivb-3770)
        Subgroup basic-default:
                pass       -> INCOMPLETE (fi-ivb-3770)

Anyone have an idea what happened to this poor ivb? Lots of flip_done timed-out, then eventually machine death.
-Daniel

Quoted 29 lines
fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 434s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time: 423s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time: 569s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 505s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 546s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time: 489s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 487s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 407s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 403s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 432s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 494s
fi-ivb-3770      total:27   pass:0    dwarn:24  dfail:0   fail:0   skip:2   time: 0s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 451s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time: 566s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 458s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time: 573s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 463s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 494s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time: 434s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 528s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 410s

e087f8395ca39c6988de8680bd6f80a20b08c0f4 drm-tip: 2017y-04m-06d-13h-28m-42s UTC integration manifest 09c592e drm: Take mode_config.mutex in setcrtc ioctl

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4426/

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx