Commit 0f797650 authored by Matthew Brost's avatar Matthew Brost Committed by John Harrison

drm/i915/guc: Rework and simplify locking

Rework and simplify the locking with GuC subission. Drop
sched_state_no_lock and move all fields under the guc_state.sched_state
and protect all these fields with guc_state.lock . This requires
changing the locking hierarchy from guc_state.lock -> sched_engine.lock
to sched_engine.lock -> guc_state.lock.

v2:
 (Daniele)
  - Don't check fields outside of lock during sched disable, check less
    fields within lock as some of the outside are no longer needed
Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210909164744.31249-18-matthew.brost@intel.com
parent 52d66c06
...@@ -161,7 +161,7 @@ struct intel_context { ...@@ -161,7 +161,7 @@ struct intel_context {
* sched_state: scheduling state of this context using GuC * sched_state: scheduling state of this context using GuC
* submission * submission
*/ */
u16 sched_state; u32 sched_state;
/* /*
* fences: maintains of list of requests that have a submit * fences: maintains of list of requests that have a submit
* fence related to GuC submission * fence related to GuC submission
...@@ -178,9 +178,6 @@ struct intel_context { ...@@ -178,9 +178,6 @@ struct intel_context {
struct list_head requests; struct list_head requests;
} guc_active; } guc_active;
/* GuC scheduling state flags that do not require a lock. */
atomic_t guc_sched_state_no_lock;
/* GuC LRC descriptor ID */ /* GuC LRC descriptor ID */
u16 guc_id; u16 guc_id;
......
...@@ -903,7 +903,6 @@ DECLARE_EVENT_CLASS(intel_context, ...@@ -903,7 +903,6 @@ DECLARE_EVENT_CLASS(intel_context,
__field(u32, guc_id) __field(u32, guc_id)
__field(int, pin_count) __field(int, pin_count)
__field(u32, sched_state) __field(u32, sched_state)
__field(u32, guc_sched_state_no_lock)
__field(u8, guc_prio) __field(u8, guc_prio)
), ),
...@@ -911,15 +910,12 @@ DECLARE_EVENT_CLASS(intel_context, ...@@ -911,15 +910,12 @@ DECLARE_EVENT_CLASS(intel_context,
__entry->guc_id = ce->guc_id; __entry->guc_id = ce->guc_id;
__entry->pin_count = atomic_read(&ce->pin_count); __entry->pin_count = atomic_read(&ce->pin_count);
__entry->sched_state = ce->guc_state.sched_state; __entry->sched_state = ce->guc_state.sched_state;
__entry->guc_sched_state_no_lock =
atomic_read(&ce->guc_sched_state_no_lock);
__entry->guc_prio = ce->guc_prio; __entry->guc_prio = ce->guc_prio;
), ),
TP_printk("guc_id=%d, pin_count=%d sched_state=0x%x,0x%x, guc_prio=%u", TP_printk("guc_id=%d, pin_count=%d sched_state=0x%x, guc_prio=%u",
__entry->guc_id, __entry->pin_count, __entry->guc_id, __entry->pin_count,
__entry->sched_state, __entry->sched_state,
__entry->guc_sched_state_no_lock,
__entry->guc_prio) __entry->guc_prio)
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment