dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Rob Clark <robdclark-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>,
	Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jeykumar Sankaran
	<jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
Subject: Re: [PATCH v2] drm/msm: Sanitize the modeset_is_locked checks in dpu
Date: Fri, 11 Oct 2019 09:33:34 -0400	[thread overview]
Message-ID: <20191011133334.GS85762@art_vandelay> (raw)
In-Reply-To: <20191010181801.186069-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>

On Thu, Oct 10, 2019 at 02:17:44PM -0400, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> As Daniel mentions in his email [1], non-blocking commits don't hold the
> modeset locks, so we can safely access state as long as these functions
> are in the commit path. So remove the WARN_ON in dpu_kms_encoder_enable.
> 
> In dpu_crtc_get_intf_mode, things are a bit more complicated. So keep
> the WARN_ON, but add a comment explaining the situation and hope someone
> comes along and fixes the issue.
> 
> [1]- https://lists.freedesktop.org/archives/dri-devel/2019-October/239441.html
> 
> Link to v1: https://patchwork.freedesktop.org/patch/msgid/20191010151351.126735-1-sean@poorly.run
> 
> Changes in v2:
> - Restored the WARN_ON in get_intf_mode and added a clarifying comment (Daniel)
> 
> Fixes: 1dfdb0e107db ("drm/msm: dpu: Add modeset lock checks where applicable")
> Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
> Cc: Rob Clark <robdclark@chromium.org>
> Suggested-by: Daniel Vetter <daniel@ffwll.ch>
> Partially-Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Applied to msm-next with danvet's full irc r-b, thanks for the report and
review!

Sean

> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 9 +++++++++
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 1 -
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 0b9dc042d2e22..f197dce545761 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -271,6 +271,15 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc *crtc)
>  		return INTF_MODE_NONE;
>  	}
>  
> +	/*
> +	 * TODO: This function is called from dpu debugfs and as part of atomic
> +	 * check. When called from debugfs, the crtc->mutex must be held to
> +	 * read crtc->state. However reading crtc->state from atomic check isn't
> +	 * allowed (unless you have a good reason, a big comment, and a deep
> +	 * understanding of how the atomic/modeset locks work (<- and this is
> +	 * probably not possible)). So we'll keep the WARN_ON here for now, but
> +	 * really we need to figure out a better way to track our operating mode
> +	 */
>  	WARN_ON(!drm_modeset_is_locked(&crtc->mutex));
>  
>  	/* TODO: Returns the first INTF_MODE, could there be multiple values? */
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index b1645ad83a1e1..6c92f0fbeac98 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -316,7 +316,6 @@ void dpu_kms_encoder_enable(struct drm_encoder *encoder)
>  	if (funcs && funcs->commit)
>  		funcs->commit(encoder);
>  
> -	WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
>  	drm_for_each_crtc(crtc, dev) {
>  		if (!(crtc->state->encoder_mask & drm_encoder_mask(encoder)))
>  			continue;
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

      parent reply	other threads:[~2019-10-11 13:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 15:13 [PATCH] Revert "drm/msm: dpu: Add modeset lock checks where applicable" Sean Paul
     [not found] ` <20191010151351.126735-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2019-10-10 15:22   ` Daniel Vetter
     [not found]     ` <CAKMK7uF2HsM5WrC5j_WNXWDjkXTyK5tP2DuoRt78FeaL5791QA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-10 18:17       ` [PATCH v2] drm/msm: Sanitize the modeset_is_locked checks in dpu Sean Paul
     [not found]         ` <20191010181801.186069-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2019-10-11 13:33           ` Sean Paul [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191011133334.GS85762@art_vandelay \
    --to=sean-p7ytbzm4h96eqtr555yldq@public.gmane.org \
    --cc=daniel-/w4YWyX8dFk@public.gmane.org \
    --cc=daniel.vetter-/w4YWyX8dFk@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox