[Intel-gfx] [PATCH] [drm/i915] Shut down retire work handler on lastclose or leavevt

Eric Anholt eric at anholt.net
Wed Oct 15 06:08:06 CEST 2008


On Tue, 2008-10-14 at 20:52 -0700, Keith Packard wrote:
> From b9c4200fc5923bae72c8f90365da79b94c9ee284 Mon Sep 17 00:00:00 2001
> From: Keith Packard <keithp at keithp.com>
> Date: Tue, 14 Oct 2008 20:48:42 -0700
> Subject: [PATCH] [drm/i915] Shut down retire work handler on lastclose or leavevt
> 
> At leavevt and lastclose time, cancel any pending retire work handler
> invocation, and keep the retire work handler from requeuing itself if it is
> currently running. This ensure that the retire work handler does not run
> when the ring is shut down, which would otherwise cause a nice crash.

> +		/**
> +		 * Flag set while the device is shutting down the ring
> +		 * This is used to prevent the retire work handler
> +		 * from re-queueing itself during lastclose or leavevt
> +		 */
> +		int ring_stopping;

cancel_delayed_work_sync is supposed to handle keeping the thing from
requeueing already.  I can see a race where

       server                     client
leavevt_ioctl()
-> i915_cancel_work()
                    		execbuf()
				-> schedule_delayed_work()
-> gem_idle()
-> cleanup_ringbuffer()
				gem_delayed_work_handler()
				-> oops

I think the solution here is setting the suspended semaphore before
canceling the work, to kill further execbufs.  I suspect that with that,
the additional cancel_work semaphore isn't needed.

-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20081014/a022ae78/attachment.sig>


More information about the Intel-gfx mailing list