From: Matthew Brost <matthew.brost@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH v2 2/2] tests/intel/xe_vm: Add bind array -ENOBUFS section
Date: Fri, 19 Jul 2024 12:46:13 -0700 [thread overview]
Message-ID: <20240719194613.1549550-2-matthew.brost@intel.com> (raw)
In-Reply-To: <20240719194613.1549550-1-matthew.brost@intel.com>
Add section which has a large enough array of binds which triggers BB
suballocation failure. Verify -ENOBUFS is returned in this case.
v2:
- Use do_ioctl_err (Matthew Auld)
- Move xe_vm_bind_array_err to xe_vm.c
v3:
- Fix sign of error usage
Cc: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
tests/intel/xe_vm.c | 51 ++++++++++++++++++++++++++++++++++-----------
1 file changed, 39 insertions(+), 12 deletions(-)
diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
index a5f25acc7e..cff71487e4 100644
--- a/tests/intel/xe_vm.c
+++ b/tests/intel/xe_vm.c
@@ -869,7 +869,7 @@ static void xe_vm_bind_array_err(int fd, uint32_t vm, uint32_t exec_queue,
}
#define BIND_ARRAY_BIND_EXEC_QUEUE_FLAG (0x1 << 0)
-
+#define BIND_ARRAY_ENOBUFS_FLAG (0x1 << 1)
/**
* SUBTEST: bind-array-twice
@@ -882,6 +882,11 @@ static void xe_vm_bind_array_err(int fd, uint32_t vm, uint32_t exec_queue,
* Functionality: bind exec_queues
* Test category: functionality test
*
+ * SUBTEST: bind-array-enobufs
+ * Description: Test bind array which too large are trigger -ENOBUFs error
+ * Functionality: bind exec_queues
+ * Test category: functionality test
+ *
* SUBTEST: bind-array-exec_queue-twice
* Description: Test bind array exec_queue twice
* Functionality: bind exec_queues
@@ -894,10 +899,10 @@ static void xe_vm_bind_array_err(int fd, uint32_t vm, uint32_t exec_queue,
*/
static void
test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
- unsigned int flags)
+ uint64_t addr, size_t bo_size, unsigned int flags)
{
uint32_t vm;
- uint64_t addr = 0x1a0000, base_addr = 0x1a0000;
+ uint64_t base_addr = addr;
struct drm_xe_sync sync[2] = {
{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ, .flags = DRM_XE_SYNC_FLAG_SIGNAL, },
{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ, .flags = DRM_XE_SYNC_FLAG_SIGNAL, },
@@ -907,9 +912,7 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
.syncs = to_user_pointer(sync),
};
uint32_t exec_queue, bind_exec_queue = 0;
-#define BIND_ARRAY_MAX_N_EXEC 16
- struct drm_xe_vm_bind_op bind_ops[BIND_ARRAY_MAX_N_EXEC] = { };
- size_t bo_size;
+ struct drm_xe_vm_bind_op *bind_ops;
uint32_t bo = 0;
struct {
uint32_t batch[16];
@@ -918,10 +921,11 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
} *data;
int i, b;
- igt_assert(n_execs <= BIND_ARRAY_MAX_N_EXEC);
+ bind_ops = malloc(sizeof(*bind_ops) * n_execs);
+ igt_assert(bind_ops);
vm = xe_vm_create(fd, 0, 0);
- bo_size = sizeof(*data) * n_execs;
+ bo_size = bo_size ?: sizeof(*data) * n_execs;
bo_size = xe_bb_size(fd, bo_size);
bo = xe_bo_create(fd, vm, bo_size,
@@ -949,6 +953,22 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
}
sync[0].handle = syncobj_create(fd, 0);
+ if (flags & BIND_ARRAY_ENOBUFS_FLAG) {
+ struct xe_cork cork;
+
+ xe_cork_init(fd, eci, &cork);
+
+ sync[1].handle = xe_cork_sync_handle(&cork);
+ sync[1].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+
+ xe_vm_bind_array_err(fd, vm, bind_exec_queue, bind_ops,
+ n_execs, sync, 2, ENOBUFS);
+ xe_cork_end(&cork);
+ xe_cork_wait_done(&cork);
+ xe_cork_fini(&cork);
+ n_execs = n_execs / 2;
+ }
+
xe_vm_bind_array(fd, vm, bind_exec_queue, bind_ops, n_execs, sync, 1);
addr = base_addr;
@@ -1008,6 +1028,7 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
munmap(data, bo_size);
gem_close(fd, bo);
xe_vm_destroy(fd, vm);
+ free(bind_ops);
}
/**
@@ -2397,20 +2418,26 @@ igt_main
igt_subtest("bind-array-twice")
xe_for_each_engine(fd, hwe)
- test_bind_array(fd, hwe, 2, 0);
+ test_bind_array(fd, hwe, 2, 0x1a0000, 0, 0);
igt_subtest("bind-array-many")
xe_for_each_engine(fd, hwe)
- test_bind_array(fd, hwe, 16, 0);
+ test_bind_array(fd, hwe, 16, 0x1a0000, 0, 0);
+
+ igt_subtest("bind-array-enobufs")
+ xe_for_each_engine(fd, hwe)
+ test_bind_array(fd, hwe, xe_has_vram(fd) ? 1024 : 512,
+ 0x1a0000, SZ_2M,
+ BIND_ARRAY_ENOBUFS_FLAG);
igt_subtest("bind-array-exec_queue-twice")
xe_for_each_engine(fd, hwe)
- test_bind_array(fd, hwe, 2,
+ test_bind_array(fd, hwe, 2, 0x1a0000, 0,
BIND_ARRAY_BIND_EXEC_QUEUE_FLAG);
igt_subtest("bind-array-exec_queue-many")
xe_for_each_engine(fd, hwe)
- test_bind_array(fd, hwe, 16,
+ test_bind_array(fd, hwe, 16, 0x1a0000, 0,
BIND_ARRAY_BIND_EXEC_QUEUE_FLAG);
igt_subtest("bind-array-conflict")
--
2.34.1
next prev parent reply other threads:[~2024-07-19 19:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 19:46 [PATCH v2 1/2] tests/intel/xe_vm: Add bind array conflict tests Matthew Brost
2024-07-19 19:46 ` Matthew Brost [this message]
2024-07-30 6:52 ` [PATCH v2 2/2] tests/intel/xe_vm: Add bind array -ENOBUFS section Kumar, Janga Rahul
2024-07-19 20:56 ` ✗ CI.xeBAT: failure for series starting with [v2,1/2] tests/intel/xe_vm: Add bind array conflict tests Patchwork
2024-07-19 21:06 ` ✓ Fi.CI.BAT: success " Patchwork
2024-07-19 22:08 ` ✗ CI.xeFULL: failure " Patchwork
2024-07-20 7:05 ` ✗ Fi.CI.IGT: " Patchwork
2024-07-30 6:49 ` [PATCH v2 1/2] " Kumar, Janga Rahul
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=20240719194613.1549550-2-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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