Skip to contentSkip to conversation

drm/modes: Switch to 64bit maths to avoid integer overflow

PATCH In review Ville Syrjala 4 participants 7 messages Oct 22, 2020 – Nov 25, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/modes: Switch to 64bit maths to avoid integer overflow

From: Ville Syrjälä <[email protected]>

The new >8k CEA modes have dotclocks reaching 5.94 GHz, which means our clock*1000 will now overflow the 32bit unsigned integer. Switch to 64bit maths to avoid it.

---
An interesting question how many other place might suffer from similar overflows. I think i915 should be mostly OK. The one place I know we use Hz instead kHz is the hsw DPLL code, which I would prefer we also change to use kHz. The other concern is whether we have any potential overflows before we check this against the platform's max dotclock.

I do have this unreviewed igt series
https://patchwork.freedesktop.org/series/69531/ which extends the current testing with some other forms of invalid modes. Could probably extend that with a mode.clock=INT_MAX test to see if anything else might trip up.

No idea about other drivers.

 drivers/gpu/drm/drm_modes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +2 -2
index 501b4fe55a3d..511cde5c7fa6 100644
@@ -762,7 +762,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
 	if (mode->htotal == 0 || mode->vtotal == 0)
 		return 0;
 
-	num = mode->clock * 1000;
+	num = mode->clock;
 	den = mode->htotal * mode->vtotal;
 
 	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
@@ -772,7 +772,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
 	if (mode->vscan > 1)
 		den *= mode->vscan;
 
-	return DIV_ROUND_CLOSEST(num, den);
+	return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den);
 }
 EXPORT_SYMBOL(drm_mode_vrefresh);
 
Signature · 1 line
2.26.2
#1 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/modes: Switch to 64bit maths to avoid integer overflow

== Series Details ==

== Series Details ==

Series: drm/modes: Switch to 64bit maths to avoid integer overflow
URL : https://patchwork.freedesktop.org/series/82963/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9186 -> Patchwork_18767
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/index.html

Known issues
------------

Here are the changes found in Patchwork_18767 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_create@basic-files:
- fi-apl-guc: [PASS][1] -> [INCOMPLETE][2] ([i915#1635])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/fi-apl-guc/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/fi-apl-guc/igt@[email protected]

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-bsw-kefka: [PASS][3] -> [DMESG-WARN][4] ([i915#1982])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/fi-bsw-kefka/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/fi-bsw-kefka/igt@[email protected]

* igt@kms_cursor_legacy@basic-flip-after-cursor-atomic:
- fi-icl-u2: [PASS][5] -> [DMESG-WARN][6] ([i915#1982])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/fi-icl-u2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/fi-icl-u2/igt@[email protected]

[i915#1635]: https://gitlab.freedesktop.org/drm/intel/issues/1635
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982

Participating hosts (44 -> 39)
------------------------------

Additional (1): fi-skl-lmem
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper

Build changes
-------------

* Linux: CI_DRM_9186 -> Patchwork_18767

CI-20190529: 20190529
CI_DRM_9186: 88e88abb49e9b08d25ba928cc34ed09082f209b0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5822: b4bcf05cb9839037128905deda7146434155cc41 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_18767: af56b064d8e01c158fb67bbc7f7475f4cb6a5ba7 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

af56b064d8e0 drm/modes: Switch to 64bit maths to avoid integer overflow

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/modes: Switch to 64bit maths to avoid integer overflow

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm/modes: Switch to 64bit maths to avoid integer overflow
URL : https://patchwork.freedesktop.org/series/82963/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9186_full -> Patchwork_18767_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_18767_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_reloc@basic-many-active@rcs0:
- shard-snb: [PASS][1] -> [FAIL][2] ([i915#2389])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-snb7/igt@gem_exec_reloc@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-snb7/igt@gem_exec_reloc@[email protected]

* igt@gem_exec_whisper@basic-forked-all:
- shard-glk: [PASS][3] -> [DMESG-WARN][4] ([i915#118] / [i915#95])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-glk1/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-glk7/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-skl: [PASS][5] -> [FAIL][6] ([i915#454])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl7/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl7/igt@[email protected]

* igt@i915_suspend@debugfs-reader:
- shard-kbl: [PASS][7] -> [INCOMPLETE][8] ([i915#155])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-kbl7/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-kbl4/igt@[email protected]

* igt@kms_big_fb@linear-32bpp-rotate-180:
- shard-glk: [PASS][9] -> [DMESG-FAIL][10] ([i915#118] / [i915#95])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-glk7/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-glk5/igt@[email protected]

* igt@kms_big_fb@y-tiled-16bpp-rotate-0:
- shard-skl: [PASS][11] -> [FAIL][12] ([i915#1119])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl9/igt@[email protected]

* igt@kms_big_fb@y-tiled-8bpp-rotate-180:
- shard-kbl: [PASS][13] -> [DMESG-WARN][14] ([i915#1982])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-kbl7/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-kbl4/igt@[email protected]

* igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions-varying-size:
- shard-skl: [PASS][15] -> [DMESG-WARN][16] ([i915#1982]) +7 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl9/igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions-varying-size.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl10/igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions-varying-size.html

* igt@kms_cursor_legacy@flip-vs-cursor-legacy:
- shard-skl: [PASS][17] -> [FAIL][18] ([i915#2346])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl7/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl8/igt@[email protected]

* igt@kms_draw_crc@draw-method-xrgb8888-render-xtiled:
- shard-snb: [PASS][19] -> [FAIL][20] ([i915#54])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-snb4/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-snb2/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@a-edp1:
- shard-skl: [PASS][21] -> [FAIL][22] ([i915#79])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl1/igt@kms_flip@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl4/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-ts-check-interruptible@c-edp1:
- shard-skl: [PASS][23] -> [FAIL][24] ([i915#2122]) +1 similar issue
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl9/igt@kms_flip@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl10/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-gtt:
- shard-tglb: [PASS][25] -> [DMESG-WARN][26] ([i915#1982]) +2 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-tglb7/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-gtt.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-tglb5/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-gtt.html

* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [PASS][27] -> [FAIL][28] ([i915#1188]) +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl9/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl2/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
- shard-kbl: [PASS][29] -> [DMESG-WARN][30] ([i915#180])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-kbl1/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-kbl4/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [PASS][31] -> [FAIL][32] ([fdo#108145] / [i915#265])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl10/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl7/igt@[email protected]

* igt@kms_plane_cursor@pipe-a-primary-size-256:
- shard-glk: [PASS][33] -> [DMESG-WARN][34] ([i915#1982])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-glk9/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-glk2/igt@[email protected]

* igt@kms_psr2_su@frontbuffer:
- shard-iclb: [PASS][35] -> [SKIP][36] ([fdo#109642] / [fdo#111068])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-iclb2/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-iclb1/igt@[email protected]

* igt@kms_psr@psr2_sprite_blt:
- shard-iclb: [PASS][37] -> [SKIP][38] ([fdo#109441]) +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-iclb2/igt@kms_psr@psr2_sprite_blt.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-iclb8/igt@kms_psr@psr2_sprite_blt.html

#### Possible fixes ####

* igt@core_hotunplug@hotrebind-lateclose:
- shard-snb: [INCOMPLETE][39] ([i915#82]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-snb4/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-snb2/igt@[email protected]

* igt@gem_exec_whisper@basic-queues-forked:
- shard-glk: [DMESG-WARN][41] ([i915#118] / [i915#95]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-glk6/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-glk5/igt@[email protected]

* igt@gem_exec_whisper@basic-queues-priority-all:
- shard-glk: [INCOMPLETE][43] -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-glk4/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-glk1/igt@[email protected]

* igt@gem_userptr_blits@sync-unmap-cycles:
- shard-skl: [TIMEOUT][45] ([i915#2424]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl8/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl2/igt@[email protected]

* {igt@kms_async_flips@async-flip-with-page-flip-events}:
- shard-apl: [FAIL][47] ([i915#1635] / [i915#2521]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-apl4/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-apl2/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-128x128-onscreen:
- shard-skl: [FAIL][49] ([i915#54]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl7/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl7/igt@[email protected]

* igt@kms_cursor_legacy@cursor-vs-flip-varying-size:
- shard-hsw: [FAIL][51] ([i915#2370]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-hsw6/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-hsw2/igt@[email protected]

* igt@kms_flip@blocking-wf_vblank@a-edp1:
- shard-tglb: [DMESG-WARN][53] ([i915#1982]) -> [PASS][54] +2 similar issues
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-tglb6/igt@kms_flip@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-tglb2/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@c-edp1:
- shard-skl: [FAIL][55] ([i915#79]) -> [PASS][56] +1 similar issue
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl2/igt@kms_flip@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl4/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible@a-hdmi-a1:
- shard-glk: [FAIL][57] ([i915#2122]) -> [PASS][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-glk4/igt@kms_flip@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-glk3/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible@c-edp1:
- shard-skl: [FAIL][59] ([i915#2122]) -> [PASS][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl10/igt@kms_flip@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl6/igt@kms_flip@[email protected]

* igt@kms_hdr@bpc-switch-suspend:
- shard-skl: [FAIL][61] ([i915#1188]) -> [PASS][62]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl4/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl9/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: [FAIL][63] ([fdo#108145] / [i915#265]) -> [PASS][64] +1 similar issue
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl7/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl7/igt@[email protected]

* igt@kms_plane_scaling@pipe-b-scaler-with-pixel-format:
- shard-skl: [DMESG-WARN][65] ([i915#1982]) -> [PASS][66] +4 similar issues
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl7/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl8/igt@[email protected]

* igt@kms_psr@psr2_cursor_render:
- shard-iclb: [SKIP][67] ([fdo#109441]) -> [PASS][68] +2 similar issues
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-iclb7/igt@kms_psr@psr2_cursor_render.html
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-iclb2/igt@kms_psr@psr2_cursor_render.html

* igt@kms_setmode@basic:
- shard-apl: [FAIL][69] ([i915#1635] / [i915#31]) -> [PASS][70]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-apl1/igt@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-apl6/igt@[email protected]

#### Warnings ####

* igt@kms_flip@flip-vs-suspend-interruptible@a-edp1:
- shard-skl: [DMESG-WARN][71] ([i915#1982]) -> [INCOMPLETE][72] ([i915#198] / [i915#1982])
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-skl7/igt@kms_flip@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-skl7/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-suspend:
- shard-tglb: [DMESG-WARN][73] ([i915#1982] / [i915#2411]) -> [DMESG-WARN][74] ([i915#2411])
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9186/shard-tglb3/igt@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18767/shard-tglb6/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[i915#1119]: https://gitlab.freedesktop.org/drm/intel/issues/1119
[i915#118]: https://gitlab.freedesktop.org/drm/intel/issues/118
[i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
[i915#155]: https://gitlab.freedesktop.org/drm/intel/issues/155
[i915#1635]: https://gitlab.freedesktop.org/drm/intel/issues/1635
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#198]: https://gitlab.freedesktop.org/drm/intel/issues/198
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2370]: https://gitlab.freedesktop.org/drm/intel/issues/2370
[i915#2389]: https://gitlab.freedesktop.org/drm/intel/issues/2389
[i915#2411]: https://gitlab.freedesktop.org/drm/intel/issues/2411
[i915#2424]: https://gitlab.freedesktop.org/drm/intel/issues/2424
[i915#2521]: https://gitlab.freedesktop.org/drm/intel/issues/2521
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#31]: https://gitlab.freedesktop.org/drm/intel/issues/31
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#82]: https://gitlab.freedesktop.org/drm/intel/issues/82
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

Participating hosts (11 -> 11)
------------------------------

No changes in participating hosts

Build changes
-------------

* Linux: CI_DRM_9186 -> Patchwork_18767

CI-20190529: 20190529
CI_DRM_9186: 88e88abb49e9b08d25ba928cc34ed09082f209b0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5822: b4bcf05cb9839037128905deda7146434155cc41 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_18767: af56b064d8e01c158fb67bbc7f7475f4cb6a5ba7 @ 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_18767/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Tested-by on v1 1/1
#3 lore raw
In reply to Ville Syrjala
Quoted 9 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

The new >8k CEA modes have dotclocks reaching 5.94 GHz, which means our clock*1000 will now overflow the 32bit unsigned integer. Switch to 64bit maths to avoid it.

This cures the problem that I reported. Thanks.

Quoted 41 lines

---
An interesting question how many other place might suffer from similar overflows. I think i915 should be mostly OK. The one place I know we use Hz instead kHz is the hsw DPLL code, which I would prefer we also change to use kHz. The other concern is whether we have any potential overflows before we check this against the platform's max dotclock.

I do have this unreviewed igt series
https://patchwork.freedesktop.org/series/69531/ which extends the current testing with some other forms of invalid modes. Could probably extend that with a mode.clock=INT_MAX test to see if anything else might trip up.

No idea about other drivers.

 drivers/gpu/drm/drm_modes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +2 -2
index 501b4fe55a3d..511cde5c7fa6 100644
@@ -762,7 +762,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
 	if (mode->htotal == 0 || mode->vtotal == 0)
 		return 0;
 
-	num = mode->clock * 1000;
+	num = mode->clock;
 	den = mode->htotal * mode->vtotal;
 
 	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
@@ -772,7 +772,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
 	if (mode->vscan > 1)
 		den *= mode->vscan;
 
-	return DIV_ROUND_CLOSEST(num, den);
+	return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den);
 }
 EXPORT_SYMBOL(drm_mode_vrefresh);
 
Signature · 5 lines
~Randy
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
In reply to Ville Syrjala

Quoting Ville Syrjala (2020-10-22 20:42:56)

Quoted 32 lines

From: Ville Syrjälä <[email protected]>

The new >8k CEA modes have dotclocks reaching 5.94 GHz, which means our clock*1000 will now overflow the 32bit unsigned integer. Switch to 64bit maths to avoid it.

---
An interesting question how many other place might suffer from similar overflows. I think i915 should be mostly OK. The one place I know we use Hz instead kHz is the hsw DPLL code, which I would prefer we also change to use kHz. The other concern is whether we have any potential overflows before we check this against the platform's max dotclock.

I do have this unreviewed igt series
https://patchwork.freedesktop.org/series/69531/ which extends the current testing with some other forms of invalid modes. Could probably extend that with a mode.clock=INT_MAX test to see if anything else might trip up.

No idea about other drivers.

 drivers/gpu/drm/drm_modes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +0 -0
index 501b4fe55a3d..511cde5c7fa6 100644

drivers/gpu/drm/drm_modes.c int drm_mode_vrefresh(const struct drm_display_mode *mode) · line 766

Quoted 6 lines
drivers/gpu/drm/drm_modes.c +1 -1
@@ -762,7 +762,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
        if (mode->htotal == 0 || mode->vtotal == 0)
                return 0;
 
-       num = mode->clock * 1000;
+       num = mode->clock;
        den = mode->htotal * mode->vtotal;

You don't want to promote den to u64 while you are here? We are at 8kx4k, throw in dblscan and some vscan, and we could soon have wacky refresh rates.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 36 lines · Chris Wilson

Quoting Ville Syrjala (2020-10-22 20:42:56)

Quoted 35 lines

From: Ville Syrjälä <[email protected]>

The new >8k CEA modes have dotclocks reaching 5.94 GHz, which means our clock*1000 will now overflow the 32bit unsigned integer. Switch to 64bit maths to avoid it.

---
An interesting question how many other place might suffer from similar overflows. I think i915 should be mostly OK. The one place I know we use Hz instead kHz is the hsw DPLL code, which I would prefer we also change to use kHz. The other concern is whether we have any potential overflows before we check this against the platform's max dotclock.

I do have this unreviewed igt series
https://patchwork.freedesktop.org/series/69531/ which extends the current testing with some other forms of invalid modes. Could probably extend that with a mode.clock=INT_MAX test to see if anything else might trip up.

No idea about other drivers.

 drivers/gpu/drm/drm_modes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +0 -0
index 501b4fe55a3d..511cde5c7fa6 100644
@@ -762,7 +762,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
        if (mode->htotal == 0 || mode->vtotal == 0)
                return 0;
 
Quoted 7 lines

drivers/gpu/drm/drm_modes.c int drm_mode_vrefresh(const struct drm_display_mode *mode) · line 766

Quoted 3 lines
drivers/gpu/drm/drm_modes.c +1 -1
-       num = mode->clock * 1000;
+       num = mode->clock;
        den = mode->htotal * mode->vtotal;

You don't want to promote den to u64 while you are here? We are at 8kx4k, throw in dblscan and some vscan, and we could soon have wacky refresh rates.

i915 has 16kx8k hard limit currently, and we reject vscan>1 (wish we could also reject DBLSCAN). So we should not hit that, at least not yet. Other drivers might not be so strict I guess.

I have a nagging feeling that other places are in danger of overflows if we try to push the current limits significantly. But I guess no real harm in going full 64bit here, except maybe making it a bit slower.

Signature · 2 lines
Ville Syrjälä
Intel
Reviewed-by
#6 lore raw

Quoting Ville Syrjälä (2020-10-30 14:43:46)

Quoted 50 lines · Chris Wilson
Quoted 36 lines

Quoting Ville Syrjala (2020-10-22 20:42:56)

Quoted 35 lines

From: Ville Syrjälä <[email protected]>

The new >8k CEA modes have dotclocks reaching 5.94 GHz, which means our clock*1000 will now overflow the 32bit unsigned integer. Switch to 64bit maths to avoid it.

---
An interesting question how many other place might suffer from similar overflows. I think i915 should be mostly OK. The one place I know we use Hz instead kHz is the hsw DPLL code, which I would prefer we also change to use kHz. The other concern is whether we have any potential overflows before we check this against the platform's max dotclock.

I do have this unreviewed igt series
https://patchwork.freedesktop.org/series/69531/ which extends the current testing with some other forms of invalid modes. Could probably extend that with a mode.clock=INT_MAX test to see if anything else might trip up.

No idea about other drivers.

 drivers/gpu/drm/drm_modes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +0 -0
index 501b4fe55a3d..511cde5c7fa6 100644
@@ -762,7 +762,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
        if (mode->htotal == 0 || mode->vtotal == 0)
                return 0;
 
Quoted 7 lines

drivers/gpu/drm/drm_modes.c int drm_mode_vrefresh(const struct drm_display_mode *mode) · line 766

Quoted 3 lines
drivers/gpu/drm/drm_modes.c +1 -1
-       num = mode->clock * 1000;
+       num = mode->clock;
        den = mode->htotal * mode->vtotal;

You don't want to promote den to u64 while you are here? We are at 8kx4k, throw in dblscan and some vscan, and we could soon have wacky refresh rates.

i915 has 16kx8k hard limit currently, and we reject vscan>1 (wish we could also reject DBLSCAN). So we should not hit that, at least not yet. Other drivers might not be so strict I guess.

Quoted 4 lines

I have a nagging feeling that other places are in danger of overflows if we try to push the current limits significantly. But I guess no real harm in going full 64bit here, except maybe making it a bit slower.

-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel