All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm()
@ 2017-11-07 12:56 Chris Wilson
  2017-11-07 12:59 ` Chris Wilson
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Chris Wilson @ 2017-11-07 12:56 UTC (permalink / raw)
  To: intel-gfx

Smatch warns of

drivers/gpu/drm/i915/intel_pm.c:1161 g4x_compute_wm() warn: signedness bug returning '(-33554430)'

which is a result of it believing that wm may be INT_MAX following
g4x_tlb_miss_wa(). Just declaring g4x_tlb_miss_wa() as returning an
unsigned integer is not sufficient, we need to tell smatch that wm itself
is unsigned for it to not worry. So mark up the locals we expect to be
non-negative, and so silence smatch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 6e1358d4e764..403097606322 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -928,7 +928,7 @@ static void pineview_update_wm(struct intel_crtc *unused_crtc)
  *  and the size of 8 whole lines. This adjustment is always performed
  *  in the actual pixel depth regardless of whether FBC is enabled or not."
  */
-static int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
+static unsigned int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
 {
 	int tlb_miss = fifo_size * 64 - width * cpp * 8;
 
@@ -1105,8 +1105,8 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->base.adjusted_mode;
-	int clock, htotal, cpp, width, wm;
-	int latency = dev_priv->wm.pri_latency[level] * 10;
+	unsigned int latency = dev_priv->wm.pri_latency[level] * 10;
+	unsigned int clock, htotal, cpp, width, wm;
 
 	if (latency == 0)
 		return USHRT_MAX;
@@ -1145,7 +1145,7 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
 		   level == G4X_WM_LEVEL_NORMAL) {
 		wm = intel_wm_method1(clock, cpp, latency);
 	} else {
-		int small, large;
+		unsigned int small, large;
 
 		small = intel_wm_method1(clock, cpp, latency);
 		large = intel_wm_method2(clock, htotal, width, cpp, latency);
@@ -1158,7 +1158,7 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
 
 	wm = DIV_ROUND_UP(wm, 64) + 2;
 
-	return min_t(int, wm, USHRT_MAX);
+	return min_t(unsigned int, wm, USHRT_MAX);
 }
 
 static bool g4x_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
-- 
2.15.0

_______________________________________________
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: Prevent unbounded wm results in g4x_compute_wm()
  2017-11-07 12:56 [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm() Chris Wilson
@ 2017-11-07 12:59 ` Chris Wilson
  2017-11-07 13:53   ` Dan Carpenter
  2017-11-07 13:20 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Chris Wilson @ 2017-11-07 12:59 UTC (permalink / raw)
  To: intel-gfx; +Cc: Dan Carpenter

Quoting Chris Wilson (2017-11-07 12:56:23)
> Smatch warns of
> 
> drivers/gpu/drm/i915/intel_pm.c:1161 g4x_compute_wm() warn: signedness bug returning '(-33554430)'
> 
> which is a result of it believing that wm may be INT_MAX following
> g4x_tlb_miss_wa(). Just declaring g4x_tlb_miss_wa() as returning an
> unsigned integer is not sufficient, we need to tell smatch that wm itself
> is unsigned for it to not worry. So mark up the locals we expect to be
> non-negative, and so silence smatch.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>

Hi Dan, do you mind sharing any insight as to why smatch generates this
warning and whether the approach in this patch is incorrect?

> ---
>  drivers/gpu/drm/i915/intel_pm.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 6e1358d4e764..403097606322 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -928,7 +928,7 @@ static void pineview_update_wm(struct intel_crtc *unused_crtc)
>   *  and the size of 8 whole lines. This adjustment is always performed
>   *  in the actual pixel depth regardless of whether FBC is enabled or not."
>   */
> -static int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
> +static unsigned int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
>  {
>         int tlb_miss = fifo_size * 64 - width * cpp * 8;
>  
> @@ -1105,8 +1105,8 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
>         struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
>         const struct drm_display_mode *adjusted_mode =
>                 &crtc_state->base.adjusted_mode;
> -       int clock, htotal, cpp, width, wm;
> -       int latency = dev_priv->wm.pri_latency[level] * 10;
> +       unsigned int latency = dev_priv->wm.pri_latency[level] * 10;
> +       unsigned int clock, htotal, cpp, width, wm;
>  
>         if (latency == 0)
>                 return USHRT_MAX;
> @@ -1145,7 +1145,7 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
>                    level == G4X_WM_LEVEL_NORMAL) {
>                 wm = intel_wm_method1(clock, cpp, latency);
>         } else {
> -               int small, large;
> +               unsigned int small, large;
>  
>                 small = intel_wm_method1(clock, cpp, latency);
>                 large = intel_wm_method2(clock, htotal, width, cpp, latency);
> @@ -1158,7 +1158,7 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
>  
>         wm = DIV_ROUND_UP(wm, 64) + 2;
>  
> -       return min_t(int, wm, USHRT_MAX);
> +       return min_t(unsigned int, wm, USHRT_MAX);
>  }
>  
>  static bool g4x_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
> -- 
> 2.15.0
> 
_______________________________________________
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: Prevent unbounded wm results in g4x_compute_wm()
  2017-11-07 12:56 [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm() Chris Wilson
  2017-11-07 12:59 ` Chris Wilson
@ 2017-11-07 13:20 ` Patchwork
  2017-11-07 13:55 ` [PATCH] " Ville Syrjälä
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2017-11-07 13:20 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Prevent unbounded wm results in g4x_compute_wm()
URL   : https://patchwork.freedesktop.org/series/33341/
State : success

== Summary ==

Series 33341v1 drm/i915: Prevent unbounded wm results in g4x_compute_wm()
https://patchwork.freedesktop.org/api/1.0/series/33341/revisions/1/mbox/

Test core_auth:
        Subgroup basic-auth:
                dmesg-warn -> PASS       (fi-bsw-n3050) fdo#103479 +1
Test gem_sync:
        Subgroup basic-store-all:
                fail       -> PASS       (fi-ivb-3520m) fdo#100007

fdo#103479 https://bugs.freedesktop.org/show_bug.cgi?id=103479
fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:444s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:463s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:381s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:544s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:275s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:511s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:501s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:507s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:491s
fi-cfl-s         total:289  pass:254  dwarn:3   dfail:0   fail:0   skip:32  time:553s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:432s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:265s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:582s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:489s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:431s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:430s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:427s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:497s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:463s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:493s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:576s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:479s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:584s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:575s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:448s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:596s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:650s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:521s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:504s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:460s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:565s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:420s

b911f67a17e5eef16d49a51b83f7da12666e3be6 drm-tip: 2017y-11m-07d-11h-11m-37s UTC integration manifest
94ba8e95628a drm/i915: Prevent unbounded wm results in g4x_compute_wm()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6989/
_______________________________________________
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: Prevent unbounded wm results in g4x_compute_wm()
  2017-11-07 12:59 ` Chris Wilson
@ 2017-11-07 13:53   ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2017-11-07 13:53 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Tue, Nov 07, 2017 at 12:59:34PM +0000, Chris Wilson wrote:
> Quoting Chris Wilson (2017-11-07 12:56:23)
> > Smatch warns of
> > 
> > drivers/gpu/drm/i915/intel_pm.c:1161 g4x_compute_wm() warn: signedness bug returning '(-33554430)'
> > 
> > which is a result of it believing that wm may be INT_MAX following
> > g4x_tlb_miss_wa(). Just declaring g4x_tlb_miss_wa() as returning an
> > unsigned integer is not sufficient, we need to tell smatch that wm itself
> > is unsigned for it to not worry. So mark up the locals we expect to be
> > non-negative, and so silence smatch.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Hi Dan, do you mind sharing any insight as to why smatch generates this
> warning and whether the approach in this patch is incorrect?
> 

It comes from this line:

	wm = DIV_ROUND_UP(wm, 64) + 2;

If you take INT_MIN / 64 + 2 then you get -33554430.  The warning is
a false positive, right?  But to me as a reviewer the original min_t()
is suspicious and I would have just done these two lines from the patch:

-       return min_t(int, wm, USHRT_MAX);
+       return min_t(unsigned int, wm, USHRT_MAX);

The rest is pure style preference so it could go either way.

regards,
dan carpenter
_______________________________________________
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: Prevent unbounded wm results in g4x_compute_wm()
  2017-11-07 12:56 [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm() Chris Wilson
  2017-11-07 12:59 ` Chris Wilson
  2017-11-07 13:20 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-11-07 13:55 ` Ville Syrjälä
  2017-11-07 14:03 ` [PATCH v2] " Chris Wilson
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Ville Syrjälä @ 2017-11-07 13:55 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Tue, Nov 07, 2017 at 12:56:23PM +0000, Chris Wilson wrote:
> Smatch warns of
> 
> drivers/gpu/drm/i915/intel_pm.c:1161 g4x_compute_wm() warn: signedness bug returning '(-33554430)'
> 
> which is a result of it believing that wm may be INT_MAX following
> g4x_tlb_miss_wa(). Just declaring g4x_tlb_miss_wa() as returning an
> unsigned integer is not sufficient, we need to tell smatch that wm itself
> is unsigned for it to not worry. So mark up the locals we expect to be
> non-negative, and so silence smatch.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 6e1358d4e764..403097606322 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -928,7 +928,7 @@ static void pineview_update_wm(struct intel_crtc *unused_crtc)
>   *  and the size of 8 whole lines. This adjustment is always performed
>   *  in the actual pixel depth regardless of whether FBC is enabled or not."
>   */
> -static int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
> +static unsigned int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
>  {
>  	int tlb_miss = fifo_size * 64 - width * cpp * 8;

Yep. This should be the only part where we depend on signed math,
so the patch lgtm.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I'd like to see the vlv code changed in the same way though,
for consistency.

>  
> @@ -1105,8 +1105,8 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
>  	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
>  	const struct drm_display_mode *adjusted_mode =
>  		&crtc_state->base.adjusted_mode;
> -	int clock, htotal, cpp, width, wm;
> -	int latency = dev_priv->wm.pri_latency[level] * 10;
> +	unsigned int latency = dev_priv->wm.pri_latency[level] * 10;
> +	unsigned int clock, htotal, cpp, width, wm;
>  
>  	if (latency == 0)
>  		return USHRT_MAX;
> @@ -1145,7 +1145,7 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
>  		   level == G4X_WM_LEVEL_NORMAL) {
>  		wm = intel_wm_method1(clock, cpp, latency);
>  	} else {
> -		int small, large;
> +		unsigned int small, large;
>  
>  		small = intel_wm_method1(clock, cpp, latency);
>  		large = intel_wm_method2(clock, htotal, width, cpp, latency);
> @@ -1158,7 +1158,7 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
>  
>  	wm = DIV_ROUND_UP(wm, 64) + 2;
>  
> -	return min_t(int, wm, USHRT_MAX);
> +	return min_t(unsigned int, wm, USHRT_MAX);
>  }
>  
>  static bool g4x_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
> -- 
> 2.15.0

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
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: Prevent unbounded wm results in g4x_compute_wm()
  2017-11-07 12:56 [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm() Chris Wilson
                   ` (2 preceding siblings ...)
  2017-11-07 13:55 ` [PATCH] " Ville Syrjälä
@ 2017-11-07 14:03 ` Chris Wilson
  2017-11-07 14:08   ` Chris Wilson
  2017-11-07 14:22 ` ✓ Fi.CI.IGT: success for " Patchwork
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Chris Wilson @ 2017-11-07 14:03 UTC (permalink / raw)
  To: intel-gfx; +Cc: Dan Carpenter

Smatch warns of

drivers/gpu/drm/i915/intel_pm.c:1161 g4x_compute_wm() warn: signedness bug returning '(-33554430)'

which is a result of it believing that wm may be INT_MAX following
g4x_tlb_miss_wa(). Just declaring g4x_tlb_miss_wa() as returning an
unsigned integer is not sufficient, we need to tell smatch that wm itself
is unsigned for it to not worry. So mark up the locals we expect to be
non-negative, and so silence smatch.

v2: Mark up vlv_compute_intermediate_wm() as unsigned similarly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> #v1
---
 drivers/gpu/drm/i915/intel_pm.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 6e1358d4e764..b75c4cf074ff 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -928,7 +928,7 @@ static void pineview_update_wm(struct intel_crtc *unused_crtc)
  *  and the size of 8 whole lines. This adjustment is always performed
  *  in the actual pixel depth regardless of whether FBC is enabled or not."
  */
-static int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
+static unsigned int g4x_tlb_miss_wa(int fifo_size, int width, int cpp)
 {
 	int tlb_miss = fifo_size * 64 - width * cpp * 8;
 
@@ -1105,8 +1105,8 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->base.adjusted_mode;
-	int clock, htotal, cpp, width, wm;
-	int latency = dev_priv->wm.pri_latency[level] * 10;
+	unsigned int latency = dev_priv->wm.pri_latency[level] * 10;
+	unsigned int clock, htotal, cpp, width, wm;
 
 	if (latency == 0)
 		return USHRT_MAX;
@@ -1145,7 +1145,7 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
 		   level == G4X_WM_LEVEL_NORMAL) {
 		wm = intel_wm_method1(clock, cpp, latency);
 	} else {
-		int small, large;
+		unsigned int small, large;
 
 		small = intel_wm_method1(clock, cpp, latency);
 		large = intel_wm_method2(clock, htotal, width, cpp, latency);
@@ -1158,7 +1158,7 @@ static uint16_t g4x_compute_wm(const struct intel_crtc_state *crtc_state,
 
 	wm = DIV_ROUND_UP(wm, 64) + 2;
 
-	return min_t(int, wm, USHRT_MAX);
+	return min_t(unsigned int, wm, USHRT_MAX);
 }
 
 static bool g4x_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
@@ -1602,7 +1602,7 @@ static uint16_t vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->base.adjusted_mode;
-	int clock, htotal, cpp, width, wm;
+	unsigned int clock, htotal, cpp, width, wm;
 
 	if (dev_priv->wm.pri_latency[level] == 0)
 		return USHRT_MAX;
@@ -1628,7 +1628,7 @@ static uint16_t vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,
 				    dev_priv->wm.pri_latency[level] * 10);
 	}
 
-	return min_t(int, wm, USHRT_MAX);
+	return min_t(unsigned int, wm, USHRT_MAX);
 }
 
 static bool vlv_need_sprite0_fifo_workaround(unsigned int active_planes)
-- 
2.15.0

_______________________________________________
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 v2] drm/i915: Prevent unbounded wm results in g4x_compute_wm()
  2017-11-07 14:03 ` [PATCH v2] " Chris Wilson
@ 2017-11-07 14:08   ` Chris Wilson
  0 siblings, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2017-11-07 14:08 UTC (permalink / raw)
  To: intel-gfx; +Cc: Dan Carpenter

Quoting Chris Wilson (2017-11-07 14:03:38)
> Smatch warns of
> 
> drivers/gpu/drm/i915/intel_pm.c:1161 g4x_compute_wm() warn: signedness bug returning '(-33554430)'
> 
> which is a result of it believing that wm may be INT_MAX following
> g4x_tlb_miss_wa(). Just declaring g4x_tlb_miss_wa() as returning an
> unsigned integer is not sufficient, we need to tell smatch that wm itself
> is unsigned for it to not worry. So mark up the locals we expect to be
> non-negative, and so silence smatch.
> 
> v2: Mark up vlv_compute_intermediate_wm() as unsigned similarly.
s/vlv_compute_intermediate_vm/vlv_compute_wm_level/
-Chris
_______________________________________________
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.IGT: success for drm/i915: Prevent unbounded wm results in g4x_compute_wm()
  2017-11-07 12:56 [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm() Chris Wilson
                   ` (3 preceding siblings ...)
  2017-11-07 14:03 ` [PATCH v2] " Chris Wilson
@ 2017-11-07 14:22 ` Patchwork
  2017-11-07 14:36 ` ✓ Fi.CI.BAT: success for drm/i915: Prevent unbounded wm results in g4x_compute_wm() (rev2) Patchwork
  2017-11-07 15:20 ` ✓ Fi.CI.IGT: " Patchwork
  6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2017-11-07 14:22 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Prevent unbounded wm results in g4x_compute_wm()
URL   : https://patchwork.freedesktop.org/series/33341/
State : success

== Summary ==

Test kms_flip:
        Subgroup plain-flip-fb-recreate-interruptible:
                fail       -> PASS       (shard-hsw) fdo#100368

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

shard-hsw        total:2540 pass:1432 dwarn:1   dfail:0   fail:10  skip:1097 time:9260s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6989/shards.html
_______________________________________________
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: Prevent unbounded wm results in g4x_compute_wm() (rev2)
  2017-11-07 12:56 [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm() Chris Wilson
                   ` (4 preceding siblings ...)
  2017-11-07 14:22 ` ✓ Fi.CI.IGT: success for " Patchwork
@ 2017-11-07 14:36 ` Patchwork
  2017-11-07 15:20 ` ✓ Fi.CI.IGT: " Patchwork
  6 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2017-11-07 14:36 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Prevent unbounded wm results in g4x_compute_wm() (rev2)
URL   : https://patchwork.freedesktop.org/series/33341/
State : success

== Summary ==

Series 33341v2 drm/i915: Prevent unbounded wm results in g4x_compute_wm()
https://patchwork.freedesktop.org/api/1.0/series/33341/revisions/2/mbox/

Test core_auth:
        Subgroup basic-auth:
                dmesg-warn -> PASS       (fi-bsw-n3050) fdo#103479 +1
Test gem_sync:
        Subgroup basic-store-all:
                fail       -> PASS       (fi-ivb-3520m) fdo#100007

fdo#103479 https://bugs.freedesktop.org/show_bug.cgi?id=103479
fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:448s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:450s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:381s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:550s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:275s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:506s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:499s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:504s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:490s
fi-cfl-s         total:289  pass:254  dwarn:3   dfail:0   fail:0   skip:32  time:551s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:634s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:428s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:263s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:589s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:489s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:435s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:431s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:428s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:497s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:464s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:494s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:575s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:477s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:588s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:575s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:447s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:595s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:648s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:522s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:508s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:456s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:570s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:427s

b911f67a17e5eef16d49a51b83f7da12666e3be6 drm-tip: 2017y-11m-07d-11h-11m-37s UTC integration manifest
b85bee819bb3 drm/i915: Prevent unbounded wm results in g4x_compute_wm()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6991/
_______________________________________________
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.IGT: success for drm/i915: Prevent unbounded wm results in g4x_compute_wm() (rev2)
  2017-11-07 12:56 [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm() Chris Wilson
                   ` (5 preceding siblings ...)
  2017-11-07 14:36 ` ✓ Fi.CI.BAT: success for drm/i915: Prevent unbounded wm results in g4x_compute_wm() (rev2) Patchwork
@ 2017-11-07 15:20 ` Patchwork
  2017-11-07 20:23   ` Chris Wilson
  6 siblings, 1 reply; 11+ messages in thread
From: Patchwork @ 2017-11-07 15:20 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Prevent unbounded wm results in g4x_compute_wm() (rev2)
URL   : https://patchwork.freedesktop.org/series/33341/
State : success

== Summary ==

Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-a:
                dmesg-warn -> PASS       (shard-hsw) fdo#102249
Test kms_flip:
        Subgroup plain-flip-fb-recreate-interruptible:
                fail       -> PASS       (shard-hsw) fdo#100368

fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

shard-hsw        total:2540 pass:1433 dwarn:0   dfail:0   fail:10  skip:1097 time:9278s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6991/shards.html
_______________________________________________
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.IGT: success for drm/i915: Prevent unbounded wm results in g4x_compute_wm() (rev2)
  2017-11-07 15:20 ` ✓ Fi.CI.IGT: " Patchwork
@ 2017-11-07 20:23   ` Chris Wilson
  0 siblings, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2017-11-07 20:23 UTC (permalink / raw)
  To: Patchwork; +Cc: intel-gfx

Quoting Patchwork (2017-11-07 15:20:55)
> == Series Details ==
> 
> Series: drm/i915: Prevent unbounded wm results in g4x_compute_wm() (rev2)
> URL   : https://patchwork.freedesktop.org/series/33341/
> State : success
> 
> == Summary ==
> 
> Test kms_busy:
>         Subgroup extended-modeset-hang-newfb-with-reset-render-a:
>                 dmesg-warn -> PASS       (shard-hsw) fdo#102249
> Test kms_flip:
>         Subgroup plain-flip-fb-recreate-interruptible:
>                 fail       -> PASS       (shard-hsw) fdo#100368
> 
> fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
> fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
> 
> shard-hsw        total:2540 pass:1433 dwarn:0   dfail:0   fail:10  skip:1097 time:9278s
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6991/shards.html

Hopefully our early warning system was sufficient to demonstrate we had
no negative wm...

Thanks for the review, pushed.
-Chris
_______________________________________________
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:[~2017-11-07 20:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-07 12:56 [PATCH] drm/i915: Prevent unbounded wm results in g4x_compute_wm() Chris Wilson
2017-11-07 12:59 ` Chris Wilson
2017-11-07 13:53   ` Dan Carpenter
2017-11-07 13:20 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-11-07 13:55 ` [PATCH] " Ville Syrjälä
2017-11-07 14:03 ` [PATCH v2] " Chris Wilson
2017-11-07 14:08   ` Chris Wilson
2017-11-07 14:22 ` ✓ Fi.CI.IGT: success for " Patchwork
2017-11-07 14:36 ` ✓ Fi.CI.BAT: success for drm/i915: Prevent unbounded wm results in g4x_compute_wm() (rev2) Patchwork
2017-11-07 15:20 ` ✓ Fi.CI.IGT: " Patchwork
2017-11-07 20:23   ` Chris Wilson

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.