public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drm/i915: Fix locking in DRRS flush/invalidate	hooks
Date: Thu, 09 Apr 2015 12:52:19 +0300	[thread overview]
Message-ID: <87y4m1r5m4.fsf@intel.com> (raw)
In-Reply-To: <1428570631-11009-1-git-send-email-daniel.vetter@ffwll.ch>

On Thu, 09 Apr 2015, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> We must acquire the mutex before we can check drrs.dp, otherwise
> someone might sneak in with a modeset, clear the pointer after we've
> checked it and then the code will Oops.
>
> This issue has been introduced in
>
> commit a93fad0f7fb8a3ff12e8814b630648f6d187954c
> Author: Vandana Kannan <vandana.kannan@intel.com>
> Date:   Sat Jan 10 02:25:59 2015 +0530
>
>     drm/i915: DRRS calls based on frontbuffer
>
> Cc: Ramalingam C <ramalingam.c@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Vandana Kannan <vandana.kannan@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Missed 4.0 so this is

Cc: stable@vger.kernel.org


> ---
>  drivers/gpu/drm/i915/intel_dp.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 1b87969536ff..e265a0dee479 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5170,7 +5170,6 @@ static void intel_edp_drrs_downclock_work(struct work_struct *work)
>  			downclock_mode->vrefresh);
>  
>  unlock:
> -
>  	mutex_unlock(&dev_priv->drrs.mutex);
>  }
>  
> @@ -5192,12 +5191,14 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
>  	struct drm_crtc *crtc;
>  	enum pipe pipe;
>  
> -	if (!dev_priv->drrs.dp)
> -		return;
> -
>  	cancel_delayed_work_sync(&dev_priv->drrs.work);
>  
>  	mutex_lock(&dev_priv->drrs.mutex);
> +	if (!dev_priv->drrs.dp) {
> +		mutex_unlock(&dev_priv->drrs.mutex);
> +		return;
> +	}
> +
>  	crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
>  	pipe = to_intel_crtc(crtc)->pipe;
>  
> @@ -5231,12 +5232,14 @@ void intel_edp_drrs_flush(struct drm_device *dev,
>  	struct drm_crtc *crtc;
>  	enum pipe pipe;
>  
> -	if (!dev_priv->drrs.dp)
> -		return;
> -
>  	cancel_delayed_work_sync(&dev_priv->drrs.work);
>  
>  	mutex_lock(&dev_priv->drrs.mutex);
> +	if (!dev_priv->drrs.dp) {
> +		mutex_unlock(&dev_priv->drrs.mutex);
> +		return;
> +	}
> +
>  	crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
>  	pipe = to_intel_crtc(crtc)->pipe;
>  	dev_priv->drrs.busy_frontbuffer_bits &= ~frontbuffer_bits;
> -- 
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-04-09  9:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09  9:10 [PATCH] drm/i915: Fix locking in DRRS flush/invalidate hooks Daniel Vetter
2015-04-09  9:52 ` Jani Nikula [this message]
2015-04-09 12:38   ` Ville Syrjälä
2015-04-09 14:44 ` [PATCH 1/2] " Daniel Vetter
2015-04-09 14:44   ` [PATCH 2/2] drm/i915: Don't cancel DRRS worker synchronously for flush/invalidate Daniel Vetter
2015-04-09 16:40     ` Chris Wilson
2015-04-09 16:39   ` [PATCH 1/2] drm/i915: Fix locking in DRRS flush/invalidate hooks Chris Wilson
2015-04-10 11:33     ` [Intel-gfx] " Jani Nikula

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=87y4m1r5m4.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /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