[PATCH 30/66] tests/xe_eudebug: Add discovery-race-vmbind subtest
Christoph Manszewski
christoph.manszewski at intel.com
Mon Jul 29 16:01:23 UTC 2024
From: Karolina Stolarek <karolina.stolarek at intel.com>
Extend discovery-race test case with BO creation and vm_bind operation
to verify that all vm_bind_op events are properly registered and
replayed.
Signed-off-by: Karolina Stolarek <karolina.stolarek at intel.com>
Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
---
tests/intel/xe_eudebug.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
index 8c21cffc7..c368e30e7 100644
--- a/tests/intel/xe_eudebug.c
+++ b/tests/intel/xe_eudebug.c
@@ -917,11 +917,13 @@ static void test_basic_discovery(int fd, unsigned int flags, bool match_opposite
#define PRIMARY_THREAD (1 << 0)
#define DISCOVERY_CLOSE_CLIENT (1 << 1)
#define DISCOVERY_DESTROY_RESOURCES (1 << 2)
+#define DISCOVERY_VM_BIND (1 << 3)
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);
+ uint64_t addr = 0x1a0000;
srand(getpid());
@@ -950,18 +952,29 @@ 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),
+ .vm_id = vm,
.instances = to_user_pointer(hwe)
};
+ const unsigned int bo_size = max_t(bo_size,
+ xe_get_default_alignment(fd[i]),
+ MIN_BO_SIZE);
+ uint32_t bo = xe_bo_create(fd[i], 0, bo_size, system_memory(fd[i]), 0);
xe_eudebug_client_exec_queue_create(c, fd[i], &create);
+ if (c->flags & DISCOVERY_VM_BIND) {
+ xe_eudebug_client_vm_bind(c, fd[i], vm, bo, 0, addr, bo_size);
+ addr += 0x100000;
+ }
+
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);
+ gem_close(fd[i], bo);
}
}
@@ -978,6 +991,7 @@ static void run_discovery_client(struct xe_eudebug_client *c)
* arg[1]:
*
* @race: resources creation
+ * @race-vmbind: vm-bind operations
* @empty: resources destruction
* @empty-clients: client closure
*/
@@ -987,6 +1001,7 @@ static void *discovery_race_thread(void *data)
uint64_t client_handle;
int vm_count;
int exec_queue_count;
+ int vm_bind_op_count;
} clients[RESOURCE_COUNT];
struct xe_eudebug_session *s = data;
int expected = RESOURCE_COUNT * (1 + 2 * RESOURCE_COUNT);
@@ -1024,12 +1039,17 @@ static void *discovery_race_thread(void *data)
igt_assert_eq(clients[i].exec_queue_count,
RESOURCE_COUNT);
+
+ if (s->c->flags & DISCOVERY_VM_BIND)
+ igt_assert_eq(clients[i].vm_bind_op_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;
+ clients[i].vm_bind_op_count = 0;
}
if (e->type == DRM_XE_EUDEBUG_EVENT_VM)
@@ -1037,6 +1057,9 @@ static void *discovery_race_thread(void *data)
if (e->type == DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE)
clients[i].exec_queue_count++;
+
+ if (e->type == DRM_XE_EUDEBUG_EVENT_VM_BIND_OP)
+ clients[i].vm_bind_op_count++;
};
igt_assert_lte(0, i);
@@ -1116,7 +1139,8 @@ static void test_race_discovery(int fd, unsigned int flags, int clients)
igt_assert_eq(sessions[i].c->seqno-1, sessions[i].d->event_count);
xe_eudebug_event_log_compare(sessions[0].d->log,
- sessions[i].d->log, 0);
+ sessions[i].d->log,
+ XE_EUDEBUG_FILTER_EVENT_VM_BIND);
xe_eudebug_client_destroy(sessions[i].c);
}
@@ -1755,6 +1779,9 @@ igt_main
igt_subtest("discovery-race")
test_race_discovery(fd, 0, 4);
+ igt_subtest("discovery-race-vmbind")
+ test_race_discovery(fd, DISCOVERY_VM_BIND, 4);
+
igt_subtest("discovery-empty")
test_empty_discovery(fd, DISCOVERY_CLOSE_CLIENT, 16);
--
2.34.1
More information about the igt-dev
mailing list