Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Summers, Stuart" <stuart.summers@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Vishwanathapura,
	Niranjana" <niranjana.vishwanathapura@intel.com>
Cc: "Ch, Sai Gowtham" <sai.gowtham.ch@intel.com>,
	"Dandamudi, Priyanka" <priyanka.dandamudi@intel.com>,
	"kamil.konieczny@linux.intel.com"
	<kamil.konieczny@linux.intel.com>
Subject: Re: [PATCH v2 16/19] tests/intel/xe_exec_multi_queue: Add submission sanity test
Date: Thu, 4 Dec 2025 21:08:06 +0000	[thread overview]
Message-ID: <04e4d61c99e2496c4ba288fcd551fb2de416282e.camel@intel.com> (raw)
In-Reply-To: <20251121035715.767226-37-niranjana.vishwanathapura@intel.com>

On Thu, 2025-11-20 at 19:57 -0800, Niranjana Vishwanathapura wrote:
> Add sanity test involving exec submissions in multi queue group.
> 
> v2: Remove simulation related code (Priyanka)
>     Use BASE_ADDRESS macro for address (Sai)
> 
> Signed-off-by: Niranjana Vishwanathapura
> <niranjana.vishwanathapura@intel.com>
> ---
>  tests/intel/xe_exec_multi_queue.c | 139
> ++++++++++++++++++++++++++++++
>  1 file changed, 139 insertions(+)
> 
> diff --git a/tests/intel/xe_exec_multi_queue.c
> b/tests/intel/xe_exec_multi_queue.c
> index 06e898a47..9f7b3b4d7 100644
> --- a/tests/intel/xe_exec_multi_queue.c
> +++ b/tests/intel/xe_exec_multi_queue.c
> @@ -44,6 +44,9 @@
>  
>  #define BASE_ADDRESS   0x1a0000
>  
> +/* Number of queues in exec sanity tests */
> +#define NUM_QUEUES             2
> +
>  static void
>  __test_sanity(int fd, int gt, int class, bool preempt_mode)
>  {
> @@ -216,6 +219,138 @@ test_sanity(int fd, int gt, int class)
>         __test_sanity(fd, gt, class, true);
>  }
>  
> +static void
> +__test_exec_sanity(int fd, struct drm_xe_engine_class_instance *eci,
> unsigned int flags)
> +{
> +#define USER_FENCE_VALUE       0xdeadbeefdeadbeefull
> +       struct drm_xe_sync sync = { };
> +       struct drm_xe_exec exec = {
> +               .num_batch_buffer = 1,
> +               .num_syncs = 1,
> +               .syncs = to_user_pointer(&sync),
> +       };
> +       uint64_t vm_sync = 0, addr[NUM_QUEUES];
> +       uint32_t vm, exec_queues[NUM_QUEUES], bo[NUM_QUEUES];
> +       int64_t fence_timeout = NSEC_PER_SEC;
> +       struct xe_spin *spin[NUM_QUEUES];
> +       size_t bo_size;
> +       struct drm_xe_ext_set_property multi_queue = {
> +               .base.name =
> DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
> +               .property =
> DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_GROUP,
> +               .value = DRM_XE_MULTI_GROUP_CREATE,
> +       };
> +       uint64_t ext = to_user_pointer(&multi_queue);
> +       bool preempt_mode = flags & PREEMPT_MODE;
> +       int i;
> +
> +       sync.flags = DRM_XE_SYNC_FLAG_SIGNAL;
> +       if (preempt_mode) {
> +               sync.type = DRM_XE_SYNC_TYPE_USER_FENCE;
> +               sync.timeline_value = USER_FENCE_VALUE;
> +       } else {
> +               sync.type = DRM_XE_SYNC_TYPE_SYNCOBJ;
> +               sync.handle = syncobj_create(fd, 0);
> +       }
> +
> +       vm = xe_vm_create(fd, preempt_mode ?
> DRM_XE_VM_CREATE_FLAG_LR_MODE : 0, 0);
> +       bo_size = xe_bb_size(fd, sizeof(struct xe_spin));
> +
> +       for (i = 0; i < NUM_QUEUES; i++) {
> +               bo[i] = xe_bo_create(fd, vm, bo_size,
> vram_if_possible(fd, eci[0].gt_id),
> +                                   
> DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
> +               spin[i] = xe_bo_map(fd, bo[i], bo_size);
> +               exec_queues[i] = xe_exec_queue_create(fd, vm, eci,
> ext);
> +               if (i == 0)
> +                       multi_queue.value = exec_queues[i];
> +
> +               addr[i] = BASE_ADDRESS + i * bo_size;
> +       }
> +
> +       if (preempt_mode)
> +               sync.addr = to_user_pointer(&vm_sync);
> +
> +       for (i = 0; i < NUM_QUEUES; i++) {
> +               xe_vm_bind_async(fd, vm, 0, bo[i], 0, addr[i],
> bo_size, &sync, 1);
> +               if (preempt_mode) {
> +                       xe_wait_ufence(fd, &vm_sync,
> USER_FENCE_VALUE, 0, fence_timeout);
> +                       vm_sync = 0;
> +               } else {
> +                       igt_assert(syncobj_wait(fd, &sync.handle, 1,
> INT64_MAX, 0, NULL));
> +                       syncobj_reset(fd, &sync.handle, 1);
> +               }
> +       }
> +
> +       /* Validate job submission on secondary queue before primary
> queue */
> +       for (i = 1; i >= 0; i--) {

for i = NUM_QUEUES = 1

In case we ever need to increase this?

Looks good otherwise:
Reviewed-by: Stuart Summers <stuart.summers@intel.com>

> +               xe_spin_init_opts(spin[i], .addr = addr[i]);
> +               if (preempt_mode)
> +                       sync.addr = addr[i] + (char *)&spin[i]-
> >exec_sync - (char *)spin[i];
> +
> +               exec.exec_queue_id = exec_queues[i];
> +               exec.address = addr[i];
> +               xe_exec(fd, &exec);
> +               xe_spin_wait_started(spin[i]);
> +               xe_spin_end(spin[i]);
> +               if (preempt_mode) {
> +                       xe_wait_ufence(fd, &spin[i]->exec_sync,
> USER_FENCE_VALUE, exec_queues[i], fence_timeout);
> +               } else {
> +                       igt_assert(syncobj_wait(fd, &sync.handle, 1,
> INT64_MAX, 0, NULL));
> +                       syncobj_reset(fd, &sync.handle, 1);
> +               }
> +       }
> +
> +       /* Destroy primary queue */
> +       xe_exec_queue_destroy(fd, exec_queues[0]);
> +
> +       /* Validate submission on secondary queues fail after
> destroying the primary */
> +       xe_spin_init_opts(spin[1], .addr = addr[1]);
> +       if (preempt_mode)
> +               sync.addr = addr[1] + (char *)&spin[1]->exec_sync -
> (char *)spin[1];
> +
> +       exec.exec_queue_id = exec_queues[1];
> +       exec.address = addr[1];
> +       igt_assert_eq(__xe_exec(fd, &exec), -ECANCELED);
> +
> +       if (preempt_mode)
> +               sync.addr = to_user_pointer(&vm_sync);
> +
> +       for (i = 0; i < NUM_QUEUES; i++) {
> +               xe_vm_unbind_async(fd, vm, 0, 0, addr[i], bo_size,
> &sync, 1);
> +               if (preempt_mode) {
> +                       xe_wait_ufence(fd, &vm_sync,
> USER_FENCE_VALUE, 0, fence_timeout);
> +                       vm_sync = 0;
> +               } else {
> +                       igt_assert(syncobj_wait(fd, &sync.handle, 1,
> INT64_MAX, 0, NULL));
> +                       syncobj_reset(fd, &sync.handle, 1);
> +               }
> +       }
> +
> +       /* Destroy secondary queue */
> +       xe_exec_queue_destroy(fd, exec_queues[1]);
> +
> +       for (i = 0; i < NUM_QUEUES; i++) {
> +               munmap(spin[i], bo_size);
> +               gem_close(fd, bo[i]);
> +       }
> +
> +       if (!preempt_mode)
> +               syncobj_destroy(fd, sync.handle);
> +
> +       xe_vm_destroy(fd, vm);
> +}
> +
> +/**
> + * SUBTEST: exec-sanity
> + * Description: Run exec submission sanity tests
> + * Test category: functionality test
> + */
> +static void
> +test_exec_sanity(int fd, struct drm_xe_engine_class_instance *eci)
> +{
> +       __test_exec_sanity(fd, eci, 0);
> +       __test_exec_sanity(fd, eci, PREEMPT_MODE);
> +}
> +
>  static void
>  __test_priority(int fd, struct drm_xe_engine_class_instance *eci,
>                 unsigned int flags)
> @@ -901,6 +1036,10 @@ igt_main
>                         xe_for_each_multi_queue_engine_class(class)
>                                 test_sanity(fd, gt, class);
>  
> +       igt_subtest_f("exec-sanity")
> +               xe_for_each_multi_queue_engine(fd, hwe)
> +                       test_exec_sanity(fd, hwe);
> +
>         igt_subtest_f("virtual")
>                 xe_for_each_gt(fd, gt)
>                         xe_for_each_multi_queue_engine_class(class)


  parent reply	other threads:[~2025-12-04 21:08 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  3:57 [PATCH v2 00/19] Multi Queue feature validation support Niranjana Vishwanathapura
2025-11-21  3:57 ` [PATCH v2 01/19] drm-uapi/xe: Sync with Multi-Queue uapi Niranjana Vishwanathapura
2025-12-04 19:19   ` Summers, Stuart
2025-12-04 20:58     ` Niranjana Vishwanathapura
2025-12-05 18:07       ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 02/19] lib/xe: Add multi-queue helper routines Niranjana Vishwanathapura
2025-12-04 19:20   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 03/19] tests/intel/xe_exec_multi_queue: Add xe_exec_multi_queue test Niranjana Vishwanathapura
2025-12-04 20:02   ` Summers, Stuart
2025-12-05  1:34     ` Niranjana Vishwanathapura
2025-12-05 18:09       ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 04/19] tests/intel/xe_exec_multi_queue: Validate exec submissions Niranjana Vishwanathapura
2025-12-02  5:27   ` Ch, Sai Gowtham
2025-12-04 20:42   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 05/19] tests/intel/xe_exec_multi_queue: Validate queue priority setting Niranjana Vishwanathapura
2025-12-02  5:29   ` Dandamudi, Priyanka
2025-12-04 20:45   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 06/19] tests/intel/xe_exec_multi_queue: Add close-fd tests Niranjana Vishwanathapura
2025-11-24  8:18   ` Goyal, Nakshtra
2025-12-04 20:46   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 07/19] tests/intel/xe_exec_multi_queue: Add multiple placement test Niranjana Vishwanathapura
2025-12-02  5:32   ` Dandamudi, Priyanka
2025-12-05 18:10   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 08/19] tests/intel/xe_exec_multi_queue: Add preempt mode test Niranjana Vishwanathapura
2025-12-04 20:52   ` Summers, Stuart
2025-12-05 19:12     ` Niranjana Vishwanathapura
2025-12-08 19:40       ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 09/19] lib/xe: Add exec_queue set_property ioctl support Niranjana Vishwanathapura
2025-12-04 19:24   ` Summers, Stuart
2025-12-05  1:58     ` Niranjana Vishwanathapura
2025-12-05 18:11       ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 10/19] tests/intel/xe_exec_multi_queue: Add dynamic priority test Niranjana Vishwanathapura
2025-12-04 20:53   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 11/19] tests/intel/xe_exec_multi_queue: Add userptr invalidation tests Niranjana Vishwanathapura
2025-12-04 20:56   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 12/19] tests/intel/xe_exec_multi_queue: Add fault mode test Niranjana Vishwanathapura
2025-11-21  5:04   ` Goyal, Nakshtra
2025-12-04 20:59   ` Summers, Stuart
2025-12-04 23:25     ` Niranjana Vishwanathapura
2025-12-05 18:13       ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 13/19] tests/intel/xe_exec_multi_queue: Add multi queues with SMEM Niranjana Vishwanathapura
2025-12-04 19:56   ` Goyal, Nakshtra
2025-12-04 20:59   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 14/19] lib/xe/xe_spin: Add switch point for preemptible spinner Niranjana Vishwanathapura
2025-12-04 21:03   ` Summers, Stuart
2025-12-04 21:42     ` Niranjana Vishwanathapura
2025-12-05 18:45       ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 15/19] tests/intel/xe_exec_multi_queue: Add priority test Niranjana Vishwanathapura
2025-12-02  5:28   ` Dandamudi, Priyanka
2025-12-04 21:53   ` Summers, Stuart
2025-12-05 18:23     ` Niranjana Vishwanathapura
2025-12-08 19:38       ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 16/19] tests/intel/xe_exec_multi_queue: Add submission sanity test Niranjana Vishwanathapura
2025-12-02 11:46   ` Ch, Sai Gowtham
2025-12-04 21:08   ` Summers, Stuart [this message]
2025-12-04 21:28     ` Niranjana Vishwanathapura
2025-11-21  3:57 ` [PATCH v2 17/19] tests/intel/xe_exec_multi_queue: Sanity test KEEP_ACTIVE flag Niranjana Vishwanathapura
2025-12-04 21:10   ` Summers, Stuart
2025-12-04 21:20     ` Niranjana Vishwanathapura
2025-11-21  3:57 ` [PATCH v2 18/19] tests/intel/xe_exec_multi_queue: Keep group active in exec-sanity Niranjana Vishwanathapura
2025-12-02 11:51   ` Ch, Sai Gowtham
2025-12-04 21:12   ` Summers, Stuart
2025-11-21  3:57 ` [PATCH v2 19/19] tests/intel/xe_exec_queue_property: Update invalid-property test Niranjana Vishwanathapura
2025-12-04 19:25   ` Summers, Stuart
2025-12-04 21:11     ` Niranjana Vishwanathapura
2025-11-21  4:32 ` ✓ Xe.CI.BAT: success for Multi Queue feature validation support (rev2) Patchwork
2025-11-21  6:47 ` ✓ i915.CI.BAT: " Patchwork
2025-11-21  7:20 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-21  9:42 ` ✗ i915.CI.Full: " Patchwork

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=04e4d61c99e2496c4ba288fcd551fb2de416282e.camel@intel.com \
    --to=stuart.summers@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=niranjana.vishwanathapura@intel.com \
    --cc=priyanka.dandamudi@intel.com \
    --cc=sai.gowtham.ch@intel.com \
    /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