From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Packard Subject: Re: [PATCH] drm/i915: don't set unpin_work if vblank_get fails Date: Mon, 22 Aug 2011 11:45:05 -0700 Message-ID: References: <20110822110531.57d85c32@jbarnes-desktop> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1394628940==" Return-path: Received: from keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id 99A0B9E798 for ; Mon, 22 Aug 2011 11:45:09 -0700 (PDT) In-Reply-To: <20110822110531.57d85c32@jbarnes-desktop> 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: Jesse Barnes , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1394628940== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable On Mon, 22 Aug 2011 11:05:31 -0700, Jesse Barnes = wrote: > This fixes a race where we may try to finish a page flip and decrement > the refcount even if our vblank_get failed and we ended up with a > spurious flip pending interrupt. >=20 > Fixes https://bugs.freedesktop.org/show_bug.cgi?id=3D34211. >=20 > Signed-off-by: Jesse Barnes >=20 > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/= intel_display.c > index 2319f62..0910537 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -6896,6 +6896,10 @@ static int intel_crtc_page_flip(struct drm_crtc *c= rtc, > work->old_fb_obj =3D intel_fb->obj; > INIT_WORK(&work->work, intel_unpin_work_fn); >=20=20 > + ret =3D drm_vblank_get(dev, intel_crtc->pipe); > + if (ret) > + goto free_work; > + > /* We borrow the event spin lock for protecting unpin_work */ > spin_lock_irqsave(&dev->event_lock, flags); > if (intel_crtc->unpin_work) { > @@ -6906,6 +6910,11 @@ static int intel_crtc_page_flip(struct drm_crtc *c= rtc, > return -EBUSY; You'll need a drm_vblank_put above this return. > } > intel_crtc->unpin_work =3D work; > + /* > + * Past this point, if we fail we'll let the flip completion code > + * clean up the vblank refcount and pin work. It'll be a spurious > + * completion, but we handle that case. > + */ I don't see how this is going to happen reliably; the hardware will have to generate a suitable interrupt, which on IRL and later will have to be an actual page flip interrupt. =2D-=20 keith.packard@intel.com --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iD8DBQFOUqOxQp8BWwlsTdMRApX+AKDBtDaxMH8OgS1TRGZZdaaDtcXKDwCgvVlY Rywf7QX6jY1QooUPDX3vsoo= =UlMY -----END PGP SIGNATURE----- --=-=-=-- --===============1394628940== 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 --===============1394628940==--