drm/i915/pmu: Stop averaging with the previous sample
Subsystems (2)
Tvrtko Ursulin
maintainerPATCH 1/1 drm/i915/pmu: Stop averaging with the previous sample
From: Tvrtko Ursulin <[email protected]>
Averaging with the previous sample brings a small statistical improvement to sampling counters, but can leek a little bit of state from a current client to the next which mulls the border between past and present for observing clients.
This is because on event enable clients record the current counter value and use it as reference, but with rapid off-on event cycles, and due the delayed nature of sampling timer self-disarm, previous sample value does not get cleared under these circumstances.
Solution is to stop averaging with the previous sample. This has a small downside of losing some precision with short and spiky signals, but the alternatives look too complicated for the benefit.
--- drivers/gpu/drm/i915/i915_pmu.c | 29 ++--------------------------- drivers/gpu/drm/i915/i915_pmu.h | 1 - 2 files changed, 2 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +2 -27
@@ -181,12 +181,7 @@ static bool grab_forcewake(struct drm_i915_private *i915, bool fw)static void update_sample (struct i915_pmu_sample *sample,u32 unit,u32 val) { -/* -* Since we are doing stochastic sampling for these counters, -* average the delta with the previous value for better accuracy. -*/ - sample->cur +=div_u64 (mul_u32_u32 (sample->prev + val, unit),2 ); - sample->prev = val; + sample->cur +=mul_u32_u32 (val, unit); }static void engines_sample (struct drm_i915_private *dev_priv)
@@ -262,31 +257,13 @@ static void frequency_sample(struct drm_i915_private *dev_priv) } } -static void pmu_init_previous_samples (struct drm_i915_private *i915) -{ -struct intel_engine_cs *engine; -enum intel_engine_id id; -unsigned int i; - -for_each_engine (engine, i915, id) { -for (i =0 ; i <ARRAY_SIZE (engine->pmu.sample); i++) - engine->pmu.sample[i].prev =0 ; - } - -for (i =0 ; i <ARRAY_SIZE (i915->pmu.sample); i++) - i915->pmu.sample[i].prev = i915->gt_pm.rps.idle_freq; -} -static enum hrtimer_restart i915_sample (struct hrtimer *hrtimer) {struct drm_i915_private *i915 = container_of(hrtimer, struct drm_i915_private, pmu.timer); -if (!READ_ONCE (i915->pmu.timer_enabled)) { -pmu_init_previous_samples (i915); - +if (!READ_ONCE (i915->pmu.timer_enabled))return HRTIMER_NORESTART ; - }engines_sample (i915);frequency_sample (i915);
@@ -867,8 +844,6 @@ void i915_pmu_register(struct drm_i915_private *i915)hrtimer_init (&i915->pmu.timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); i915->pmu.timer.function = i915_sample; -pmu_init_previous_samples (i915); -for_each_engine (engine, i915, id)INIT_DELAYED_WORK (&engine->pmu.disable_busy_stats, __disable_busy_stats);
drivers/gpu/drm/i915/i915_pmu.h +0 -1
@@ -41,7 +41,6 @@ enum {struct i915_pmu_sample {u64 cur; -u32 prev; };struct i915_pmu {
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/pmu: Stop averaging with the previous sample
== Series Details ==
== Series Details ==
Series: drm/i915/pmu: Stop averaging with the previous sample
URL : https://patchwork.freedesktop.org/series/34346/
State : success
== Summary ==
Series 34346v1 drm/i915/pmu: Stop averaging with the previous sample
https://patchwork.freedesktop.org/api/1.0/series/34346/revisions/1/mbox/
Test gem_busy:
Subgroup basic-hang-default:
incomplete -> PASS (fi-cfl-s2)
Test gem_exec_reloc:
Subgroup basic-gtt-cpu-active:
fail -> PASS (fi-gdg-551) fdo#102582 +2fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:443s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:464s 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:537s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:278s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:508s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:513s 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:492s fi-cfl-s2 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:612s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:432s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:269s 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:428s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:442s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:428s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:471s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:468s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:489s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:527s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:476s 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:578s 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:545s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:566s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:518s 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:459s 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:431s
a5d8a220645ed25df2088568070cfdfb1bbf59c4 drm-tip: 2017y-11m-24d-09h-54m-57s UTC integration manifest bc84de5a37ce drm/i915/pmu: Stop averaging with the previous sample
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7275/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Tvrtko Ursulin (2017-11-24 09:49:59)
Quoted 12 lines
From: Tvrtko Ursulin <[email protected]>
Averaging with the previous sample brings a small statistical improvement to sampling counters, but can leek a little bit of state from a current client to the next which mulls the border between past and present for observing clients.
This is because on event enable clients record the current counter value and use it as reference, but with rapid off-on event cycles, and due the delayed nature of sampling timer self-disarm, previous sample value does not get cleared under these circumstances.
Quoted 7 lines
Solution is to stop averaging with the previous sample. This has a small downside of losing some precision with short and spiky signals, but the alternatives look too complicated for the benefit.
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Sagar Arun Kamble <[email protected]>
Nothing wrong with the patch, and I agree that chasing that little bit of smoothness is not worth the complexity in the edge cases. Oh well.
(Until such a time as we have a clean way of being perfect, good enough.)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson
Tested-byQuoting Chris Wilson (2017-11-24 10:42:15)
Quoted 17 lines
Quoting Tvrtko Ursulin (2017-11-24 09:49:59)
Quoted 16 lines
From: Tvrtko Ursulin <[email protected]>
Averaging with the previous sample brings a small statistical improvement to sampling counters, but can leek a little bit of state from a current client to the next which mulls the border between past and present for observing clients.
This is because on event enable clients record the current counter value and use it as reference, but with rapid off-on event cycles, and due the delayed nature of sampling timer self-disarm, previous sample value does not get cleared under these circumstances.
Solution is to stop averaging with the previous sample. This has a small downside of losing some precision with short and spiky signals, but the alternatives look too complicated for the benefit.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Tvrtko Ursulin <[email protected]>Cc Chris Wilson <[email protected]>Cc Sagar Arun Kamble <[email protected]>Nothing wrong with the patch, and I agree that chasing that little bit of smoothness is not worth the complexity in the edge cases. Oh well.
Reviewed-by Chris Wilson <[email protected]>
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for drm/i915/pmu: Stop averaging with the previous sample
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: drm/i915/pmu: Stop averaging with the previous sample
URL : https://patchwork.freedesktop.org/series/34346/
State : warning
== Summary ==
Test drv_module_reload:
Subgroup basic-no-display:
dmesg-warn -> PASS (shard-snb) fdo#102707 +1
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
fail -> PASS (shard-snb) fdo#101623
Subgroup fbc-tilingchange:
pass -> SKIP (shard-hsw)
Test kms_flip:
Subgroup flip-vs-absolute-wf_vblank-interruptible:
fail -> PASS (shard-hsw) fdo#100368
Test gem_busy:
Subgroup close-race:
pass -> FAIL (shard-snb) fdo#103829
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-hsw) fdo#99912fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103829 https://bugs.freedesktop.org/show_bug.cgi?id=103829
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
shard-hsw total:2667 pass:1534 dwarn:1 dfail:0 fail:10 skip:1122 time:9512s shard-snb total:2667 pass:1312 dwarn:1 dfail:0 fail:13 skip:1341 time:8119s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7275/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✓ Fi.CI.BAT: success for drm/i915/pmu: Stop averaging with the previous sample
In reply to PatchworkQuoted 52 lines · Patchwork
== Series Details ==
Series: drm/i915/pmu: Stop averaging with the previous sample
URL : https://patchwork.freedesktop.org/series/34346/
State : success== Summary ==
Series 34346v1 drm/i915/pmu: Stop averaging with the previous sample
https://patchwork.freedesktop.org/api/1.0/series/34346/revisions/1/mbox/Test
gem_busy:Subgroup basic-hang-default: incomplete -> PASS (fi-cfl-s2) Test gem_exec_reloc: Subgroup basic-gtt-cpu-active: fail -> PASS (fi-gdg-551) fdo#102582 +2fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:443s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:464s 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:537s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:278s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:508s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:513s 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:492s fi-cfl-s2 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:612s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:432s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:269s 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:428s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:442s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:428s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:471s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:468s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:489s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:527s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:476s 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:578s 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:545s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:566s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:518s 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:459s 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:431s
Quoted 2 lines
a5d8a220645ed25df2088568070cfdfb1bbf59c4drm-tip: 2017y-11m-24d-09h-54m-57s UTC integration manifestbc84de5a37cedrm/i915/pmu: Stop averaging with the previous sample
Pushed after seeing that shards were also happy.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx