From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: intel-xe@lists.freedesktop.org, niranjana.vishwanathapura@intel.com
Cc: matthew.brost@intel.com, stuart.summers@intel.com
Subject: [PATCH v3 05/11] drm/xe/multi_queue: Store primary LRC and position info in LRC
Date: Tue, 5 May 2026 16:44:14 -0700 [thread overview]
Message-ID: <20260505234408.3552147-18-umesh.nerlige.ramappa@intel.com> (raw)
In-Reply-To: <20260505234408.3552147-13-umesh.nerlige.ramappa@intel.com>
Given 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 as well
as take a reference to the primary LRC from each LRC in the queue group.
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 there 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)
---
drivers/gpu/drm/xe/xe_exec_queue.c | 5 +++++
drivers/gpu/drm/xe/xe_lrc.h | 5 +++++
drivers/gpu/drm/xe/xe_lrc_types.h | 8 ++++++++
3 files changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
index 9b36ff5b09a6..bc8110a9b054 100644
--- a/drivers/gpu/drm/xe/xe_exec_queue.c
+++ b/drivers/gpu/drm/xe/xe_exec_queue.c
@@ -1389,6 +1389,11 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,
goto put_exec_queue;
}
+ if (xe_exec_queue_is_multi_queue(q)) {
+ q->lrc[0]->multi_queue.pos = q->multi_queue.pos;
+ q->lrc[0]->multi_queue.primary_lrc = q->multi_queue.group->primary->lrc[0];
+ }
+
if (xe_vm_in_preempt_fence_mode(vm)) {
q->lr.context = dma_fence_context_alloc(1);
diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h
index d280e6572398..557dce004d48 100644
--- a/drivers/gpu/drm/xe/xe_lrc.h
+++ b/drivers/gpu/drm/xe/xe_lrc.h
@@ -91,6 +91,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-05 23:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 23:44 [PATCH v3 00/11] Support run ticks for multi-queue use case Umesh Nerlige Ramappa
2026-05-05 23:44 ` [PATCH v3 01/11] drm/xe/lrc: Use 64 bit ctx timestamp in the LRC snapshot Umesh Nerlige Ramappa
2026-05-05 23:44 ` [PATCH v3 02/11] drm/xe: Add timestamp_ms to " Umesh Nerlige Ramappa
2026-05-06 3:10 ` Niranjana Vishwanathapura
2026-05-05 23:44 ` [PATCH v3 03/11] drm/xe/lrc: Refactor xe_lrc_timestamp to simplify logic Umesh Nerlige Ramappa
2026-05-06 3:13 ` Niranjana Vishwanathapura
2026-05-05 23:44 ` [PATCH v3 04/11] drm/xe/multi_queue: Refactor check for multi queue support for engine class Umesh Nerlige Ramappa
2026-05-06 3:16 ` Niranjana Vishwanathapura
2026-05-05 23:44 ` Umesh Nerlige Ramappa [this message]
2026-05-06 3:47 ` [PATCH v3 05/11] drm/xe/multi_queue: Store primary LRC and position info in LRC Niranjana Vishwanathapura
2026-05-05 23:44 ` [PATCH v3 06/11] drm/xe/multi_queue: Add helpers to access CS QUEUE TIMESTAMP from lrc Umesh Nerlige Ramappa
2026-05-06 3:25 ` Niranjana Vishwanathapura
2026-05-06 5:07 ` Niranjana Vishwanathapura
2026-05-05 23:44 ` [PATCH v3 07/11] drm/xe/lrc: Refactor out engine id to hwe conversion Umesh Nerlige Ramappa
2026-05-05 23:44 ` [PATCH v3 08/11] drm/xe/multi_queue: Capture queue run times for active queues Umesh Nerlige Ramappa
2026-05-06 3:30 ` Niranjana Vishwanathapura
2026-05-05 23:44 ` [PATCH v3 09/11] drm/xe/multi_queue: Add trace event for the multi queue timestamp Umesh Nerlige Ramappa
2026-05-06 5:03 ` Niranjana Vishwanathapura
2026-05-06 20:25 ` Umesh Nerlige Ramappa
2026-05-05 23:44 ` [PATCH v3 10/11] drm/xe/multi_queue: Use QUEUE_TIMESTAMP as job timestamp for multi-queue Umesh Nerlige Ramappa
2026-05-05 23:44 ` [PATCH v3 11/11] drm/xe/multi_queue: Whitelist QUEUE_TIMESTAMP register Umesh Nerlige Ramappa
2026-05-06 3:31 ` Niranjana Vishwanathapura
2026-05-05 23:51 ` ✗ CI.checkpatch: warning for Support run ticks for multi-queue use case (rev3) Patchwork
2026-05-05 23:53 ` ✓ CI.KUnit: success " 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=20260505234408.3552147-18-umesh.nerlige.ramappa@intel.com \
--to=umesh.nerlige.ramappa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@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