Add tests to help verify VF migration
cover Add tests to help verify VF migration
These are proving helpful to find VF migration issues.
Matt
Matthew Brost (3):
tests/intel/xe_exec_reset: Add job cancel tests tests/intel/xe_exec_reset: Add timeslice preempt test tests/intel/xe_exec_reset: Long spin tests
lib/xe/xe_legacy.c | 56 ++++++++++- tests/intel/xe_exec_reset.c | 193 +++++++++++++++++++++++++++++++++++- 2 files changed, 241 insertions(+), 8 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 tests/intel/xe_exec_reset: Add job cancel tests
This test has pulled out when the ability to set the job timeout via IOCTL was removed from the uAPI while upstreaming Xe. Add this coverage back in but only run on a single hardware engine given by default jobs take 5 seconds to timeout.
--- lib/xe/xe_legacy.c | 3 ++- tests/intel/xe_exec_reset.c | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-)
lib/xe/xe_legacy.c +2 -1
@@ -12,6 +12,7 @@/* Batch buffer element count, in number of dwords(u32) */ #define BATCH_DW_COUNT 16 +#define PREEMPT (0x1 << 6)#define CAT_ERROR (0x1 << 5)#define CLOSE_EXEC_QUEUES (0x1 << 2)#define CLOSE_FD (0x1 << 1)
@@ -56,7 +57,7 @@ xe_legacy_test_mode(int fd, struct drm_xe_engine_class_instance *eci,u64 pad;u32 data; } *data; -struct xe_spin_opts spin_opts = { .preempt = false }; +struct xe_spin_opts spin_opts = { .preempt = flags &PREEMPT };int i, b;igt_assert_lte (n_exec_queues,MAX_N_EXECQUEUES );
tests/intel/xe_exec_reset.c +22 -1
@@ -116,6 +116,7 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci,#define VIRTUAL (0x1 << 3)#define PARALLEL (0x1 << 4)#define CAT_ERROR (0x1 << 5) +#define PREEMPT (0x1 << 6)/** * SUBTEST: %s-cat-error
@@ -295,6 +296,12 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,* SUBTEST: cat-error * Description: Test cat error * +* SUBTEST: cancel +* Description: Test job cancel +* +* SUBTEST: cancel-preempt +* Description: Test job cancel with a preemptable job +* * SUBTEST: gt-reset * Description: Test GT reset *
@@ -350,7 +357,7 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,uint64_t exec_sync;uint32_t data; } *data; -struct xe_spin_opts spin_opts = { .preempt = false }; +struct xe_spin_opts spin_opts = { .preempt = flags &PREEMPT };int i, b;igt_assert_lte (n_exec_queues,MAX_N_EXECQUEUES );
@@ -659,6 +666,20 @@ igt_mainxe_legacy_test_mode (fd, hwe,2 ,2 ,CAT_ERROR ,LEGACY_MODE_ADDR , false); + igt_subtest("cancel") +xe_for_each_engine (fd, hwe) { +xe_legacy_test_mode (fd, hwe,1 ,1 ,0 , +LEGACY_MODE_ADDR , false); +break ; + } + + igt_subtest("cancel-preempt") +xe_for_each_engine (fd, hwe) { +xe_legacy_test_mode (fd, hwe,1 ,1 ,PREEMPT , +LEGACY_MODE_ADDR , false); +break ; + } + igt_subtest("gt-reset")xe_for_each_engine (fd, hwe) xe_legacy_test_mode(fd, hwe, 2, 2, GT_RESET,
Signature · 1 line
2.34.1
PATCH 2/3 tests/intel/xe_exec_reset: Add timeslice preempt test
In reply to Matthew BrostAdd tests in which submit multiple preemptable spinners to same hardware engine ensuring a cumulative longer timeout and validating the restart paths in the DRM scheduler TDR (Timeout Detection and Recovery).
v3:
- Spell out TDR (Kamal)
--- lib/xe/xe_legacy.c | 5 +++-- tests/intel/xe_exec_reset.c | 25 +++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-)
lib/xe/xe_legacy.c +3 -2
@@ -12,6 +12,7 @@/* Batch buffer element count, in number of dwords(u32) */ #define BATCH_DW_COUNT 16 +#define CANCEL (0x1 << 7)#define PREEMPT (0x1 << 6)#define CAT_ERROR (0x1 << 5)#define CLOSE_EXEC_QUEUES (0x1 << 2)
@@ -100,7 +101,7 @@ xe_legacy_test_mode(int fd, struct drm_xe_engine_class_instance *eci,u64 exec_addr;int e = i % n_exec_queues; -if (!i) { +if (!i || flags &CANCEL ) { spin_opts.addr = base_addr + spin_offset;xe_spin_init (&data[i].spin, &spin_opts); exec_addr = spin_opts.addr;
@@ -155,7 +156,7 @@ xe_legacy_test_mode(int fd, struct drm_xe_engine_class_instance *eci,xe_vm_unbind_async (fd, vm,0 ,0 , addr, bo_size, sync,1 );igt_assert (syncobj_wait (fd, &sync[0 ].handle,1 ,INT64_MAX ,0 ,NULL )); -if (!use_capture_mode && !(flags >_RESET )) { +if (!use_capture_mode && !(flags & (GT_RESET |CANCEL ))) {for (i =1 ; i < n_execs; i++)igt_assert_eq (data[i].data,0xc0ffee ); }
tests/intel/xe_exec_reset.c +23 -2
@@ -117,6 +117,7 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci,#define PARALLEL (0x1 << 4)#define CAT_ERROR (0x1 << 5)#define PREEMPT (0x1 << 6) +#define CANCEL (0x1 << 7)/** * SUBTEST: %s-cat-error
@@ -302,6 +303,12 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,* SUBTEST: cancel-preempt * Description: Test job cancel with a preemptable job * +* SUBTEST: cancel-timeslice-preempt +* Description: Test job cancel with 2 preemptable jobs +* +* SUBTEST: cancel-timeslice-many-preempt +* Description: Test job cancel with many preemptable jobs +* * SUBTEST: gt-reset * Description: Test GT reset *
@@ -396,7 +403,7 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,uint64_t exec_addr;int e = i % n_exec_queues; -if (!i) { +if (!i || flags &CANCEL ) { spin_opts.addr = base_addr + spin_offset;xe_spin_init (&data[i].spin, &spin_opts); exec_addr = spin_opts.addr;
@@ -451,7 +458,7 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,xe_vm_unbind_async (fd, vm,0 ,0 , addr, bo_size, sync,1 );xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,0 ,3 *NSEC_PER_SEC ); -if (!(flags >_RESET )) { +if (!(flags & (GT_RESET |CANCEL ))) {for (i =1 ; i < n_execs; i++)igt_assert_eq (data[i].data,0xc0ffee ); }
@@ -680,6 +687,20 @@ igt_mainbreak ; } + igt_subtest("cancel-timeslice-preempt") +xe_for_each_engine (fd, hwe) { +xe_legacy_test_mode (fd, hwe,2 ,2 ,CANCEL |PREEMPT , +LEGACY_MODE_ADDR , false); +break ; + } + + igt_subtest("cancel-timeslice-many-preempt") +xe_for_each_engine (fd, hwe) { +xe_legacy_test_mode (fd, hwe,4 ,4 ,CANCEL |PREEMPT , +LEGACY_MODE_ADDR , false); +break ; + } + igt_subtest("gt-reset")xe_for_each_engine (fd, hwe) xe_legacy_test_mode(fd, hwe, 2, 2, GT_RESET,
Signature · 1 line
2.34.1
PATCH 3/3 tests/intel/xe_exec_reset: Long spin tests
In reply to Matthew BrostAdd a long spin test places multiple spinners on an engine instance to ensure they can properly timeslice and complete successfully. This extends the single engine instance tests to multiple threads as well.
These tests are particularly useful for verifying that VF migration works as expected while jobs are actively running on the hardware during the migration process.
--- lib/xe/xe_legacy.c | 52 ++++++++++++- tests/intel/xe_exec_reset.c | 145 ++++++++++++++++++++++++++++++++++++ 2 files changed, 193 insertions(+), 4 deletions(-)
lib/xe/xe_legacy.c +48 -4
@@ -12,6 +12,8 @@/* Batch buffer element count, in number of dwords(u32) */ #define BATCH_DW_COUNT 16 +#define LONG_SPIN_REUSE_QUEUE (0x1 << 11) +#define LONG_SPIN (0x1 << 8)#define CANCEL (0x1 << 7)#define PREEMPT (0x1 << 6)#define CAT_ERROR (0x1 << 5)
@@ -58,8 +60,14 @@ xe_legacy_test_mode(int fd, struct drm_xe_engine_class_instance *eci,u64 pad;u32 data; } *data; -struct xe_spin_opts spin_opts = { .preempt = flags &PREEMPT }; +struct xe_spin_opts spin_opts = { + .preempt = flags &PREEMPT , +#define THREE_SEC (3 * 1000000000ull) + .ctx_ticks = flags &LONG_SPIN ? +xe_spin_nsec_to_ticks (fd,0 ,THREE_SEC ) :0 , + };int i, b; +int extra_execs = (flags &LONG_SPIN_REUSE_QUEUE ) ? n_exec_queues :0 ;igt_assert_lte (n_exec_queues,MAX_N_EXECQUEUES );
@@ -67,7 +75,7 @@ xe_legacy_test_mode(int fd, struct drm_xe_engine_class_instance *eci, fd =drm_open_driver (DRIVER_XE ); vm =xe_vm_create (fd,0 ,0 ); - bo_size =sizeof (*data) * n_execs; + bo_size =sizeof (*data) * (n_execs + extra_execs); bo_size =xe_bb_size (fd, bo_size); bo = xe_bo_create(fd, vm, bo_size,
@@ -101,7 +109,8 @@ xe_legacy_test_mode(int fd, struct drm_xe_engine_class_instance *eci,u64 exec_addr;int e = i % n_exec_queues; -if (!i || flags &CANCEL ) { +if (!i || flags &CANCEL || + (flags &LONG_SPIN && i < n_exec_queues)) { spin_opts.addr = base_addr + spin_offset;xe_spin_init (&data[i].spin, &spin_opts); exec_addr = spin_opts.addr;
@@ -152,12 +161,47 @@ xe_legacy_test_mode(int fd, struct drm_xe_engine_class_instance *eci,igt_assert (syncobj_wait (fd, &sync[0 ].handle,1 ,INT64_MAX ,0 ,NULL )); +for (i = n_execs; i < n_execs + extra_execs; i++) { +u64 base_addr = (!use_capture_mode && (flags &CAT_ERROR ) && !i) + ? (addr + bo_size *128 ) : addr; +u64 batch_offset = (char *)&data[i].batch - (char *)data; +u64 batch_addr = base_addr + batch_offset; +u64 sdi_offset = (char *)&data[i].data - (char *)data; +u64 sdi_addr = base_addr + sdi_offset; +u64 exec_addr; +int e = i % n_exec_queues; + + b =0 ; + data[i].batch[b++] =MI_STORE_DWORD_IMM_GEN4 ; + data[i].batch[b++] = sdi_addr; + data[i].batch[b++] = sdi_addr >>32 ; + data[i].batch[b++] =0xc0ffee ; + data[i].batch[b++] =MI_BATCH_BUFFER_END ; +igt_assert (b <=ARRAY_SIZE (data[i].batch)); + + exec_addr = batch_addr; + + sync[0 ].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL ; + sync[1 ].flags |=DRM_XE_SYNC_FLAG_SIGNAL ; + sync[1 ].handle = syncobjs[e]; + + exec.exec_queue_id = exec_queues[e]; + exec.address = exec_addr; + +syncobj_reset (fd, &syncobjs[e],1 ); +xe_exec (fd, &exec); + } + +for (i =0 ; i < n_exec_queues && extra_execs; i++) +igt_assert (syncobj_wait (fd, &syncobjs[i],1 ,INT64_MAX ,0 ,NULL )); + sync[0 ].flags |=DRM_XE_SYNC_FLAG_SIGNAL ;xe_vm_unbind_async (fd, vm,0 ,0 , addr, bo_size, sync,1 );igt_assert (syncobj_wait (fd, &sync[0 ].handle,1 ,INT64_MAX ,0 ,NULL ));if (!use_capture_mode && !(flags & (GT_RESET |CANCEL ))) { -for (i =1 ; i < n_execs; i++) +for (i = flags &LONG_SPIN ? n_exec_queues :1 ; + i < n_execs + extra_execs; i++)igt_assert_eq (data[i].data,0xc0ffee ); }
tests/intel/xe_exec_reset.c +145 -0
163 lines not on this page · raw message
Signature · 1 line
2.34.1