* [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
@ 2018-03-13 0:40 Chris Wilson
2018-03-13 0:40 ` [PATCH 2/2] drm/i915: Warn against variable length arrays Chris Wilson
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Chris Wilson @ 2018-03-13 0:40 UTC (permalink / raw)
To: intel-gfx; +Cc: Matthew Auld
In order to enable -Wvla to prevent new variable length arrays being
used in i915.ko, we first must remove the existing VLA. Inside
i915_print_sseu_info(), VLA are used as the actual size of the sseu
depends on platform. Replace the VLA with the maximum required.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index c4cc8fef11a0..0eac7dcdddbf 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4312,9 +4312,10 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_cache_sharing_fops,
static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv,
struct sseu_dev_info *sseu)
{
- int ss_max = 2;
+#define SS_MAX 2
+ const int ss_max = SS_MAX;
+ u32 sig1[SS_MAX], sig2[SS_MAX];
int ss;
- u32 sig1[ss_max], sig2[ss_max];
sig1[0] = I915_READ(CHV_POWER_SS0_SIG1);
sig1[1] = I915_READ(CHV_POWER_SS1_SIG1);
@@ -4338,15 +4339,15 @@ static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv,
sseu->eu_per_subslice = max_t(unsigned int,
sseu->eu_per_subslice, eu_cnt);
}
+#undef SS_MAX
}
static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
struct sseu_dev_info *sseu)
{
const struct intel_device_info *info = INTEL_INFO(dev_priv);
+ u32 s_reg[6], eu_reg[2 * 4], eu_mask[2];
int s, ss;
- u32 s_reg[info->sseu.max_slices];
- u32 eu_reg[2 * info->sseu.max_subslices], eu_mask[2];
for (s = 0; s < info->sseu.max_slices; s++) {
/*
@@ -4399,9 +4400,8 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
struct sseu_dev_info *sseu)
{
const struct intel_device_info *info = INTEL_INFO(dev_priv);
+ u32 s_reg[3], eu_reg[2 * 4], eu_mask[2];
int s, ss;
- u32 s_reg[info->sseu.max_slices];
- u32 eu_reg[2 * info->sseu.max_subslices], eu_mask[2];
for (s = 0; s < info->sseu.max_slices; s++) {
s_reg[s] = I915_READ(GEN9_SLICE_PGCTL_ACK(s));
--
2.16.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] drm/i915: Warn against variable length arrays
2018-03-13 0:40 [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Chris Wilson
@ 2018-03-13 0:40 ` Chris Wilson
2018-03-13 8:39 ` Jani Nikula
2018-03-13 1:04 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Patchwork
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Chris Wilson @ 2018-03-13 0:40 UTC (permalink / raw)
To: intel-gfx; +Cc: Jani Nikula
VLA are strongly discouraged in the kernel due to ambiguity they impose
on the limited stack space and security concerns over manipulating the
stack frame. Add -Wvla to our compiler flags so that CI rejects them.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
drivers/gpu/drm/i915/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 4eee91a3a236..fcb8a7b27ae2 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -12,7 +12,7 @@
# Note the danger in using -Wall -Wextra is that when CI updates gcc we
# will most likely get a sudden build breakage... Hopefully we will fix
# new warnings before CI updates!
-subdir-ccflags-y := -Wall -Wextra
+subdir-ccflags-y := -Wall -Wextra -Wvla
subdir-ccflags-y += $(call cc-disable-warning, unused-parameter)
subdir-ccflags-y += $(call cc-disable-warning, type-limits)
subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
--
2.16.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 8+ messages in thread
* ✗ Fi.CI.SPARSE: warning for series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
2018-03-13 0:40 [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Chris Wilson
2018-03-13 0:40 ` [PATCH 2/2] drm/i915: Warn against variable length arrays Chris Wilson
@ 2018-03-13 1:04 ` Patchwork
2018-03-13 1:22 ` ✓ Fi.CI.BAT: success " Patchwork
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-03-13 1:04 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
URL : https://patchwork.freedesktop.org/series/39822/
State : warning
== Summary ==
$ dim sparse origin/drm-tip
Commit: drm/i915: Remove variable length arrays from sseu debugfs printers
-O:drivers/gpu/drm/i915/i915_debugfs.c:4348:29: warning: Variable length array is used.
-O:drivers/gpu/drm/i915/i915_debugfs.c:4349:22: warning: Variable length array is used.
-O:drivers/gpu/drm/i915/i915_debugfs.c:4403:29: warning: Variable length array is used.
-O:drivers/gpu/drm/i915/i915_debugfs.c:4404:22: warning: Variable length array is used.
+
Commit: drm/i915: Warn against variable length arrays
-
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: expected void [noderef] <asn:4>**slot
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: expected void **slot
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: expected void **slot
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: expected void **slot
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: got void [noderef] <asn:4>**
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: got void [noderef] <asn:4>**
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: got void [noderef] <asn:4>**
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: got void **slot
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: warning: incorrect type in argument 1 (different address spaces)
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: warning: incorrect type in assignment (different address spaces)
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: warning: incorrect type in assignment (different address spaces)
+drivers/gpu/drm/i915/gvt/gtt.c:661:9: warning: incorrect type in assignment (different address spaces)
+drivers/gpu/drm/i915/gvt/gtt.c:662:45: expected void [noderef] <asn:4>**slot
+drivers/gpu/drm/i915/gvt/gtt.c:662:45: got void **slot
+drivers/gpu/drm/i915/gvt/gtt.c:662:45: warning: incorrect type in argument 1 (different address spaces)
+drivers/gpu/drm/i915/gvt/mmio.c:255:23: warning: memcpy with byte count of 279040
+drivers/gpu/drm/i915/gvt/mmio.c:256:23: warning: memcpy with byte count of 279040
+drivers/gpu/drm/i915/i915_perf.c:1365:15: warning: memset with byte count of 16777216
+drivers/gpu/drm/i915/i915_perf.c:1423:15: warning: memset with byte count of 16777216
+drivers/gpu/drm/i915/i915_pmu.c:442:47: warning: context imbalance in 'get_rc6' - unexpected unlock
+drivers/gpu/drm/i915/i915_request.c:299:13: error: undefined identifier '__builtin_add_overflow_p'
+drivers/gpu/drm/i915/i915_request.c:299:13: warning: call with no type!
+drivers/gpu/drm/i915/selftests/i915_syncmap.c:80:54: warning: dubious: x | !y
+./include/linux/relay.h:258:34: expected void const [noderef] <asn:3>*__vpp_verify
+./include/linux/relay.h:258:34: expected void const [noderef] <asn:3>*__vpp_verify
+./include/linux/relay.h:258:34: got struct rchan_buf **<noident>
+./include/linux/relay.h:258:34: got struct rchan_buf **<noident>
+./include/linux/relay.h:258:34: warning: incorrect type in initializer (different address spaces)
+./include/linux/relay.h:258:34: warning: incorrect type in initializer (different address spaces)
+./include/linux/relay.h:269:9: warning: dereference of noderef expression
+./include/linux/relay.h:269:9: warning: dereference of noderef expression
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
2018-03-13 0:40 [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Chris Wilson
2018-03-13 0:40 ` [PATCH 2/2] drm/i915: Warn against variable length arrays Chris Wilson
2018-03-13 1:04 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Patchwork
@ 2018-03-13 1:22 ` Patchwork
2018-03-13 7:25 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-03-13 9:35 ` [PATCH 1/2] " Tvrtko Ursulin
4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-03-13 1:22 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
URL : https://patchwork.freedesktop.org/series/39822/
State : success
== Summary ==
Series 39822v1 series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
https://patchwork.freedesktop.org/api/1.0/series/39822/revisions/1/mbox/
---- Known issues:
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
fail -> PASS (fi-gdg-551) fdo#102575
Test prime_vgem:
Subgroup basic-fence-flip:
pass -> FAIL (fi-ilk-650) fdo#104008
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:433s
fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:382s
fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:530s
fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:298s
fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:509s
fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:508s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:513s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:497s
fi-cfl-8700k total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:411s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:579s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:423s
fi-gdg-551 total:288 pass:180 dwarn:0 dfail:0 fail:0 skip:108 time:315s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:533s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:404s
fi-ilk-650 total:288 pass:227 dwarn:0 dfail:0 fail:1 skip:60 time:418s
fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:471s
fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:429s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:472s
fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:469s
fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:513s
fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:646s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:439s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:526s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:543s
fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:503s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:487s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:426s
fi-snb-2520m total:245 pass:211 dwarn:0 dfail:0 fail:0 skip:33
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:406s
Blacklisted hosts:
fi-cfl-u total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:511s
fi-cnl-drrs total:285 pass:254 dwarn:0 dfail:1 fail:2 skip:27
fi-glk-j5005 failed to collect. IGT log at Patchwork_8318/fi-glk-j5005/run0.log
da600bbe24412edd1c46591fd21ef81518e49c5d drm-tip: 2018y-03m-12d-22h-06m-53s UTC integration manifest
438b50ac4b44 drm/i915: Warn against variable length arrays
ca711de66705 drm/i915: Remove variable length arrays from sseu debugfs printers
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8318/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* ✗ Fi.CI.IGT: failure for series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
2018-03-13 0:40 [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Chris Wilson
` (2 preceding siblings ...)
2018-03-13 1:22 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-03-13 7:25 ` Patchwork
2018-03-13 9:35 ` [PATCH 1/2] " Tvrtko Ursulin
4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-03-13 7:25 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
URL : https://patchwork.freedesktop.org/series/39822/
State : failure
== Summary ==
---- Possible new issues:
Test kms_cursor_crc:
Subgroup cursor-64x64-dpms:
pass -> FAIL (shard-apl)
---- Known issues:
Test drv_suspend:
Subgroup forcewake:
pass -> SKIP (shard-hsw) k.org#196691
Test gem_eio:
Subgroup in-flight-contexts:
incomplete -> PASS (shard-apl) fdo#105341
Test kms_atomic_transition:
Subgroup 1x-modeset-transitions-nonblocking-fencing:
fail -> PASS (shard-apl) fdo#103207
Test kms_cursor_crc:
Subgroup cursor-256x256-suspend:
pass -> SKIP (shard-hsw) fdo#103375
k.org#196691 https://bugzilla.kernel.org/show_bug.cgi?id=196691
fdo#105341 https://bugs.freedesktop.org/show_bug.cgi?id=105341
fdo#103207 https://bugs.freedesktop.org/show_bug.cgi?id=103207
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
shard-apl total:3473 pass:1829 dwarn:1 dfail:0 fail:8 skip:1634 time:12994s
shard-hsw total:3473 pass:1775 dwarn:1 dfail:0 fail:2 skip:1694 time:11746s
shard-snb total:3473 pass:1364 dwarn:1 dfail:0 fail:3 skip:2105 time:7183s
Blacklisted hosts:
shard-kbl total:3297 pass:1856 dwarn:1 dfail:0 fail:8 skip:1430 time:9156s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8318/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] drm/i915: Warn against variable length arrays
2018-03-13 0:40 ` [PATCH 2/2] drm/i915: Warn against variable length arrays Chris Wilson
@ 2018-03-13 8:39 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2018-03-13 8:39 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On Tue, 13 Mar 2018, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> VLA are strongly discouraged in the kernel due to ambiguity they impose
> on the limited stack space and security concerns over manipulating the
> stack frame. Add -Wvla to our compiler flags so that CI rejects them.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 4eee91a3a236..fcb8a7b27ae2 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -12,7 +12,7 @@
> # Note the danger in using -Wall -Wextra is that when CI updates gcc we
> # will most likely get a sudden build breakage... Hopefully we will fix
> # new warnings before CI updates!
> -subdir-ccflags-y := -Wall -Wextra
> +subdir-ccflags-y := -Wall -Wextra -Wvla
> subdir-ccflags-y += $(call cc-disable-warning, unused-parameter)
> subdir-ccflags-y += $(call cc-disable-warning, type-limits)
> subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
2018-03-13 0:40 [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Chris Wilson
` (3 preceding siblings ...)
2018-03-13 7:25 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2018-03-13 9:35 ` Tvrtko Ursulin
2018-03-13 9:57 ` Chris Wilson
4 siblings, 1 reply; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-03-13 9:35 UTC (permalink / raw)
To: Chris Wilson, intel-gfx; +Cc: Matthew Auld
On 13/03/2018 00:40, Chris Wilson wrote:
> In order to enable -Wvla to prevent new variable length arrays being
> used in i915.ko, we first must remove the existing VLA. Inside
> i915_print_sseu_info(), VLA are used as the actual size of the sseu
> depends on platform. Replace the VLA with the maximum required.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index c4cc8fef11a0..0eac7dcdddbf 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -4312,9 +4312,10 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_cache_sharing_fops,
> static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv,
> struct sseu_dev_info *sseu)
> {
> - int ss_max = 2;
> +#define SS_MAX 2
> + const int ss_max = SS_MAX;
> + u32 sig1[SS_MAX], sig2[SS_MAX];
> int ss;
> - u32 sig1[ss_max], sig2[ss_max];
Even const, sigh.
>
> sig1[0] = I915_READ(CHV_POWER_SS0_SIG1);
> sig1[1] = I915_READ(CHV_POWER_SS1_SIG1);
> @@ -4338,15 +4339,15 @@ static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv,
> sseu->eu_per_subslice = max_t(unsigned int,
> sseu->eu_per_subslice, eu_cnt);
> }
> +#undef SS_MAX
> }
>
> static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
> struct sseu_dev_info *sseu)
> {
> const struct intel_device_info *info = INTEL_INFO(dev_priv);
> + u32 s_reg[6], eu_reg[2 * 4], eu_mask[2];
For future improvement I think pulling out 6 and 4 to something like
GEN10_MAX_SLICES and GEN10_MAX_SUBSLICES would be good. Just so numbers
are centralized and we remove any possibility of walking out of bounds.
Actually for all of the impacted platforms.
> int s, ss;
> - u32 s_reg[info->sseu.max_slices];
> - u32 eu_reg[2 * info->sseu.max_subslices], eu_mask[2];
>
> for (s = 0; s < info->sseu.max_slices; s++) {
> /*
> @@ -4399,9 +4400,8 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
> struct sseu_dev_info *sseu)
> {
> const struct intel_device_info *info = INTEL_INFO(dev_priv);
> + u32 s_reg[3], eu_reg[2 * 4], eu_mask[2];
> int s, ss;
> - u32 s_reg[info->sseu.max_slices];
> - u32 eu_reg[2 * info->sseu.max_subslices], eu_mask[2];
>
> for (s = 0; s < info->sseu.max_slices; s++) {
> s_reg[s] = I915_READ(GEN9_SLICE_PGCTL_ACK(s));
>
Maximums are correct so for now it is workable:
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers
2018-03-13 9:35 ` [PATCH 1/2] " Tvrtko Ursulin
@ 2018-03-13 9:57 ` Chris Wilson
0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2018-03-13 9:57 UTC (permalink / raw)
To: Tvrtko Ursulin, intel-gfx; +Cc: Matthew Auld
Quoting Tvrtko Ursulin (2018-03-13 09:35:03)
>
> On 13/03/2018 00:40, Chris Wilson wrote:
> > In order to enable -Wvla to prevent new variable length arrays being
> > used in i915.ko, we first must remove the existing VLA. Inside
> > i915_print_sseu_info(), VLA are used as the actual size of the sseu
> > depends on platform. Replace the VLA with the maximum required.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > Cc: Matthew Auld <matthew.auld@intel.com>
> > ---
> > drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index c4cc8fef11a0..0eac7dcdddbf 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -4312,9 +4312,10 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_cache_sharing_fops,
> > static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv,
> > struct sseu_dev_info *sseu)
> > {
> > - int ss_max = 2;
> > +#define SS_MAX 2
> > + const int ss_max = SS_MAX;
> > + u32 sig1[SS_MAX], sig2[SS_MAX];
> > int ss;
> > - u32 sig1[ss_max], sig2[ss_max];
>
> Even const, sigh.
>
> >
> > sig1[0] = I915_READ(CHV_POWER_SS0_SIG1);
> > sig1[1] = I915_READ(CHV_POWER_SS1_SIG1);
> > @@ -4338,15 +4339,15 @@ static void cherryview_sseu_device_status(struct drm_i915_private *dev_priv,
> > sseu->eu_per_subslice = max_t(unsigned int,
> > sseu->eu_per_subslice, eu_cnt);
> > }
> > +#undef SS_MAX
> > }
> >
> > static void gen10_sseu_device_status(struct drm_i915_private *dev_priv,
> > struct sseu_dev_info *sseu)
> > {
> > const struct intel_device_info *info = INTEL_INFO(dev_priv);
> > + u32 s_reg[6], eu_reg[2 * 4], eu_mask[2];
>
> For future improvement I think pulling out 6 and 4 to something like
> GEN10_MAX_SLICES and GEN10_MAX_SUBSLICES would be good. Just so numbers
> are centralized and we remove any possibility of walking out of bounds.
> Actually for all of the impacted platforms.
>
> > int s, ss;
> > - u32 s_reg[info->sseu.max_slices];
> > - u32 eu_reg[2 * info->sseu.max_subslices], eu_mask[2];
> >
> > for (s = 0; s < info->sseu.max_slices; s++) {
> > /*
> > @@ -4399,9 +4400,8 @@ static void gen9_sseu_device_status(struct drm_i915_private *dev_priv,
> > struct sseu_dev_info *sseu)
> > {
> > const struct intel_device_info *info = INTEL_INFO(dev_priv);
> > + u32 s_reg[3], eu_reg[2 * 4], eu_mask[2];
> > int s, ss;
> > - u32 s_reg[info->sseu.max_slices];
> > - u32 eu_reg[2 * info->sseu.max_subslices], eu_mask[2];
> >
> > for (s = 0; s < info->sseu.max_slices; s++) {
> > s_reg[s] = I915_READ(GEN9_SLICE_PGCTL_ACK(s));
> >
>
> Maximums are correct so for now it is workable:
>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
I figure I'd let someone else figure out how to write GENX_MAX_SLICES
nicely and push this pair while we have no more VLA in the driver. :)
Thanks for the review,
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-03-13 9:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 0:40 [PATCH 1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Chris Wilson
2018-03-13 0:40 ` [PATCH 2/2] drm/i915: Warn against variable length arrays Chris Wilson
2018-03-13 8:39 ` Jani Nikula
2018-03-13 1:04 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/2] drm/i915: Remove variable length arrays from sseu debugfs printers Patchwork
2018-03-13 1:22 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-13 7:25 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-03-13 9:35 ` [PATCH 1/2] " Tvrtko Ursulin
2018-03-13 9:57 ` 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.