From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> To: Intel-gfx@lists.freedesktop.org Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>, "Tvrtko Ursulin" <tvrtko.ursulin@intel.com>, dri-devel@lists.freedesktop.org, "Chris Wilson" <chris@chris-wilson.co.uk> Subject: [PATCH 03/12] drm/i915: Lift marking a lock as used to utils Date: Wed, 26 May 2021 15:14:47 +0100 [thread overview] Message-ID: <20210526141456.2334192-4-tvrtko.ursulin@linux.intel.com> (raw) In-Reply-To: <20210526141456.2334192-1-tvrtko.ursulin@linux.intel.com> From: Chris Wilson <chris@chris-wilson.co.uk> After calling lock_set_subclass() the lock _must_ be used, or else lockdep's internal nr_used_locks becomes unbalanced. Extract the little utility function to i915_utils.c Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 13 +------------ drivers/gpu/drm/i915/i915_utils.c | 15 +++++++++++++++ drivers/gpu/drm/i915/i915_utils.h | 7 +++++++ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c index 3f9a811eb02b..15566819539f 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c @@ -794,18 +794,7 @@ intel_engine_init_active(struct intel_engine_cs *engine, unsigned int subclass) spin_lock_init(&engine->active.lock); lockdep_set_subclass(&engine->active.lock, subclass); - - /* - * Due to an interesting quirk in lockdep's internal debug tracking, - * after setting a subclass we must ensure the lock is used. Otherwise, - * nr_unused_locks is incremented once too often. - */ -#ifdef CONFIG_DEBUG_LOCK_ALLOC - local_irq_disable(); - lock_map_acquire(&engine->active.lock.dep_map); - lock_map_release(&engine->active.lock.dep_map); - local_irq_enable(); -#endif + mark_lock_used_irq(&engine->active.lock); } static struct intel_context * diff --git a/drivers/gpu/drm/i915/i915_utils.c b/drivers/gpu/drm/i915/i915_utils.c index 90c7f0c4838c..894de60833ec 100644 --- a/drivers/gpu/drm/i915/i915_utils.c +++ b/drivers/gpu/drm/i915/i915_utils.c @@ -127,3 +127,18 @@ void fs_reclaim_taints_mutex(struct mutex *mutex) fs_reclaim_release(GFP_KERNEL); } + +#ifdef CONFIG_DEBUG_LOCK_ALLOC +void __mark_lock_used_irq(struct lockdep_map *lock) +{ + /* + * Due to an interesting quirk in lockdep's internal debug tracking, + * after setting a subclass we must ensure the lock is used. Otherwise, + * nr_unused_locks is incremented once too often. + */ + local_irq_disable(); + lock_map_acquire(lock); + lock_map_release(lock); + local_irq_enable(); +} +#endif diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h index 4133d5193839..c3d234133da7 100644 --- a/drivers/gpu/drm/i915/i915_utils.h +++ b/drivers/gpu/drm/i915/i915_utils.h @@ -455,6 +455,13 @@ static inline bool timer_expired(const struct timer_list *t) return timer_active(t) && !timer_pending(t); } +#ifdef CONFIG_DEBUG_LOCK_ALLOC +void __mark_lock_used_irq(struct lockdep_map *lock); +#define mark_lock_used_irq(lock) __mark_lock_used_irq(&(lock)->dep_map) +#else +#define mark_lock_used_irq(lock) +#endif + /* * This is a lookalike for IS_ENABLED() that takes a kconfig value, * e.g. CONFIG_DRM_I915_SPIN_REQUEST, and evaluates whether it is non-zero -- 2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> To: Intel-gfx@lists.freedesktop.org Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>, dri-devel@lists.freedesktop.org, "Chris Wilson" <chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 03/12] drm/i915: Lift marking a lock as used to utils Date: Wed, 26 May 2021 15:14:47 +0100 [thread overview] Message-ID: <20210526141456.2334192-4-tvrtko.ursulin@linux.intel.com> (raw) In-Reply-To: <20210526141456.2334192-1-tvrtko.ursulin@linux.intel.com> From: Chris Wilson <chris@chris-wilson.co.uk> After calling lock_set_subclass() the lock _must_ be used, or else lockdep's internal nr_used_locks becomes unbalanced. Extract the little utility function to i915_utils.c Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 13 +------------ drivers/gpu/drm/i915/i915_utils.c | 15 +++++++++++++++ drivers/gpu/drm/i915/i915_utils.h | 7 +++++++ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c index 3f9a811eb02b..15566819539f 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c @@ -794,18 +794,7 @@ intel_engine_init_active(struct intel_engine_cs *engine, unsigned int subclass) spin_lock_init(&engine->active.lock); lockdep_set_subclass(&engine->active.lock, subclass); - - /* - * Due to an interesting quirk in lockdep's internal debug tracking, - * after setting a subclass we must ensure the lock is used. Otherwise, - * nr_unused_locks is incremented once too often. - */ -#ifdef CONFIG_DEBUG_LOCK_ALLOC - local_irq_disable(); - lock_map_acquire(&engine->active.lock.dep_map); - lock_map_release(&engine->active.lock.dep_map); - local_irq_enable(); -#endif + mark_lock_used_irq(&engine->active.lock); } static struct intel_context * diff --git a/drivers/gpu/drm/i915/i915_utils.c b/drivers/gpu/drm/i915/i915_utils.c index 90c7f0c4838c..894de60833ec 100644 --- a/drivers/gpu/drm/i915/i915_utils.c +++ b/drivers/gpu/drm/i915/i915_utils.c @@ -127,3 +127,18 @@ void fs_reclaim_taints_mutex(struct mutex *mutex) fs_reclaim_release(GFP_KERNEL); } + +#ifdef CONFIG_DEBUG_LOCK_ALLOC +void __mark_lock_used_irq(struct lockdep_map *lock) +{ + /* + * Due to an interesting quirk in lockdep's internal debug tracking, + * after setting a subclass we must ensure the lock is used. Otherwise, + * nr_unused_locks is incremented once too often. + */ + local_irq_disable(); + lock_map_acquire(lock); + lock_map_release(lock); + local_irq_enable(); +} +#endif diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h index 4133d5193839..c3d234133da7 100644 --- a/drivers/gpu/drm/i915/i915_utils.h +++ b/drivers/gpu/drm/i915/i915_utils.h @@ -455,6 +455,13 @@ static inline bool timer_expired(const struct timer_list *t) return timer_active(t) && !timer_pending(t); } +#ifdef CONFIG_DEBUG_LOCK_ALLOC +void __mark_lock_used_irq(struct lockdep_map *lock); +#define mark_lock_used_irq(lock) __mark_lock_used_irq(&(lock)->dep_map) +#else +#define mark_lock_used_irq(lock) +#endif + /* * This is a lookalike for IS_ENABLED() that takes a kconfig value, * e.g. CONFIG_DRM_I915_SPIN_REQUEST, and evaluates whether it is non-zero -- 2.30.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2021-05-26 14:15 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-26 14:14 [PATCH 00/12] Catchup with a few dropped patches Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 01/12] drm/i915: Take rcu_read_lock for querying fence's driver/timeline names Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-27 10:46 ` Daniel Vetter 2021-05-27 10:46 ` Daniel Vetter 2021-05-26 14:14 ` [PATCH 02/12] drm/i915: Remove notion of GEM from i915_gem_shrinker_taints_mutex Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` Tvrtko Ursulin [this message] 2021-05-26 14:14 ` [Intel-gfx] [PATCH 03/12] drm/i915: Lift marking a lock as used to utils Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 04/12] drm/i915: Wrap cmpxchg64 with try_cmpxchg64() helper Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 05/12] drm/i915/selftests: Set cache status for huge_gem_object Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 06/12] drm/i915/selftests: Use a coherent map to setup scratch batch buffers Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 07/12] drm/i915/selftests: Replace the unbounded set-domain with an explicit wait Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 08/12] drm/i915/selftests: Remove redundant set-to-gtt-domain Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 09/12] drm/i915/selftests: Replace unbound set-domain waits with explicit timeouts Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 10/12] drm/i915/selftests: Replace an unbounded set-domain wait with a timeout Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 11/12] drm/i915/selftests: Remove redundant set-to-gtt-domain before batch submission Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:14 ` [PATCH 12/12] drm/i915/gem: Manage all set-domain waits explicitly Tvrtko Ursulin 2021-05-26 14:14 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-26 14:30 ` Matthew Auld 2021-05-26 14:30 ` [Intel-gfx] " Matthew Auld 2021-05-26 14:37 ` [PATCH v2 " Tvrtko Ursulin 2021-05-26 14:37 ` [Intel-gfx] " Tvrtko Ursulin 2021-05-27 10:44 ` [PATCH " Daniel Vetter 2021-05-27 10:44 ` [Intel-gfx] " Daniel Vetter 2021-05-27 13:33 ` kernel test robot 2021-05-26 20:19 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Catchup with a few dropped patches (rev2) Patchwork 2021-05-26 20:21 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork 2021-05-26 21:00 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210526141456.2334192-4-tvrtko.ursulin@linux.intel.com \ --to=tvrtko.ursulin@linux.intel.com \ --cc=Intel-gfx@lists.freedesktop.org \ --cc=chris@chris-wilson.co.uk \ --cc=dri-devel@lists.freedesktop.org \ --cc=thomas.hellstrom@linux.intel.com \ --cc=tvrtko.ursulin@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.