All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/perf: Wrap 64bit divides in do_div()
@ 2016-11-22 21:14 Chris Wilson
  2016-11-22 21:46 ` ✗ Fi.CI.BAT: warning for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Chris Wilson @ 2016-11-22 21:14 UTC (permalink / raw)
  To: intel-gfx

Just a couple of naked 64bit divides causing link errors on 32bit
builds, with:

	ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined!

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: d79651522e89 ("drm/i915: Enable i915 perf stream for Haswell OA unit")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Robert Bragg <robert@sixbynine.org>
---
 drivers/gpu/drm/i915/i915_perf.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 95512824922b..7d00532ae010 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -974,8 +974,12 @@ static void i915_oa_stream_disable(struct i915_perf_stream *stream)
 
 static u64 oa_exponent_to_ns(struct drm_i915_private *dev_priv, int exponent)
 {
-	return 1000000000ULL * (2ULL << exponent) /
-		dev_priv->perf.oa.timestamp_frequency;
+	u64 interval;
+
+	interval = 1000000000ULL * (2ULL << exponent);
+	do_div(interval, dev_priv->perf.oa.timestamp_frequency);
+
+	return interval;
 }
 
 static const struct i915_perf_stream_ops i915_oa_stream_ops = {
@@ -1051,16 +1055,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
 
 	dev_priv->perf.oa.periodic = props->oa_periodic;
 	if (dev_priv->perf.oa.periodic) {
-		u64 period_ns = oa_exponent_to_ns(dev_priv,
-						  props->oa_period_exponent);
+		u64 margin;
 
 		dev_priv->perf.oa.period_exponent = props->oa_period_exponent;
 
 		/* See comment for OA_TAIL_MARGIN_NSEC for details
 		 * about this tail_margin...
 		 */
-		dev_priv->perf.oa.tail_margin =
-			((OA_TAIL_MARGIN_NSEC / period_ns) + 1) * format_size;
+		margin = OA_TAIL_MARGIN_NSEC;
+		do_div(margin,
+		       oa_exponent_to_ns(dev_priv, props->oa_period_exponent));
+		dev_priv->perf.oa.tail_margin = (margin + 1) * format_size;
 	}
 
 	if (stream->ctx) {
-- 
2.10.2

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* ✗ Fi.CI.BAT: warning for drm/i915/perf: Wrap 64bit divides in do_div()
  2016-11-22 21:14 [PATCH] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
@ 2016-11-22 21:46 ` Patchwork
  2016-11-23  6:46   ` Saarinen, Jani
  2016-11-22 23:32 ` [PATCH] " Robert Bragg
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Patchwork @ 2016-11-22 21:46 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/perf: Wrap 64bit divides in do_div()
URL   : https://patchwork.freedesktop.org/series/15769/
State : warning

== Summary ==

Series 15769v1 drm/i915/perf: Wrap 64bit divides in do_div()
https://patchwork.freedesktop.org/api/1.0/series/15769/revisions/1/mbox/

Test drv_module_reload_basic:
                dmesg-warn -> PASS       (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-ilk-650)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-a:
                dmesg-warn -> PASS       (fi-ilk-650)

fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:204  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650       total:244  pass:190  dwarn:1   dfail:0   fail:0   skip:53 
fi-ivb-3520m     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7200u     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:223  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600      total:244  pass:211  dwarn:0   dfail:0   fail:0   skip:33 

b34f27e00c9a21d2078062da760e24fd4a620391 drm-intel-nightly: 2016y-11m-22d-17h-42m-39s UTC integration manifest
97cba78 drm/i915/perf: Wrap 64bit divides in do_div()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3085/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] drm/i915/perf: Wrap 64bit divides in do_div()
  2016-11-22 21:14 [PATCH] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
  2016-11-22 21:46 ` ✗ Fi.CI.BAT: warning for " Patchwork
@ 2016-11-22 23:32 ` Robert Bragg
  2016-11-22 23:49   ` Chris Wilson
  2016-11-23  7:46   ` [PATCH v2] " Chris Wilson
  2016-11-23  8:45 ` ✓ Fi.CI.BAT: success for drm/i915/perf: Wrap 64bit divides in do_div() (rev2) Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Robert Bragg @ 2016-11-22 23:32 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Intel Graphics Development


[-- Attachment #1.1: Type: text/plain, Size: 3139 bytes --]

Thanks for sending out. It looked good to me, but testing shows a 'divide
error'.

I haven't double checked, but I think it's because the max OA exponent (31)
converted to nanoseconds is > UINT32_MAX with the lower 32bits zero and the
do_div denominator argument is only 32bit.

It corresponds to a 5 minute period which is a bit silly, so we could
reduce the max exponent. A period of UINT32_MAX is about 4 seconds where I
can't currently think of a good use case for such a low frequency.

Instead of changing the max OA exponent (where the relationship to the
period changes for gen9 and may become fuzzy if we start training our view
of the gpu timestamp frequency instead of using constants) maybe we should
set an early limit on an exponent resulting in a period > UINT32_MAX?

- Robert


On Tue, Nov 22, 2016 at 9:14 PM, Chris Wilson <chris@chris-wilson.co.uk>
wrote:

> Just a couple of naked 64bit divides causing link errors on 32bit
> builds, with:
>
>         ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined!
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Fixes: d79651522e89 ("drm/i915: Enable i915 perf stream for Haswell OA
> unit")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Robert Bragg <robert@sixbynine.org>
> ---
>  drivers/gpu/drm/i915/i915_perf.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c
> b/drivers/gpu/drm/i915/i915_perf.c
> index 95512824922b..7d00532ae010 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -974,8 +974,12 @@ static void i915_oa_stream_disable(struct
> i915_perf_stream *stream)
>
>  static u64 oa_exponent_to_ns(struct drm_i915_private *dev_priv, int
> exponent)
>  {
> -       return 1000000000ULL * (2ULL << exponent) /
> -               dev_priv->perf.oa.timestamp_frequency;
> +       u64 interval;
> +
> +       interval = 1000000000ULL * (2ULL << exponent);
> +       do_div(interval, dev_priv->perf.oa.timestamp_frequency);
> +
> +       return interval;
>  }
>
>  static const struct i915_perf_stream_ops i915_oa_stream_ops = {
> @@ -1051,16 +1055,17 @@ static int i915_oa_stream_init(struct
> i915_perf_stream *stream,
>
>         dev_priv->perf.oa.periodic = props->oa_periodic;
>         if (dev_priv->perf.oa.periodic) {
> -               u64 period_ns = oa_exponent_to_ns(dev_priv,
> -
>  props->oa_period_exponent);
> +               u64 margin;
>
>                 dev_priv->perf.oa.period_exponent =
> props->oa_period_exponent;
>
>                 /* See comment for OA_TAIL_MARGIN_NSEC for details
>                  * about this tail_margin...
>                  */
> -               dev_priv->perf.oa.tail_margin =
> -                       ((OA_TAIL_MARGIN_NSEC / period_ns) + 1) *
> format_size;
> +               margin = OA_TAIL_MARGIN_NSEC;
> +               do_div(margin,
> +                      oa_exponent_to_ns(dev_priv,
> props->oa_period_exponent));
> +               dev_priv->perf.oa.tail_margin = (margin + 1) * format_size;
>         }
>
>         if (stream->ctx) {
> --
> 2.10.2
>
>

[-- Attachment #1.2: Type: text/html, Size: 4337 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] drm/i915/perf: Wrap 64bit divides in do_div()
  2016-11-22 23:32 ` [PATCH] " Robert Bragg
@ 2016-11-22 23:49   ` Chris Wilson
  2016-11-23  8:32     ` Robert Bragg
  2016-11-23  7:46   ` [PATCH v2] " Chris Wilson
  1 sibling, 1 reply; 11+ messages in thread
From: Chris Wilson @ 2016-11-22 23:49 UTC (permalink / raw)
  To: Robert Bragg; +Cc: Intel Graphics Development

On Tue, Nov 22, 2016 at 11:32:38PM +0000, Robert Bragg wrote:
>    Thanks for sending out. It looked good to me, but testing shows a 'divide
>    error'.
> 
>    I haven't double checked, but I think it's because the max OA exponent
>    (31) converted to nanoseconds is > UINT32_MAX with the lower 32bits zero
>    and the do_div denominator argument is only 32bit.

Hmm, I thought do_div() was u64 / u64, but no it is u64 / u32. Looks
like the appropriate function would be div64_u64().

>    It corresponds to a 5 minute period which is a bit silly, so we could
>    reduce the max exponent. A period of UINT32_MAX is about 4 seconds where I
>    can't currently think of a good use case for such a low frequency.
> 
>    Instead of changing the max OA exponent (where the relationship to the
>    period changes for gen9 and may become fuzzy if we start training our view
>    of the gpu timestamp frequency instead of using constants) maybe we should
>    set an early limit on an exponent resulting in a period > UINT32_MAX?

Seems like picking the right function would help!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: ✗ Fi.CI.BAT: warning for drm/i915/perf: Wrap 64bit divides in do_div()
  2016-11-22 21:46 ` ✗ Fi.CI.BAT: warning for " Patchwork
@ 2016-11-23  6:46   ` Saarinen, Jani
  0 siblings, 0 replies; 11+ messages in thread
From: Saarinen, Jani @ 2016-11-23  6:46 UTC (permalink / raw)
  To: intel-gfx, Chris Wilson

> == Series Details ==
> 
> Series: drm/i915/perf: Wrap 64bit divides in do_div()
> URL   : https://patchwork.freedesktop.org/series/15769/
> State : warning
> 
> == Summary ==
> 
> Series 15769v1 drm/i915/perf: Wrap 64bit divides in do_div()
> https://patchwork.freedesktop.org/api/1.0/series/15769/revisions/1/mbo
> x/
> 
> Test drv_module_reload_basic:
>                 dmesg-warn -> PASS       (fi-skl-6770hq)
>                 pass       -> DMESG-WARN (fi-ilk-650)
https://bugs.freedesktop.org/show_bug.cgi?id=74102 ?

> Test kms_pipe_crc_basic:
>         Subgroup nonblocking-crc-pipe-a:
>                 dmesg-warn -> PASS       (fi-ilk-650)
> 
> fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15
> fi-bsw-n3050     total:244  pass:204  dwarn:0   dfail:0   fail:0   skip:40
> fi-bxt-t5700     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28
> fi-byt-j1900     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28
> fi-byt-n2820     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32
> fi-hsw-4770      total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20
> fi-hsw-4770r     total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20
> fi-ilk-650       total:244  pass:190  dwarn:1   dfail:0   fail:0   skip:53
> fi-ivb-3520m     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22
> fi-ivb-3770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22
> fi-kbl-7200u     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22
> fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14
> fi-skl-6700hq    total:244  pass:223  dwarn:0   dfail:0   fail:0   skip:21
> fi-skl-6700k     total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21
> fi-skl-6770hq    total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14
> fi-snb-2520m     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32
> fi-snb-2600      total:244  pass:211  dwarn:0   dfail:0   fail:0   skip:33
> 
> b34f27e00c9a21d2078062da760e24fd4a620391 drm-intel-nightly: 2016y-
> 11m-22d-17h-42m-39s UTC integration manifest
> 97cba78 drm/i915/perf: Wrap 64bit divides in do_div()
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3085/
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2] drm/i915/perf: Wrap 64bit divides in do_div()
  2016-11-22 23:32 ` [PATCH] " Robert Bragg
  2016-11-22 23:49   ` Chris Wilson
@ 2016-11-23  7:46   ` Chris Wilson
  1 sibling, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2016-11-23  7:46 UTC (permalink / raw)
  To: intel-gfx

Just a couple of naked 64bit divides causing link errors on 32bit
builds, with:

	ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined!

v2: do_div() is only u64/u32, we need a u32/u64!

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: d79651522e89 ("drm/i915: Enable i915 perf stream for Haswell OA unit")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Robert Bragg <robert@sixbynine.org>
---
 drivers/gpu/drm/i915/i915_perf.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 95512824922b..62685c14b726 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -974,8 +974,8 @@ static void i915_oa_stream_disable(struct i915_perf_stream *stream)
 
 static u64 oa_exponent_to_ns(struct drm_i915_private *dev_priv, int exponent)
 {
-	return 1000000000ULL * (2ULL << exponent) /
-		dev_priv->perf.oa.timestamp_frequency;
+	return div64_u64(1000000000ULL * (2ULL << exponent),
+			 dev_priv->perf.oa.timestamp_frequency);
 }
 
 static const struct i915_perf_stream_ops i915_oa_stream_ops = {
@@ -1051,16 +1051,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
 
 	dev_priv->perf.oa.periodic = props->oa_periodic;
 	if (dev_priv->perf.oa.periodic) {
-		u64 period_ns = oa_exponent_to_ns(dev_priv,
-						  props->oa_period_exponent);
+		u32 margin;
 
 		dev_priv->perf.oa.period_exponent = props->oa_period_exponent;
 
 		/* See comment for OA_TAIL_MARGIN_NSEC for details
 		 * about this tail_margin...
 		 */
-		dev_priv->perf.oa.tail_margin =
-			((OA_TAIL_MARGIN_NSEC / period_ns) + 1) * format_size;
+		margin = div_u64(OA_TAIL_MARGIN_NSEC,
+				 oa_exponent_to_ns(dev_priv,
+						   props->oa_period_exponent));
+		dev_priv->perf.oa.tail_margin = (margin + 1) * format_size;
 	}
 
 	if (stream->ctx) {
-- 
2.10.2

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] drm/i915/perf: Wrap 64bit divides in do_div()
  2016-11-22 23:49   ` Chris Wilson
@ 2016-11-23  8:32     ` Robert Bragg
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Bragg @ 2016-11-23  8:32 UTC (permalink / raw)
  To: Chris Wilson, Intel Graphics Development


[-- Attachment #1.1: Type: text/plain, Size: 1313 bytes --]

On Nov 22, 2016 23:49, "Chris Wilson" <chris@chris-wilson.co.uk> wrote:
>
> On Tue, Nov 22, 2016 at 11:32:38PM +0000, Robert Bragg wrote:
> >    Thanks for sending out. It looked good to me, but testing shows a
'divide
> >    error'.
> >
> >    I haven't double checked, but I think it's because the max OA
exponent
> >    (31) converted to nanoseconds is > UINT32_MAX with the lower 32bits
zero
> >    and the do_div denominator argument is only 32bit.
>
> Hmm, I thought do_div() was u64 / u64, but no it is u64 / u32. Looks
> like the appropriate function would be div64_u64().
>
> >    It corresponds to a 5 minute period which is a bit silly, so we could
> >    reduce the max exponent. A period of UINT32_MAX is about 4 seconds
where I
> >    can't currently think of a good use case for such a low frequency.
> >
> >    Instead of changing the max OA exponent (where the relationship to
the
> >    period changes for gen9 and may become fuzzy if we start training
our view
> >    of the gpu timestamp frequency instead of using constants) maybe we
should
> >    set an early limit on an exponent resulting in a period > UINT32_MAX?
>
> Seems like picking the right function would help!

Or that, yep. Sounds good to me, thanks.
- Robert

> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre

[-- Attachment #1.2: Type: text/html, Size: 1750 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915/perf: Wrap 64bit divides in do_div() (rev2)
  2016-11-22 21:14 [PATCH] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
  2016-11-22 21:46 ` ✗ Fi.CI.BAT: warning for " Patchwork
  2016-11-22 23:32 ` [PATCH] " Robert Bragg
@ 2016-11-23  8:45 ` Patchwork
  2016-11-23 15:07 ` [PATCH v3] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
  2016-11-23 17:15 ` ✓ Fi.CI.BAT: success for drm/i915/perf: Wrap 64bit divides in do_div() (rev3) Patchwork
  4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2016-11-23  8:45 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/perf: Wrap 64bit divides in do_div() (rev2)
URL   : https://patchwork.freedesktop.org/series/15769/
State : success

== Summary ==

Series 15769v2 drm/i915/perf: Wrap 64bit divides in do_div()
https://patchwork.freedesktop.org/api/1.0/series/15769/revisions/2/mbox/


fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:204  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650       total:244  pass:191  dwarn:0   dfail:0   fail:0   skip:53 
fi-ivb-3520m     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7200u     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:223  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600      total:244  pass:211  dwarn:0   dfail:0   fail:0   skip:33 

d8db619985b5a8e4416ab78017ea9252e7f24689 drm-intel-nightly: 2016y-11m-23d-07h-34m-41s UTC integration manifest
4e5ed87 drm/i915/perf: Wrap 64bit divides in do_div()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3088/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3] drm/i915/perf: Wrap 64bit divides in do_div()
  2016-11-22 21:14 [PATCH] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
                   ` (2 preceding siblings ...)
  2016-11-23  8:45 ` ✓ Fi.CI.BAT: success for drm/i915/perf: Wrap 64bit divides in do_div() (rev2) Patchwork
@ 2016-11-23 15:07 ` Chris Wilson
  2016-11-29 10:29   ` Robert Bragg
  2016-11-23 17:15 ` ✓ Fi.CI.BAT: success for drm/i915/perf: Wrap 64bit divides in do_div() (rev3) Patchwork
  4 siblings, 1 reply; 11+ messages in thread
From: Chris Wilson @ 2016-11-23 15:07 UTC (permalink / raw)
  To: intel-gfx

Just a couple of naked 64bit divides causing link errors on 32bit
builds, with:

	ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined!

v2: do_div() is only u64/u32, we need a u32/u64!
v3: div_u64() == u64/u32, div64_u64() == u64/u64

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: d79651522e89 ("drm/i915: Enable i915 perf stream for Haswell OA unit")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Robert Bragg <robert@sixbynine.org>
---
 drivers/gpu/drm/i915/i915_perf.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 95512824922b..14de9a4eee27 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -974,8 +974,8 @@ static void i915_oa_stream_disable(struct i915_perf_stream *stream)
 
 static u64 oa_exponent_to_ns(struct drm_i915_private *dev_priv, int exponent)
 {
-	return 1000000000ULL * (2ULL << exponent) /
-		dev_priv->perf.oa.timestamp_frequency;
+	return div_u64(1000000000ULL * (2ULL << exponent),
+		       dev_priv->perf.oa.timestamp_frequency);
 }
 
 static const struct i915_perf_stream_ops i915_oa_stream_ops = {
@@ -1051,16 +1051,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
 
 	dev_priv->perf.oa.periodic = props->oa_periodic;
 	if (dev_priv->perf.oa.periodic) {
-		u64 period_ns = oa_exponent_to_ns(dev_priv,
-						  props->oa_period_exponent);
+		u32 tail;
 
 		dev_priv->perf.oa.period_exponent = props->oa_period_exponent;
 
 		/* See comment for OA_TAIL_MARGIN_NSEC for details
 		 * about this tail_margin...
 		 */
-		dev_priv->perf.oa.tail_margin =
-			((OA_TAIL_MARGIN_NSEC / period_ns) + 1) * format_size;
+		tail = div64_u64(OA_TAIL_MARGIN_NSEC,
+				 oa_exponent_to_ns(dev_priv,
+						   props->oa_period_exponent));
+		dev_priv->perf.oa.tail_margin = (tail + 1) * format_size;
 	}
 
 	if (stream->ctx) {
-- 
2.10.2

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915/perf: Wrap 64bit divides in do_div() (rev3)
  2016-11-22 21:14 [PATCH] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
                   ` (3 preceding siblings ...)
  2016-11-23 15:07 ` [PATCH v3] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
@ 2016-11-23 17:15 ` Patchwork
  4 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2016-11-23 17:15 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/perf: Wrap 64bit divides in do_div() (rev3)
URL   : https://patchwork.freedesktop.org/series/15769/
State : success

== Summary ==

Series 15769v3 drm/i915/perf: Wrap 64bit divides in do_div()
https://patchwork.freedesktop.org/api/1.0/series/15769/revisions/3/mbox/


fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:204  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650       total:244  pass:191  dwarn:0   dfail:0   fail:0   skip:53 
fi-ivb-3520m     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7200u     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:223  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600      total:244  pass:211  dwarn:0   dfail:0   fail:0   skip:33 

01896e61d9cc0cad08e19990cd095cdf679f6142 drm-intel-nightly: 2016y-11m-23d-14h-45m-53s UTC integration manifest
f9e1734 drm/i915/perf: Wrap 64bit divides in do_div()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3095/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] drm/i915/perf: Wrap 64bit divides in do_div()
  2016-11-23 15:07 ` [PATCH v3] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
@ 2016-11-29 10:29   ` Robert Bragg
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Bragg @ 2016-11-29 10:29 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Intel Graphics Development


[-- Attachment #1.1: Type: text/plain, Size: 2452 bytes --]

On Wed, Nov 23, 2016 at 3:07 PM, Chris Wilson <chris@chris-wilson.co.uk>
wrote:

> Just a couple of naked 64bit divides causing link errors on 32bit
> builds, with:
>
>         ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined!
>
> v2: do_div() is only u64/u32, we need a u32/u64!
> v3: div_u64() == u64/u32, div64_u64() == u64/u64
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Fixes: d79651522e89 ("drm/i915: Enable i915 perf stream for Haswell OA
> unit")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Robert Bragg <robert@sixbynine.org>
> ---
>  drivers/gpu/drm/i915/i915_perf.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_
> perf.c
> index 95512824922b..14de9a4eee27 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -974,8 +974,8 @@ static void i915_oa_stream_disable(struct
> i915_perf_stream *stream)
>
>  static u64 oa_exponent_to_ns(struct drm_i915_private *dev_priv, int
> exponent)
>  {
> -       return 1000000000ULL * (2ULL << exponent) /
> -               dev_priv->perf.oa.timestamp_frequency;
> +       return div_u64(1000000000ULL * (2ULL << exponent),
> +                      dev_priv->perf.oa.timestamp_frequency);
>  }
>
>  static const struct i915_perf_stream_ops i915_oa_stream_ops = {
> @@ -1051,16 +1051,17 @@ static int i915_oa_stream_init(struct
> i915_perf_stream *stream,
>
>         dev_priv->perf.oa.periodic = props->oa_periodic;
>         if (dev_priv->perf.oa.periodic) {
> -               u64 period_ns = oa_exponent_to_ns(dev_priv,
> -
>  props->oa_period_exponent);
> +               u32 tail;
>
>                 dev_priv->perf.oa.period_exponent =
> props->oa_period_exponent;
>
>                 /* See comment for OA_TAIL_MARGIN_NSEC for details
>                  * about this tail_margin...
>                  */
> -               dev_priv->perf.oa.tail_margin =
> -                       ((OA_TAIL_MARGIN_NSEC / period_ns) + 1) *
> format_size;
> +               tail = div64_u64(OA_TAIL_MARGIN_NSEC,
> +                                oa_exponent_to_ns(dev_priv,
> +
> props->oa_period_exponent));
> +               dev_priv->perf.oa.tail_margin = (tail + 1) * format_size;
>         }
>
>         if (stream->ctx) {
> --
> 2.10.2
>
>
This looks good to me, thanks.

Reviewed-by: Robert Bragg <robert@sixbynine.org>

[-- Attachment #1.2: Type: text/html, Size: 3769 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-11-29 10:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-22 21:14 [PATCH] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
2016-11-22 21:46 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-11-23  6:46   ` Saarinen, Jani
2016-11-22 23:32 ` [PATCH] " Robert Bragg
2016-11-22 23:49   ` Chris Wilson
2016-11-23  8:32     ` Robert Bragg
2016-11-23  7:46   ` [PATCH v2] " Chris Wilson
2016-11-23  8:45 ` ✓ Fi.CI.BAT: success for drm/i915/perf: Wrap 64bit divides in do_div() (rev2) Patchwork
2016-11-23 15:07 ` [PATCH v3] drm/i915/perf: Wrap 64bit divides in do_div() Chris Wilson
2016-11-29 10:29   ` Robert Bragg
2016-11-23 17:15 ` ✓ Fi.CI.BAT: success for drm/i915/perf: Wrap 64bit divides in do_div() (rev3) Patchwork

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.