From: Paul Menzel Subject: Re: [PATCH] drm/i915: Eliminate race from gen2/3 page flip interrupt handling Date: Mon, 18 Feb 2013 13:07:53 +0100 Message-ID: <1361189273.5878.33.camel@mattotaupa> References: <1361188671-11639-1-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0122291903==" Return-path: Received: from mail.gw90.de (mail.gw90.de [188.40.100.199]) by gabe.freedesktop.org (Postfix) with ESMTP id B60B5E5FBC for ; Mon, 18 Feb 2013 04:07:58 -0800 (PST) In-Reply-To: <1361188671-11639-1-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: ville.syrjala@linux.intel.com Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============0122291903== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-4LQI8Jios9DUeVzIZfY1" --=-4LQI8Jios9DUeVzIZfY1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Am Montag, den 18.02.2013, 13:57 +0200 schrieb ville.syrjala@linux.intel.co= m: > From: Ville Syrj=C3=A4l=C3=A4 >=20 > If the interrupt handler were to process a previous vblank interrupt and > the following flip pending interrupt at the same time, the page flip > would be complete too soon. =C2=BBwould complete=C2=AB or =C2=BBwould be complete*d*=C2=AB > To eliminate this race check the live pending flip status from the ISR > register before finishing the page flip. Could this be tested somehow? Could a test case be written for this? > Signed-off-by: Ville Syrj=C3=A4l=C3=A4 > --- > drivers/gpu/drm/i915/i915_irq.c | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_= irq.c > index 9fde49a..3de570c 100644 > --- a/drivers/gpu/drm/i915/i915_irq.c > +++ b/drivers/gpu/drm/i915/i915_irq.c > @@ -2284,8 +2284,11 @@ static irqreturn_t i8xx_irq_handler(int irq, void = *arg) > drm_handle_vblank(dev, 0)) { > if (iir & I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT) { > intel_prepare_page_flip(dev, 0); > - intel_finish_page_flip(dev, 0); > - flip_mask &=3D ~I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT; > + > + if ((I915_READ16(ISR) & I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT)= =3D=3D 0) { > + intel_finish_page_flip(dev, 0); > + flip_mask &=3D ~I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT; > + } > } > } > =20 > @@ -2293,8 +2296,11 @@ static irqreturn_t i8xx_irq_handler(int irq, void = *arg) > drm_handle_vblank(dev, 1)) { > if (iir & I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT) { > intel_prepare_page_flip(dev, 1); > - intel_finish_page_flip(dev, 1); > - flip_mask &=3D ~I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; > + > + if ((I915_READ16(ISR) & I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT)= =3D=3D 0) { > + intel_finish_page_flip(dev, 1); > + flip_mask &=3D ~I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; > + } > } > } > =20 > @@ -2491,8 +2497,11 @@ static irqreturn_t i915_irq_handler(int irq, void = *arg) > drm_handle_vblank(dev, pipe)) { > if (iir & flip[plane]) { > intel_prepare_page_flip(dev, plane); > - intel_finish_page_flip(dev, pipe); > - flip_mask &=3D ~flip[plane]; > + > + if ((I915_READ(ISR) & flip[plane]) =3D=3D 0) { Why not `I915_READ16`? > + intel_finish_page_flip(dev, pipe); > + flip_mask &=3D ~flip[plane]; > + } > } > } Thanks, Paul --=-4LQI8Jios9DUeVzIZfY1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEABECAAYFAlEiGZoACgkQPX1aK2wOHVibmACdFxhvjmo6hlj4Ui0Ay8EE6gt2 DAcAn1HTMJ4uY7mqhQudTbAXHQdIFnEt =Bvh1 -----END PGP SIGNATURE----- --=-4LQI8Jios9DUeVzIZfY1-- --===============0122291903== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============0122291903==--