[PATCH i-g-t v2 17/66] tests/xe_eudebug: Include exec queues in discovery testing
Christoph Manszewski
christoph.manszewski at intel.com
Tue Jul 30 11:44:34 UTC 2024
From: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Extend discovery-* subtests to create exec_queue resources.
Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Christoph Manszewski <christoph.manszewski at intel.com>
---
tests/intel/xe_eudebug.c | 41 ++++++++++++++++++++++++++++++++++++----
1 file changed, 37 insertions(+), 4 deletions(-)
diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
index 4051eac53..9497e73e9 100644
--- a/tests/intel/xe_eudebug.c
+++ b/tests/intel/xe_eudebug.c
@@ -341,6 +341,7 @@ static void test_basic_sessions(int fd, unsigned int flags, int count)
#define DISCOVERY_DESTROY_RESOURCES (1 << 2)
static void run_discovery_client(struct xe_eudebug_client *c)
{
+ struct drm_xe_engine_class_instance *hwe = NULL;
int fd[RESOURCE_COUNT], i;
bool skip_sleep = c->flags & (DISCOVERY_DESTROY_RESOURCES | DISCOVERY_CLOSE_CLIENT);
@@ -349,6 +350,20 @@ static void run_discovery_client(struct xe_eudebug_client *c)
for (i = 0; i < RESOURCE_COUNT; i++) {
fd[i] = xe_eudebug_client_open_driver(c);
+ if (!i) {
+ bool found = false;
+
+ xe_device_get(fd[0]);
+ xe_for_each_engine(fd[0], hwe) {
+ if (hwe->engine_class == DRM_XE_ENGINE_CLASS_COMPUTE ||
+ hwe->engine_class == DRM_XE_ENGINE_CLASS_RENDER) {
+ found = true;
+ break;
+ }
+ }
+ igt_assert(found);
+ }
+
/*
* Give the debugger a break in event stream after every
* other client, that allows to read discovery and dettach in quiet.
@@ -357,15 +372,25 @@ static void run_discovery_client(struct xe_eudebug_client *c)
sleep(1);
for (int j = 0; j < RESOURCE_COUNT; j++) {
- uint32_t vm = xe_eudebug_client_vm_create(c, fd[i], 0, 0);
+ struct drm_xe_exec_queue_create create = {
+ .width = 1,
+ .num_placements = 1,
+ .vm_id = xe_eudebug_client_vm_create(c, fd[i], 0, 0),
+ .instances = to_user_pointer(hwe)
+ };
- if (c->flags & DISCOVERY_DESTROY_RESOURCES)
- xe_eudebug_client_vm_destroy(c, fd[i], vm);
+ xe_eudebug_client_exec_queue_create(c, fd[i], &create);
+
+ if (c->flags & DISCOVERY_DESTROY_RESOURCES) {
+ xe_eudebug_client_exec_queue_destroy(c, fd[i], &create);
+ xe_eudebug_client_vm_destroy(c, fd[i], create.vm_id);
+ }
}
if (c->flags & DISCOVERY_CLOSE_CLIENT)
xe_eudebug_client_close_driver(c, fd[i]);
}
+ xe_device_put(fd[0]);
}
/**
@@ -383,9 +408,10 @@ static void *discovery_race_thread(void *data)
struct {
uint64_t client_handle;
int vm_count;
+ int exec_queue_count;
} clients[RESOURCE_COUNT];
struct xe_eudebug_session *s = data;
- int expected = RESOURCE_COUNT * (1 + RESOURCE_COUNT);
+ int expected = RESOURCE_COUNT * (1 + 2 * RESOURCE_COUNT);
const int tries = 100;
bool done = false;
int ret = 0;
@@ -417,15 +443,22 @@ static void *discovery_race_thread(void *data)
if (i >= 0) {
igt_assert_eq(clients[i].vm_count,
RESOURCE_COUNT);
+
+ igt_assert_eq(clients[i].exec_queue_count,
+ RESOURCE_COUNT);
}
igt_assert(++i < RESOURCE_COUNT);
clients[i].client_handle = eo->client_handle;
clients[i].vm_count = 0;
+ clients[i].exec_queue_count = 0;
}
if (e->type == DRM_XE_EUDEBUG_EVENT_VM)
clients[i].vm_count++;
+
+ if (e->type == DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE)
+ clients[i].exec_queue_count++;
};
igt_assert_lte(0, i);
--
2.34.1
More information about the igt-dev
mailing list