Message ID | 1454411190-15721-13-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Feb 02, 2016 at 11:06:30AM +0000, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > Purpose is catching illegal callers. > > v2: Replace WARN_ON with lockdep_assert_held. (Chris Wilson, Daniel Vetter) > v3: Moved under dedicated CONFIG_DRM_I915_DEBUG and back to WARN_ON. > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: Chris Wilson <chris@chris-wilson.co.uk> > --- > drivers/gpu/drm/i915/i915_drv.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 4ad025210416..6d34f74a5919 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -2933,6 +2933,9 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n); > static inline struct page * > i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n) > { > +#ifdef CONFIG_DRM_I915_DEBUG > + WARN_ON_ONCE(!mutex_is_locked(&obj->base.dev->struct_mutex)); > +#endif But lockdep gives us useful debug information! -Chris
On 02/02/16 11:39, Chris Wilson wrote: > On Tue, Feb 02, 2016 at 11:06:30AM +0000, Tvrtko Ursulin wrote: >> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> >> >> Purpose is catching illegal callers. >> >> v2: Replace WARN_ON with lockdep_assert_held. (Chris Wilson, Daniel Vetter) >> v3: Moved under dedicated CONFIG_DRM_I915_DEBUG and back to WARN_ON. >> >> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> >> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> >> Cc: Chris Wilson <chris@chris-wilson.co.uk> >> --- >> drivers/gpu/drm/i915/i915_drv.h | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h >> index 4ad025210416..6d34f74a5919 100644 >> --- a/drivers/gpu/drm/i915/i915_drv.h >> +++ b/drivers/gpu/drm/i915/i915_drv.h >> @@ -2933,6 +2933,9 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n); >> static inline struct page * >> i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n) >> { >> +#ifdef CONFIG_DRM_I915_DEBUG >> + WARN_ON_ONCE(!mutex_is_locked(&obj->base.dev->struct_mutex)); >> +#endif > > But lockdep gives us useful debug information! But you can't stick in a for loop. That applies to the previous patch so this one is consistent with what CONFIG_DRM_I915_DEBUG does. Regards, Tvrtko
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 4ad025210416..6d34f74a5919 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2933,6 +2933,9 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n); static inline struct page * i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n) { +#ifdef CONFIG_DRM_I915_DEBUG + WARN_ON_ONCE(!mutex_is_locked(&obj->base.dev->struct_mutex)); +#endif if (WARN_ON(n >= obj->base.size >> PAGE_SHIFT)) return NULL;