Skip to content

Commit

Permalink
drm/i915/gt: Mark up the nested engine-pm timeline lock as irqsafe
Browse files Browse the repository at this point in the history
We use a fake timeline->mutex lock to reassure lockdep that the timeline
is always locked when emitting requests. However, the use inside
__engine_park() may be inside hardirq and so lockdep now complains about
the mixed irq-state of the nested locked. Disable irqs around the
lockdep tracking to keep it happy.

Fixes: 6c69a45 ("drm/i915/gt: Mark context->active_count as protected by timeline->mutex")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190819075835.20065-3-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Aug 19, 2019
1 parent 6a736eb commit d677392
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/gpu/drm/i915/gt/intel_engine_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,34 @@ static int __engine_unpark(struct intel_wakeref *wf)
return 0;
}

#if IS_ENABLED(CONFIG_LOCKDEP)

static inline void __timeline_mark_lock(struct intel_context *ce)
{
unsigned long flags;

local_irq_save(flags);
mutex_acquire(&ce->timeline->mutex.dep_map, 2, 0, _THIS_IP_);
local_irq_restore(flags);
}

static inline void __timeline_mark_unlock(struct intel_context *ce)
{
mutex_release(&ce->timeline->mutex.dep_map, 0, _THIS_IP_);
}

#else

static inline void __timeline_mark_lock(struct intel_context *ce)
{
}

static inline void __timeline_mark_unlock(struct intel_context *ce)
{
}

#endif /* !IS_ENABLED(CONFIG_LOCKDEP) */

static bool switch_to_kernel_context(struct intel_engine_cs *engine)
{
struct i915_request *rq;
Expand Down

0 comments on commit d677392

Please sign in to comment.