From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Only free the unpin_work if cancelled before being run
Date: Tue, 17 Apr 2012 11:47:38 +0200 [thread overview]
Message-ID: <20120417094738.GD4104@phenom.ffwll.local> (raw)
In-Reply-To: <1334654978-16021-1-git-send-email-chris@chris-wilson.co.uk>
On Tue, Apr 17, 2012 at 10:29:38AM +0100, Chris Wilson wrote:
> The unpin worker frees it work struct and so during intel_crtc_disable
s/disable/destroy/
> we should only also free the work struct if cancel_work_sync() reports
> that it successfully cancelled the work prior to it being executed and
> thus avoid the double free.
>
> The impact is only for people unloading modules during a fullscreen game
> or movie playback, so extremely small.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/i915/intel_display.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 8298b72..78390e8 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -7602,10 +7602,8 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)
> intel_crtc->unpin_work = NULL;
> spin_unlock_irqrestore(&dev->event_lock, flags);
>
> - if (work) {
> - cancel_work_sync(&work->work);
> + if (work && cancel_work_sync(&work->work))
> kfree(work);
> - }
>
> drm_crtc_cleanup(crtc);
>
> --
> 1.7.10
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
next prev parent reply other threads:[~2012-04-17 9:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-17 9:29 [PATCH] drm/i915: Only free the unpin_work if cancelled before being run Chris Wilson
2012-04-17 9:47 ` Daniel Vetter [this message]
2012-04-17 9:53 ` Chris Wilson
2012-04-17 10:33 ` Daniel Vetter
2012-04-17 13:30 ` Chris Wilson
2012-04-17 13:44 ` Daniel Vetter
2012-04-17 13:45 ` 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=20120417094738.GD4104@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=chris@chris-wilson.co.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.