Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Aakash Deep Sarkar <aakash.deep.sarkar@intel.com>,
	intel-xe@lists.freedesktop.org
Cc: jeevaka.badrappan@intel.com, rodrigo.vivi@intel.com,
	matthew.brost@intel.com, carlos.santa@intel.com,
	matthew.auld@intel.com,
	Aakash Deep Sarkar <aakash.deep.sarkar@intel.com>
Subject: Re: [PATCH v4 8/9] drm/xe: Handle xe_work_period destruction
Date: Fri, 26 Sep 2025 14:32:20 +0300	[thread overview]
Message-ID: <410b1c3689f9d95a27a3826e4efabc2b23faa112@intel.com> (raw)
In-Reply-To: <20250926104521.1815428-9-aakash.deep.sarkar@intel.com>

On Fri, 26 Sep 2025, Aakash Deep Sarkar <aakash.deep.sarkar@intel.com> wrote:
> This adds the xe_work_period destruction procedure.
> We iterate over all entries in the xe::work_period::users
> xarray and cancel any pending delayed work. Then destroy
> the xarray itself.
>
> Signed-off-by: Aakash Deep Sarkar <aakash.deep.sarkar@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index c34da72e5c9a..e270f57a9750 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -419,6 +419,8 @@ static struct drm_driver driver = {
>  static void xe_device_destroy(struct drm_device *dev, void *dummy)
>  {
>  	struct xe_device *xe = to_xe_device(dev);
> +	struct xe_user *user = NULL;
> +	unsigned long i;
>  
>  	xe_bo_dev_fini(&xe->bo_device);
>  
> @@ -434,6 +436,15 @@ static void xe_device_destroy(struct drm_device *dev, void *dummy)
>  	if (xe->destroy_wq)
>  		destroy_workqueue(xe->destroy_wq);
>  
> +
> +	mutex_lock(&xe->work_period.lock);
> +	xa_for_each(&xe->work_period.users, i, user) {
> +		if (cancel_delayed_work_sync(&user->delay_work))
> +			xe_user_put(user);
> +	}
> +	xa_destroy(&xe->work_period.users);
> +	mutex_unlock(&xe->work_period.lock);

These are all user details, why are they in xe_device_destroy()? Add a
new function that does this for you, and hide all the details away.

BR,
Jani.

> +
>  	ttm_device_fini(&xe->ttm);
>  }

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-09-26 11:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26 10:45 [PATCH v4 0/9] [ANDROID]: Add GPU work period support for Xe driver Aakash Deep Sarkar
2025-09-26 10:45 ` [PATCH v4 1/9] drm/xe: Add a new xe_user structure Aakash Deep Sarkar
2025-10-02 14:40   ` Rodrigo Vivi
2025-09-26 10:45 ` [PATCH v4 2/9] drm/xe: Add xe_gt_clock_interval_to_ns function Aakash Deep Sarkar
2025-09-26 10:45 ` [PATCH v4 3/9] drm/xe: Add a trace point for GPU work period Aakash Deep Sarkar
2025-10-02 14:42   ` Rodrigo Vivi
2025-10-03 21:41     ` Dixit, Ashutosh
2025-09-26 10:45 ` [PATCH v4 4/9] drm/xe: Modify xe_exec_queue_update_run_ticks Aakash Deep Sarkar
2025-09-26 10:45 ` [PATCH v4 5/9] drm/xe: Handle xe_user creation and removal Aakash Deep Sarkar
2025-09-26 11:29   ` Jani Nikula
2025-09-26 10:45 ` [PATCH v4 6/9] drm/xe: Implement xe_work_period_worker Aakash Deep Sarkar
2025-09-26 11:31   ` Jani Nikula
2025-09-26 10:45 ` [PATCH v4 7/9] drm/xe: Add a Kconfig option for GPU work period Aakash Deep Sarkar
2025-09-26 10:45 ` [PATCH v4 8/9] drm/xe: Handle xe_work_period destruction Aakash Deep Sarkar
2025-09-26 11:32   ` Jani Nikula [this message]
2025-09-26 10:45 ` [PATCH v4 9/9] Hack patch: Do not merge Aakash Deep Sarkar
2025-09-26 11:59 ` ✗ CI.checkpatch: warning for : Add GPU work period support for Xe driver (rev4) Patchwork
2025-09-26 12:01 ` ✓ CI.KUnit: success " Patchwork
2025-09-26 12:51 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-09-26 18:04 ` ✗ Xe.CI.Full: " 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=410b1c3689f9d95a27a3826e4efabc2b23faa112@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=aakash.deep.sarkar@intel.com \
    --cc=carlos.santa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jeevaka.badrappan@intel.com \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@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