Re: [PATCH 08/13] drm/fb-helper: Stop using mode_config.mutex for internals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 04, 2017 at 05:18:28PM +0200, Daniel Vetter wrote:
> Those are now all protected using fb_helper->lock.
> 
> v2: We still need to hold mode_config.mutex right around calling
> connector->fill_modes.
> 
> v3: I forgot to hold mode_config.mutex while looking at
> connector->status and the mode list. Also, we need to patch up the
> i915 ->initial_config callback to grab the locks it needs to inspect
> the modeset state recovered from the fw.
> 
> Cc: John Stultz <john.stultz@xxxxxxxxxx>
> Cc: Thierry Reding <treding@xxxxxxxxxx>
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_fb_helper.c    | 33 ++++++++-------------------------
>  drivers/gpu/drm/drm_vblank.c       |  2 +-
>  drivers/gpu/drm/i915/intel_fbdev.c | 16 ++++++++++++----
>  3 files changed, 21 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 400bbb07eff2..59e2916471b2 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
<snip>
> @@ -2296,12 +2284,8 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper,
>  	int i;
>  
>  	DRM_DEBUG_KMS("\n");
> -	if (drm_fb_helper_probe_connector_modes(fb_helper, width, height) == 0)
> -		DRM_DEBUG_KMS("No connectors reported connected with modes\n");
> -
>  	/* prevent concurrent modification of connector_count by hotplug */
>  	lockdep_assert_held(&fb_helper->lock);
> -	lockdep_assert_held(&fb_helper->dev->mode_config.mutex);
>  
>  	crtcs = kcalloc(fb_helper->connector_count,
>  			sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL);
> @@ -2316,7 +2300,10 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper,
>  		goto out;
>  	}
>  
> +	mutex_lock(&fb_helper->dev->mode_config.mutex);
>  	drm_enable_connectors(fb_helper, enabled);
> +	if (drm_fb_helper_probe_connector_modes(fb_helper, width, height) == 0)

This changes the order of these two functions calls. Looks to me like
drm_fb_helper_probe_connector_modes() updates connector->status, and
drm_enable_connectors() depends on it. So either these shouldn't get 
reordered or there's some not immediately obvious reason why that's OK.

> +		DRM_DEBUG_KMS("No connectors reported connected with modes\n");
>  
>  	if (!(fb_helper->funcs->initial_config &&
>  	      fb_helper->funcs->initial_config(fb_helper, crtcs, modes,

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux