Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: <sai.gowtham.ch@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t] tests/intel/xe_exec_compute_mode: Fix non-blocking subtest
Date: Mon, 15 Jan 2024 03:50:16 +0000	[thread overview]
Message-ID: <ZaSrePffu4Zthdla@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <20240115031942.29658-1-sai.gowtham.ch@intel.com>

On Mon, Jan 15, 2024 at 08:49:42AM +0530, sai.gowtham.ch@intel.com wrote:
> From: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
> 
> Fix submission of exec, Call exec ioctl sperately instead existing
> igt wrapper _xe_exec which leads to infinite loop even kernel throws an
> error.
> 
> Cc: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> Signed-off-by: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
> ---
>  tests/intel/xe_exec_compute_mode.c | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/intel/xe_exec_compute_mode.c b/tests/intel/xe_exec_compute_mode.c
> index 6ebfa1a86..473b11ae9 100644
> --- a/tests/intel/xe_exec_compute_mode.c
> +++ b/tests/intel/xe_exec_compute_mode.c
> @@ -15,6 +15,7 @@
>  #include "igt.h"
>  #include "lib/igt_syncobj.h"
>  #include "lib/intel_reg.h"
> +#include <sys/ioctl.h>
>  #include "xe_drm.h"
>  
>  #include "xe/xe_ioctl.h"
> @@ -320,7 +321,7 @@ static void non_block(int fd, int expect)
>  		uint32_t data;
>  		uint64_t exec_sync;
>  	} *data = NULL;
> -	struct xe_spin_opts spin_opts = { .addr = addr, .preempt = false };
> +	struct xe_spin_opts spin_opts = { .preempt = false };
>  	struct drm_xe_engine *engine;
>  	uint64_t batch_offset = (char *)&data[EXEC_DATA].batch - (char *)data;
>  	uint64_t batch_addr = addr + batch_offset;
> @@ -350,6 +351,7 @@ static void non_block(int fd, int expect)
>  	xe_wait_ufence(fd, &data[VM_DATA].vm_sync, USER_FENCE_VALUE, 0, ONE_SEC);
>  	data[VM_DATA].vm_sync = 0;
>  
> +	spin_opts.addr = addr + (char *)&data[SPIN_DATA].spin - (char *)data;
>  	xe_spin_init(&data[SPIN_DATA].spin, &spin_opts);
>  	sync[0].addr = addr + (char *)&data[SPIN_DATA].exec_sync - (char *)data;
>  	exec.exec_queue_id = exec_queue;
> @@ -358,11 +360,11 @@ static void non_block(int fd, int expect)
>  	xe_spin_wait_started(&data[SPIN_DATA].spin);
>  
>  	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++] = value;
> -	data[0].batch[b++] = MI_BATCH_BUFFER_END;
> +	data[EXEC_DATA].batch[b++] = MI_STORE_DWORD_IMM_GEN4;
> +	data[EXEC_DATA].batch[b++] = sdi_addr;
> +	data[EXEC_DATA].batch[b++] = sdi_addr >> 32;
> +	data[EXEC_DATA].batch[b++] = value;
> +	data[EXEC_DATA].batch[b++] = MI_BATCH_BUFFER_END;
>  	igt_assert(b <= ARRAY_SIZE(data->batch));
>  
>  	sync[0].addr = addr + (char *)&data[EXEC_DATA].exec_sync - (char *)data;
> @@ -371,12 +373,15 @@ static void non_block(int fd, int expect)
>  	exec.address = batch_addr;
>  
>  	while (1) {
> -		err = __xe_exec(fd, &exec);
>  
> -		if (err == -EWOULDBLOCK)
> +		err = ioctl(fd, DRM_IOCTL_XE_EXEC, &exec);
> +
> +		if (err == -1 && errno == EWOULDBLOCK)
>  			break;
> +
> +		igt_assert_eq(err, 0);
>  	}
> -	igt_assert_eq(err, expect);
> +	igt_assert_eq(errno, expect);
>  
>  	xe_spin_end(&data[SPIN_DATA].spin);
>  	xe_wait_ufence(fd, &data[SPIN_DATA].exec_sync, USER_FENCE_VALUE, 0, ONE_SEC);
> @@ -454,7 +459,7 @@ igt_main
>  	}
>  
>  	igt_subtest("non-blocking")
> -		non_block(fd, -EWOULDBLOCK);
> +		non_block(fd, EWOULDBLOCK);
>  
>  
>  	igt_fixture
> -- 
> 2.39.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: Matthew Brost <matthew.brost@intel.com>
To: sai.gowtham.ch@intel.com
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t] tests/intel/xe_exec_compute_mode: Fix non-blocking subtest
Date: Mon, 15 Jan 2024 03:50:16 +0000	[thread overview]
Message-ID: <ZaSrePffu4Zthdla@DUT025-TGLU.fm.intel.com> (raw)
Message-ID: <20240115035016.Kx4NNC84TWCG6tp4p-sJlWSfWOAK1B-hhohBzfPJIeM@z> (raw)
In-Reply-To: <20240115031942.29658-1-sai.gowtham.ch@intel.com>

On Mon, Jan 15, 2024 at 08:49:42AM +0530, sai.gowtham.ch@intel.com wrote:
> From: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
> 
> Fix submission of exec, Call exec ioctl sperately instead existing
> igt wrapper _xe_exec which leads to infinite loop even kernel throws an
> error.
> 
> Cc: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> Signed-off-by: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
> ---
>  tests/intel/xe_exec_compute_mode.c | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/intel/xe_exec_compute_mode.c b/tests/intel/xe_exec_compute_mode.c
> index 6ebfa1a86..473b11ae9 100644
> --- a/tests/intel/xe_exec_compute_mode.c
> +++ b/tests/intel/xe_exec_compute_mode.c
> @@ -15,6 +15,7 @@
>  #include "igt.h"
>  #include "lib/igt_syncobj.h"
>  #include "lib/intel_reg.h"
> +#include <sys/ioctl.h>
>  #include "xe_drm.h"
>  
>  #include "xe/xe_ioctl.h"
> @@ -320,7 +321,7 @@ static void non_block(int fd, int expect)
>  		uint32_t data;
>  		uint64_t exec_sync;
>  	} *data = NULL;
> -	struct xe_spin_opts spin_opts = { .addr = addr, .preempt = false };
> +	struct xe_spin_opts spin_opts = { .preempt = false };
>  	struct drm_xe_engine *engine;
>  	uint64_t batch_offset = (char *)&data[EXEC_DATA].batch - (char *)data;
>  	uint64_t batch_addr = addr + batch_offset;
> @@ -350,6 +351,7 @@ static void non_block(int fd, int expect)
>  	xe_wait_ufence(fd, &data[VM_DATA].vm_sync, USER_FENCE_VALUE, 0, ONE_SEC);
>  	data[VM_DATA].vm_sync = 0;
>  
> +	spin_opts.addr = addr + (char *)&data[SPIN_DATA].spin - (char *)data;
>  	xe_spin_init(&data[SPIN_DATA].spin, &spin_opts);
>  	sync[0].addr = addr + (char *)&data[SPIN_DATA].exec_sync - (char *)data;
>  	exec.exec_queue_id = exec_queue;
> @@ -358,11 +360,11 @@ static void non_block(int fd, int expect)
>  	xe_spin_wait_started(&data[SPIN_DATA].spin);
>  
>  	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++] = value;
> -	data[0].batch[b++] = MI_BATCH_BUFFER_END;
> +	data[EXEC_DATA].batch[b++] = MI_STORE_DWORD_IMM_GEN4;
> +	data[EXEC_DATA].batch[b++] = sdi_addr;
> +	data[EXEC_DATA].batch[b++] = sdi_addr >> 32;
> +	data[EXEC_DATA].batch[b++] = value;
> +	data[EXEC_DATA].batch[b++] = MI_BATCH_BUFFER_END;
>  	igt_assert(b <= ARRAY_SIZE(data->batch));
>  
>  	sync[0].addr = addr + (char *)&data[EXEC_DATA].exec_sync - (char *)data;
> @@ -371,12 +373,15 @@ static void non_block(int fd, int expect)
>  	exec.address = batch_addr;
>  
>  	while (1) {
> -		err = __xe_exec(fd, &exec);
>  
> -		if (err == -EWOULDBLOCK)
> +		err = ioctl(fd, DRM_IOCTL_XE_EXEC, &exec);
> +
> +		if (err == -1 && errno == EWOULDBLOCK)
>  			break;
> +
> +		igt_assert_eq(err, 0);
>  	}
> -	igt_assert_eq(err, expect);
> +	igt_assert_eq(errno, expect);
>  
>  	xe_spin_end(&data[SPIN_DATA].spin);
>  	xe_wait_ufence(fd, &data[SPIN_DATA].exec_sync, USER_FENCE_VALUE, 0, ONE_SEC);
> @@ -454,7 +459,7 @@ igt_main
>  	}
>  
>  	igt_subtest("non-blocking")
> -		non_block(fd, -EWOULDBLOCK);
> +		non_block(fd, EWOULDBLOCK);
>  
>  
>  	igt_fixture
> -- 
> 2.39.1
> 

  reply	other threads:[~2024-01-15  3:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15  3:19 [PATCH i-g-t] tests/intel/xe_exec_compute_mode: Fix non-blocking subtest sai.gowtham.ch
2024-01-15  3:50 ` Matthew Brost [this message]
2024-01-15  3:50   ` Matthew Brost
2024-01-15  3:52 ` ✓ CI.xeBAT: success for " Patchwork
2024-01-15  4:10 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-01-15 13:43   ` Kamil Konieczny

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=ZaSrePffu4Zthdla@DUT025-TGLU.fm.intel.com \
    --to=matthew.brost@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --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