* [PATCH] xe_vm: Add bind array -ENOBUFS section
@ 2024-06-20 23:54 Matthew Brost
2024-06-21 0:15 ` ✗ Fi.CI.BUILD: failure for " Patchwork
2024-06-21 11:09 ` [PATCH] " Matthew Auld
0 siblings, 2 replies; 4+ messages in thread
From: Matthew Brost @ 2024-06-20 23:54 UTC (permalink / raw)
To: igt-dev; +Cc: matthew.auld
Add section which has a large enough array of binds which triggers BB
suballocation failure. Verify -ENOBUFS is returned in this case.
Cc: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
lib/xe/xe_ioctl.c | 19 +++++++++++++++++
lib/xe/xe_ioctl.h | 4 ++++
tests/intel/xe_vm.c | 50 ++++++++++++++++++++++++++++++++++-----------
3 files changed, 61 insertions(+), 12 deletions(-)
diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
index a437fd828a..9072801ce1 100644
--- a/lib/xe/xe_ioctl.c
+++ b/lib/xe/xe_ioctl.c
@@ -115,6 +115,25 @@ void xe_vm_bind_array_enospc(int fd, uint32_t vm, uint32_t exec_queue,
igt_assert_eq(-errno, -ENOSPC);
}
+void xe_vm_bind_array_enobufs(int fd, uint32_t vm, uint32_t exec_queue,
+ struct drm_xe_vm_bind_op *bind_ops,
+ uint32_t num_bind, struct drm_xe_sync *sync,
+ uint32_t num_syncs)
+{
+ struct drm_xe_vm_bind bind = {
+ .vm_id = vm,
+ .num_binds = num_bind,
+ .vector_of_binds = (uintptr_t)bind_ops,
+ .num_syncs = num_syncs,
+ .syncs = (uintptr_t)sync,
+ .exec_queue_id = exec_queue,
+ };
+
+ igt_assert(num_bind > 1);
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind), -1);
+ igt_assert_eq(-errno, -ENOBUFS);
+}
+
int __xe_vm_bind(int fd, uint32_t vm, uint32_t exec_queue, uint32_t bo,
uint64_t offset, uint64_t addr, uint64_t size, uint32_t op,
uint32_t flags, struct drm_xe_sync *sync, uint32_t num_syncs,
diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
index 2c7506caaf..a9954d0d41 100644
--- a/lib/xe/xe_ioctl.h
+++ b/lib/xe/xe_ioctl.h
@@ -61,6 +61,10 @@ void xe_vm_bind_array_enospc(int fd, uint32_t vm, uint32_t exec_queue,
struct drm_xe_vm_bind_op *bind_ops,
uint32_t num_bind, struct drm_xe_sync *sync,
uint32_t num_syncs);
+void xe_vm_bind_array_enobufs(int fd, uint32_t vm, uint32_t exec_queue,
+ struct drm_xe_vm_bind_op *bind_ops,
+ uint32_t num_bind, struct drm_xe_sync *sync,
+ uint32_t num_syncs);
void xe_vm_unbind_all_async(int fd, uint32_t vm, uint32_t exec_queue,
uint32_t bo, struct drm_xe_sync *sync,
uint32_t num_syncs);
diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
index 7be85da62f..b116d7da1b 100644
--- a/tests/intel/xe_vm.c
+++ b/tests/intel/xe_vm.c
@@ -728,7 +728,7 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
}
#define BIND_ARRAY_BIND_EXEC_QUEUE_FLAG (0x1 << 0)
-
+#define BIND_ARRAY_ENOBUFS_FLAG (0x1 << 1)
/**
* SUBTEST: bind-array-twice
@@ -741,6 +741,11 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
* 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
@@ -753,10 +758,10 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
*/
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, },
@@ -766,9 +771,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];
@@ -777,10 +780,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,
@@ -808,6 +812,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_enobufs(fd, vm, bind_exec_queue, bind_ops,
+ n_execs, sync, 2);
+ 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;
@@ -867,6 +887,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);
}
/**
@@ -2251,20 +2272,25 @@ 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, 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* ✗ Fi.CI.BUILD: failure for xe_vm: Add bind array -ENOBUFS section
2024-06-20 23:54 [PATCH] xe_vm: Add bind array -ENOBUFS section Matthew Brost
@ 2024-06-21 0:15 ` Patchwork
2024-06-21 11:09 ` [PATCH] " Matthew Auld
1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2024-06-21 0:15 UTC (permalink / raw)
To: Matthew Brost; +Cc: igt-dev
== Series Details ==
Series: xe_vm: Add bind array -ENOBUFS section
URL : https://patchwork.freedesktop.org/series/135143/
State : failure
== Summary ==
Applying: xe_vm: Add bind array -ENOBUFS section
Patch failed at 0001 xe_vm: Add bind array -ENOBUFS section
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xe_vm: Add bind array -ENOBUFS section
2024-06-20 23:54 [PATCH] xe_vm: Add bind array -ENOBUFS section Matthew Brost
2024-06-21 0:15 ` ✗ Fi.CI.BUILD: failure for " Patchwork
@ 2024-06-21 11:09 ` Matthew Auld
2024-06-21 17:08 ` Matthew Brost
1 sibling, 1 reply; 4+ messages in thread
From: Matthew Auld @ 2024-06-21 11:09 UTC (permalink / raw)
To: Matthew Brost, igt-dev
On 21/06/2024 00:54, Matthew Brost wrote:
> Add section which has a large enough array of binds which triggers BB
> suballocation failure. Verify -ENOBUFS is returned in this case.
>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
tests/intel/xe_vm: or similar for the commit title prefix.
> ---
> lib/xe/xe_ioctl.c | 19 +++++++++++++++++
> lib/xe/xe_ioctl.h | 4 ++++
> tests/intel/xe_vm.c | 50 ++++++++++++++++++++++++++++++++++-----------
> 3 files changed, 61 insertions(+), 12 deletions(-)
>
> diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
> index a437fd828a..9072801ce1 100644
> --- a/lib/xe/xe_ioctl.c
> +++ b/lib/xe/xe_ioctl.c
> @@ -115,6 +115,25 @@ void xe_vm_bind_array_enospc(int fd, uint32_t vm, uint32_t exec_queue,
> igt_assert_eq(-errno, -ENOSPC);
> }
>
> +void xe_vm_bind_array_enobufs(int fd, uint32_t vm, uint32_t exec_queue,
> + struct drm_xe_vm_bind_op *bind_ops,
> + uint32_t num_bind, struct drm_xe_sync *sync,
> + uint32_t num_syncs)
> +{
> + struct drm_xe_vm_bind bind = {
> + .vm_id = vm,
> + .num_binds = num_bind,
> + .vector_of_binds = (uintptr_t)bind_ops,
> + .num_syncs = num_syncs,
> + .syncs = (uintptr_t)sync,
> + .exec_queue_id = exec_queue,
> + };
> +
> + igt_assert(num_bind > 1);
> + igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind), -1);
> + igt_assert_eq(-errno, -ENOBUFS);
I think we can replace with:
do_ioctl_err(fd, DRM_IOCTL_XE_VM_BIND, &bind, ENOBUFS);
Do we really need this in lib/ ? Are we expecting other users?
Anyway, having a test like this to ensure we don't trigger any kernel
warnings or similar makes sense to me,
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
> +}
> +
> int __xe_vm_bind(int fd, uint32_t vm, uint32_t exec_queue, uint32_t bo,
> uint64_t offset, uint64_t addr, uint64_t size, uint32_t op,
> uint32_t flags, struct drm_xe_sync *sync, uint32_t num_syncs,
> diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
> index 2c7506caaf..a9954d0d41 100644
> --- a/lib/xe/xe_ioctl.h
> +++ b/lib/xe/xe_ioctl.h
> @@ -61,6 +61,10 @@ void xe_vm_bind_array_enospc(int fd, uint32_t vm, uint32_t exec_queue,
> struct drm_xe_vm_bind_op *bind_ops,
> uint32_t num_bind, struct drm_xe_sync *sync,
> uint32_t num_syncs);
> +void xe_vm_bind_array_enobufs(int fd, uint32_t vm, uint32_t exec_queue,
> + struct drm_xe_vm_bind_op *bind_ops,
> + uint32_t num_bind, struct drm_xe_sync *sync,
> + uint32_t num_syncs);
> void xe_vm_unbind_all_async(int fd, uint32_t vm, uint32_t exec_queue,
> uint32_t bo, struct drm_xe_sync *sync,
> uint32_t num_syncs);
> diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
> index 7be85da62f..b116d7da1b 100644
> --- a/tests/intel/xe_vm.c
> +++ b/tests/intel/xe_vm.c
> @@ -728,7 +728,7 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
> }
>
> #define BIND_ARRAY_BIND_EXEC_QUEUE_FLAG (0x1 << 0)
> -
> +#define BIND_ARRAY_ENOBUFS_FLAG (0x1 << 1)
>
> /**
> * SUBTEST: bind-array-twice
> @@ -741,6 +741,11 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
> * 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
> @@ -753,10 +758,10 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
> */
> 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, },
> @@ -766,9 +771,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];
> @@ -777,10 +780,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,
> @@ -808,6 +812,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_enobufs(fd, vm, bind_exec_queue, bind_ops,
> + n_execs, sync, 2);
> + 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;
> @@ -867,6 +887,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);
> }
>
> /**
> @@ -2251,20 +2272,25 @@ 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, 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")
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xe_vm: Add bind array -ENOBUFS section
2024-06-21 11:09 ` [PATCH] " Matthew Auld
@ 2024-06-21 17:08 ` Matthew Brost
0 siblings, 0 replies; 4+ messages in thread
From: Matthew Brost @ 2024-06-21 17:08 UTC (permalink / raw)
To: Matthew Auld; +Cc: igt-dev
On Fri, Jun 21, 2024 at 12:09:39PM +0100, Matthew Auld wrote:
> On 21/06/2024 00:54, Matthew Brost wrote:
> > Add section which has a large enough array of binds which triggers BB
> > suballocation failure. Verify -ENOBUFS is returned in this case.
> >
> > Cc: Matthew Auld <matthew.auld@intel.com>
> > Signed-off-by: Matthew Brost <matthew.brost@intel.com>
>
> tests/intel/xe_vm: or similar for the commit title prefix.
>
Wil adjust.
> > ---
> > lib/xe/xe_ioctl.c | 19 +++++++++++++++++
> > lib/xe/xe_ioctl.h | 4 ++++
> > tests/intel/xe_vm.c | 50 ++++++++++++++++++++++++++++++++++-----------
> > 3 files changed, 61 insertions(+), 12 deletions(-)
> >
> > diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
> > index a437fd828a..9072801ce1 100644
> > --- a/lib/xe/xe_ioctl.c
> > +++ b/lib/xe/xe_ioctl.c
> > @@ -115,6 +115,25 @@ void xe_vm_bind_array_enospc(int fd, uint32_t vm, uint32_t exec_queue,
> > igt_assert_eq(-errno, -ENOSPC);
> > }
> > +void xe_vm_bind_array_enobufs(int fd, uint32_t vm, uint32_t exec_queue,
> > + struct drm_xe_vm_bind_op *bind_ops,
> > + uint32_t num_bind, struct drm_xe_sync *sync,
> > + uint32_t num_syncs)
> > +{
> > + struct drm_xe_vm_bind bind = {
> > + .vm_id = vm,
> > + .num_binds = num_bind,
> > + .vector_of_binds = (uintptr_t)bind_ops,
> > + .num_syncs = num_syncs,
> > + .syncs = (uintptr_t)sync,
> > + .exec_queue_id = exec_queue,
> > + };
> > +
> > + igt_assert(num_bind > 1);
> > + igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind), -1);
> > + igt_assert_eq(-errno, -ENOBUFS);
>
> I think we can replace with:
>
> do_ioctl_err(fd, DRM_IOCTL_XE_VM_BIND, &bind, ENOBUFS);
>
I figured we had something like this. Let me use this.
> Do we really need this in lib/ ? Are we expecting other users?
>
> Anyway, having a test like this to ensure we don't trigger any kernel
> warnings or similar makes sense to me,
>
I have similar function for ENOSPC on an array will move both locally in
xe_vm.c and share code.
Matt
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>
> > +}
> > +
> > int __xe_vm_bind(int fd, uint32_t vm, uint32_t exec_queue, uint32_t bo,
> > uint64_t offset, uint64_t addr, uint64_t size, uint32_t op,
> > uint32_t flags, struct drm_xe_sync *sync, uint32_t num_syncs,
> > diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
> > index 2c7506caaf..a9954d0d41 100644
> > --- a/lib/xe/xe_ioctl.h
> > +++ b/lib/xe/xe_ioctl.h
> > @@ -61,6 +61,10 @@ void xe_vm_bind_array_enospc(int fd, uint32_t vm, uint32_t exec_queue,
> > struct drm_xe_vm_bind_op *bind_ops,
> > uint32_t num_bind, struct drm_xe_sync *sync,
> > uint32_t num_syncs);
> > +void xe_vm_bind_array_enobufs(int fd, uint32_t vm, uint32_t exec_queue,
> > + struct drm_xe_vm_bind_op *bind_ops,
> > + uint32_t num_bind, struct drm_xe_sync *sync,
> > + uint32_t num_syncs);
> > void xe_vm_unbind_all_async(int fd, uint32_t vm, uint32_t exec_queue,
> > uint32_t bo, struct drm_xe_sync *sync,
> > uint32_t num_syncs);
> > diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
> > index 7be85da62f..b116d7da1b 100644
> > --- a/tests/intel/xe_vm.c
> > +++ b/tests/intel/xe_vm.c
> > @@ -728,7 +728,7 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
> > }
> > #define BIND_ARRAY_BIND_EXEC_QUEUE_FLAG (0x1 << 0)
> > -
> > +#define BIND_ARRAY_ENOBUFS_FLAG (0x1 << 1)
> > /**
> > * SUBTEST: bind-array-twice
> > @@ -741,6 +741,11 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
> > * 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
> > @@ -753,10 +758,10 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
> > */
> > 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, },
> > @@ -766,9 +771,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];
> > @@ -777,10 +780,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,
> > @@ -808,6 +812,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_enobufs(fd, vm, bind_exec_queue, bind_ops,
> > + n_execs, sync, 2);
> > + 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;
> > @@ -867,6 +887,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);
> > }
> > /**
> > @@ -2251,20 +2272,25 @@ 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, 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")
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-21 17:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20 23:54 [PATCH] xe_vm: Add bind array -ENOBUFS section Matthew Brost
2024-06-21 0:15 ` ✗ Fi.CI.BUILD: failure for " Patchwork
2024-06-21 11:09 ` [PATCH] " Matthew Auld
2024-06-21 17:08 ` Matthew Brost
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox