From: Maciej Patelczyk <maciej.patelczyk@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: niranjana.vishwanathapura@intel.com,
Maciej Patelczyk <maciej.patelczyk@intel.com>
Subject: [PATCH 1/2] drm/xe: introduce xe_gt_reset_wait to wait for async gt reset
Date: Mon, 9 Dec 2024 15:12:09 +0100 [thread overview]
Message-ID: <20241209141210.1311374-2-maciej.patelczyk@intel.com> (raw)
In-Reply-To: <20241209141210.1311374-1-maciej.patelczyk@intel.com>
The reset of the GT is asynchronous.
Adding a wait helper to wait until gt reset is done.
Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
---
drivers/gpu/drm/xe/tests/xe_bo.c | 2 +-
drivers/gpu/drm/xe/tests/xe_mocs.c | 2 +-
drivers/gpu/drm/xe/xe_gt.h | 12 ++++++++++++
drivers/gpu/drm/xe/xe_gt_debugfs.c | 2 +-
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c
index c9ec7a313c6b..b51434fc5bd1 100644
--- a/drivers/gpu/drm/xe/tests/xe_bo.c
+++ b/drivers/gpu/drm/xe/tests/xe_bo.c
@@ -266,7 +266,7 @@ static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struc
*/
for_each_gt(__gt, xe, id) {
xe_gt_reset_async(__gt);
- flush_work(&__gt->reset.worker);
+ xe_gt_reset_wait(__gt);
}
if (err) {
KUNIT_FAIL(test, "restore kernel err=%pe\n",
diff --git a/drivers/gpu/drm/xe/tests/xe_mocs.c b/drivers/gpu/drm/xe/tests/xe_mocs.c
index 6f9b7a266b41..7bfba172ce2a 100644
--- a/drivers/gpu/drm/xe/tests/xe_mocs.c
+++ b/drivers/gpu/drm/xe/tests/xe_mocs.c
@@ -163,7 +163,7 @@ static int mocs_reset_test_run_device(struct xe_device *xe)
read_l3cc_table(gt, &mocs.table);
xe_gt_reset_async(gt);
- flush_work(>->reset.worker);
+ xe_gt_reset_wait(gt);
kunit_info(test, "mocs_reset_test after reset\n");
if (flags & HAS_GLOBAL_MOCS)
diff --git a/drivers/gpu/drm/xe/xe_gt.h b/drivers/gpu/drm/xe/xe_gt.h
index 82b9b7f82fca..3e75f623c346 100644
--- a/drivers/gpu/drm/xe/xe_gt.h
+++ b/drivers/gpu/drm/xe/xe_gt.h
@@ -56,6 +56,18 @@ void xe_gt_sanitize(struct xe_gt *gt);
int xe_gt_sanitize_freq(struct xe_gt *gt);
void xe_gt_remove(struct xe_gt *gt);
+/**
+ * xe_gt_reset_wait - wait for gt's async reset to finalize.
+ * @gt: GT structure
+ * Return:
+ * %true if xe_gt_reset_wait() waited for the work to finish execution,
+ * %false if there was no scheduled reset or it was done.
+ */
+static inline bool xe_gt_reset_wait(struct xe_gt *gt)
+{
+ return flush_work(>->reset.worker);
+}
+
/**
* xe_gt_any_hw_engine_by_reset_domain - scan the list of engines and return the
* first that matches the same reset domain as @class
diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
index 3e8c351a0eab..79f61532fd00 100644
--- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
@@ -135,7 +135,7 @@ static int force_reset_sync(struct xe_gt *gt, struct drm_printer *p)
xe_gt_reset_async(gt);
xe_pm_runtime_put(gt_to_xe(gt));
- flush_work(>->reset.worker);
+ xe_gt_reset_wait(gt);
return 0;
}
--
2.43.0
next prev parent reply other threads:[~2024-12-09 14:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 14:12 [PATCH 0/2] drm/xe: adding wait helper for gt async reset Maciej Patelczyk
2024-12-09 14:12 ` Maciej Patelczyk [this message]
2024-12-09 14:42 ` [PATCH 1/2] drm/xe: introduce xe_gt_reset_wait to wait for async gt reset Raag Jadav
2024-12-09 14:54 ` Raag Jadav
2024-12-09 16:22 ` Lucas De Marchi
2024-12-09 19:39 ` Maciej Patelczyk
2024-12-09 20:05 ` Lucas De Marchi
2024-12-09 14:12 ` [PATCH 2/2] drm/xe: make change ccs_mode a synchronous action Maciej Patelczyk
2024-12-09 16:26 ` Lucas De Marchi
2024-12-09 19:31 ` Maciej Patelczyk
2024-12-09 14:50 ` ✓ CI.Patch_applied: success for drm/xe: adding wait helper for gt async reset Patchwork
2024-12-09 14:50 ` ✓ CI.checkpatch: " Patchwork
2024-12-09 14:51 ` ✗ CI.KUnit: failure " 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=20241209141210.1311374-2-maciej.patelczyk@intel.com \
--to=maciej.patelczyk@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=niranjana.vishwanathapura@intel.com \
/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