From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
intel-xe@lists.freedesktop.org
Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>,
Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: Re: [PATCH 3/3] drm/xe: Stop accumulating LRC timestamp on job_free
Date: Mon, 28 Oct 2024 18:23:25 +0100 [thread overview]
Message-ID: <d2ac9d9a-76d2-483e-bdb0-2e81954549d0@linux.intel.com> (raw)
In-Reply-To: <20241026170952.94670-5-lucas.demarchi@intel.com>
On 10/26/2024 7:08 PM, Lucas De Marchi wrote:
> The exec queue timestamp is only really useful when it's being queried
> through the fdinfo. There's no need to update it so often, on every
> job_free. Tracing a simple app like vkcube running shows an update
> rate of ~ 120Hz.
>
> The update on job_free() is used to cover a gap: if exec
> queue is created and destroyed rapidily, before a new query, the
> timestamp still needs to be accumulated and accounted on the xef.
> Initial implementation in commit 6109f24f87d7 ("drm/xe: Add helper to
> accumulate exec queue runtime") couldn't do it on the exec_queue_fini
> since the xef could be gone at that point. However since commit
> ce8c161cbad4 ("drm/xe: Add ref counting for xe_file") the xef is
> refcounted and the exec queue has a reference.
>
> Improve the fix in commit 2149ded63079 ("drm/xe: Fix use after free when
> client stats are captured") by reducing the frequency in which the
> update is needed.
>
> Fixes: 2149ded63079 ("drm/xe: Fix use after free when client stats are captured")
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
> drivers/gpu/drm/xe/xe_exec_queue.c | 6 ++++++
> drivers/gpu/drm/xe/xe_guc_submit.c | 2 --
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
> index b15ca84b2422..bc2fc917e0de 100644
> --- a/drivers/gpu/drm/xe/xe_exec_queue.c
> +++ b/drivers/gpu/drm/xe/xe_exec_queue.c
> @@ -260,8 +260,14 @@ void xe_exec_queue_fini(struct xe_exec_queue *q)
> {
> int i;
>
> + /*
> + * Before releasing our ref to lrc and xef, accumulate our run ticks
> + */
> + xe_exec_queue_update_run_ticks(q);
> +
> for (i = 0; i < q->width; ++i)
> xe_lrc_put(q->lrc[i]);
> +
> __xe_exec_queue_free(q);
> }
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index e5d7c767a744..ebe4665d9159 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -747,8 +747,6 @@ static void guc_exec_queue_free_job(struct drm_sched_job *drm_job)
> {
> struct xe_sched_job *job = to_xe_sched_job(drm_job);
>
> - xe_exec_queue_update_run_ticks(job->q);
> -
> trace_xe_sched_job_free(job);
> xe_sched_job_put(job);
> }
next prev parent reply other threads:[~2024-10-28 17:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 17:08 [PATCH 0/3] drm/xe: Fix races on fdinfo Lucas De Marchi
2024-10-26 17:08 ` [PATCH 1/3] drm/xe: Add trace to lrc timestamp update Lucas De Marchi
2024-10-28 14:37 ` Cavitt, Jonathan
2024-10-26 17:08 ` [PATCH 2/3] drm/xe: Accumulate exec queue timestamp on destroy Lucas De Marchi
2024-10-28 14:38 ` Cavitt, Jonathan
2024-10-28 20:33 ` Umesh Nerlige Ramappa
2024-10-28 21:59 ` Matthew Brost
2024-10-28 22:17 ` Cavitt, Jonathan
2024-10-28 23:05 ` Lucas De Marchi
2024-10-28 22:32 ` Lucas De Marchi
2024-10-29 17:27 ` Umesh Nerlige Ramappa
2024-10-29 17:58 ` Lucas De Marchi
2024-10-29 19:03 ` Umesh Nerlige Ramappa
2024-10-29 19:12 ` Lucas De Marchi
2024-10-29 19:31 ` Umesh Nerlige Ramappa
2024-10-29 19:53 ` Lucas De Marchi
2024-10-26 17:08 ` [PATCH 3/3] drm/xe: Stop accumulating LRC timestamp on job_free Lucas De Marchi
2024-10-28 17:23 ` Nirmoy Das [this message]
2024-10-28 20:29 ` Cavitt, Jonathan
2024-10-26 17:15 ` ✓ CI.Patch_applied: success for drm/xe: Fix races on fdinfo Patchwork
2024-10-26 17:16 ` ✗ CI.checkpatch: warning " Patchwork
2024-10-26 17:17 ` ✓ CI.KUnit: success " Patchwork
2024-10-26 17:29 ` ✓ CI.Build: " Patchwork
2024-10-26 17:31 ` ✓ CI.Hooks: " Patchwork
2024-10-26 17:32 ` ✓ CI.checksparse: " Patchwork
2024-10-26 17:57 ` ✓ CI.BAT: " Patchwork
2024-10-27 16:45 ` ✗ CI.FULL: failure " Patchwork
2024-10-29 20:02 ` ✗ CI.Patch_applied: failure for drm/xe: Fix races on fdinfo (rev2) Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-10-26 6:26 [PATCH 0/3] drm/xe: Fix races on fdinfo Lucas De Marchi
2024-10-26 6:26 ` [PATCH 3/3] drm/xe: Stop accumulating LRC timestamp on job_free Lucas De Marchi
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=d2ac9d9a-76d2-483e-bdb0-2e81954549d0@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.com \
--cc=lucas.demarchi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.