From: Tomasz Lis <tomasz.lis@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Michał Winiarski" <michal.winiarski@intel.com>,
"Michał Wajdeczko" <michal.wajdeczko@intel.com>
Subject: [PATCH v5 5/5] drm/xe/vf: Defer fixups if migrated twice fast
Date: Tue, 29 Oct 2024 20:39:56 +0100 [thread overview]
Message-ID: <20241029193956.1043614-6-tomasz.lis@intel.com> (raw)
In-Reply-To: <20241029193956.1043614-1-tomasz.lis@intel.com>
If another VF migration happened during post-migration recovery,
then the current worker should be finished to allow the next
one start swiftly and cleanly.
Check for defer in two places: before fixups, and before
sending RESFIX_DONE.
Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
---
drivers/gpu/drm/xe/xe_sriov_vf.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_sriov_vf.c b/drivers/gpu/drm/xe/xe_sriov_vf.c
index 6aac4e7d5945..1352584669c8 100644
--- a/drivers/gpu/drm/xe/xe_sriov_vf.c
+++ b/drivers/gpu/drm/xe/xe_sriov_vf.c
@@ -50,6 +50,19 @@ static int vf_post_migration_requery_guc(struct xe_device *xe)
return ret;
}
+/*
+ * vf_post_migration_imminent - Check if post-restore recovery is coming.
+ * @xe: the &xe_device struct instance
+ *
+ * Return: True if migration recovery worker will soon be running. Any worker currently
+ * executing does not affect the result.
+ */
+static bool vf_post_migration_imminent(struct xe_device *xe)
+{
+ return xe->sriov.vf.migration.gt_flags != 0 ||
+ work_pending(&xe->sriov.vf.migration.worker);
+}
+
/*
* Notify all GuCs about resource fixups apply finished.
*/
@@ -59,8 +72,14 @@ static void vf_post_migration_notify_resfix_done(struct xe_device *xe)
unsigned int id;
for_each_gt(gt, xe, id) {
+ if (vf_post_migration_imminent(xe))
+ goto skip;
xe_gt_sriov_vf_notify_resfix_done(gt);
}
+ return;
+
+skip:
+ drm_dbg(&xe->drm, "another recovery imminent, skipping notifications\n");
}
static void vf_post_migration_recovery(struct xe_device *xe)
@@ -70,6 +89,8 @@ static void vf_post_migration_recovery(struct xe_device *xe)
drm_dbg(&xe->drm, "migration recovery in progress\n");
xe_pm_runtime_get(xe);
err = vf_post_migration_requery_guc(xe);
+ if (vf_post_migration_imminent(xe))
+ goto defer;
if (unlikely(err))
goto fail;
@@ -78,6 +99,10 @@ static void vf_post_migration_recovery(struct xe_device *xe)
xe_pm_runtime_put(xe);
drm_notice(&xe->drm, "migration recovery ended\n");
return;
+defer:
+ xe_pm_runtime_put(xe);
+ drm_dbg(&xe->drm, "migration recovery deferred\n");
+ return;
fail:
xe_pm_runtime_put(xe);
drm_err(&xe->drm, "migration recovery failed (%pe)\n", ERR_PTR(err));
--
2.25.1
next prev parent reply other threads:[~2024-10-29 19:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 19:39 [PATCH v5 0/5] drm/xe/vf: Post-migration recovery worker basis Tomasz Lis
2024-10-29 19:39 ` [PATCH v5 1/5] drm/xe/vf: React to MIGRATED interrupt Tomasz Lis
2024-11-03 20:39 ` Michal Wajdeczko
2024-10-29 19:39 ` [PATCH v5 2/5] drm/xe/vf: Document SRIOV VF restore flow Tomasz Lis
2024-11-03 21:21 ` Michal Wajdeczko
2024-11-04 18:46 ` Lis, Tomasz
2024-11-04 20:59 ` Michal Wajdeczko
2024-10-29 19:39 ` [PATCH v5 3/5] drm/xe/vf: Send RESFIX_DONE message at end of VF restore Tomasz Lis
2024-10-29 19:39 ` [PATCH v5 4/5] drm/xe/vf: Start post-migration fixups with provisinoning query Tomasz Lis
2024-10-29 19:39 ` Tomasz Lis [this message]
2024-10-29 20:57 ` ✓ CI.Patch_applied: success for drm/xe/vf: Post-migration recovery worker basis (rev5) Patchwork
2024-10-29 20:57 ` ✗ CI.checkpatch: warning " Patchwork
2024-10-29 20:58 ` ✓ CI.KUnit: success " Patchwork
2024-10-29 21:10 ` ✓ CI.Build: " Patchwork
2024-10-29 21:12 ` ✓ CI.Hooks: " Patchwork
2024-10-29 21:14 ` ✓ CI.checksparse: " Patchwork
2024-10-29 21:42 ` ✓ CI.BAT: " Patchwork
2024-10-30 1:58 ` ✗ CI.FULL: 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=20241029193956.1043614-6-tomasz.lis@intel.com \
--to=tomasz.lis@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
--cc=michal.winiarski@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