From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Maciej Patelczyk <maciej.patelczyk@intel.com>,
intel-xe@lists.freedesktop.org
Cc: lucas.demarchi@intel.com, raag.jadav@intel.com
Subject: Re: [PATCH v3 1/2] drm/xe: introduce xe_gt_reset and xe_gt_wait_for_reset
Date: Wed, 11 Dec 2024 12:39:06 +0100 [thread overview]
Message-ID: <01e6467e-c5b2-46a7-9f84-125186bfe8af@linux.intel.com> (raw)
In-Reply-To: <20241211111727.1481476-2-maciej.patelczyk@intel.com>
On 12/11/2024 12:17 PM, Maciej Patelczyk wrote:
> Add synchronous version gt reset as there are few places where it
> is expected.
> Also add a wait helper to wait until gt reset is done.
>
> Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Patch 2 needs this so the same fixes should be applies here too
Fixes: f3bc5bb4d53d ("drm/xe: Allow userspace to configure CCS mode")
Cc: <stable@vger.kernel.org> # v6.8+
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
> drivers/gpu/drm/xe/tests/xe_bo.c | 7 +++----
> drivers/gpu/drm/xe/tests/xe_mocs.c | 3 +--
> drivers/gpu/drm/xe/xe_gt.h | 25 +++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_gt_debugfs.c | 4 +---
> 4 files changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c
> index c9ec7a313c6b..a1af45e06189 100644
> --- a/drivers/gpu/drm/xe/tests/xe_bo.c
> +++ b/drivers/gpu/drm/xe/tests/xe_bo.c
> @@ -264,10 +264,9 @@ static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struc
> * however seems quite fragile not to also restart the GT. Try
> * to do that here by triggering a GT reset.
> */
> - for_each_gt(__gt, xe, id) {
> - xe_gt_reset_async(__gt);
> - flush_work(&__gt->reset.worker);
> - }
> + for_each_gt(__gt, xe, id)
> + xe_gt_reset(__gt);
> +
> if (err) {
> KUNIT_FAIL(test, "restore kernel err=%pe\n",
> ERR_PTR(err));
> diff --git a/drivers/gpu/drm/xe/tests/xe_mocs.c b/drivers/gpu/drm/xe/tests/xe_mocs.c
> index 6f9b7a266b41..2698e433c6fa 100644
> --- a/drivers/gpu/drm/xe/tests/xe_mocs.c
> +++ b/drivers/gpu/drm/xe/tests/xe_mocs.c
> @@ -162,8 +162,7 @@ static int mocs_reset_test_run_device(struct xe_device *xe)
> if (flags & HAS_LNCF_MOCS)
> read_l3cc_table(gt, &mocs.table);
>
> - xe_gt_reset_async(gt);
> - flush_work(>->reset.worker);
> + xe_gt_reset(gt);
>
> kunit_info(test, "mocs_reset_test after reset\n");
> if (flags & HAS_GLOBAL_MOCS)
> diff --git a/drivers/gpu/drm/xe/xe_gt.h b/drivers/gpu/drm/xe/xe_gt.h
> index 82b9b7f82fca..eb2946963420 100644
> --- a/drivers/gpu/drm/xe/xe_gt.h
> +++ b/drivers/gpu/drm/xe/xe_gt.h
> @@ -56,6 +56,31 @@ void xe_gt_sanitize(struct xe_gt *gt);
> int xe_gt_sanitize_freq(struct xe_gt *gt);
> void xe_gt_remove(struct xe_gt *gt);
>
> +/**
> + * xe_gt_wait_for_reset - wait for gt's async reset to finalize.
> + * @gt: GT structure
> + * Return:
> + * %true if it waited for the work to finish execution,
> + * %false if there was no scheduled reset or it was done.
> + */
> +static inline bool xe_gt_wait_for_reset(struct xe_gt *gt)
> +{
> + return flush_work(>->reset.worker);
> +}
> +
> +/**
> + * xe_gt_reset - perform synchronous reset
> + * @gt: GT structure
> + * Return:
> + * %true if it waited for the reset to finish,
> + * %false if there was no scheduled reset.
> + */
> +static inline bool xe_gt_reset(struct xe_gt *gt)
> +{
> + xe_gt_reset_async(gt);
> + return xe_gt_wait_for_reset(gt);
> +}
> +
> /**
> * xe_gt_any_hw_engine_by_reset_domain - scan the list of engines and return the
> * first that matches the same reset domain as @class
> diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> index 3e8c351a0eab..e7792858b1e4 100644
> --- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> @@ -132,11 +132,9 @@ static int force_reset(struct xe_gt *gt, struct drm_printer *p)
> static int force_reset_sync(struct xe_gt *gt, struct drm_printer *p)
> {
> xe_pm_runtime_get(gt_to_xe(gt));
> - xe_gt_reset_async(gt);
> + xe_gt_reset(gt);
> xe_pm_runtime_put(gt_to_xe(gt));
>
> - flush_work(>->reset.worker);
> -
> return 0;
> }
>
next prev parent reply other threads:[~2024-12-11 11:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 11:17 [PATCH v3 0/2] drm/xe: adding wait helper for gt async reset Maciej Patelczyk
2024-12-11 11:17 ` [PATCH v3 1/2] drm/xe: introduce xe_gt_reset and xe_gt_wait_for_reset Maciej Patelczyk
2024-12-11 11:39 ` Nirmoy Das [this message]
2024-12-11 11:17 ` [PATCH v3 2/2] drm/xe: make change ccs_mode a synchronous action Maciej Patelczyk
2024-12-11 11:33 ` Nirmoy Das
2024-12-11 11:59 ` ✓ CI.Patch_applied: success for drm/xe: adding wait helper for gt async reset (rev3) Patchwork
2024-12-11 11:59 ` ✓ CI.checkpatch: " Patchwork
2024-12-11 12:00 ` ✓ CI.KUnit: " Patchwork
2024-12-11 12:18 ` ✓ CI.Build: " Patchwork
2024-12-11 12:20 ` ✓ CI.Hooks: " Patchwork
2024-12-11 12:22 ` ✓ CI.checksparse: " Patchwork
2024-12-12 6:43 ` ✓ CI.BAT: " Patchwork
2024-12-17 11:25 ` ✓ CI.Patch_applied: success for drm/xe: adding wait helper for gt async reset (rev4) Patchwork
2024-12-17 11:25 ` ✓ CI.checkpatch: " Patchwork
2024-12-17 11:27 ` ✓ CI.KUnit: " Patchwork
2024-12-17 11:45 ` ✓ CI.Build: " Patchwork
2024-12-17 11:47 ` ✓ CI.Hooks: " Patchwork
2024-12-17 11:48 ` ✓ CI.checksparse: " Patchwork
2024-12-17 12:09 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-17 19:49 ` ✗ Xe.CI.Full: failure " Patchwork
2024-12-20 10:05 ` Maciej Patelczyk
2025-01-13 9:50 ` Nirmoy Das
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=01e6467e-c5b2-46a7-9f84-125186bfe8af@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=maciej.patelczyk@intel.com \
--cc=raag.jadav@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.