Skip to contentSkip to conversation

tests/intel/xe_exec_multi_queue: enable preempt flag for Q0

PATCH Superseded Xin Wang 2 participants 2 messages Jan 14

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xin Wang

author
#0 lore raw

PATCH 1/1 tests/intel/xe_exec_multi_queue: enable preempt flag for Q0

The spinner preempt flag enables queue preemption and multi-queue switching. Always enable premept flag while inserting multi-queue switch point. We need multi-queue switch point only in Q0 which acts as a gating queue until all other queues with different priorities are submitted to hardware.

---
 lib/xe/xe_spin.c                  | 2 +-
 tests/intel/xe_exec_multi_queue.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
lib/xe/xe_spin.c +1 -1
index 4dc110c22..0bc06aec3 100644
@@ -181,7 +181,7 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
 	 */
 	if (opts->multi_queue_switch) {
 		uint64_t wait_addr = opts->addr + offsetof(struct xe_spin, wait_cond);
-
+		igt_assert_f(opts->preempt, "preempt field is required to enable multi-queue switching\n");
 		spin->batch[b++] = MI_SEMAPHORE_WAIT_CMD |
 				MI_SEMAPHORE_POLL |
 				MI_SEMAPHORE_QUEUE_SWITCH_MODE |
tests/intel/xe_exec_multi_queue.c +2 -2
index 6bc6f9f63..32a84ef6b 100644
@@ -453,8 +453,8 @@ __test_priority(int fd, struct drm_xe_engine_class_instance *eci,
 
 	for (i = 0; i < num_queues; i++) {
 		uint64_t spin_addr = addr + i * sizeof(struct xe_spin);
-
-		xe_spin_init_opts(spin[i], .addr = spin_addr, .multi_queue_switch = true);
+		/* Insert multi-queue switch point in Q0 to validate priority based queue switching */
+		xe_spin_init_opts(spin[i], .addr = spin_addr, .multi_queue_switch = !i, .preempt = !i);
 		sync.addr = spin_addr + (char *)&spin[i]->exec_sync - (char *)spin[i];
 		exec.exec_queue_id = exec_queues[i];
 		exec.address = spin_addr;
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Xin Wang

The spinner preempt flag enables queue preemption and multi-queue switching. Always enable premept flag while inserting multi-queue switch point. We need multi-queue switch point only in Q0 which acts as a gating queue until all other queues with different priorities are submitted to hardware.

NIT...may be bit of rewording...
"In priority test, we need multi-queue switch point only in Q0..."

In any case, LGTM.

Quoted 39 lines

---
lib/xe/xe_spin.c | 2 +-
tests/intel/xe_exec_multi_queue.c | 4 ++--

2 files changed, 3 insertions(+), 3 deletions(-)
lib/xe/xe_spin.c +1 -1
index 4dc110c22..0bc06aec3 100644
@@ -181,7 +181,7 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
 	 */
 	if (opts->multi_queue_switch) {
 		uint64_t wait_addr = opts->addr + offsetof(struct xe_spin, wait_cond);
-
+		igt_assert_f(opts->preempt, "preempt field is required to enable multi-queue switching\n");
 		spin->batch[b++] = MI_SEMAPHORE_WAIT_CMD |
 				MI_SEMAPHORE_POLL |
 				MI_SEMAPHORE_QUEUE_SWITCH_MODE |
tests/intel/xe_exec_multi_queue.c +2 -2
index 6bc6f9f63..32a84ef6b 100644
@@ -453,8 +453,8 @@ __test_priority(int fd, struct drm_xe_engine_class_instance *eci,
 
 	for (i = 0; i < num_queues; i++) {
 		uint64_t spin_addr = addr + i * sizeof(struct xe_spin);
-
-		xe_spin_init_opts(spin[i], .addr = spin_addr, .multi_queue_switch = true);
+		/* Insert multi-queue switch point in Q0 to validate priority based queue switching */
+		xe_spin_init_opts(spin[i], .addr = spin_addr, .multi_queue_switch = !i, .preempt = !i);
 		sync.addr = spin_addr + (char *)&spin[i]->exec_sync - (char *)spin[i];
 		exec.exec_queue_id = exec_queues[i];
 		exec.address = spin_addr;
Signature · 1 line
2.43.0