All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>, intel-gfx@lists.freedesktop.org
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915/selftest: use igt_vma_move_to_active_unlocked if possible
Date: Tue, 13 Dec 2022 13:21:05 +0000	[thread overview]
Message-ID: <6d9cdcfa-01d2-d1b0-e754-3d73a488c789@linux.intel.com> (raw)
In-Reply-To: <20221213121951.1515023-2-andrzej.hajda@intel.com>


On 13/12/2022 12:19, Andrzej Hajda wrote:
> Helper replaces common sequence of calls.
> 
> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
> ---
>   .../gpu/drm/i915/gem/selftests/i915_gem_context.c    |  8 ++------
>   drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c   |  8 ++------
>   drivers/gpu/drm/i915/gt/selftest_execlists.c         | 12 +++---------
>   drivers/gpu/drm/i915/gt/selftest_lrc.c               |  4 +---
>   drivers/gpu/drm/i915/gt/selftest_mocs.c              |  4 +---
>   drivers/gpu/drm/i915/gt/selftest_workarounds.c       | 12 +++---------
>   6 files changed, 12 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
> index ac02fb03659208..9c6a64a0de5c0b 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
> @@ -1549,9 +1549,7 @@ static int write_to_scratch(struct i915_gem_context *ctx,
>   		goto err_unpin;
>   	}
>   
> -	i915_vma_lock(vma);
> -	err = i915_vma_move_to_active(vma, rq, 0);
> -	i915_vma_unlock(vma);
> +	err = igt_vma_move_to_active_unlocked(vma, rq, 0);
>   	if (err)
>   		goto skip_request;
>   
> @@ -1684,9 +1682,7 @@ static int read_from_scratch(struct i915_gem_context *ctx,
>   		goto err_unpin;
>   	}
>   
> -	i915_vma_lock(vma);
> -	err = i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
> -	i915_vma_unlock(vma);
> +	err = igt_vma_move_to_active_unlocked(vma, rq, EXEC_OBJECT_WRITE);
>   	if (err)
>   		goto skip_request;
>   
> diff --git a/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c b/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
> index c147038230c462..20a232a140b0f2 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c
> @@ -130,15 +130,11 @@ int igt_gpu_fill_dw(struct intel_context *ce,
>   		goto err_batch;
>   	}
>   
> -	i915_vma_lock(batch);
> -	err = i915_vma_move_to_active(batch, rq, 0);
> -	i915_vma_unlock(batch);
> +	err = igt_vma_move_to_active_unlocked(batch, rq, 0);
>   	if (err)
>   		goto skip_request;
>   
> -	i915_vma_lock(vma);
> -	err = i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
> -	i915_vma_unlock(vma);
> +	err = igt_vma_move_to_active_unlocked(vma, rq, EXEC_OBJECT_WRITE);
>   	if (err)
>   		goto skip_request;
>   
> diff --git a/drivers/gpu/drm/i915/gt/selftest_execlists.c b/drivers/gpu/drm/i915/gt/selftest_execlists.c
> index a619057543fd94..736b89a8ecf54f 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_execlists.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_execlists.c
> @@ -2763,13 +2763,11 @@ static int create_gang(struct intel_engine_cs *engine,
>   	rq->batch = i915_vma_get(vma);
>   	i915_request_get(rq);
>   
> -	i915_vma_lock(vma);
> -	err = i915_vma_move_to_active(vma, rq, 0);
> +	err = igt_vma_move_to_active_unlocked(vma, rq, 0);
>   	if (!err)
>   		err = rq->engine->emit_bb_start(rq,
>   						i915_vma_offset(vma),
>   						PAGE_SIZE, 0);
> -	i915_vma_unlock(vma);
>   	i915_request_add(rq);
>   	if (err)
>   		goto err_rq;
> @@ -3177,9 +3175,7 @@ create_gpr_client(struct intel_engine_cs *engine,
>   		goto out_batch;
>   	}
>   
> -	i915_vma_lock(vma);
> -	err = i915_vma_move_to_active(vma, rq, 0);
> -	i915_vma_unlock(vma);
> +	err = igt_vma_move_to_active_unlocked(vma, rq, 0);
>   
>   	i915_vma_lock(batch);
>   	if (!err)
> @@ -3514,13 +3510,11 @@ static int smoke_submit(struct preempt_smoke *smoke,
>   	}
>   
>   	if (vma) {
> -		i915_vma_lock(vma);
> -		err = i915_vma_move_to_active(vma, rq, 0);
> +		err = igt_vma_move_to_active_unlocked(vma, rq, 0);
>   		if (!err)
>   			err = rq->engine->emit_bb_start(rq,
>   							i915_vma_offset(vma),
>   							PAGE_SIZE, 0);
> -		i915_vma_unlock(vma);
>   	}
>   
>   	i915_request_add(rq);
> diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
> index a61ae9d7e0a220..a78a3d2c2e16e8 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
> @@ -599,9 +599,7 @@ __gpr_read(struct intel_context *ce, struct i915_vma *scratch, u32 *slot)
>   		*cs++ = 0;
>   	}
>   
> -	i915_vma_lock(scratch);
> -	err = i915_vma_move_to_active(scratch, rq, EXEC_OBJECT_WRITE);
> -	i915_vma_unlock(scratch);
> +	err = igt_vma_move_to_active_unlocked(scratch, rq, EXEC_OBJECT_WRITE);
>   
>   	i915_request_get(rq);
>   	i915_request_add(rq);
> diff --git a/drivers/gpu/drm/i915/gt/selftest_mocs.c b/drivers/gpu/drm/i915/gt/selftest_mocs.c
> index f27cc28608d4ff..ca009a6a13bdbb 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_mocs.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_mocs.c
> @@ -228,9 +228,7 @@ static int check_mocs_engine(struct live_mocs *arg,
>   	if (IS_ERR(rq))
>   		return PTR_ERR(rq);
>   
> -	i915_vma_lock(vma);
> -	err = i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
> -	i915_vma_unlock(vma);
> +	err = igt_vma_move_to_active_unlocked(vma, rq, EXEC_OBJECT_WRITE);
>   
>   	/* Read the mocs tables back using SRM */
>   	offset = i915_ggtt_offset(vma);
> diff --git a/drivers/gpu/drm/i915/gt/selftest_workarounds.c b/drivers/gpu/drm/i915/gt/selftest_workarounds.c
> index 9c5449709161c0..14a8b25b6204a7 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_workarounds.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_workarounds.c
> @@ -138,9 +138,7 @@ read_nonprivs(struct intel_context *ce)
>   		goto err_pin;
>   	}
>   
> -	i915_vma_lock(vma);
> -	err = i915_vma_move_to_active(vma, rq, EXEC_OBJECT_WRITE);
> -	i915_vma_unlock(vma);
> +	err = igt_vma_move_to_active_unlocked(vma, rq, EXEC_OBJECT_WRITE);
>   	if (err)
>   		goto err_req;
>   
> @@ -853,9 +851,7 @@ static int read_whitelisted_registers(struct intel_context *ce,
>   	if (IS_ERR(rq))
>   		return PTR_ERR(rq);
>   
> -	i915_vma_lock(results);
> -	err = i915_vma_move_to_active(results, rq, EXEC_OBJECT_WRITE);
> -	i915_vma_unlock(results);
> +	err = igt_vma_move_to_active_unlocked(results, rq, EXEC_OBJECT_WRITE);
>   	if (err)
>   		goto err_req;
>   
> @@ -935,9 +931,7 @@ static int scrub_whitelisted_registers(struct intel_context *ce)
>   			goto err_request;
>   	}
>   
> -	i915_vma_lock(batch);
> -	err = i915_vma_move_to_active(batch, rq, 0);
> -	i915_vma_unlock(batch);
> +	err = igt_vma_move_to_active_unlocked(batch, rq, 0);
>   	if (err)
>   		goto err_request;
>   

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

  reply	other threads:[~2022-12-13 13:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 12:19 [Intel-gfx] [PATCH 1/2] drm/i915: use proper helper in igt_vma_move_to_active_unlocked Andrzej Hajda
2022-12-13 12:19 ` [Intel-gfx] [PATCH 2/2] drm/i915/selftest: use igt_vma_move_to_active_unlocked if possible Andrzej Hajda
2022-12-13 13:21   ` Tvrtko Ursulin [this message]
2022-12-13 15:38   ` Andi Shyti
2022-12-13 13:12 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: use proper helper in igt_vma_move_to_active_unlocked Patchwork
2022-12-13 13:14 ` [Intel-gfx] [PATCH 1/2] " Tvrtko Ursulin
2022-12-13 15:37 ` Andi Shyti
2022-12-14 15:48 ` [Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [1/2] " Patchwork
2023-01-09 13:55 ` [Intel-gfx] [PATCH 1/2] " Andi Shyti

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=6d9cdcfa-01d2-d1b0-e754-3d73a488c789@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.