* [PATCH] drm/i915: protect against division by zero.
@ 2018-08-23 0:51 Rodrigo Vivi
2018-08-23 1:14 ` ✗ Fi.CI.BAT: failure for " Patchwork
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Rodrigo Vivi @ 2018-08-23 0:51 UTC (permalink / raw)
To: intel-gfx; +Cc: Rodrigo Vivi
Static analyzer tools thinks it is possible to have a division by zero
here.
I don't believe we would really reach this path without any crtc enabled,
but may be good to protect against some unexpected path or behavior.
Fixes: cf1f697acb04 ("drm/i915/skl: distribute DDB based on panel resolution")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
drivers/gpu/drm/i915/intel_pm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index d99e5fabe93c..fac6e159a640 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3878,6 +3878,12 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
pipe_width = hdisplay;
}
+ if (WARN_ON(total_width == 0)) {
+ alloc->start = 0;
+ alloc->end = 0;
+ return;
+ }
+
alloc->start = ddb_size * width_before_pipe / total_width;
alloc->end = ddb_size * (width_before_pipe + pipe_width) / total_width;
}
--
2.17.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 6+ messages in thread* ✗ Fi.CI.BAT: failure for drm/i915: protect against division by zero.
2018-08-23 0:51 [PATCH] drm/i915: protect against division by zero Rodrigo Vivi
@ 2018-08-23 1:14 ` Patchwork
2018-08-23 2:15 ` ✓ Fi.CI.BAT: success " Patchwork
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-08-23 1:14 UTC (permalink / raw)
To: Rodrigo Vivi; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: protect against division by zero.
URL : https://patchwork.freedesktop.org/series/48595/
State : failure
== Summary ==
= CI Bug Log - changes from CI_DRM_4699 -> Patchwork_9997 =
== Summary - FAILURE ==
Serious unknown changes coming with Patchwork_9997 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_9997, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/48595/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_9997:
=== IGT changes ===
==== Possible regressions ====
igt@drv_selftest@live_hangcheck:
fi-bxt-j4205: PASS -> DMESG-FAIL
{igt@pm_rpm@module-reload}:
fi-byt-j1900: NOTRUN -> DMESG-WARN
==== Warnings ====
{igt@kms_psr@primary_page_flip}:
fi-cnl-psr: DMESG-FAIL -> DMESG-WARN
== Known issues ==
Here are the changes found in Patchwork_9997 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_pipe_crc_basic@read-crc-pipe-b:
{fi-byt-clapper}: PASS -> FAIL (fdo#107362)
==== Possible fixes ====
igt@drv_selftest@live_coherency:
fi-gdg-551: DMESG-FAIL (fdo#107164) -> PASS
igt@drv_selftest@live_hangcheck:
fi-kbl-7560u: DMESG-FAIL (fdo#106560, fdo#106947) -> PASS
fi-skl-guc: DMESG-FAIL (fdo#106685, fdo#107174) -> PASS
igt@kms_chamelium@dp-edid-read:
fi-kbl-7500u: FAIL (fdo#103841) -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
fdo#106685 https://bugs.freedesktop.org/show_bug.cgi?id=106685
fdo#106947 https://bugs.freedesktop.org/show_bug.cgi?id=106947
fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
fdo#107174 https://bugs.freedesktop.org/show_bug.cgi?id=107174
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
== Participating hosts (52 -> 48) ==
Additional (1): fi-byt-j1900
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u
== Build changes ==
* Linux: CI_DRM_4699 -> Patchwork_9997
CI_DRM_4699: 499f94dbe3632e59aa93d186cda836247523f23f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4608: 94ebd21177feedf03e8f6dd1e73dca1a6ec7a0ac @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9997: 37263b7fe8497d0cbc7e2bbf552fe5ce0077c3fa @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
37263b7fe849 drm/i915: protect against division by zero.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9997/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread* ✓ Fi.CI.BAT: success for drm/i915: protect against division by zero.
2018-08-23 0:51 [PATCH] drm/i915: protect against division by zero Rodrigo Vivi
2018-08-23 1:14 ` ✗ Fi.CI.BAT: failure for " Patchwork
@ 2018-08-23 2:15 ` Patchwork
2018-08-23 3:28 ` ✓ Fi.CI.IGT: " Patchwork
2018-08-23 5:11 ` [PATCH] " Maarten Lankhorst
3 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-08-23 2:15 UTC (permalink / raw)
To: Rodrigo Vivi; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: protect against division by zero.
URL : https://patchwork.freedesktop.org/series/48595/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4700 -> Patchwork_9998 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/48595/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_9998:
=== IGT changes ===
==== Warnings ====
{igt@kms_psr@primary_page_flip}:
fi-cnl-psr: DMESG-FAIL -> DMESG-WARN
== Known issues ==
Here are the changes found in Patchwork_9998 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_selftest@live_hangcheck:
fi-skl-guc: PASS -> DMESG-FAIL (fdo#107174)
==== Possible fixes ====
igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
{fi-byt-clapper}: FAIL (fdo#107362, fdo#103191) -> PASS
{igt@kms_psr@primary_mmap_gtt}:
fi-cnl-psr: DMESG-WARN -> PASS
{igt@pm_rpm@module-reload}:
fi-cnl-psr: FAIL -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#107174 https://bugs.freedesktop.org/show_bug.cgi?id=107174
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
== Participating hosts (53 -> 48) ==
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u
== Build changes ==
* Linux: CI_DRM_4700 -> Patchwork_9998
CI_DRM_4700: b7d51b8e106cf75ee061244eff6281a9867e3651 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4608: 94ebd21177feedf03e8f6dd1e73dca1a6ec7a0ac @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9998: c2770c9f2c6f4af0b9917ece97ee8c2091c7b283 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
c2770c9f2c6f drm/i915: protect against division by zero.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9998/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread* ✓ Fi.CI.IGT: success for drm/i915: protect against division by zero.
2018-08-23 0:51 [PATCH] drm/i915: protect against division by zero Rodrigo Vivi
2018-08-23 1:14 ` ✗ Fi.CI.BAT: failure for " Patchwork
2018-08-23 2:15 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-08-23 3:28 ` Patchwork
2018-08-23 5:11 ` [PATCH] " Maarten Lankhorst
3 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-08-23 3:28 UTC (permalink / raw)
To: Rodrigo Vivi; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: protect against division by zero.
URL : https://patchwork.freedesktop.org/series/48595/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4700_full -> Patchwork_9998_full =
== Summary - SUCCESS ==
No regressions found.
== Known issues ==
Here are the changes found in Patchwork_9998_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_ppgtt@blt-vs-render-ctx0:
shard-kbl: PASS -> INCOMPLETE (fdo#106023, fdo#103665)
igt@kms_flip@flip-vs-expired-vblank-interruptible:
shard-glk: PASS -> FAIL (fdo#102887, fdo#105363)
==== Possible fixes ====
igt@kms_flip@modeset-vs-vblank-race:
shard-snb: FAIL (fdo#103060) -> PASS
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
== Participating hosts (5 -> 5) ==
No changes in participating hosts
== Build changes ==
* Linux: CI_DRM_4700 -> Patchwork_9998
CI_DRM_4700: b7d51b8e106cf75ee061244eff6281a9867e3651 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4608: 94ebd21177feedf03e8f6dd1e73dca1a6ec7a0ac @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9998: c2770c9f2c6f4af0b9917ece97ee8c2091c7b283 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9998/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] drm/i915: protect against division by zero.
2018-08-23 0:51 [PATCH] drm/i915: protect against division by zero Rodrigo Vivi
` (2 preceding siblings ...)
2018-08-23 3:28 ` ✓ Fi.CI.IGT: " Patchwork
@ 2018-08-23 5:11 ` Maarten Lankhorst
2018-08-23 5:24 ` Rodrigo Vivi
3 siblings, 1 reply; 6+ messages in thread
From: Maarten Lankhorst @ 2018-08-23 5:11 UTC (permalink / raw)
To: Rodrigo Vivi, intel-gfx
Op 23-08-18 om 02:51 schreef Rodrigo Vivi:
> Static analyzer tools thinks it is possible to have a division by zero
> here.
>
> I don't believe we would really reach this path without any crtc enabled,
> but may be good to protect against some unexpected path or behavior.
>
> Fixes: cf1f697acb04 ("drm/i915/skl: distribute DDB based on panel resolution")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/i915/intel_pm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index d99e5fabe93c..fac6e159a640 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3878,6 +3878,12 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
> pipe_width = hdisplay;
> }
>
> + if (WARN_ON(total_width == 0)) {
> + alloc->start = 0;
> + alloc->end = 0;
> + return;
> + }
> +
> alloc->start = ddb_size * width_before_pipe / total_width;
> alloc->end = ddb_size * (width_before_pipe + pipe_width) / total_width;
> }
It's actually quite impossible.. only way I can imagine if hw is already borked.
It must be the case that we will set cstate->active, which implies cstate->enable,
which implies a valid mode is set at least on the current crtc.
I don't think static analysis tools could deduce it, but definitely a false positive.
Also too generic commit message oneliner?
~Maarten
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] drm/i915: protect against division by zero.
2018-08-23 5:11 ` [PATCH] " Maarten Lankhorst
@ 2018-08-23 5:24 ` Rodrigo Vivi
0 siblings, 0 replies; 6+ messages in thread
From: Rodrigo Vivi @ 2018-08-23 5:24 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: intel-gfx
On Thu, Aug 23, 2018 at 07:11:16AM +0200, Maarten Lankhorst wrote:
> Op 23-08-18 om 02:51 schreef Rodrigo Vivi:
> > Static analyzer tools thinks it is possible to have a division by zero
> > here.
> >
> > I don't believe we would really reach this path without any crtc enabled,
> > but may be good to protect against some unexpected path or behavior.
> >
> > Fixes: cf1f697acb04 ("drm/i915/skl: distribute DDB based on panel resolution")
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> > drivers/gpu/drm/i915/intel_pm.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index d99e5fabe93c..fac6e159a640 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -3878,6 +3878,12 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
> > pipe_width = hdisplay;
> > }
> >
> > + if (WARN_ON(total_width == 0)) {
> > + alloc->start = 0;
> > + alloc->end = 0;
> > + return;
> > + }
> > +
> > alloc->start = ddb_size * width_before_pipe / total_width;
> > alloc->end = ddb_size * (width_before_pipe + pipe_width) / total_width;
> > }
>
> It's actually quite impossible.. only way I can imagine if hw is already borked.
>
> It must be the case that we will set cstate->active, which implies cstate->enable,
> which implies a valid mode is set at least on the current crtc.
yeap... that's what I thought... but I decided to check just in case I missed something.
>
> I don't think static analysis tools could deduce it, but definitely a false positive.
I'll mart that so...
>
> Also too generic commit message oneliner?
it just reflects the amount of confidence I had on the need of this ;)
just dropping it then.
thanks for the confirmation
>
> ~Maarten
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-23 5:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-23 0:51 [PATCH] drm/i915: protect against division by zero Rodrigo Vivi
2018-08-23 1:14 ` ✗ Fi.CI.BAT: failure for " Patchwork
2018-08-23 2:15 ` ✓ Fi.CI.BAT: success " Patchwork
2018-08-23 3:28 ` ✓ Fi.CI.IGT: " Patchwork
2018-08-23 5:11 ` [PATCH] " Maarten Lankhorst
2018-08-23 5:24 ` Rodrigo Vivi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).