From: Matthew Brost <matthew.brost@intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2 4/4] drm/xe/multi_queue: replay dynamic CGP updates lost during VF migration
Date: Mon, 3 Aug 2026 12:20:17 -0700 [thread overview]
Message-ID: <anDp8bCCV4S0qAMy@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260731232625.3313657-10-niranjana.vishwanathapura@intel.com>
On Fri, Jul 31, 2026 at 04:26:27PM -0700, Niranjana Vishwanathapura wrote:
> When guc_exec_queue_revert_pending_state_change() sets needs_cgp_sync for
> a queue, replay that update during unpause by injecting a CGP_SYNC_MSG
> static message at the head of the scheduler queue.
>
> The message handler __guc_exec_queue_process_msg_cgp_sync() calls
> guc_exec_queue_send_cgp_sync() which re-reads the current priority from
> q->multi_queue.priority and re-issues the CGP write + CGP_SYNC H2G, so
> the queue's CGP entry is restored to the correct value after migration.
>
> Assisted-by: Github-Copilot:Claude-opus-4.8
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_exec_queue_types.h | 2 +-
> drivers/gpu/drm/xe/xe_guc_submit.c | 28 ++++++++++++++++++++
> 2 files changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_exec_queue_types.h b/drivers/gpu/drm/xe/xe_guc_exec_queue_types.h
> index 573b920edb41..d27826b36649 100644
> --- a/drivers/gpu/drm/xe/xe_guc_exec_queue_types.h
> +++ b/drivers/gpu/drm/xe/xe_guc_exec_queue_types.h
> @@ -36,7 +36,7 @@ struct xe_guc_exec_queue {
> * a message needs to sent through the GPU scheduler but memory
> * allocations are not allowed.
> */
> -#define MAX_STATIC_MSG_TYPE 3
> +#define MAX_STATIC_MSG_TYPE 4
> struct xe_sched_msg static_msgs[MAX_STATIC_MSG_TYPE];
> /** @destroy_async: do final destroy async from this worker */
> struct work_struct destroy_async;
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index c018bc0d8d6f..9036f89dff7d 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -1960,11 +1960,25 @@ static void __guc_exec_queue_process_msg_set_multi_queue_priority(struct xe_sche
> kfree(msg);
> }
>
> +static void __guc_exec_queue_process_msg_cgp_sync(struct xe_sched_msg *msg)
> +{
> + struct xe_exec_queue *q = msg->private_data;
> +
> + /*
> + * Replay a dynamic CGP update lost across VF migration by re-issuing the
> + * CGP update + CGP_SYNC (re-applies the current priority from
> + * q->multi_queue.priority).
> + */
> + if (guc_exec_queue_allowed_to_change_state(q))
> + guc_exec_queue_send_cgp_sync(q, 0);
> +}
> +
> #define CLEANUP 1 /* Non-zero values to catch uninitialized msg */
> #define SET_SCHED_PROPS 2
> #define SUSPEND 3
> #define RESUME 4
> #define SET_MULTI_QUEUE_PRIORITY 5
> +#define CGP_SYNC_MSG 6
> #define OPCODE_MASK 0xf
> #define MSG_LOCKED BIT(8)
> #define MSG_HEAD BIT(9)
> @@ -1991,6 +2005,9 @@ static void guc_exec_queue_process_msg(struct xe_sched_msg *msg)
> case SET_MULTI_QUEUE_PRIORITY:
> __guc_exec_queue_process_msg_set_multi_queue_priority(msg);
> break;
> + case CGP_SYNC_MSG:
> + __guc_exec_queue_process_msg_cgp_sync(msg);
> + break;
> default:
> XE_WARN_ON("Unknown message type");
> }
> @@ -2160,6 +2177,7 @@ static bool guc_exec_queue_try_add_msg(struct xe_exec_queue *q,
> #define STATIC_MSG_CLEANUP 0
> #define STATIC_MSG_SUSPEND 1
> #define STATIC_MSG_RESUME 2
> +#define STATIC_MSG_CGP_SYNC 3
> static void guc_exec_queue_destroy(struct xe_exec_queue *q)
> {
> struct xe_sched_msg *msg = q->guc->static_msgs + STATIC_MSG_CLEANUP;
> @@ -3024,6 +3042,16 @@ static void guc_exec_queue_replay_pending_state_change(struct xe_exec_queue *q)
> struct xe_gpu_scheduler *sched = &q->guc->sched;
> struct xe_sched_msg *msg;
>
> + if (q->guc->multi_queue.needs_cgp_sync) {
> + msg = q->guc->static_msgs + STATIC_MSG_CGP_SYNC;
> +
> + xe_sched_msg_lock(sched);
> + guc_exec_queue_try_add_msg_head(q, msg, CGP_SYNC_MSG);
> + xe_sched_msg_unlock(sched);
> +
> + q->guc->multi_queue.needs_cgp_sync = false;
> + }
> +
> if (q->guc->needs_cleanup) {
> msg = q->guc->static_msgs + STATIC_MSG_CLEANUP;
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-08-03 19:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 23:26 [PATCH v2 0/4] drm/xe/multi_queue: Handle lost message during VF migration Niranjana Vishwanathapura
2026-07-31 23:26 ` [PATCH v2 1/4] drm/xe: split VF pause into prepare and revert phases Niranjana Vishwanathapura
2026-08-03 16:55 ` Matthew Brost
2026-07-31 23:26 ` [PATCH v2 2/4] drm/xe/multi_queue: handle CGP_SYNC wait timeout during VF recovery Niranjana Vishwanathapura
2026-08-03 17:06 ` Matthew Brost
2026-07-31 23:26 ` [PATCH v2 3/4] drm/xe/multi_queue: track and recover lost CGP updates across VF migration Niranjana Vishwanathapura
2026-08-03 19:19 ` Matthew Brost
2026-07-31 23:26 ` [PATCH v2 4/4] drm/xe/multi_queue: replay dynamic CGP updates lost during " Niranjana Vishwanathapura
2026-08-03 19:20 ` Matthew Brost [this message]
2026-07-31 23:33 ` ✓ CI.KUnit: success for drm/xe/multi_queue: Handle lost message during VF migration (rev3) Patchwork
2026-08-01 0:25 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-01 1:08 ` ✓ 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=anDp8bCCV4S0qAMy@gsse-cloud1.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=niranjana.vishwanathapura@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