drm/xe/hw_engine_group: Ensure safe transition between execution modes
authorFrancois Dugast <francois.dugast@intel.com>
Fri, 9 Aug 2024 15:51:33 +0000 (17:51 +0200)
committerMatthew Brost <matthew.brost@intel.com>
Sun, 18 Aug 2024 01:31:56 +0000 (18:31 -0700)
commit770bd1d341130ff38feda169177159cd78389cfc
tree11b8ec9242410b985e775c9bb990f558e4f777ed
parent2750ff97ee385b85195c5579ee911a551fbb0dd9
drm/xe/hw_engine_group: Ensure safe transition between execution modes

Provide a way to safely transition execution modes of the hw engine group
ahead of the actual execution. When necessary, either wait for running
jobs to complete or preempt them, thus ensuring mutual exclusion between
execution modes.

Unlike a mutex, the rw_semaphore used in this context allows multiple
submissions in the same mode.

v2: Use lockdep_assert_held_write, add annotations (Matt Brost)

v3: Fix kernel doc, remove redundant code (Matt Brost)

v4: Now that xe_hw_engine_group_suspend_faulting_lr_jobs can fail,
    propagate the error to the caller (Matt Brost)

Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240809155156.1955925-9-francois.dugast@intel.com
drivers/gpu/drm/xe/xe_hw_engine_group.c
drivers/gpu/drm/xe/xe_hw_engine_group.h