From: Lucas De Marchi <lucas.demarchi@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>,
Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH 2/3] drm/xe: Accumulate exec queue timestamp on destroy
Date: Sat, 26 Oct 2024 01:26:57 -0500 [thread overview]
Message-ID: <20241026062658.28060-3-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20241026062658.28060-1-lucas.demarchi@intel.com>
When the exec queue is destroyed, there's a race between a query to the
fdinfo and the exec queue value being updated: after the destroy ioctl,
if the fdinfo is queried before a call to guc_exec_queue_free_job(),
the wrong utilization is reported: it's not accumulated on the query
since the queue was removed from the array, and the value wasn't updated
yet by the free_job().
Explicitly accumulate the engine utilization so the right value is
visible after the ioctl return.
Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2667
Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
drivers/gpu/drm/xe/xe_exec_queue.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
index d098d2dd1b2d..b15ca84b2422 100644
--- a/drivers/gpu/drm/xe/xe_exec_queue.c
+++ b/drivers/gpu/drm/xe/xe_exec_queue.c
@@ -829,6 +829,14 @@ int xe_exec_queue_destroy_ioctl(struct drm_device *dev, void *data,
xe_exec_queue_kill(q);
+ /*
+ * After killing and destroying the exec queue, make sure userspace has
+ * an updated view of the run ticks, regardless if this was the last
+ * ref: since the exec queue is removed from xef->exec_queue.xa, a
+ * query to fdinfo after this returns could not account for this load.
+ */
+ xe_exec_queue_update_run_ticks(q);
+
trace_xe_exec_queue_close(q);
xe_exec_queue_put(q);
--
2.47.0
next prev parent reply other threads:[~2024-10-26 6:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 6:26 [PATCH 0/3] drm/xe: Fix races on fdinfo Lucas De Marchi
2024-10-26 6:26 ` [PATCH 1/3] drm/xe: Add trace to lrc timestamp update Lucas De Marchi
2024-10-28 12:40 ` Nirmoy Das
2024-10-26 6:26 ` Lucas De Marchi [this message]
2024-10-28 12:46 ` [PATCH 2/3] drm/xe: Accumulate exec queue timestamp on destroy Nirmoy Das
2024-10-26 6:26 ` [PATCH 3/3] drm/xe: Stop accumulating LRC timestamp on job_free Lucas De Marchi
2024-10-28 15:39 ` ✗ Fi.CI.CHECKPATCH: warning for drm/xe: Fix races on fdinfo Patchwork
2024-10-28 15:39 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-10-28 15:43 ` ✓ Fi.CI.BAT: success " 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=20241026062658.28060-3-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.com \
--cc=umesh.nerlige.ramappa@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