[PATCH 4/4] drm/xe/guc: Flush G2H handler when turning off CTs
Matthew Brost
matthew.brost at intel.com
Fri Dec 29 04:35:07 UTC 2023
Make sure G2H handler is not running when changing the CT state to drop
messages or disabled. This will help prevent races in the code ensuring
that G2H are not being processed after changing the state.
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
drivers/gpu/drm/xe/xe_guc_ct.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
index 8c91d189d859..24331d20ddf8 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.c
+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
@@ -328,14 +328,21 @@ int xe_guc_ct_enable(struct xe_guc_ct *ct)
return err;
}
+static void flush_g2h_handler(struct xe_guc_ct *ct)
+{
+ cancel_work_sync(&ct->g2h_worker);
+}
+
void xe_guc_ct_disable(struct xe_guc_ct *ct)
{
xe_guc_ct_set_state(ct, XE_GUC_CT_STATE_DISABLED);
+ flush_g2h_handler(ct);
}
void xe_guc_ct_drop_messages(struct xe_guc_ct *ct)
{
xe_guc_ct_set_state(ct, XE_GUC_CT_STATE_DROP_MESSAGES);
+ flush_g2h_handler(ct);
xa_destroy(&ct->fence_lookup);
}
--
2.34.1
More information about the Intel-xe
mailing list