diff mbox

drm: Take mode_config.mutex in setcrtc ioctl

Message ID 20170406185519.5918-1-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter April 6, 2017, 6:55 p.m. UTC
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 <harry.wentland@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexdeucher@gmail.com>
Reported-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_crtc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alex Deucher April 6, 2017, 7:02 p.m. UTC | #1
On Thu, Apr 6, 2017 at 2:55 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> 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 <harry.wentland@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Cc: Alex Deucher <alexdeucher@gmail.com>
> Reported-by: Alex Deucher <alexdeucher@gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Acked-and-tested-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/drm_crtc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index d69e180fc563..42257f373c59 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -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
>
Daniel Vetter April 7, 2017, 7:25 a.m. UTC | #2
On Thu, Apr 06, 2017 at 07:34:41PM -0000, Patchwork wrote:
> == 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)

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

> 
> 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/
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d69e180fc563..42257f373c59 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -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;
 }