From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Subject: [PATCH v5 3/3] drm/xe/guc: Flush G2H handler when turning off CTs
Date: Mon, 22 Jan 2024 13:01:56 -0800 [thread overview]
Message-ID: <20240122210156.1517444-4-matthew.brost@intel.com> (raw)
In-Reply-To: <20240122210156.1517444-1-matthew.brost@intel.com>
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.
v2:
- s/flush_g2h_handler/stop_g2h_handler (Michal)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
drivers/gpu/drm/xe/xe_guc_ct.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
index 1c915a26bb97..bc6e656c3bf4 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.c
+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
@@ -346,26 +346,35 @@ int xe_guc_ct_enable(struct xe_guc_ct *ct)
return err;
}
+static void stop_g2h_handler(struct xe_guc_ct *ct)
+{
+ cancel_work_sync(&ct->g2h_worker);
+}
+
+
/**
* xe_guc_ct_disable - Set GuC to disabled state
* @ct: the &xe_guc_ct
*
- * Set GuC CT to disabled state, no outstanding g2h expected in this transition
+ * Set GuC CT to disabled state and stop g2h handler. No outstanding g2h expected
+ * in this transition.
*/
void xe_guc_ct_disable(struct xe_guc_ct *ct)
{
xe_guc_ct_set_state(ct, XE_GUC_CT_STATE_DISABLED);
+ stop_g2h_handler(ct);
}
/**
* xe_guc_ct_stop - Set GuC to stopped state
* @ct: the &xe_guc_ct
*
- * Set GuC CT to stopped state and clear any outstanding g2h
+ * Set GuC CT to stopped state, stop g2h handler, and clear any outstanding g2h
*/
void xe_guc_ct_stop(struct xe_guc_ct *ct)
{
xe_guc_ct_set_state(ct, XE_GUC_CT_STATE_STOPPED);
+ stop_g2h_handler(ct);
}
static bool h2g_has_room(struct xe_guc_ct *ct, u32 cmd_len)
--
2.34.1
next prev parent reply other threads:[~2024-01-22 21:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 21:01 [PATCH v5 0/3] GuC CT tweaks Matthew Brost
2024-01-22 21:01 ` [PATCH v5 1/3] drm/xe/guc: Add more GuC CT states Matthew Brost
2024-01-22 21:01 ` [PATCH v5 2/3] drm/xe: Move TLB invalidation reset before HW reset Matthew Brost
2024-01-22 21:01 ` Matthew Brost [this message]
2024-01-22 21:04 ` ✓ CI.Patch_applied: success for GuC CT tweaks Patchwork
2024-01-22 21:04 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-22 21:05 ` ✓ CI.KUnit: success " Patchwork
2024-01-22 21:13 ` ✓ CI.Build: " Patchwork
2024-01-22 21:13 ` ✗ CI.Hooks: failure " Patchwork
2024-01-22 21:14 ` ✓ CI.checksparse: success " Patchwork
2024-01-22 21:38 ` ✓ CI.BAT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240122210156.1517444-4-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox