All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/selftests: Exercise concurrent submission to all engines
Date: Fri, 27 Sep 2019 13:38:15 +0300	[thread overview]
Message-ID: <875zlem3c8.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20190925193446.26007-1-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> The simplest and most maximal submission we can do, a thread to submit
> requests unto each engine.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/selftests/i915_request.c | 125 ++++++++++++++++++
>  1 file changed, 125 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index b3688543ed7d..57cd4180d06c 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -1062,6 +1062,130 @@ static int live_sequential_engines(void *arg)
>  	return err;
>  }
>  
> +static int __live_parallel_engine1(void *arg)
> +{
> +	struct intel_engine_cs *engine = arg;
> +	IGT_TIMEOUT(end_time);
> +	unsigned long count;
> +
> +	count = 0;
> +	do {
> +		struct i915_request *rq;
> +		int err;
> +
> +		mutex_lock(&engine->i915->drm.struct_mutex);
> +		rq = i915_request_create(engine->kernel_context);
> +		if (IS_ERR(rq)) {
> +			mutex_unlock(&engine->i915->drm.struct_mutex);
> +			return PTR_ERR(rq);
> +		}
> +
> +		i915_request_get(rq);
> +		i915_request_add(rq);
> +		mutex_unlock(&engine->i915->drm.struct_mutex);
> +
> +		err = 0;
> +		if (i915_request_wait(rq, 0, HZ / 5) < 0)
> +			err = -ETIME;
> +		i915_request_put(rq);
> +		if (err)
> +			return err;
> +
> +		count++;
> +	} while (!__igt_timeout(end_time, NULL));
> +
> +	pr_info("%s: %lu request + sync\n", engine->name, count);
> +	return 0;
> +}
> +
> +static int __live_parallel_engineN(void *arg)
> +{
> +	struct intel_engine_cs *engine = arg;
> +	IGT_TIMEOUT(end_time);
> +	unsigned long count;
> +
> +	count = 0;
> +	do {
> +		struct i915_request *rq;
> +
> +		mutex_lock(&engine->i915->drm.struct_mutex);
> +		rq = i915_request_create(engine->kernel_context);
> +		if (IS_ERR(rq)) {
> +			mutex_unlock(&engine->i915->drm.struct_mutex);
> +			return PTR_ERR(rq);
> +		}
> +
> +		i915_request_add(rq);
> +		mutex_unlock(&engine->i915->drm.struct_mutex);
> +
> +		count++;
> +	} while (!__igt_timeout(end_time, NULL));
> +
> +	pr_info("%s: %lu requests\n", engine->name, count);
> +	return 0;
> +}
> +
> +static int live_parallel_engines(void *arg)
> +{
> +	struct drm_i915_private *i915 = arg;
> +	static int (* const func[])(void *arg) = {
> +		__live_parallel_engine1,
> +		__live_parallel_engineN,

The ratio of waited vs nonwaited ones is
now up to their competition for access which
did concern me.

But then on the other hand, due to wait,
that thread will end up with lot less
access.

So, I think in the end the pattern will
be mostly unwaited ones with a wait now
and then.

Which was kind of what I was yearning for
so,

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> +		NULL,
> +	};
> +	struct intel_engine_cs *engine;
> +	enum intel_engine_id id;
> +	int (* const *fn)(void *arg);
> +	int err = 0;
> +
> +	/*
> +	 * Check we can submit requests to all engines concurrently. This
> +	 * tests that we load up the system maximally.
> +	 */
> +
> +	for (fn = func; !err && *fn; fn++) {
> +		struct task_struct *tsk[I915_NUM_ENGINES] = {};
> +		struct igt_live_test t;
> +
> +		mutex_lock(&i915->drm.struct_mutex);
> +		err = igt_live_test_begin(&t, i915, __func__, "");
> +		mutex_unlock(&i915->drm.struct_mutex);
> +		if (err)
> +			break;
> +
> +		for_each_engine(engine, i915, id) {
> +			tsk[id] = kthread_run(*fn, engine,
> +					      "igt/parallel:%s",
> +					      engine->name);
> +			if (IS_ERR(tsk[id])) {
> +				err = PTR_ERR(tsk[id]);
> +				break;
> +			}
> +			get_task_struct(tsk[id]);
> +		}
> +
> +		for_each_engine(engine, i915, id) {
> +			int status;
> +
> +			if (IS_ERR_OR_NULL(tsk[id]))
> +				continue;
> +
> +			status = kthread_stop(tsk[id]);
> +			if (status && !err)
> +				err = status;
> +
> +			put_task_struct(tsk[id]);
> +		}
> +
> +		mutex_lock(&i915->drm.struct_mutex);
> +		if (igt_live_test_end(&t))
> +			err = -EIO;
> +		mutex_unlock(&i915->drm.struct_mutex);
> +	}
> +
> +	return err;
> +}
> +
>  static int
>  max_batches(struct i915_gem_context *ctx, struct intel_engine_cs *engine)
>  {
> @@ -1240,6 +1364,7 @@ int i915_request_live_selftests(struct drm_i915_private *i915)
>  		SUBTEST(live_nop_request),
>  		SUBTEST(live_all_engines),
>  		SUBTEST(live_sequential_engines),
> +		SUBTEST(live_parallel_engines),
>  		SUBTEST(live_empty_request),
>  		SUBTEST(live_breadcrumbs_smoketest),
>  	};
> -- 
> 2.23.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2019-09-27 10:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 19:34 [PATCH] drm/i915/selftests: Exercise concurrent submission to all engines Chris Wilson
2019-09-25 20:09 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-09-25 20:32 ` ✓ Fi.CI.BAT: success " Patchwork
2019-09-26 14:45 ` ✓ Fi.CI.IGT: " Patchwork
2019-09-27 10:38 ` Mika Kuoppala [this message]

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=875zlem3c8.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@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 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.