On Mon, Nov 14, 2016 at 04:48:00PM +0200, Joonas Lahtinen wrote: > On ma, 2016-11-14 at 08:56 +0000, Chris Wilson wrote: > > + static struct lock_class_key __key; \ > > When lockdep is disabled, this becomes zero size. We might still get > rid of the #fence strings, with some #ifdef, did you measure the > impact? I remember some for_each_engine_masked cry over bytes. I was copying mutex_init. To avoid it is not just a little ifdeffery :| The strings currently cost us around 160 bytes of text. text data bss dec hex filename 1222524 5077 608 1228209 12bdb1 drivers/gpu/drm/i915/i915.ko 1222364 5077 608 1228049 12bd11 drivers/gpu/drm/i915/i915.ko diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c index 65fded24a9eb..804af5766650 100644 --- a/drivers/gpu/drm/i915/i915_sw_fence.c +++ b/drivers/gpu/drm/i915/i915_sw_fence.c @@ -110,6 +110,9 @@ static void i915_sw_fence_await(struct i915_sw_fence *fence) WARN_ON(atomic_inc_return(&fence->pending) <= 1); } +#ifndef CONFIG_LOCKDEP +static +#endif void __i915_sw_fence_init(struct i915_sw_fence *fence, i915_sw_fence_notify_t fn, const char *name, @@ -123,6 +126,16 @@ void __i915_sw_fence_init(struct i915_sw_fence *fence, fence->flags = (unsigned long)fn; } +#ifndef CONFIG_LOCKDEP +void i915_sw_fence_init(struct i915_sw_fence *fence, + i915_sw_fence_notify_t fn) +{ + static struct lock_class_key __key; + + __i915_sw_fence_init(fence, fn, NULL, &__key); +} +#endif + void i915_sw_fence_commit(struct i915_sw_fence *fence) { i915_sw_fence_complete(fence); diff --git a/drivers/gpu/drm/i915/i915_sw_fence.h b/drivers/gpu/drm/i915/i915_sw_fence.h index 23748a1ae6ae..d8510a4b02bd 100644 --- a/drivers/gpu/drm/i915/i915_sw_fence.h +++ b/drivers/gpu/drm/i915/i915_sw_fence.h @@ -40,6 +40,7 @@ typedef int (*i915_sw_fence_notify_t)(struct i915_sw_fence *, enum i915_sw_fence_notify state); #define __i915_sw_fence_call __aligned(4) +#ifdef CONFIG_LOCKDEP void __i915_sw_fence_init(struct i915_sw_fence *fence, i915_sw_fence_notify_t fn, const char *name, @@ -49,6 +50,10 @@ void __i915_sw_fence_init(struct i915_sw_fence *fence, \ __i915_sw_fence_init((fence), (fn), #fence, &__key); \ } while (0) +#else +void i915_sw_fence_init(struct i915_sw_fence *fence, + i915_sw_fence_notify_t fn); +#endif void i915_sw_fence_commit(struct i915_sw_fence *fence); Can we do that more neatly? -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx