Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: Derek Morton <derek.j.morton@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t v3 5/6] tests/gem_scheduler: Add subtests to test batch priority behaviour
Date: Thu, 17 Mar 2016 08:58:15 +0000	[thread overview]
Message-ID: <56EA71A7.30901@intel.com> (raw)
In-Reply-To: <1457607814-18751-6-git-send-email-derek.j.morton@intel.com>



On 10/03/16 11:03, Derek Morton wrote:
> Add subtests to test each ring to check batch buffers of a higher
> priority will be executed before batch buffers of a lower priority.
>
> v2: Addressed review comments from Daniele Ceraolo Spurio
>
> Signed-off-by: Derek Morton <derek.j.morton@intel.com>
> ---
>   tests/gem_scheduler.c | 53 +++++++++++++++++++++++++++++++++++++++++++--------
>   1 file changed, 45 insertions(+), 8 deletions(-)
>
> diff --git a/tests/gem_scheduler.c b/tests/gem_scheduler.c
> index 436440a..126ee97 100644
> --- a/tests/gem_scheduler.c
> +++ b/tests/gem_scheduler.c
> @@ -39,7 +39,8 @@
>   
>   IGT_TEST_DESCRIPTION("Check scheduler behaviour. Basic tests ensure independant "
>                        "batch buffers of the same priority are executed in "
> -                     "submission order. Read-read tests ensure "
> +                     "submission order. Priority tests ensure higher priority "
> +                     "batch buffers are executed first. Read-read tests ensure "
>                        "batch buffers with a read dependency to the same buffer "
>                        "object do not block each other. Write-write dependency "
>                        "tests ensure batch buffers with a write dependency to a "
> @@ -136,11 +137,23 @@ static void init_context(int *fd, drm_intel_bufmgr **bufmgr, int ringid)
>   	intel_batchbuffer_free(noop_bb);
>   }
>   
> -/* Basic test. Check batch buffers of the same priority and with no dependencies
> - * are executed in the order they are submitted.
> +static void set_priority(int fd, int value)
> +{
> +	struct local_i915_gem_context_param param;
> +	param.context = 0; /* Default context */
> +	param.size = 0;
> +	param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
> +	param.value = (uint64_t)value;
> +	gem_context_set_param(fd, &param);
> +}
> +
> +/* If 'priority' is 0, check batch buffers of the same priority and with
> + * no dependencies are executed in the order they are submitted.
> + * If 'priority' is set !0, check batch buffers of higher priority are
> + * executed before batch buffers of lower priority.
>    */
>   #define NBR_BASIC_FDs (3)
> -static void run_test_basic(int in_flight, int ringid)
> +static void run_test_basic(int in_flight, int ringid, int priority)
>   {
>   	int fd[NBR_BASIC_FDs];
>   	int loop;
> @@ -160,6 +173,13 @@ static void run_test_basic(int in_flight, int ringid)
>   	for(loop=0; loop < NBR_BASIC_FDs; loop++)
>   		init_context(&(fd[loop]), &(bufmgr[loop]), ringid);
>   
> +	/* For high priority set priority of second context to overtake first
> +	 * For low priority set priority of first context to be overtaxen by second
> +	 */
> +	if(priority > 0)
> +		set_priority(fd[2], priority);
> +	else if(priority < 0)
> +		set_priority(fd[1], priority);
>   
>   	/* Create buffer objects */
>   	delay_bo = create_and_check_bo(bufmgr[0], "delay bo");
> @@ -209,9 +229,14 @@ static void run_test_basic(int in_flight, int ringid)
>   	igt_assert_f(igt_compare_timestamps(delay_buf[2], ts1_buf[0]),
>   	             "Delay ts (0x%08" PRIx32 ") > TS1 ts (0x%08" PRIx32 ")\n",
>   	             delay_buf[2], ts1_buf[0]);
> -	igt_assert_f(igt_compare_timestamps(ts1_buf[0], ts2_buf[0]),
> -	             "TS1 ts (0x%08" PRIx32 ") > TS2 ts (0x%08" PRIx32 ")\n",
> -	             ts1_buf[0], ts2_buf[0]);
> +	if(priority)
> +		igt_assert_f(igt_compare_timestamps(ts2_buf[0], ts1_buf[0]),
> +		             "TS2 ts (0x%08" PRIx32 ") > TS1 ts (0x%08" PRIx32 ")\n",
> +		             ts2_buf[0], ts1_buf[0]);
> +	else
> +		igt_assert_f(igt_compare_timestamps(ts1_buf[0], ts2_buf[0]),
> +		             "TS1 ts (0x%08" PRIx32 ") > TS2 ts (0x%08" PRIx32 ")\n",
> +		             ts1_buf[0], ts2_buf[0]);
>   
>   	/* Cleanup */
>   	for(loop = 0; loop < in_flight; loop++)
> @@ -438,7 +463,19 @@ igt_main
>   	for (loop=0; loop < NBR_RINGS; loop++)
>   		igt_subtest_f("%s-basic", rings[loop].name) {
>   			gem_require_ring(fd, rings[loop].id);
> -			run_test_basic(in_flight, rings[loop].id);
> +			run_test_basic(in_flight, rings[loop].id, false);
> +		}
> +
> +	for (loop=0; loop < NBR_RINGS; loop++)
> +		igt_subtest_f("%s-priority-high", rings[loop].name) {
> +			gem_require_ring(fd, rings[loop].id);
> +			run_test_basic(in_flight, rings[loop].id, 1000);

1000 is a very high priority and it could cause a preemption (when the 
support lands). That shouldn't fail the test because the second batch 
will still overtake the first one but we might end up testing a 
different scenario that the one we're trying to test here, so we could 
use a smaller priority value here and use 1000+ in future preemption 
specific tests.

Regards,
Daniele

> +		}
> +
> +	for (loop=0; loop < NBR_RINGS; loop++)
> +		igt_subtest_f("%s-priority-low", rings[loop].name) {
> +			gem_require_ring(fd, rings[loop].id);
> +			run_test_basic(in_flight, rings[loop].id, -1000);
>   		}
>   
>   	for (loop=0; loop < NBR_RINGS; loop++)

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

  reply	other threads:[~2016-03-17  8:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10 11:03 [PATCH i-g-t v3 0/6] Scheduler tests Derek Morton
2016-03-10 11:03 ` [PATCH i-g-t v3 1/6] ioctl_wrappers: make gem_has_ring non static Derek Morton
2016-03-14 12:29   ` Daniele Ceraolo Spurio
2016-03-29 13:08     ` Morton, Derek J
2016-03-10 11:03 ` [PATCH i-g-t v3 2/6] lib/intel_batchbuffer: Add functions to be used in the scheduler test Derek Morton
2016-03-14 12:16   ` Daniele Ceraolo Spurio
2016-03-29 15:04     ` Morton, Derek J
2016-03-10 11:03 ` [PATCH i-g-t v3 3/6] tests/gem_scheduler: Add gem_scheduler test Derek Morton
2016-03-17  8:49   ` Daniele Ceraolo Spurio
2016-03-17 10:33     ` Daniele Ceraolo Spurio
2016-03-10 11:03 ` [PATCH i-g-t v3 4/6] igt/gem_ctx_param_basic: Updated to support scheduler priority interface Derek Morton
2016-03-10 11:03 ` [PATCH i-g-t v3 5/6] tests/gem_scheduler: Add subtests to test batch priority behaviour Derek Morton
2016-03-17  8:58   ` Daniele Ceraolo Spurio [this message]
2016-03-30  8:19     ` Morton, Derek J
2016-03-10 11:03 ` [PATCH i-g-t v3 6/6] gem_scheduler: Added subtests to test priority bumping Derek Morton

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=56EA71A7.30901@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=derek.j.morton@intel.com \
    --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