intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Daniel Stone <daniel@fooishbar.org>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm: Clean up pending events in the core
Date: Thu, 14 Jan 2016 20:49:18 +0200	[thread overview]
Message-ID: <7775509.kGaXzDWlha@avalon> (raw)
In-Reply-To: <CAPj87rPR97XST_-tqvB-a2O2HFrydsqd_cqXyQSXX5CdVujUYA@mail.gmail.com>

Hi Daniel,

On Monday 11 January 2016 14:51:46 Daniel Stone wrote:
> On 10 January 2016 at 23:48, Laurent Pinchart wrote:
> > On Saturday 09 January 2016 14:28:46 Daniel Vetter wrote:
> >> @@ -353,18 +354,16 @@ static void drm_events_release(struct drm_file
> >> *file_priv) {
> >> 
> >>       struct drm_device *dev = file_priv->minor->dev;
> >>       struct drm_pending_event *e, *et;
> >> 
> >> -     struct drm_pending_vblank_event *v, *vt;
> >> 
> >>       unsigned long flags;
> >>       
> >>       spin_lock_irqsave(&dev->event_lock, flags);
> >> 
> >> -     /* Remove pending flips */
> >> -     list_for_each_entry_safe(v, vt, &dev->vblank_event_list, base.link)
> >> -             if (v->base.file_priv == file_priv) {
> >> -                     list_del(&v->base.link);
> >> -                     drm_vblank_put(dev, v->pipe);
> >> -                     v->base.destroy(&v->base);
> >> -             }
> > 
> > Where does this code go ?
> 
> It doesn't: instead of deleting the events, the helpers to either
> cancel or send the event just notice that file_priv is NULL and bail
> out early.

Thank you for the explanation. What bothered me was that the drm_vblank_put() 
call got dropped. With v2 of this patch series that splits that change to a 
separate patch it's easier to understand.

> >> +     /* Unlink pending events */
> >> +     list_for_each_entry_safe(e, et, &file_priv->pending_event_list,
> >> +                              pending_link) {
> >> +             list_del(&e->pending_link);
> >> +             e->file_priv = NULL;
> >> +     }
> 
> file_priv gets reset here ...
> 
> >> @@ -736,7 +736,10 @@ void drm_event_cancel_free(struct drm_device *dev,
> >> 
> >>  {
> >>  
> >>       unsigned long flags;
> >>       spin_lock_irqsave(&dev->event_lock, flags);
> >> 
> >> -     p->file_priv->event_space += p->event->length;
> >> +     if (p->file_priv) {
> >> +             p->file_priv->event_space += p->event->length;
> >> +             list_del(&p->pending_link);
> >> +     }
> >> 
> >>       spin_unlock_irqrestore(&dev->event_lock, flags);
> >>       p->destroy(p);
> 
> Allowing us to DTRT here ...
> 
> >>  void drm_send_event_locked(struct drm_device *dev, struct
> >>  drm_pending_event
> >> 
> >> *e) {
> >> 
> >>       assert_spin_locked(&dev->event_lock);
> >> 
> >> +     if (!e->file_priv) {
> > 
> > I don't think this could happen before this patch as e->file_priv is
> > dereferenced below, and I don't see anything in this patch that makes the
> > condition possible.
> > 
> >> +             e->destroy(e);
> >> +             return;
> >> +     }
> 
> ... and now here.
> 
> This looks good to me, and a good sight better than doing it in every
> driver. Still drowning in stuff after three weeks off though, so the
> best I can offer for the series right now is:
> Acked-by: Daniel Stone <daniels@collabora.com>

-- 
Regards,

Laurent Pinchart

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-01-14 18:49 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 20:36 [PATCH 00/21] drm_event cleanup Daniel Vetter
2016-01-08 20:36 ` [PATCH 01/21] drm: kerneldoc for drm_fops.c Daniel Vetter
2016-01-08 20:36 ` [PATCH 02/21] drm: Add functions to setup/tear down drm_events Daniel Vetter
2016-01-08 21:10   ` Alex Deucher
2016-01-09 13:27   ` [PATCH] " Daniel Vetter
2016-01-08 20:36 ` [PATCH 03/21] drm/exynos: Use the new event init/free functions Daniel Vetter
2016-01-08 20:36 ` [PATCH 04/21] drm/vmwgfx: " Daniel Vetter
2016-01-08 20:36 ` [PATCH 05/21] drm: Create drm_send_event helpers Daniel Vetter
2016-01-09 13:28   ` [PATCH] " Daniel Vetter
2016-01-08 20:36 ` [PATCH 06/21] drm/fsl: Remove preclose hook Daniel Vetter
2016-01-08 20:36 ` [PATCH 07/21] drm/armada: Remove NULL open/pre/postclose hooks Daniel Vetter
2016-01-08 20:36 ` [PATCH 08/21] drm/gma500: Remove empty preclose hook Daniel Vetter
2016-01-08 20:36 ` [PATCH 09/21] drm: Clean up pending events in the core Daniel Vetter
2016-01-09 13:28   ` [PATCH] " Daniel Vetter
2016-01-10 23:48     ` Laurent Pinchart
2016-01-11 14:51       ` [Intel-gfx] " Daniel Stone
2016-01-14 18:49         ` Laurent Pinchart [this message]
2016-01-08 20:36 ` [PATCH 10/21] drm/i915: Nuke intel_modeset_preclose Daniel Vetter
2016-01-08 20:36 ` [PATCH 11/21] drm/atmel: Nuke preclose Daniel Vetter
2016-01-08 20:36 ` [PATCH 12/21] drm/exynos: Remove event cancelling from postclose Daniel Vetter
2016-01-08 20:36 ` [PATCH 13/21] drm/imx: Unconfuse preclose logic Daniel Vetter
2016-01-08 20:36 ` [PATCH 14/21] drm/msm: Nuke preclose hooks Daniel Vetter
2016-01-08 20:36 ` [PATCH 15/21] drm/omap: Nuke close hooks Daniel Vetter
2016-01-11  0:03   ` Laurent Pinchart
2016-01-11  7:10     ` Daniel Vetter
2016-01-08 20:36 ` [PATCH 16/21] drm/rcar: Nuke preclose hook Daniel Vetter
2016-01-11  0:01   ` Laurent Pinchart
2016-01-08 20:36 ` [PATCH 17/21] drm/shmob: " Daniel Vetter
2016-01-10 22:26   ` [PATCH 1/5] " Daniel Vetter
2016-01-10 22:26     ` [PATCH 2/5] drm/tegra: Stop cancelling page flip events Daniel Vetter
2016-01-10 22:26     ` [PATCH 3/5] drm/tilcdc: Nuke preclose hook Daniel Vetter
2016-01-10 22:26     ` [PATCH 4/5] drm/vc4: " Daniel Vetter
2016-01-10 22:26     ` [PATCH 5/5] drm/vmwgfx: " Daniel Vetter
2016-01-11 10:20       ` Thomas Hellstrom
2016-01-11  0:00     ` [PATCH 1/5] drm/shmob: " Laurent Pinchart
2016-01-08 20:36 ` [PATCH 18/21] drm/tegra: Stop cancelling page flip events Daniel Vetter
2016-01-08 20:36 ` [PATCH 19/21] drm/tilcdc: Nuke preclose hook Daniel Vetter
2016-01-08 20:36 ` [PATCH 20/21] drm/vc4: " Daniel Vetter
2016-01-08 20:36 ` [PATCH 21/21] drm/vmwgfx: " Daniel Vetter
2016-01-08 20:53   ` Thomas Hellstrom
2016-01-09 10:43     ` Daniel Vetter
2016-01-10 20:52       ` Thomas Hellstrom
2016-01-10 21:59         ` Daniel Vetter
2016-01-10 22:02   ` [PATCH] " Daniel Vetter
2016-01-10 22:17     ` Thomas Hellstrom
2016-01-10 22:22       ` Daniel Vetter
2016-01-08 21:47 ` [PATCH 00/21] drm_event cleanup Alex Deucher
2016-01-09 13:32 ` Daniel Vetter
2016-01-11 11:20 ` ✗ failure: Fi.CI.BAT Patchwork
2016-01-12 16:24   ` Daniel Vetter

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=7775509.kGaXzDWlha@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=alexander.deucher@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@fooishbar.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.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;
as well as URLs for NNTP newsgroup(s).