From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>, <igt-dev@lists.freedesktop.org>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 2/3] tests/intel/xe_wedged: Also add a simple exec to confirm GPU health
Date: Thu, 18 Apr 2024 20:05:57 +0530 [thread overview]
Message-ID: <d12f1bea-b014-4967-9b3c-81cca01fdf35@intel.com> (raw)
In-Reply-To: <20240409221908.1077893-2-rodrigo.vivi@intel.com>
On 10-04-2024 03:49, Rodrigo Vivi wrote:
> Besides confirming that the rebind puts the device in a state
> where we can send IOCTLs, let's also ensure it can really
> perform some basic exec functions.
>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> tests/intel/xe_wedged.c | 90 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 90 insertions(+)
>
> diff --git a/tests/intel/xe_wedged.c b/tests/intel/xe_wedged.c
> index f2587cc43..ab9bf23d5 100644
> --- a/tests/intel/xe_wedged.c
> +++ b/tests/intel/xe_wedged.c
> @@ -17,9 +17,13 @@
> #include "igt.h"
> #include "igt_device.h"
> #include "igt_kmod.h"
> +#include "igt_syncobj.h"
> #include "igt_sysfs.h"
>
> +#include "xe_drm.h"
> #include "xe/xe_ioctl.h"
> +#include "xe/xe_query.h"
> +#include "xe/xe_spin.h"
>
> static void force_wedged(int fd)
> {
> @@ -75,12 +79,96 @@ static int simple_ioctl(int fd)
> return ret;
> }
>
> +static void
> +simple_exec(int fd, struct drm_xe_engine_class_instance *eci)
> +{
> + uint32_t vm;
> + uint64_t addr = 0x1a0000;
> + 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, },
> + };
> + struct drm_xe_exec exec = {
> + .num_batch_buffer = 1,
> + .num_syncs = 2,
> + .syncs = to_user_pointer(sync),
> + };
> + uint64_t batch_offset, batch_addr, sdi_offset, sdi_addr;
> + uint32_t exec_queue;
> + uint32_t syncobjs;
> + size_t bo_size;
> + uint32_t bo = 0;
> + struct {
> + uint32_t batch[16];
> + uint64_t pad;
> + uint32_t data;
> + } *data;
> + int b;
> +
> + vm = xe_vm_create(fd, 0, 0);
> +
> + bo_size = sizeof(*data) * 2;
> + bo_size = xe_bb_size(fd, bo_size);
> + bo = xe_bo_create(fd, vm, bo_size,
> + vram_if_possible(fd, eci->gt_id),
> + DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
> + data = xe_bo_map(fd, bo, bo_size);
> +
> + exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
> +
> + syncobjs = syncobj_create(fd, 0);
> + sync[0].handle = syncobj_create(fd, 0);
> +
> + xe_vm_bind_async(fd, vm, 0, bo, 0, addr,
> + bo_size, sync, 1);
> +
> + batch_offset = (char *)&data[0].batch - (char *)data;
> + batch_addr = addr + batch_offset;
> + sdi_offset = (char *)&data[0].data - (char *)data;
> + sdi_addr = addr + sdi_offset;
> +
> + b = 0;
> + data[0].batch[b++] = MI_STORE_DWORD_IMM_GEN4;
> + data[0].batch[b++] = sdi_addr;
> + data[0].batch[b++] = sdi_addr >> 32;
> + data[0].batch[b++] = 0xc0ffee;
> + data[0].batch[b++] = MI_BATCH_BUFFER_END;
> + igt_assert(b <= ARRAY_SIZE(data[0].batch));
> +
> + sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
> + sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
> + sync[1].handle = syncobjs;
> +
> + exec.exec_queue_id = exec_queue;
> + exec.address = batch_addr;
> +
> + syncobj_reset(fd, &syncobjs, 1);
> +
> + xe_exec(fd, &exec);
> +
> + igt_assert(syncobj_wait(fd, &syncobjs, 1, INT64_MAX, 0, NULL));
> + igt_assert_eq(data[0].data, 0xc0ffee);
> + igt_assert(syncobj_wait(fd, &sync[0].handle, 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));
> + igt_assert_eq(data[0].data, 0xc0ffee);
> +
> + syncobj_destroy(fd, sync[0].handle);
> + syncobj_destroy(fd, syncobjs);
> + xe_exec_queue_destroy(fd, exec_queue);
> + munmap(data, bo_size);
> + gem_close(fd, bo);
> + xe_vm_destroy(fd, vm);
> +}
> +
> /**
> * SUBTEST: basic-wedged
> * Description: Force Xe device wedged after injecting a failure in GT reset
> */
> igt_main
> {
> + struct drm_xe_engine_class_instance *hwe;
> int fd;
>
> igt_fixture {
> @@ -96,6 +184,8 @@ igt_main
> igt_assert_neq(simple_ioctl(fd), 0);
> fd = rebind_xe(fd);
> igt_assert_eq(simple_ioctl(fd), 0);
> + xe_for_each_engine(fd, hwe)
> + simple_exec(fd, hwe);
LGTM
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> }
>
> igt_fixture {
next prev parent reply other threads:[~2024-04-18 14:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 22:19 [PATCH i-g-t 1/3] tests/intel/xe_wedged: Introduce a new test for Xe device wedged state Rodrigo Vivi
2024-04-09 22:19 ` [PATCH i-g-t 2/3] tests/intel/xe_wedged: Also add a simple exec to confirm GPU health Rodrigo Vivi
2024-04-18 14:35 ` Ghimiray, Himal Prasad [this message]
2024-04-09 22:19 ` [PATCH i-g-t 3/3] tests/intel/xe_wedged: Introduce test for wedged_mode=2 Rodrigo Vivi
2024-04-09 23:07 ` ✗ CI.Patch_applied: failure for series starting with [i-g-t,1/3] tests/intel/xe_wedged: Introduce a new test for Xe device wedged state Patchwork
2024-04-10 4:17 ` [PATCH i-g-t 1/3] " Ghimiray, Himal Prasad
2024-04-18 14:28 ` Ghimiray, Himal Prasad
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=d12f1bea-b014-4967-9b3c-81cca01fdf35@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=rodrigo.vivi@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