drm/i915/selftests: Delay spinner before waiting for an interrupt
Subsystems (2)
PATCH 1/5 drm/i915/selftests: Delay spinner before waiting for an interrupt
It seems that although (perhaps because of the memory stall?) the spinner has signaled that it has started, it still takes some time to spin up to 100% utilisation of the HW. Since the test depends on the full utilisation of the HW to trigger the RPS interrupt, wait a little bit and flush the interrupt status to be sure that the event we see if from the spinner.
--- drivers/gpu/drm/i915/gt/selftest_rps.c | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/gt/selftest_rps.c +16 -12
@@ -14,6 +14,20 @@ static void dummy_rps_work(struct work_struct *wrk) { } +static void sleep_for_ei (struct intel_rps *rps,int timeout_us) +{ +/* Flush any previous EI */ +usleep_range (timeout_us,2 * timeout_us); + +/* Reset the interrupt status */ +rps_disable_interrupts (rps); +GEM_BUG_ON (rps->pm_iir); +rps_enable_interrupts (rps); + +/* And then wait for the timeout, for real this time */ +usleep_range (2 * timeout_us,3 * timeout_us); +} +static int __rps_up_interrupt (struct intel_rps *rps,struct intel_engine_cs *engine,struct igt_spinner *spin)
@@ -28,7 +42,6 @@ static int __rps_up_interrupt(struct intel_rps *rps,intel_gt_pm_wait_for_idle (engine->gt);GEM_BUG_ON (rps->active); - rps->pm_iir =0 ; rps->cur_freq = rps->min_freq; rq =igt_spinner_create_request (spin, engine->kernel_context,MI_NOOP );
@@ -71,7 +84,7 @@ static int __rps_up_interrupt(struct intel_rps *rps, timeout =intel_uncore_read (uncore,GEN6_RP_UP_EI ); timeout =GT_PM_INTERVAL_TO_US (engine->i915, timeout); -usleep_range (2 * timeout,3 * timeout); +sleep_for_ei (rps, timeout);GEM_BUG_ON (i915_request_completed (rq));igt_spinner_end (spin);
@@ -122,16 +135,7 @@ static int __rps_down_interrupt(struct intel_rps *rps, timeout =intel_uncore_read (uncore,GEN6_RP_DOWN_EI ); timeout =GT_PM_INTERVAL_TO_US (engine->i915, timeout); -/* Flush any previous EI */ -usleep_range (timeout,2 * timeout); - -/* Reset the interrupt status */ -rps_disable_interrupts (rps); -GEM_BUG_ON (rps->pm_iir); -rps_enable_interrupts (rps); - -/* And then wait for the timeout, for real this time */ -usleep_range (2 * timeout,3 * timeout); +sleep_for_ei (rps, timeout);if (rps->cur_freq != rps->max_freq) { pr_err("%s: Frequency unexpectedly changed [down], now %d!\n",
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915/selftests: Move gpu energy measurement into its own little lib
Move the handy utility to measure the GPU energy consumption using RAPL msr into a common lib so that it can be reused easily.
--- drivers/gpu/drm/i915/Makefile | 3 ++- drivers/gpu/drm/i915/gt/selftest_rc6.c | 25 +++++------------------- drivers/gpu/drm/i915/selftests/librapl.c | 24 +++++++++++++++++++++++ drivers/gpu/drm/i915/selftests/librapl.h | 13 ++++++++++++ 4 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 drivers/gpu/drm/i915/selftests/librapl.c create mode 100644 drivers/gpu/drm/i915/selftests/librapl.h
drivers/gpu/drm/i915/Makefile +2 -1
@@ -257,7 +257,8 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \ selftests/igt_live_test.o \ selftests/igt_mmap.o \ selftests/igt_reset.o \ - selftests/igt_spinner.o + selftests/igt_spinner.o \ + selftests/librapl.o # virtual gpu code i915-y += i915_vgpu.o
drivers/gpu/drm/i915/gt/selftest_rc6.c +5 -20
@@ -11,22 +11,7 @@#include "selftest_rc6.h" #include "selftests/i915_random.h" - -static u64 energy_uJ (struct intel_rc6 *rc6) -{ -unsigned long long power; -u32 units; - -if (rdmsrl_safe (MSR_RAPL_POWER_UNIT , &power)) -return 0 ; - - units = (power &0x1f00 ) >>8 ; - -if (rdmsrl_safe (MSR_PP1_ENERGY_STATUS , &power)) -return 0 ; - -return (1000000 * power) >> units;/* convert to uJ */ -} +#include "selftests/librapl.h" static u64 rc6_residency (struct intel_rc6 *rc6) {
@@ -74,9 +59,9 @@ int live_rc6_manual(void *arg) res[0 ] =rc6_residency (rc6); dt =ktime_get (); - rc0_power =energy_uJ (rc6); + rc0_power =librapl_energy_uJ ();msleep (250 ); - rc0_power =energy_uJ (rc6) - rc0_power; + rc0_power =librapl_energy_uJ () - rc0_power; dt =ktime_sub (ktime_get (), dt); res[1 ] =rc6_residency (rc6);if ((res[1 ] - res[0 ]) >>10 ) {
@@ -99,9 +84,9 @@ int live_rc6_manual(void *arg) res[0 ] =rc6_residency (rc6);intel_uncore_forcewake_flush (rc6_to_uncore (rc6),FORCEWAKE_ALL ); dt =ktime_get (); - rc6_power =energy_uJ (rc6); + rc6_power =librapl_energy_uJ ();msleep (100 ); - rc6_power =energy_uJ (rc6) - rc6_power; + rc6_power =librapl_energy_uJ () - rc6_power; dt =ktime_sub (ktime_get (), dt); res[1 ] =rc6_residency (rc6);if (res[1 ] == res[0 ]) {
drivers/gpu/drm/i915/selftests/librapl.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2020 Intel Corporation +*/ + +#include <asm/msr.h> + +#include "librapl.h" + +u64 librapl_energy_uJ (void ) +{ +unsigned long long power; +u32 units; + +if (rdmsrl_safe (MSR_RAPL_POWER_UNIT , &power)) +return 0 ; + + units = (power &0x1f00 ) >>8 ; + +if (rdmsrl_safe (MSR_PP1_ENERGY_STATUS , &power)) +return 0 ; + +return (1000000 * power) >> units;/* convert to uJ */ +}
drivers/gpu/drm/i915/selftests/librapl.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2020 Intel Corporation +*/ + +#ifndef SELFTEST_LIBRAPL_H +#define SELFTEST_LIBRAPL_H + +#include <linux/types.h> + +u64 librapl_energy_uJ (void ); + +#endif /* SELFTEST_LIBRAPL_H */
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915/selftests: Check power consumption at min/max frequencies
In reply to Chris WilsonA basic premise of RPS is that at lower frequencies, not only do we run slower, but we save power compared to higher frequencies. For example, when idle, we set the minimum frequency just in case there is some residual current. Since the power curve should be a physical relationship, if we find no power saving it's likely that we've broken our frequency handling, so test!
--- drivers/gpu/drm/i915/gt/selftest_gt_pm.c | 1 + drivers/gpu/drm/i915/gt/selftest_rps.c | 138 +++++++++++++++++++++++ drivers/gpu/drm/i915/gt/selftest_rps.h | 1 + 3 files changed, 140 insertions(+)
drivers/gpu/drm/i915/gt/selftest_gt_pm.c +1 -0
@@ -54,6 +54,7 @@ int intel_gt_pm_live_selftests(struct drm_i915_private *i915)static const struct i915_subtest tests[] = {SUBTEST (live_rc6_manual),SUBTEST (live_rps_interrupt), +SUBTEST (live_rps_power),SUBTEST (live_gt_resume), };
drivers/gpu/drm/i915/gt/selftest_rps.c +138 -0
153 lines not on this page · raw message
drivers/gpu/drm/i915/gt/selftest_rps.h +1 -0
@@ -7,5 +7,6 @@#define SELFTEST_RPS_H int live_rps_interrupt (void *arg); +int live_rps_power (void *arg);#endif /* SELFTEST_RPS_H */
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: Relinquish forcewake immediately after manual grouping
In reply to Chris WilsonOur forcewake utilisation is split into categories: automatic and manual. Around bare register reads, we look up the right forcewake domain and automatically acquire and release [upon a timer] the forcewake domain. For other access, where we know we require the forcewake across a group of register reads, we manually acquire the forcewake domain and release it at the end. Again, this currently arms the domain timer for a later release.
However, looking at some energy utilisation profiles, we have tried to avoid using forcewake [and rely on the natural wake up to post register updates] due to that even keep the fw active for a brief period contributes to a significant power draw [i.e. when the gpu is sleeping with rc6 at high clocks]. But as it turns out, not posting the writes immediately also has unintended consequences, such as not reducing the clocks and so conserving power while busy.
As a compromise, let us only arm the domain timer for automatic forcewake usage around bare register access, but immediately release the forcewake when manually acquired by intel_uncore_forcewake_get/_put.
The corollary to this is that we may instead have to take forcewake more often, and so incur a latency penalty in doing so. For Sandybridge this was significant, and even on the latest machines, taking forcewake at interrupt frequency is a huge impact. [So we don't do that anymore! Hopefully, this will spare us from still needing the mitigation of the timer for steady state execution.]
--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -709,7 +709,7 @@ static void __intel_uncore_forcewake_put(struct intel_uncore *uncore,continue ; } -fw_domain_arm_timer (domain); + uncore->funcs.force_wake_put (uncore, domain->mask); } }
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 drm/i915/gt: Always take fw around RPS frequency changes
In reply to Chris WilsonIn the selftest, we are observing that requests to change frequency are simply not occuring [within a 20ms period]. The assumption was that with an active GPU, these writes would be flush naturally; this appears to be false.
--- drivers/gpu/drm/i915/gt/intel_rps.c | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/gt/intel_rps.c +16 -17
@@ -698,18 +698,32 @@ static int rps_set(struct intel_rps *rps, u8 val, bool update)if (val == rps->last_freq)return 0 ; +/* +* The punit delays the write of the frequency and voltage until it +* determines the GPU is awake. During normal usage we don't want to +* waste power changing the frequency if the GPU is sleeping (rc6). +* However, the GPU and driver is now idle and we do not want to delay +* switching to minimum voltage (reducing power whilst idle) as we do +* not expect to be woken in the near future and so must flush the +* change by waking the device. +*/ +intel_uncore_forcewake_get (rps_to_uncore (rps),FORCEWAKE_ALL ); +if (IS_VALLEYVIEW (i915) ||IS_CHERRYVIEW (i915)) err =vlv_rps_set (rps, val);else err =gen6_rps_set (rps, val);if (err) -return err; + goto out_fw;if (update)gen6_rps_set_thresholds (rps, val); + rps->last_freq = val; -return 0 ; +out_fw: +intel_uncore_forcewake_put (rps_to_uncore (rps),FORCEWAKE_ALL ); +return err; }void intel_rps_unpark (struct intel_rps *rps)
@@ -755,22 +769,7 @@ void intel_rps_park(struct intel_rps *rps)if (rps->last_freq <= rps->idle_freq)return ; -/* -* The punit delays the write of the frequency and voltage until it -* determines the GPU is awake. During normal usage we don't want to -* waste power changing the frequency if the GPU is sleeping (rc6). -* However, the GPU and driver is now idle and we do not want to delay -* switching to minimum voltage (reducing power whilst idle) as we do -* not expect to be woken in the near future and so must flush the -* change by waking the device. -* -* We choose to take the media powerwell (either would do to trick the -* punit into committing the voltage change) as that takes a lot less -* power than the render powerwell. -*/ -intel_uncore_forcewake_get (rps_to_uncore (rps),FORCEWAKE_MEDIA );rps_set (rps, rps->idle_freq, false); -intel_uncore_forcewake_put (rps_to_uncore (rps),FORCEWAKE_MEDIA );/* * Since we will try and restart from the previously requested
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm/i915/selftests: Delay spinner before waiting for an interrupt
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/5] drm/i915/selftests: Delay spinner before waiting for an interrupt
URL : https://patchwork.freedesktop.org/series/76075/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip be52c781157e drm/i915/selftests: Delay spinner before waiting for an interrupt 0766aab64e4d drm/i915/selftests: Move gpu energy measurement into its own little lib -:79: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #79: new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 91 lines checked 83822ea52d10 drm/i915/selftests: Check power consumption at min/max frequencies 1608aacdcf9a drm/i915: Relinquish forcewake immediately after manual grouping 704dc9ea4ed2 drm/i915/gt: Always take fw around RPS frequency changes -:7: WARNING:TYPO_SPELLING: 'occuring' may be misspelled - perhaps 'occurring'? #7:
simply not occuring [within a 20ms period]. The assumption was that with
total: 0 errors, 1 warnings, 0 checks, 56 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.DOCS: warning for series starting with [1/5] drm/i915/selftests: Delay spinner before waiting for an interrupt
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/5] drm/i915/selftests: Delay spinner before waiting for an interrupt
URL : https://patchwork.freedesktop.org/series/76075/
State : warning
== Summary ==
$ make htmldocs 2>&1 > /dev/null | grep i915 /home/cidrm/kernel/Documentation/gpu/i915.rst:610: WARNING: duplicate label gpu/i915:layout, other instance in /home/cidrm/kernel/Documentation/gpu/i915.rst
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/5] drm/i915/selftests: Delay spinner before waiting for an interrupt
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/5] drm/i915/selftests: Delay spinner before waiting for an interrupt
URL : https://patchwork.freedesktop.org/series/76075/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_8315 -> Patchwork_17341
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_17341 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_17341, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17341/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_17341:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8315/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17341/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
Known issues
------------
Here are the changes found in Patchwork_17341 that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@i915_pm_rpm@module-reload:
- fi-skl-6770hq: [FAIL][3] ([i915#178]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8315/fi-skl-6770hq/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17341/fi-skl-6770hq/igt@[email protected]
* igt@i915_selftest@live@requests:
- fi-icl-guc: [INCOMPLETE][5] ([i915#1581]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8315/fi-icl-guc/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17341/fi-icl-guc/igt@i915_selftest@[email protected]
#### Warnings ####
* igt@i915_pm_rpm@module-reload:
- fi-kbl-x1275: [SKIP][7] ([fdo#109271]) -> [FAIL][8] ([i915#62])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8315/fi-kbl-x1275/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17341/fi-kbl-x1275/igt@[email protected]
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1581]: https://gitlab.freedesktop.org/drm/intel/issues/1581
[i915#178]: https://gitlab.freedesktop.org/drm/intel/issues/178
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
Participating hosts (51 -> 46)
------------------------------
Additional (1): fi-kbl-7560u
Missing (6): fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_8315 -> Patchwork_17341
CI-20190529: 20190529
CI_DRM_8315: cf2c3255ec72dfcb37385181a362cbf8e6cfdd15 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5599: cdb07101dda33e2fcb0f4c2aa199c47159d88f35 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17341: 704dc9ea4ed2c089f637b27e7067e154adbe2db8 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
704dc9ea4ed2 drm/i915/gt: Always take fw around RPS frequency changes 1608aacdcf9a drm/i915: Relinquish forcewake immediately after manual grouping 83822ea52d10 drm/i915/selftests: Check power consumption at min/max frequencies 0766aab64e4d drm/i915/selftests: Move gpu energy measurement into its own little lib be52c781157e drm/i915/selftests: Delay spinner before waiting for an interrupt
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17341/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx