From: Matthew Brost <matthew.brost@intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <lucas.demarchi@intel.com>,
<stuart.summers@intel.com>
Subject: Re: [PATCH] drm/xe: Streamline exec queue freeing path
Date: Wed, 20 Mar 2024 00:34:43 +0000 [thread overview]
Message-ID: <ZfovI81GPOS4ZceA@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <20240319175947.15890-1-niranjana.vishwanathapura@intel.com>
On Tue, Mar 19, 2024 at 10:59:46AM -0700, Niranjana Vishwanathapura wrote:
> Ensure exec queue freeing happens at one place, that is in
> __xe_exec_queue_free(). It releases q->vm reference also. Set
> q->vm before handling extensions as they can potentially reference it.
>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_exec_queue.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
> index 2016c1af9633..a1b3c7144977 100644
> --- a/drivers/gpu/drm/xe/xe_exec_queue.c
> +++ b/drivers/gpu/drm/xe/xe_exec_queue.c
> @@ -33,6 +33,13 @@ enum xe_exec_queue_sched_prop {
> static int exec_queue_user_extensions(struct xe_device *xe, struct xe_exec_queue *q,
> u64 extensions, int ext_number);
>
> +static void __xe_exec_queue_free(struct xe_exec_queue *q)
> +{
> + if (q->vm)
> + xe_vm_put(q->vm);
> + kfree(q);
> +}
> +
> static struct xe_exec_queue *__xe_exec_queue_alloc(struct xe_device *xe,
> struct xe_vm *vm,
> u32 logical_mask,
> @@ -74,6 +81,9 @@ static struct xe_exec_queue *__xe_exec_queue_alloc(struct xe_device *xe,
> else
> q->sched_props.priority = XE_EXEC_QUEUE_PRIORITY_NORMAL;
>
> + if (vm)
> + q->vm = xe_vm_get(vm);
> +
> if (extensions) {
> /*
> * may set q->usm, must come before xe_lrc_init(),
> @@ -81,14 +91,11 @@ static struct xe_exec_queue *__xe_exec_queue_alloc(struct xe_device *xe,
> */
> err = exec_queue_user_extensions(xe, q, extensions, 0);
> if (err) {
> - kfree(q);
> + __xe_exec_queue_free(q);
> return ERR_PTR(err);
> }
> }
>
> - if (vm)
> - q->vm = xe_vm_get(vm);
> -
> if (xe_exec_queue_is_parallel(q)) {
> q->parallel.composite_fence_ctx = dma_fence_context_alloc(1);
> q->parallel.composite_fence_seqno = XE_FENCE_INITIAL_SEQNO;
> @@ -97,13 +104,6 @@ static struct xe_exec_queue *__xe_exec_queue_alloc(struct xe_device *xe,
> return q;
> }
>
> -static void __xe_exec_queue_free(struct xe_exec_queue *q)
> -{
> - if (q->vm)
> - xe_vm_put(q->vm);
> - kfree(q);
> -}
> -
> static int __xe_exec_queue_init(struct xe_exec_queue *q)
> {
> struct xe_device *xe = gt_to_xe(q->gt);
> --
> 2.43.0
>
prev parent reply other threads:[~2024-03-20 0:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 17:59 [PATCH] drm/xe: Streamline exec queue freeing path Niranjana Vishwanathapura
2024-03-19 20:16 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-19 20:16 ` ✓ CI.checkpatch: " Patchwork
2024-03-19 20:17 ` ✓ CI.KUnit: " Patchwork
2024-03-19 20:27 ` ✓ CI.Build: " Patchwork
2024-03-19 20:30 ` ✓ CI.Hooks: " Patchwork
2024-03-19 20:31 ` ✓ CI.checksparse: " Patchwork
2024-03-19 20:57 ` ✓ CI.BAT: " Patchwork
2024-03-20 0:34 ` Matthew Brost [this message]
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=ZfovI81GPOS4ZceA@DUT025-TGLU.fm.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=niranjana.vishwanathapura@intel.com \
--cc=stuart.summers@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