public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: tvrtko.ursulin@intel.com, thomas.hellstrom@intel.com,
	daniel.vetter@intel.com, petri.latvala@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t v6 13/13] tests/i915/vm_bind: Add gem_shrink@vm_bind* subtests
Date: Wed, 9 Nov 2022 12:38:35 +0000	[thread overview]
Message-ID: <e4a001f8-2e00-7116-90b6-7c10dbe0e29e@intel.com> (raw)
In-Reply-To: <20221107085256.17293-14-niranjana.vishwanathapura@intel.com>

On 07/11/2022 08:52, Niranjana Vishwanathapura wrote:
> Add VM_BIND shrinker subtests.
> 
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
> ---
>   tests/i915/gem_shrink.c | 60 +++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 60 insertions(+)
> 
> diff --git a/tests/i915/gem_shrink.c b/tests/i915/gem_shrink.c
> index e3e20dfc9..b97a77e8f 100644
> --- a/tests/i915/gem_shrink.c
> +++ b/tests/i915/gem_shrink.c
> @@ -29,10 +29,13 @@
>   
>   #include "i915/gem.h"
>   #include "i915/gem_create.h"
> +#include "i915/gem_vm.h"
> +#include "i915/i915_vm_bind.h"
>   #include "igt.h"
>   #include "igt_gt.h"
>   #include "igt_debugfs.h"
>   #include "igt_sysfs.h"
> +#include "igt_syncobj.h"
>   
>   #ifndef MADV_FREE
>   #define MADV_FREE 8
> @@ -229,6 +232,62 @@ static void hang(int fd, uint64_t alloc)
>   	munmap(obj, obj_size);
>   }
>   
> +static uint64_t gettime_ns(void)
> +{
> +	struct timespec current;
> +	clock_gettime(CLOCK_MONOTONIC, &current);
> +	return (uint64_t)current.tv_sec * NSEC_PER_SEC + current.tv_nsec;
> +}
> +
> +#define BATCH_VA	0xc0000000
> +static void vm_bind(int fd, uint64_t alloc)
> +{
> +	struct drm_i915_gem_timeline_fence exec_fence = { };
> +	struct drm_i915_gem_context_param param = {
> +		.param = I915_CONTEXT_PARAM_RECOVERABLE,
> +		.value = 0,
> +	};
> +	const uint32_t bbe = MI_BATCH_BUFFER_END;
> +	struct drm_i915_gem_execbuffer3 execbuf3;
> +	uint32_t vm_id, handle, exec_syncobj;
> +	struct intel_engine_data engines;
> +	const intel_ctx_t *ctx;
> +	uint64_t fence_value = 0;
> +
> +	vm_id = gem_vm_create_in_vm_bind_mode(fd);

Some kind of igt_require() to check we have vm_bind support somewhere?

Also do we need to unblacklist this particular test?

Reviewed-by: Matthew Auld <matthew.auld@intel.com>

> +	ctx = intel_ctx_create_all_physical(fd);
> +	param.ctx_id = ctx->id;
> +	gem_context_set_param(fd, &param);
> +	gem_context_set_vm(fd, ctx->id, vm_id);
> +	(void)gem_context_get_vm(fd, ctx->id);
> +	engines = intel_engine_list_for_ctx_cfg(fd, &ctx->cfg);
> +
> +	handle = gem_create(fd, alloc);
> +	gem_write(fd, handle, 0, &bbe, sizeof(bbe));
> +	i915_vm_bind(fd, vm_id, BATCH_VA, handle, 0, alloc, 0, 0);
> +
> +	exec_syncobj = syncobj_create(fd, 0);
> +	exec_fence.handle = exec_syncobj;
> +	exec_fence.flags = I915_TIMELINE_FENCE_SIGNAL;
> +
> +	memset(&execbuf3, 0, sizeof(execbuf3));
> +	execbuf3.ctx_id = ctx->id;
> +	execbuf3.engine_idx = engines.engines[0].flags;
> +	execbuf3.batch_address = BATCH_VA;
> +	execbuf3.fence_count = 1;
> +	execbuf3.timeline_fences = to_user_pointer(&exec_fence);
> +
> +	gem_execbuf3(fd, &execbuf3);
> +
> +	igt_assert(syncobj_timeline_wait(fd, &exec_syncobj, &fence_value, 1,
> +					 gettime_ns() + (2 * NSEC_PER_SEC),
> +					 DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT, NULL));
> +	gem_madvise(fd, handle, I915_MADV_DONTNEED);
> +
> +	syncobj_destroy(fd, exec_syncobj);
> +	intel_ctx_destroy(fd, ctx);
> +}
> +
>   static void userptr(int fd, uint64_t alloc, unsigned int flags)
>   #define UDIRTY (1 << 0)
>   {
> @@ -418,6 +477,7 @@ igt_main
>   		{ "execbufN", execbufN },
>   		{ "execbufX", execbufX },
>   		{ "hang", hang },
> +		{ "vm_bind", vm_bind },
>   		{ NULL },
>   	};
>   	const struct mode {

  reply	other threads:[~2022-11-09 12:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07  8:52 [igt-dev] [PATCH i-g-t v6 00/13] vm_bind: Add VM_BIND validation support Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 01/13] lib/i915: memory region gtt_alignment support Niranjana Vishwanathapura
2022-11-09 12:40   ` Matthew Auld
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 02/13] lib/vm_bind: import uapi definitions Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 03/13] lib/vm_bind: Add vm_bind/unbind and execbuf3 ioctls Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 04/13] lib/vm_bind: Add vm_bind mode support for VM Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 05/13] lib/vm_bind: Add vm_bind specific library functions Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 06/13] lib/vm_bind: Add __prime_handle_to_fd() Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 07/13] tests/i915/vm_bind: Add vm_bind sanity test Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 08/13] tests/i915/vm_bind: Add basic VM_BIND test support Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 09/13] tests/i915/vm_bind: Add userptr subtest Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 10/13] tests/i915/vm_bind: Add gem_exec3_basic test Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 11/13] tests/i915/vm_bind: Add gem_exec3_balancer test Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 12/13] tests/i915/vm_bind: Add gem_lmem_swapping@vm_bind sub test Niranjana Vishwanathapura
2022-11-07  8:52 ` [igt-dev] [PATCH i-g-t v6 13/13] tests/i915/vm_bind: Add gem_shrink@vm_bind* subtests Niranjana Vishwanathapura
2022-11-09 12:38   ` Matthew Auld [this message]
2022-11-09 16:02     ` Niranjana Vishwanathapura
2022-11-07 11:02 ` [igt-dev] ✗ GitLab.Pipeline: warning for vm_bind: Add VM_BIND validation support (rev10) Patchwork
2022-11-07 11:18 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-11-07 13:33 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=e4a001f8-2e00-7116-90b6-7c10dbe0e29e@intel.com \
    --to=matthew.auld@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=niranjana.vishwanathapura@intel.com \
    --cc=petri.latvala@intel.com \
    --cc=thomas.hellstrom@intel.com \
    --cc=tvrtko.ursulin@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