Skip to content

Commit

Permalink
drm/i915: Replace nested subclassing with explicit subclasses
Browse files Browse the repository at this point in the history
In the next patch, we will want a third distinct class of timeline that
may overlap with the current pair of client and engine timeline classes.
Rather than use the ad hoc markup of SINGLE_DEPTH_NESTING, initialise
the different timeline classes with an explicit subclass.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180706210710.16251-1-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Jul 7, 2018
1 parent 07e070e commit 890fd18
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -3095,7 +3095,7 @@ static void engine_skip_context(struct i915_request *request)
GEM_BUG_ON(timeline == &engine->timeline);

spin_lock_irqsave(&engine->timeline.lock, flags);
spin_lock_nested(&timeline->lock, SINGLE_DEPTH_NESTING);
spin_lock(&timeline->lock);

list_for_each_entry_continue(request, &engine->timeline.requests, link)
if (request->gem_context == hung_ctx)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ static void move_to_timeline(struct i915_request *request,
GEM_BUG_ON(request->timeline == &request->engine->timeline);
lockdep_assert_held(&request->engine->timeline.lock);

spin_lock_nested(&request->timeline->lock, SINGLE_DEPTH_NESTING);
spin_lock(&request->timeline->lock);
list_move_tail(&request->link, &timeline->requests);
spin_unlock(&request->timeline->lock);
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/i915/i915_timeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ struct i915_timeline {
u32 seqno;

spinlock_t lock;
#define TIMELINE_CLIENT 0 /* default subclass */
#define TIMELINE_ENGINE 1

/**
* List of breadcrumbs associated with GPU requests currently
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/i915/intel_engine_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ static void intel_engine_init_execlist(struct intel_engine_cs *engine)
void intel_engine_setup_common(struct intel_engine_cs *engine)
{
i915_timeline_init(engine->i915, &engine->timeline, engine->name);
lockdep_set_subclass(&engine->timeline.lock, TIMELINE_ENGINE);

intel_engine_init_execlist(engine);
intel_engine_init_hangcheck(engine);
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/i915/selftests/mock_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
engine->base.submit_request = mock_submit_request;

i915_timeline_init(i915, &engine->base.timeline, engine->base.name);
lockdep_set_subclass(&engine->base.timeline.lock, TIMELINE_ENGINE);

intel_engine_init_breadcrumbs(&engine->base);
engine->base.breadcrumbs.mock = true; /* prevent touching HW for irqs */

Expand Down

0 comments on commit 890fd18

Please sign in to comment.