From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH] drm/i915: Only free the unpin_work if cancelled before being run Date: Tue, 17 Apr 2012 10:53:24 +0100 Message-ID: <1334656418_11970@CP5-2952> References: <1334654978-16021-1-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from fireflyinternet.com (smtp.fireflyinternet.com [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id 93BC6A08E7 for ; Tue, 17 Apr 2012 02:53:44 -0700 (PDT) Received: from cantiga.alporthouse.com (unverified [78.156.66.37]) by fireflyinternet.com (Firefly Internet SMTP) with ESMTP id 111382206-1500050 for ; Tue, 17 Apr 2012 10:53:38 +0100 In-Reply-To: <1334654978-16021-1-git-send-email-chris@chris-wilson.co.uk> 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: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, 17 Apr 2012 10:29:38 +0100, Chris Wilson wrote: > The unpin worker frees it work struct and so during intel_crtc_disable > 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. Futher review (hunting for some sign of workqueue corruption, cf https://bugs.freedesktop.org/show_bug.cgi?id=48798) says that if work is non-NULL here it will not have been scheduled so cancel_work_sync() will always return true. Which also means that we have no way of waiting upon the scheduled unpin_work. :| -Chris -- Chris Wilson, Intel Open Source Technology Centre