Intel-GFX Archive on lore.kernel.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] drm/i915: Fixup 64bit divides in timelines selftest
Date: Mon, 15 May 2017 10:54:10 +0100	[thread overview]
Message-ID: <fc8fcbc1-682a-ae89-6efc-cbc171abd1d7@linux.intel.com> (raw)
In-Reply-To: <20170513094154.3581-1-chris@chris-wilson.co.uk>


On 13/05/2017 10:41, Chris Wilson wrote:
> Some 64b divides snuck in when doing the prng timing compensation.
>
> Fixes: 4797948071f6 ("drm/i915: Squash repeated awaits on the same fence")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/selftests/i915_gem_timeline.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_timeline.c b/drivers/gpu/drm/i915/selftests/i915_gem_timeline.c
> index 6df00cc02c12..7a44dab631b8 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_timeline.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_timeline.c
> @@ -126,7 +126,6 @@ static unsigned int random_engine(struct rnd_state *rnd)
>
>  static int bench_sync(void *arg)
>  {
> -#define M (1 << 20)
>  	struct rnd_state prng;
>  	struct intel_timeline *tl;
>  	unsigned long end_time, count;
> @@ -158,7 +157,7 @@ static int bench_sync(void *arg)
>  	kt = ktime_sub(ktime_get(), kt);
>  	pr_debug("%s: %lu random evaluations, %lluns/prng\n",
>  		 __func__, count, (long long)div64_ul(ktime_to_ns(kt), count));
> -	prng32_1M = ktime_to_ns(kt) * M / count;
> +	prng32_1M = div64_ul(ktime_to_ns(kt) << 20, count);
>
>  	/* Benchmark (only) setting random context ids */
>  	prandom_seed_state(&prng, i915_selftest.random_seed);
> @@ -172,7 +171,7 @@ static int bench_sync(void *arg)
>  		count++;
>  	} while (!time_after(jiffies, end_time));
>  	kt = ktime_sub(ktime_get(), kt);
> -	kt = ktime_sub_ns(kt, count * prng32_1M * 2 / M);
> +	kt = ktime_sub_ns(kt, (count * prng32_1M * 2) >> 20);
>  	pr_info("%s: %lu random insertions, %lluns/insert\n",
>  		__func__, count, (long long)div64_ul(ktime_to_ns(kt), count));
>
> @@ -190,7 +189,7 @@ static int bench_sync(void *arg)
>  		}
>  	}
>  	kt = ktime_sub(ktime_get(), kt);
> -	kt = ktime_sub_ns(kt, count * prng32_1M * 2 / M);
> +	kt = ktime_sub_ns(kt, (count * prng32_1M * 2) >> 20);
>  	pr_info("%s: %lu random lookups, %lluns/lookup\n",
>  		__func__, count, (long long)div64_ul(ktime_to_ns(kt), count));
>
> @@ -248,7 +247,7 @@ static int bench_sync(void *arg)
>  		count++;
>  	} while (!time_after(jiffies, end_time));
>  	kt = ktime_sub(ktime_get(), kt);
> -	kt = ktime_sub_ns(kt, count * prng32_1M * 2 / M);
> +	kt = ktime_sub_ns(kt, (count * prng32_1M * 2) >> 20);
>  	pr_info("%s: %lu repeated insert/lookups, %lluns/op\n",
>  		__func__, count, (long long)div64_ul(ktime_to_ns(kt), count));
>  	mock_timeline_destroy(tl);
> @@ -287,7 +286,6 @@ static int bench_sync(void *arg)
>  	}
>
>  	return 0;
> -#undef M
>  }
>
>  int i915_gem_timeline_mock_selftests(void)
>

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

  parent reply	other threads:[~2017-05-15  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-13  9:41 [PATCH] drm/i915: Fixup 64bit divides in timelines selftest Chris Wilson
2017-05-13 10:01 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-05-15  9:54 ` Tvrtko Ursulin [this message]
2017-05-15 13:45   ` [PATCH] " 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=fc8fcbc1-682a-ae89-6efc-cbc171abd1d7@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