Re: [Intel-gfx] [PATCH 01/12] drm/i915: Assert mutex_is_locked on context lookup

2013-05-06 Thread Daniel Vetter
On Mon, May 6, 2013 at 7:59 PM, Ben Widawsky wrote: > > Why I wanted a BUG: When you get a ref to an object without holding a > lock you get a potentially unsafe pointer (to which we will be writing). > If the context object memory is freed, and we write to it, we have a > potential to late scribb

Re: [Intel-gfx] [PATCH 01/12] drm/i915: Assert mutex_is_locked on context lookup

2013-05-06 Thread Ben Widawsky
On Mon, May 06, 2013 at 11:44:22AM +0200, Daniel Vetter wrote: > On Mon, May 06, 2013 at 11:40:06AM +0200, Daniel Vetter wrote: > > On Thu, May 02, 2013 at 01:27:32PM -0700, Jesse Barnes wrote: > > > On Tue, 23 Apr 2013 23:15:29 -0700 > > > Ben Widawsky wrote: > > > > > > > Because our context re

Re: [Intel-gfx] [PATCH 01/12] drm/i915: Assert mutex_is_locked on context lookup

2013-05-06 Thread Daniel Vetter
On Mon, May 06, 2013 at 11:40:06AM +0200, Daniel Vetter wrote: > On Thu, May 02, 2013 at 01:27:32PM -0700, Jesse Barnes wrote: > > On Tue, 23 Apr 2013 23:15:29 -0700 > > Ben Widawsky wrote: > > > > > Because our context refcounting doesn't grab a ref at lookup time, it is > > > unsafe to do so wi

Re: [Intel-gfx] [PATCH 01/12] drm/i915: Assert mutex_is_locked on context lookup

2013-05-06 Thread Daniel Vetter
On Thu, May 02, 2013 at 01:27:32PM -0700, Jesse Barnes wrote: > On Tue, 23 Apr 2013 23:15:29 -0700 > Ben Widawsky wrote: > > > Because our context refcounting doesn't grab a ref at lookup time, it is > > unsafe to do so without the lock. > > > > NOTE: We don't have an easy way to put the asserti

Re: [Intel-gfx] [PATCH 01/12] drm/i915: Assert mutex_is_locked on context lookup

2013-05-02 Thread Jesse Barnes
On Tue, 23 Apr 2013 23:15:29 -0700 Ben Widawsky wrote: > Because our context refcounting doesn't grab a ref at lookup time, it is > unsafe to do so without the lock. > > NOTE: We don't have an easy way to put the assertion in the lookup > function which is where this really belongs. Context swit

[Intel-gfx] [PATCH 01/12] drm/i915: Assert mutex_is_locked on context lookup

2013-04-23 Thread Ben Widawsky
Because our context refcounting doesn't grab a ref at lookup time, it is unsafe to do so without the lock. NOTE: We don't have an easy way to put the assertion in the lookup function which is where this really belongs. Context switching is good enough because it actually asserts even more correctn