From: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <matthew.brost@intel.com>,
<stuart.summers@intel.com>
Subject: Re: [PATCH v4 05/11] drm/xe/multi_queue: Store primary LRC and position info in LRC
Date: Wed, 6 May 2026 17:35:17 -0700 [thread overview]
Message-ID: <afveRR-TNmiAdCFx@nvishwa1-desk> (raw)
In-Reply-To: <20260506223500.3769614-18-umesh.nerlige.ramappa@intel.com>
On Wed, May 06, 2026 at 03:35:06PM -0700, Umesh Nerlige Ramappa wrote:
>For an LRC belonging to the secondary queue, in order to check if its
>context group is active, we need to check the LRC of the primary queue.
>In addition to that we want to compare the secondary queue position to
>CSMQDEBUG register to check if the queue itself is active.
>
>To do so, store primary LRC and position information in the LRC.
>
>A note on references involved:
>
>- In general the Queue takes a ref on its LRC.
>- In addition, for multi-queue,
>a. Primary Queue takes a ref for each Secondary LRC.
>b. Each Secondary Queue takes a ref to the Primary Queue
>
>In the current patch, each LRC in the queue group is storing a pointer
>to primary LRC. Both primary and secondary LRCs are freed only when
>primary queue is destroyed. At this time, all secondary queues are
>already destroyed, so there is no one using secondary LRCs. We should be
>good without taking any additional references.
>
>Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>---
>v2:
>- Store primary LRC instead of primary queue (Niranjana)
>- Drop the valid flag and check if primary_lrc is NULL (Niranjana)
>- Document/Revisit references (Matt/Umesh)
>
>v3:
>- Drop the reference logic since it's not needed (Niranjana)
>- Move lrc->multi_queue initialization to a later point (Niranjana)
>
>v4: (Niranjana)
>- Set lrc[0].multi_queue.primary_lrc in xe_exec_queue_set_lrc
>- Set lrc[0].multi_queue.pos in xe_exec_queue_group_add
>- Include primary_context_desc and pos in snapshot
>---
> drivers/gpu/drm/xe/xe_exec_queue.c | 6 +++++-
> drivers/gpu/drm/xe/xe_lrc.c | 14 ++++++++++++++
> drivers/gpu/drm/xe/xe_lrc.h | 9 +++++++++
> drivers/gpu/drm/xe/xe_lrc_types.h | 8 ++++++++
> 4 files changed, 36 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
>index 62a75c8fe72f..4647a24dcffb 100644
>--- a/drivers/gpu/drm/xe/xe_exec_queue.c
>+++ b/drivers/gpu/drm/xe/xe_exec_queue.c
>@@ -275,8 +275,11 @@ static void xe_exec_queue_set_lrc(struct xe_exec_queue *q, struct xe_lrc *lrc, u
> {
> xe_assert(gt_to_xe(q->gt), idx < q->width);
>
>- scoped_guard(spinlock, &q->lrc_lookup_lock)
>+ scoped_guard(spinlock, &q->lrc_lookup_lock) {
> q->lrc[idx] = lrc;
>+ if (xe_exec_queue_is_multi_queue(q))
>+ q->lrc[idx]->multi_queue.primary_lrc = q->multi_queue.group->primary->lrc[0];
>+ }
> }
>
> /**
>@@ -907,6 +910,7 @@ static int xe_exec_queue_group_add(struct xe_device *xe, struct xe_exec_queue *q
> }
>
> q->multi_queue.pos = pos;
>+ q->lrc[0]->multi_queue.pos = pos;
>
> return 0;
> }
>diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
>index b31525bd2a4c..3def999ce48a 100644
>--- a/drivers/gpu/drm/xe/xe_lrc.c
>+++ b/drivers/gpu/drm/xe/xe_lrc.c
>@@ -2466,6 +2466,14 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc)
> snapshot->ctx_timestamp = xe_lrc_ctx_timestamp(lrc);
> snapshot->ctx_timestamp_ms =
> xe_gt_clock_interval_to_ms(lrc->gt, xe_lrc_ctx_timestamp(lrc));
>+ if (xe_lrc_is_multi_queue(lrc)) {
>+ snapshot->multi_queue.primary_context_desc =
>+ xe_lrc_ggtt_addr(lrc->multi_queue.primary_lrc);
>+ snapshot->multi_queue.pos = lrc->multi_queue.pos;
>+ } else {
>+ snapshot->multi_queue.primary_context_desc = 0;
>+ snapshot->multi_queue.pos = 0;
>+ }
> snapshot->ctx_job_timestamp = xe_lrc_ctx_job_timestamp(lrc);
> return snapshot;
> }
>@@ -2521,6 +2529,12 @@ void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer
> drm_printf(p, "\tTimestamp: 0x%016llx\n", snapshot->ctx_timestamp);
> drm_printf(p, "\tTimestamp ms: %llu\n", snapshot->ctx_timestamp_ms);
> drm_printf(p, "\tJob Timestamp: 0x%08x\n", snapshot->ctx_job_timestamp);
>+ if (snapshot->multi_queue.primary_context_desc) {
>+ drm_printf(p, "\tMulti queue primary Context Desc: 0x%08x\n",
>+ snapshot->multi_queue.primary_context_desc);
>+ drm_printf(p, "\tMulti queue position: %d\n",
>+ snapshot->multi_queue.pos);
What I am seeing is that LRC snapshot is printed along with exec_queue snapshot.
The multi_queue position is already printed as part of exec_queue snapshot.
Besides, as multi-queue primary guc id is also printed, one can easily get
the primary context descriptor also. So, perhaps we can remove printing
these info here as I am seeing LRC snapshot is always printed along with
exec_queue snapshot. Sorry, for the confusion.
Niranjana
>+ }
>
> if (!snapshot->lrc_snapshot)
> return;
>diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h
>index d280e6572398..d0deb916e4f1 100644
>--- a/drivers/gpu/drm/xe/xe_lrc.h
>+++ b/drivers/gpu/drm/xe/xe_lrc.h
>@@ -40,6 +40,10 @@ struct xe_lrc_snapshot {
> u64 ctx_timestamp;
> u64 ctx_timestamp_ms;
> u32 ctx_job_timestamp;
>+ struct {
>+ u32 primary_context_desc;
>+ u8 pos;
>+ } multi_queue;
> };
>
> #define LRC_PPHWSP_FLUSH_INVAL_SCRATCH_ADDR (0x34 * 4)
>@@ -91,6 +95,11 @@ static inline size_t xe_lrc_ring_size(void)
> return SZ_16K;
> }
>
>+static inline bool xe_lrc_is_multi_queue(struct xe_lrc *lrc)
>+{
>+ return lrc->multi_queue.primary_lrc;
>+}
>+
> size_t xe_gt_lrc_hang_replay_size(struct xe_gt *gt, enum xe_engine_class class);
> size_t xe_gt_lrc_size(struct xe_gt *gt, enum xe_engine_class class);
> u32 xe_lrc_pphwsp_offset(struct xe_lrc *lrc);
>diff --git a/drivers/gpu/drm/xe/xe_lrc_types.h b/drivers/gpu/drm/xe/xe_lrc_types.h
>index 5a718f759ed6..0a5c13ec2ad7 100644
>--- a/drivers/gpu/drm/xe/xe_lrc_types.h
>+++ b/drivers/gpu/drm/xe/xe_lrc_types.h
>@@ -63,6 +63,14 @@ struct xe_lrc {
>
> /** @ctx_timestamp: readout value of CTX_TIMESTAMP on last update */
> u64 ctx_timestamp;
>+
>+ /** @multi_queue: Multi queue LRC related information */
>+ struct {
>+ /** @multi_queue.primary_lrc: Primary lrc of this multi-queue group*/
>+ struct xe_lrc *primary_lrc;
>+ /** @multi_queue.pos: Position of LRC within the multi-queue group */
>+ u8 pos;
>+ } multi_queue;
> };
>
> struct xe_lrc_snapshot;
>--
>2.51.0
>
next prev parent reply other threads:[~2026-05-07 0:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 22:35 [PATCH v4 00/11] Support run ticks for multi-queue use case Umesh Nerlige Ramappa
2026-05-06 22:35 ` [PATCH v4 01/11] drm/xe/lrc: Use 64 bit ctx timestamp in the LRC snapshot Umesh Nerlige Ramappa
2026-05-06 22:35 ` [PATCH v4 02/11] drm/xe: Add timestamp_ms to " Umesh Nerlige Ramappa
2026-05-06 22:35 ` [PATCH v4 03/11] drm/xe/lrc: Refactor xe_lrc_timestamp to simplify logic Umesh Nerlige Ramappa
2026-05-06 22:35 ` [PATCH v4 04/11] drm/xe/multi_queue: Refactor check for multi queue support for engine class Umesh Nerlige Ramappa
2026-05-07 0:28 ` Niranjana Vishwanathapura
2026-05-06 22:35 ` [PATCH v4 05/11] drm/xe/multi_queue: Store primary LRC and position info in LRC Umesh Nerlige Ramappa
2026-05-07 0:35 ` Niranjana Vishwanathapura [this message]
2026-05-07 1:39 ` Niranjana Vishwanathapura
2026-05-06 22:35 ` [PATCH v4 06/11] drm/xe/multi_queue: Add helpers to access CS QUEUE TIMESTAMP from lrc Umesh Nerlige Ramappa
2026-05-07 0:29 ` Niranjana Vishwanathapura
2026-05-06 22:35 ` [PATCH v4 07/11] drm/xe/lrc: Refactor out engine id to hwe conversion Umesh Nerlige Ramappa
2026-05-06 22:35 ` [PATCH v4 08/11] drm/xe/multi_queue: Capture queue run times for active queues Umesh Nerlige Ramappa
2026-05-06 22:35 ` [PATCH v4 09/11] drm/xe/multi_queue: Add trace event for the multi queue timestamp Umesh Nerlige Ramappa
2026-05-07 0:28 ` Niranjana Vishwanathapura
2026-05-06 22:35 ` [PATCH v4 10/11] drm/xe/multi_queue: Use QUEUE_TIMESTAMP as job timestamp for multi-queue Umesh Nerlige Ramappa
2026-05-06 22:35 ` [PATCH v4 11/11] drm/xe/multi_queue: Whitelist QUEUE_TIMESTAMP register Umesh Nerlige Ramappa
2026-05-06 22:41 ` ✗ CI.checkpatch: warning for Support run ticks for multi-queue use case (rev4) Patchwork
2026-05-06 22:42 ` ✓ CI.KUnit: success " Patchwork
2026-05-06 23:44 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-07 0:44 ` ✗ Xe.CI.FULL: failure " 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=afveRR-TNmiAdCFx@nvishwa1-desk \
--to=niranjana.vishwanathapura@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=stuart.summers@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).