All of lore.kernel.org
 help / color / mirror / Atom feed
* Trivial compiler squelching
@ 2017-11-15 10:50 Chris Wilson
  2017-11-15 10:50 ` [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Chris Wilson
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Chris Wilson @ 2017-11-15 10:50 UTC (permalink / raw)
  To: intel-gfx

Some minor cleanup for the older compilers.
-Chris

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

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

* [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-15 10:50 Trivial compiler squelching Chris Wilson
@ 2017-11-15 10:50 ` Chris Wilson
  2017-11-15 12:50   ` Ville Syrjälä
  2017-11-15 13:17   ` [PATCH v2] " Chris Wilson
  2017-11-15 10:50 ` [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm() Chris Wilson
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Chris Wilson @ 2017-11-15 10:50 UTC (permalink / raw)
  To: intel-gfx

gcc-4.7.3 is confused by the guards inside intel_ppat_get() and reports:

drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘intel_ppat_get’:
drivers/gpu/drm/i915/i915_gem_gtt.c:3044:27: warning: ‘entry’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Forgive the compiler this once, and rearrange the code so that entry is
always initialised.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 3c3a699436c9..10e3c6e64d9e 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3076,7 +3076,7 @@ const struct intel_ppat_entry *
 intel_ppat_get(struct drm_i915_private *i915, u8 value)
 {
 	struct intel_ppat *ppat = &i915->ppat;
-	struct intel_ppat_entry *entry;
+	struct intel_ppat_entry *entry = ERR_PTR(-ENOSPC);
 	unsigned int scanned, best_score;
 	int i;
 
@@ -3099,10 +3099,8 @@ intel_ppat_get(struct drm_i915_private *i915, u8 value)
 	}
 
 	if (scanned == ppat->max_entries) {
-		if (!best_score)
-			return ERR_PTR(-ENOSPC);
-
-		kref_get(&entry->ref);
+		if (best_score)
+			kref_get(&entry->ref);
 		return entry;
 	}
 
-- 
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] 19+ messages in thread

* [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm()
  2017-11-15 10:50 Trivial compiler squelching Chris Wilson
  2017-11-15 10:50 ` [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Chris Wilson
@ 2017-11-15 10:50 ` Chris Wilson
  2017-11-15 10:54   ` Chris Wilson
  2017-11-16  1:12   ` Rodrigo Vivi
  2017-11-15 10:50 ` [PATCH 3/3] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Chris Wilson @ 2017-11-15 10:50 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

clang spots

drivers/gpu/drm/i915/intel_pm.c:4655:6: warning: variable 'trans_min' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (INTEL_GEN(dev_priv) >= 10)

but fortunately for us we skip the function unless on a gen10+ device.
However, to keep the function generic in case we do want to re-enable it
for gen9 again, initialise trans_min to 0.

References: ca47667f523e ("drm/i915/gen10: Calculate and enable transition WM")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 8c69ec9eb6ee..5d8babfaec30 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4649,6 +4649,7 @@ static void skl_compute_transition_wm(struct intel_crtc_state *cstate,
 	if (!dev_priv->ipc_enabled)
 		goto exit;
 
+	trans_min = 0;
 	if (INTEL_GEN(dev_priv) >= 10)
 		trans_min = 4;
 
-- 
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] 19+ messages in thread

* [PATCH 3/3] drm/i915/crt: Silence compiler warning for uninitialised status
  2017-11-15 10:50 Trivial compiler squelching Chris Wilson
  2017-11-15 10:50 ` [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Chris Wilson
  2017-11-15 10:50 ` [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm() Chris Wilson
@ 2017-11-15 10:50 ` Chris Wilson
  2017-11-15 12:48   ` Ville Syrjälä
  2017-11-15 11:14 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Patchwork
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2017-11-15 10:50 UTC (permalink / raw)
  To: intel-gfx

clang is confused by our if-else-chain that abruptly exits before a
final else:

drivers/gpu/drm/i915/intel_crt.c:821:11: warning: variable 'status' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        else if (ret < 0)
                 ^~~~~~~
drivers/gpu/drm/i915/intel_crt.c:826:9: note: uninitialized use occurs here
        return status;
               ^~~~~~
drivers/gpu/drm/i915/intel_crt.c:821:7: note: remove the 'if' if its condition is always true
        else if (ret < 0)
             ^~~~~~~~~~~~
drivers/gpu/drm/i915/intel_crt.c:761:12: note: initialize the variable 'status' to silence this warning
        int status, ret;

In this case, we can reduce the final else-if clause to an unconditional else.

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

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 9f31aea51dff..ae55afcbdc2c 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -810,10 +810,11 @@ intel_crt_detect(struct drm_connector *connector,
 		else
 			status = connector_status_unknown;
 		intel_release_load_detect_pipe(connector, &tmp, ctx);
-	} else if (ret == 0)
+	} else if (ret == 0) {
 		status = connector_status_unknown;
-	else if (ret < 0)
+	} else {
 		status = ret;
+	}
 
 out:
 	intel_display_power_put(dev_priv, intel_encoder->power_domain);
-- 
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] 19+ messages in thread

* Re: [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm()
  2017-11-15 10:50 ` [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm() Chris Wilson
@ 2017-11-15 10:54   ` Chris Wilson
  2017-11-16  1:12   ` Rodrigo Vivi
  1 sibling, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2017-11-15 10:54 UTC (permalink / raw)
  To: intel-gfx; +Cc: Mahesh

Quoting Chris Wilson (2017-11-15 10:50:35)
> clang spots
> 
> drivers/gpu/drm/i915/intel_pm.c:4655:6: warning: variable 'trans_min' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>         if (INTEL_GEN(dev_priv) >= 10)
> 
> but fortunately for us we skip the function unless on a gen10+ device.
> However, to keep the function generic in case we do want to re-enable it
> for gen9 again, initialise trans_min to 0.
> 
> References: ca47667f523e ("drm/i915/gen10: Calculate and enable transition WM")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

Forget this patch, the code is just wrong. But no fix sent yet!
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-15 10:50 Trivial compiler squelching Chris Wilson
                   ` (2 preceding siblings ...)
  2017-11-15 10:50 ` [PATCH 3/3] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
@ 2017-11-15 11:14 ` Patchwork
  2017-11-15 12:08 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2017-11-15 11:14 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers
URL   : https://patchwork.freedesktop.org/series/33862/
State : success

== Summary ==

Series 33862v1 series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers
https://patchwork.freedesktop.org/api/1.0/series/33862/revisions/1/mbox/

Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c:
                skip       -> PASS       (fi-hsw-4770r)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> INCOMPLETE (fi-snb-2520m) fdo#103713

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

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:442s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:449s
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:549s
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:498s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:501s
fi-byt-j1900     total:289  pass:254  dwarn:0   dfail:0   fail:0   skip:35  time:495s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:490s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:432s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:538s
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:437s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:426s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:469s
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:483s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:525s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:472s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:539s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:573s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:541s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:561s
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:498s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:460s
fi-snb-2520m     total:246  pass:212  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:421s
Blacklisted hosts:
fi-cfl-s         total:289  pass:254  dwarn:3   dfail:0   fail:0   skip:32  time:524s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:556s

2cac5c93bc9427509e5164289e810bdcabfc0351 drm-tip: 2017y-11m-15d-09h-10m-41s UTC integration manifest
33309e2b012c drm/i915/crt: Silence compiler warning for uninitialised status
dc1e31067076 drm/i915/: Initialise trans_min for skl_compute_transition_wm()
81c528f106f3 drm/i915: Initialise entry in intel_ppat_get() for older compilers

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7138/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-15 10:50 Trivial compiler squelching Chris Wilson
                   ` (3 preceding siblings ...)
  2017-11-15 11:14 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Patchwork
@ 2017-11-15 12:08 ` Patchwork
  2017-11-15 13:34 ` ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers (rev2) Patchwork
  2017-11-15 14:27 ` ✓ Fi.CI.IGT: " Patchwork
  6 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2017-11-15 12:08 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers
URL   : https://patchwork.freedesktop.org/series/33862/
State : success

== Summary ==

Test kms_busy:
        Subgroup extended-modeset-hang-oldfb-with-reset-render-c:
                dmesg-warn -> PASS       (shard-hsw) fdo#102249
Test drv_module_reload:
        Subgroup basic-reload-inject:
                dmesg-warn -> PASS       (shard-hsw) fdo#102707
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912

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

shard-hsw        total:2584 pass:1472 dwarn:2   dfail:1   fail:10  skip:1099 time:9442s
Blacklisted hosts:
shard-apl        total:2565 pass:1603 dwarn:1   dfail:1   fail:23  skip:936 time:12839s
shard-kbl        total:2465 pass:1639 dwarn:9   dfail:2   fail:23  skip:790 time:10123s
shard-snb        total:2584 pass:1201 dwarn:1   dfail:1   fail:12  skip:1369 time:7735s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7138/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 3/3] drm/i915/crt: Silence compiler warning for uninitialised status
  2017-11-15 10:50 ` [PATCH 3/3] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
@ 2017-11-15 12:48   ` Ville Syrjälä
  0 siblings, 0 replies; 19+ messages in thread
From: Ville Syrjälä @ 2017-11-15 12:48 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 15, 2017 at 10:50:36AM +0000, Chris Wilson wrote:
> clang is confused by our if-else-chain that abruptly exits before a
> final else:
> 
> drivers/gpu/drm/i915/intel_crt.c:821:11: warning: variable 'status' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>         else if (ret < 0)
>                  ^~~~~~~
> drivers/gpu/drm/i915/intel_crt.c:826:9: note: uninitialized use occurs here
>         return status;
>                ^~~~~~
> drivers/gpu/drm/i915/intel_crt.c:821:7: note: remove the 'if' if its condition is always true
>         else if (ret < 0)
>              ^~~~~~~~~~~~
> drivers/gpu/drm/i915/intel_crt.c:761:12: note: initialize the variable 'status' to silence this warning
>         int status, ret;
> 
> In this case, we can reduce the final else-if clause to an unconditional else.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_crt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 9f31aea51dff..ae55afcbdc2c 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -810,10 +810,11 @@ intel_crt_detect(struct drm_connector *connector,
>  		else
>  			status = connector_status_unknown;
>  		intel_release_load_detect_pipe(connector, &tmp, ctx);
> -	} else if (ret == 0)
> +	} else if (ret == 0) {
>  		status = connector_status_unknown;
> -	else if (ret < 0)
> +	} else {
>  		status = ret;
> +	}

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

On a somewhat related note, the return value of intel_get_load_detect_pipe()
is quite a mess. It's mixing ints and bools in a way that makes the whole
thing look very confusing. In the end it looks like like -EDEADLK is the
only error we can get here.

>  
>  out:
>  	intel_display_power_put(dev_priv, intel_encoder->power_domain);
> -- 
> 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] 19+ messages in thread

* Re: [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-15 10:50 ` [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Chris Wilson
@ 2017-11-15 12:50   ` Ville Syrjälä
  2017-11-15 13:17   ` [PATCH v2] " Chris Wilson
  1 sibling, 0 replies; 19+ messages in thread
From: Ville Syrjälä @ 2017-11-15 12:50 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 15, 2017 at 10:50:34AM +0000, Chris Wilson wrote:
> gcc-4.7.3 is confused by the guards inside intel_ppat_get() and reports:
> 
> drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘intel_ppat_get’:
> drivers/gpu/drm/i915/i915_gem_gtt.c:3044:27: warning: ‘entry’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> Forgive the compiler this once, and rearrange the code so that entry is
> always initialised.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 3c3a699436c9..10e3c6e64d9e 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3076,7 +3076,7 @@ const struct intel_ppat_entry *
>  intel_ppat_get(struct drm_i915_private *i915, u8 value)
>  {
>  	struct intel_ppat *ppat = &i915->ppat;
> -	struct intel_ppat_entry *entry;
> +	struct intel_ppat_entry *entry = ERR_PTR(-ENOSPC);

Or maybe?

struct intel_ppat_entry *entry = NULL;

>  	unsigned int scanned, best_score;
>  	int i;
>  
> @@ -3099,10 +3099,8 @@ intel_ppat_get(struct drm_i915_private *i915, u8 value)
>  	}
>  
>  	if (scanned == ppat->max_entries) {
> -		if (!best_score)

if (!entry)

> -			return ERR_PTR(-ENOSPC);
> -
> -		kref_get(&entry->ref);
> +		if (best_score)
> +			kref_get(&entry->ref);
>  		return entry;
>  	}
>  
> -- 
> 2.15.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
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] 19+ messages in thread

* [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-15 10:50 ` [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Chris Wilson
  2017-11-15 12:50   ` Ville Syrjälä
@ 2017-11-15 13:17   ` Chris Wilson
  2017-11-15 13:24     ` Ville Syrjälä
  2017-11-17 13:32     ` Wang, Zhi A
  1 sibling, 2 replies; 19+ messages in thread
From: Chris Wilson @ 2017-11-15 13:17 UTC (permalink / raw)
  To: intel-gfx

gcc-4.7.3 is confused by the guards inside intel_ppat_get() and reports:

drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘intel_ppat_get’:
drivers/gpu/drm/i915/i915_gem_gtt.c:3044:27: warning: ‘entry’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Forgive the compiler this once, and rearrange the code so that entry is
always initialised.

v2: Flavour with a bit of NULL (instead of ERR_PTR(-ENOSPC).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 3c3a699436c9..f92a39fc511c 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3076,7 +3076,7 @@ const struct intel_ppat_entry *
 intel_ppat_get(struct drm_i915_private *i915, u8 value)
 {
 	struct intel_ppat *ppat = &i915->ppat;
-	struct intel_ppat_entry *entry;
+	struct intel_ppat_entry *entry = NULL;
 	unsigned int scanned, best_score;
 	int i;
 
@@ -3099,7 +3099,7 @@ intel_ppat_get(struct drm_i915_private *i915, u8 value)
 	}
 
 	if (scanned == ppat->max_entries) {
-		if (!best_score)
+		if (!entry)
 			return ERR_PTR(-ENOSPC);
 
 		kref_get(&entry->ref);
-- 
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] 19+ messages in thread

* Re: [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-15 13:17   ` [PATCH v2] " Chris Wilson
@ 2017-11-15 13:24     ` Ville Syrjälä
  2017-11-17 13:32     ` Wang, Zhi A
  1 sibling, 0 replies; 19+ messages in thread
From: Ville Syrjälä @ 2017-11-15 13:24 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 15, 2017 at 01:17:05PM +0000, Chris Wilson wrote:
> gcc-4.7.3 is confused by the guards inside intel_ppat_get() and reports:
> 
> drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘intel_ppat_get’:
> drivers/gpu/drm/i915/i915_gem_gtt.c:3044:27: warning: ‘entry’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> Forgive the compiler this once, and rearrange the code so that entry is
> always initialised.
> 
> v2: Flavour with a bit of NULL (instead of ERR_PTR(-ENOSPC).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 3c3a699436c9..f92a39fc511c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3076,7 +3076,7 @@ const struct intel_ppat_entry *
>  intel_ppat_get(struct drm_i915_private *i915, u8 value)
>  {
>  	struct intel_ppat *ppat = &i915->ppat;
> -	struct intel_ppat_entry *entry;
> +	struct intel_ppat_entry *entry = NULL;
>  	unsigned int scanned, best_score;
>  	int i;
>  
> @@ -3099,7 +3099,7 @@ intel_ppat_get(struct drm_i915_private *i915, u8 value)
>  	}
>  
>  	if (scanned == ppat->max_entries) {
> -		if (!best_score)
> +		if (!entry)
>  			return ERR_PTR(-ENOSPC);
>  
>  		kref_get(&entry->ref);
> -- 
> 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] 19+ messages in thread

* ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers (rev2)
  2017-11-15 10:50 Trivial compiler squelching Chris Wilson
                   ` (4 preceding siblings ...)
  2017-11-15 12:08 ` ✓ Fi.CI.IGT: " Patchwork
@ 2017-11-15 13:34 ` Patchwork
  2017-11-15 14:27 ` ✓ Fi.CI.IGT: " Patchwork
  6 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2017-11-15 13:34 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers (rev2)
URL   : https://patchwork.freedesktop.org/series/33862/
State : success

== Summary ==

Series 33862v2 series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers
https://patchwork.freedesktop.org/api/1.0/series/33862/revisions/2/mbox/

Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c:
                skip       -> PASS       (fi-hsw-4770r)

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:453s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:383s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:542s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:274s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:502s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:500s
fi-byt-j1900     total:289  pass:254  dwarn:0   dfail:0   fail:0   skip:35  time:497s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:496s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:432s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:540s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:427s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:440s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:423s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:480s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:461s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:486s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:530s
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:533s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:568s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:456s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:543s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:563s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:517s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:491s
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:559s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:423s
Blacklisted hosts:
fi-cfl-s         total:289  pass:254  dwarn:3   dfail:0   fail:0   skip:32  time:524s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:562s

2cac5c93bc9427509e5164289e810bdcabfc0351 drm-tip: 2017y-11m-15d-09h-10m-41s UTC integration manifest
275338a27314 drm/i915/crt: Silence compiler warning for uninitialised status
c8511451a55d drm/i915/: Initialise trans_min for skl_compute_transition_wm()
143084d19bbf drm/i915: Initialise entry in intel_ppat_get() for older compilers

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7142/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers (rev2)
  2017-11-15 10:50 Trivial compiler squelching Chris Wilson
                   ` (5 preceding siblings ...)
  2017-11-15 13:34 ` ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers (rev2) Patchwork
@ 2017-11-15 14:27 ` Patchwork
  6 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2017-11-15 14:27 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers (rev2)
URL   : https://patchwork.freedesktop.org/series/33862/
State : success

== Summary ==

Test drv_module_reload:
        Subgroup basic-reload-inject:
                dmesg-warn -> PASS       (shard-hsw) fdo#102707
Test drv_selftest:
        Subgroup mock_sanitycheck:
                pass       -> DMESG-WARN (shard-hsw) fdo#103719
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912

fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#103719 https://bugs.freedesktop.org/show_bug.cgi?id=103719
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-hsw        total:2584 pass:1469 dwarn:4   dfail:2   fail:10  skip:1099 time:9412s
Blacklisted hosts:
shard-apl        total:2584 pass:1619 dwarn:2   dfail:2   fail:25  skip:936 time:13039s
shard-kbl        total:2517 pass:1662 dwarn:9   dfail:3   fail:25  skip:816 time:10119s
shard-snb        total:2584 pass:1200 dwarn:1   dfail:1   fail:13  skip:1369 time:7747s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7142/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm()
  2017-11-15 10:50 ` [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm() Chris Wilson
  2017-11-15 10:54   ` Chris Wilson
@ 2017-11-16  1:12   ` Rodrigo Vivi
  2018-01-22 19:13     ` Chris Wilson
  1 sibling, 1 reply; 19+ messages in thread
From: Rodrigo Vivi @ 2017-11-16  1:12 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Nov 15, 2017 at 10:50:35AM +0000, Chris Wilson wrote:
> clang spots
> 
> drivers/gpu/drm/i915/intel_pm.c:4655:6: warning: variable 'trans_min' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>         if (INTEL_GEN(dev_priv) >= 10)
> 
> but fortunately for us we skip the function unless on a gen10+ device.
> However, to keep the function generic in case we do want to re-enable it
> for gen9 again, initialise trans_min to 0.

Based on this comment:  /* Transition WM are not recommended by HW team for GEN9 */

I believe the function should be called cnl_compute_transition_wm

plus:

-  uint16_t trans_min, trans_y_tile_min;
+  u16 trans_min = 4, trans_y_tile_min;

-  if (INTEL_GEN(dev_priv) >= 10)
-  	trans_min = 4;

Also Wa for CNL A0 can be removed... We never put our hands in on A0...

But in case you want to go with the quick fix:
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

up to you.

> 
> References: ca47667f523e ("drm/i915/gen10: Calculate and enable transition WM")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 8c69ec9eb6ee..5d8babfaec30 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4649,6 +4649,7 @@ static void skl_compute_transition_wm(struct intel_crtc_state *cstate,
>  	if (!dev_priv->ipc_enabled)
>  		goto exit;
>  
> +	trans_min = 0;
>  	if (INTEL_GEN(dev_priv) >= 10)
>  		trans_min = 4;
>  
> -- 
> 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] 19+ messages in thread

* Re: [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-15 13:17   ` [PATCH v2] " Chris Wilson
  2017-11-15 13:24     ` Ville Syrjälä
@ 2017-11-17 13:32     ` Wang, Zhi A
  2017-11-20  9:54       ` Joonas Lahtinen
  1 sibling, 1 reply; 19+ messages in thread
From: Wang, Zhi A @ 2017-11-17 13:32 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

Thanks! Looks good to me.

-----Original Message-----
From: Chris Wilson [mailto:chris@chris-wilson.co.uk] 
Sent: Wednesday, November 15, 2017 3:17 PM
To: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>; Joonas Lahtinen <joonas.lahtinen@linux.intel.com>; Wang, Zhi A <zhi.a.wang@intel.com>; Ville Syrjälä <ville.syrjala@linux.intel.com>
Subject: [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers

gcc-4.7.3 is confused by the guards inside intel_ppat_get() and reports:

drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘intel_ppat_get’:
drivers/gpu/drm/i915/i915_gem_gtt.c:3044:27: warning: ‘entry’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Forgive the compiler this once, and rearrange the code so that entry is always initialised.

v2: Flavour with a bit of NULL (instead of ERR_PTR(-ENOSPC).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 3c3a699436c9..f92a39fc511c 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3076,7 +3076,7 @@ const struct intel_ppat_entry *  intel_ppat_get(struct drm_i915_private *i915, u8 value)  {
 	struct intel_ppat *ppat = &i915->ppat;
-	struct intel_ppat_entry *entry;
+	struct intel_ppat_entry *entry = NULL;
 	unsigned int scanned, best_score;
 	int i;
 
@@ -3099,7 +3099,7 @@ intel_ppat_get(struct drm_i915_private *i915, u8 value)
 	}
 
 	if (scanned == ppat->max_entries) {
-		if (!best_score)
+		if (!entry)
 			return ERR_PTR(-ENOSPC);
 
 		kref_get(&entry->ref);
--
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] 19+ messages in thread

* Re: [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-17 13:32     ` Wang, Zhi A
@ 2017-11-20  9:54       ` Joonas Lahtinen
  2017-11-20 10:02         ` Wang, Zhi A
  0 siblings, 1 reply; 19+ messages in thread
From: Joonas Lahtinen @ 2017-11-20  9:54 UTC (permalink / raw)
  To: Wang, Zhi A, Chris Wilson, intel-gfx

On Fri, 2017-11-17 at 13:32 +0000, Wang, Zhi A wrote:
> Thanks! Looks good to me.

An explicit Reviewed-by would probably be in place then? Then we get
the patch merged, too.

Regards, Joonas

> -----Original Message-----
> From: Chris Wilson [mailto:chris@chris-wilson.co.uk] 
> Sent: Wednesday, November 15, 2017 3:17 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Chris Wilson <chris@chris-wilson.co.uk>; Joonas Lahtinen <joonas.lahtinen@linux.intel.com>; Wang, Zhi A <zhi.a.wang@intel.com>; Ville Syrjälä <ville.syrjala@linux.intel.com>
> Subject: [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers
> 
> gcc-4.7.3 is confused by the guards inside intel_ppat_get() and reports:
> 
> drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘intel_ppat_get’:
> drivers/gpu/drm/i915/i915_gem_gtt.c:3044:27: warning: ‘entry’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> Forgive the compiler this once, and rearrange the code so that entry is always initialised.
> 
> v2: Flavour with a bit of NULL (instead of ERR_PTR(-ENOSPC).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 3c3a699436c9..f92a39fc511c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3076,7 +3076,7 @@ const struct intel_ppat_entry *  intel_ppat_get(struct drm_i915_private *i915, u8 value)  {
>  	struct intel_ppat *ppat = &i915->ppat;
> -	struct intel_ppat_entry *entry;
> +	struct intel_ppat_entry *entry = NULL;
>  	unsigned int scanned, best_score;
>  	int i;
>  
> @@ -3099,7 +3099,7 @@ intel_ppat_get(struct drm_i915_private *i915, u8 value)
>  	}
>  
>  	if (scanned == ppat->max_entries) {
> -		if (!best_score)
> +		if (!entry)
>  			return ERR_PTR(-ENOSPC);
>  
>  		kref_get(&entry->ref);
> --
> 2.15.0
> 
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers
  2017-11-20  9:54       ` Joonas Lahtinen
@ 2017-11-20 10:02         ` Wang, Zhi A
  0 siblings, 0 replies; 19+ messages in thread
From: Wang, Zhi A @ 2017-11-20 10:02 UTC (permalink / raw)
  To: Joonas Lahtinen, Chris Wilson, intel-gfx

Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>

-----Original Message-----
From: Joonas Lahtinen [mailto:joonas.lahtinen@linux.intel.com] 
Sent: Monday, November 20, 2017 11:55 AM
To: Wang, Zhi A <zhi.a.wang@intel.com>; Chris Wilson <chris@chris-wilson.co.uk>; intel-gfx@lists.freedesktop.org
Cc: Ville Syrj?l? <ville.syrjala@linux.intel.com>
Subject: Re: [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers

On Fri, 2017-11-17 at 13:32 +0000, Wang, Zhi A wrote:
> Thanks! Looks good to me.

An explicit Reviewed-by would probably be in place then? Then we get the patch merged, too.

Regards, Joonas

> -----Original Message-----
> From: Chris Wilson [mailto:chris@chris-wilson.co.uk]
> Sent: Wednesday, November 15, 2017 3:17 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Chris Wilson <chris@chris-wilson.co.uk>; Joonas Lahtinen 
> <joonas.lahtinen@linux.intel.com>; Wang, Zhi A <zhi.a.wang@intel.com>; 
> Ville Syrjälä <ville.syrjala@linux.intel.com>
> Subject: [PATCH v2] drm/i915: Initialise entry in intel_ppat_get() for 
> older compilers
> 
> gcc-4.7.3 is confused by the guards inside intel_ppat_get() and reports:
> 
> drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘intel_ppat_get’:
> drivers/gpu/drm/i915/i915_gem_gtt.c:3044:27: warning: ‘entry’ may be 
> used uninitialized in this function [-Wmaybe-uninitialized]
> 
> Forgive the compiler this once, and rearrange the code so that entry is always initialised.
> 
> v2: Flavour with a bit of NULL (instead of ERR_PTR(-ENOSPC).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 3c3a699436c9..f92a39fc511c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3076,7 +3076,7 @@ const struct intel_ppat_entry *  intel_ppat_get(struct drm_i915_private *i915, u8 value)  {
>  	struct intel_ppat *ppat = &i915->ppat;
> -	struct intel_ppat_entry *entry;
> +	struct intel_ppat_entry *entry = NULL;
>  	unsigned int scanned, best_score;
>  	int i;
>  
> @@ -3099,7 +3099,7 @@ intel_ppat_get(struct drm_i915_private *i915, u8 value)
>  	}
>  
>  	if (scanned == ppat->max_entries) {
> -		if (!best_score)
> +		if (!entry)
>  			return ERR_PTR(-ENOSPC);
>  
>  		kref_get(&entry->ref);
> --
> 2.15.0
> 
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm()
  2017-11-16  1:12   ` Rodrigo Vivi
@ 2018-01-22 19:13     ` Chris Wilson
  2018-02-19 20:41       ` Chris Wilson
  0 siblings, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2018-01-22 19:13 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: Mahesh, intel-gfx

Quoting Rodrigo Vivi (2017-11-16 01:12:15)
> On Wed, Nov 15, 2017 at 10:50:35AM +0000, Chris Wilson wrote:
> > clang spots
> > 
> > drivers/gpu/drm/i915/intel_pm.c:4655:6: warning: variable 'trans_min' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> >         if (INTEL_GEN(dev_priv) >= 10)
> > 
> > but fortunately for us we skip the function unless on a gen10+ device.
> > However, to keep the function generic in case we do want to re-enable it
> > for gen9 again, initialise trans_min to 0.
> 
> Based on this comment:  /* Transition WM are not recommended by HW team for GEN9 */
> 
> I believe the function should be called cnl_compute_transition_wm
> 
> plus:
> 
> -  uint16_t trans_min, trans_y_tile_min;
> +  u16 trans_min = 4, trans_y_tile_min;
> 
> -  if (INTEL_GEN(dev_priv) >= 10)
> -       trans_min = 4;
> 
> Also Wa for CNL A0 can be removed... We never put our hands in on A0...
> 
> But in case you want to go with the quick fix:
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

This code still hasn't been fixed. At this rate I'll merge this patch
just to suppress the compiler warning... But please fix the code!
 
> up to you.
> 
> > 
> > References: ca47667f523e ("drm/i915/gen10: Calculate and enable transition WM")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 8c69ec9eb6ee..5d8babfaec30 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -4649,6 +4649,7 @@ static void skl_compute_transition_wm(struct intel_crtc_state *cstate,
> >       if (!dev_priv->ipc_enabled)
> >               goto exit;
> >  
> > +     trans_min = 0;
> >       if (INTEL_GEN(dev_priv) >= 10)
> >               trans_min = 4;
> >  
> > -- 
> > 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] 19+ messages in thread

* Re: [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm()
  2018-01-22 19:13     ` Chris Wilson
@ 2018-02-19 20:41       ` Chris Wilson
  0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2018-02-19 20:41 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: intel-gfx, Maarten

Quoting Chris Wilson (2018-01-22 19:13:01)
> Quoting Rodrigo Vivi (2017-11-16 01:12:15)
> > On Wed, Nov 15, 2017 at 10:50:35AM +0000, Chris Wilson wrote:
> > > clang spots
> > > 
> > > drivers/gpu/drm/i915/intel_pm.c:4655:6: warning: variable 'trans_min' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> > >         if (INTEL_GEN(dev_priv) >= 10)
> > > 
> > > but fortunately for us we skip the function unless on a gen10+ device.
> > > However, to keep the function generic in case we do want to re-enable it
> > > for gen9 again, initialise trans_min to 0.
> > 
> > Based on this comment:  /* Transition WM are not recommended by HW team for GEN9 */
> > 
> > I believe the function should be called cnl_compute_transition_wm
> > 
> > plus:
> > 
> > -  uint16_t trans_min, trans_y_tile_min;
> > +  u16 trans_min = 4, trans_y_tile_min;
> > 
> > -  if (INTEL_GEN(dev_priv) >= 10)
> > -       trans_min = 4;
> > 
> > Also Wa for CNL A0 can be removed... We never put our hands in on A0...
> > 
> > But in case you want to go with the quick fix:
> > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> This code still hasn't been fixed. At this rate I'll merge this patch
> just to suppress the compiler warning... But please fix the code!

After 3 months, the code still is not fixed. So I gave in pushed the
patch to silence the warning.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2018-02-19 20:41 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15 10:50 Trivial compiler squelching Chris Wilson
2017-11-15 10:50 ` [PATCH 1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Chris Wilson
2017-11-15 12:50   ` Ville Syrjälä
2017-11-15 13:17   ` [PATCH v2] " Chris Wilson
2017-11-15 13:24     ` Ville Syrjälä
2017-11-17 13:32     ` Wang, Zhi A
2017-11-20  9:54       ` Joonas Lahtinen
2017-11-20 10:02         ` Wang, Zhi A
2017-11-15 10:50 ` [PATCH 2/3] drm/i915/: Initialise trans_min for skl_compute_transition_wm() Chris Wilson
2017-11-15 10:54   ` Chris Wilson
2017-11-16  1:12   ` Rodrigo Vivi
2018-01-22 19:13     ` Chris Wilson
2018-02-19 20:41       ` Chris Wilson
2017-11-15 10:50 ` [PATCH 3/3] drm/i915/crt: Silence compiler warning for uninitialised status Chris Wilson
2017-11-15 12:48   ` Ville Syrjälä
2017-11-15 11:14 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Initialise entry in intel_ppat_get() for older compilers Patchwork
2017-11-15 12:08 ` ✓ Fi.CI.IGT: " Patchwork
2017-11-15 13:34 ` ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Initialise entry in intel_ppat_get() for older compilers (rev2) Patchwork
2017-11-15 14:27 ` ✓ Fi.CI.IGT: " 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.