public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/9] drm/i915/selftests: Exercise some AB...BA preemption chains
Date: Tue, 29 Jan 2019 11:24:01 +0000	[thread overview]
Message-ID: <c0768f15-2c00-bce2-7984-75e3b8070d7b@linux.intel.com> (raw)
In-Reply-To: <20190129105918.5522-5-chris@chris-wilson.co.uk>


On 29/01/2019 10:59, Chris Wilson wrote:
> Build a chain using 2 contexts (A, B) then request a preemption such
> that a later A request runs before the spinner in B.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/selftests/intel_lrc.c | 103 +++++++++++++++++++++
>   1 file changed, 103 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/intel_lrc.c b/drivers/gpu/drm/i915/selftests/intel_lrc.c
> index 58f534a39118..fe58ad711e2f 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_lrc.c
> @@ -4,6 +4,8 @@
>    * Copyright © 2018 Intel Corporation
>    */
>   
> +#include <linux/prime_numbers.h>
> +
>   #include "../i915_reset.h"
>   
>   #include "../i915_selftest.h"
> @@ -405,6 +407,106 @@ static int live_suppress_preempt(void *arg)
>   	goto err_client_b;
>   }
>   
> +static int live_chain_preempt(void *arg)
> +{
> +	struct drm_i915_private *i915 = arg;
> +	struct intel_engine_cs *engine;
> +	struct preempt_client hi, lo;
> +	enum intel_engine_id id;
> +	intel_wakeref_t wakeref;
> +	int err = -ENOMEM;
> +
> +	/*
> +	 * Build a chain AB...BA between two contexts (A, B) and request
> +	 * preemption of the last request. It should then complete before
> +	 * the previously submitted spinner in B.
> +	 */
> +
> +	if (!HAS_LOGICAL_RING_PREEMPTION(i915))
> +		return 0;
> +
> +	mutex_lock(&i915->drm.struct_mutex);
> +	wakeref = intel_runtime_pm_get(i915);
> +
> +	if (preempt_client_init(i915, &hi))
> +		goto err_unlock;
> +
> +	if (preempt_client_init(i915, &lo))
> +		goto err_client_hi;
> +
> +	for_each_engine(engine, i915, id) {
> +		struct i915_sched_attr attr = {
> +			.priority = I915_USER_PRIORITY(I915_PRIORITY_MAX),
> +		};
> +		int count, i;
> +
> +		for_each_prime_number_from(count, 1, 32) { /* must fit ring! */
> +			struct i915_request *rq;
> +
> +			rq = igt_spinner_create_request(&hi.spin,
> +							hi.ctx, engine,
> +							MI_ARB_CHECK);
> +			if (IS_ERR(rq))
> +				goto err_wedged;
> +			i915_request_add(rq);
> +			if (!igt_wait_for_spinner(&hi.spin, rq))
> +				goto err_wedged;
> +
> +			rq = igt_spinner_create_request(&lo.spin,
> +							lo.ctx, engine,
> +							MI_ARB_CHECK);
> +			if (IS_ERR(rq))
> +				goto err_wedged;
> +			i915_request_add(rq);
> +
> +			for (i = 0; i < count; i++) {
> +				rq = i915_request_alloc(engine, lo.ctx);
> +				if (IS_ERR(rq))
> +					goto err_wedged;
> +				i915_request_add(rq);
> +			}
> +
> +			rq = i915_request_alloc(engine, hi.ctx);
> +			if (IS_ERR(rq))
> +				goto err_wedged;
> +			i915_request_add(rq);
> +			engine->schedule(rq, &attr);
> +
> +			igt_spinner_end(&hi.spin);
> +			if (i915_request_wait(rq, I915_WAIT_LOCKED, HZ / 5) < 0) {
> +				struct drm_printer p =
> +					drm_info_printer(i915->drm.dev);
> +
> +				pr_err("Failed to preempt over chain of %d\n",
> +				       count);
> +				intel_engine_dump(engine, &p,
> +						  "%s\n", engine->name);
> +				goto err_wedged;
> +			}
> +			igt_spinner_end(&lo.spin);
> +		}
> +	}
> +
> +	err = 0;
> +err_client_lo:
> +	preempt_client_fini(&lo);
> +err_client_hi:
> +	preempt_client_fini(&hi);
> +err_unlock:
> +	if (igt_flush_test(i915, I915_WAIT_LOCKED))
> +		err = -EIO;
> +	intel_runtime_pm_put(i915, wakeref);
> +	mutex_unlock(&i915->drm.struct_mutex);
> +	return err;
> +
> +err_wedged:
> +	igt_spinner_end(&hi.spin);
> +	igt_spinner_end(&lo.spin);
> +	i915_gem_set_wedged(i915);
> +	err = -EIO;
> +	goto err_client_lo;
> +}
> +
>   static int live_preempt_hang(void *arg)
>   {
>   	struct drm_i915_private *i915 = arg;
> @@ -785,6 +887,7 @@ int intel_execlists_live_selftests(struct drm_i915_private *i915)
>   		SUBTEST(live_preempt),
>   		SUBTEST(live_late_preempt),
>   		SUBTEST(live_suppress_preempt),
> +		SUBTEST(live_chain_preempt),
>   		SUBTEST(live_preempt_hang),
>   		SUBTEST(live_preempt_smoke),
>   	};
> 

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

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-01-29 11:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 10:59 [PATCH 1/9] drm/i915/selftests: Apply a subtest filter Chris Wilson
2019-01-29 10:59 ` [PATCH 2/9] drm/i915: Rename execlists->queue_priority to queue_priority_hint Chris Wilson
2019-01-29 11:16   ` Tvrtko Ursulin
2019-01-29 10:59 ` [PATCH 3/9] drm/i915/execlists: Suppress preempting self Chris Wilson
2019-01-29 10:59 ` [PATCH 4/9] drm/i915/execlists: Suppress redundant preemption Chris Wilson
2019-01-29 10:59 ` [PATCH 5/9] drm/i915/selftests: Exercise some AB...BA preemption chains Chris Wilson
2019-01-29 11:24   ` Tvrtko Ursulin [this message]
2019-01-29 10:59 ` [PATCH 6/9] drm/i915: Identify active requests Chris Wilson
2019-01-29 10:59 ` [PATCH 7/9] drm/i915: Remove the intel_engine_notify tracepoint Chris Wilson
2019-01-29 10:59 ` [PATCH 8/9] drm/i915: Replace global breadcrumbs with per-context interrupt tracking Chris Wilson
2019-01-29 10:59 ` [PATCH 9/9] drm/i915: Drop fake breadcrumb irq Chris Wilson
2019-01-29 12:00 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/9] drm/i915/selftests: Apply a subtest filter Patchwork
2019-01-29 12:04 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-01-29 12:28 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-29 15:57 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-01-29 17:01 [PATCH 1/9] " Chris Wilson
2019-01-29 17:02 ` [PATCH 5/9] drm/i915/selftests: Exercise some AB...BA preemption chains Chris Wilson
2019-01-29 17:10   ` Chris Wilson

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=c0768f15-2c00-bce2-7984-75e3b8070d7b@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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