i915/guc: Get runtime pm in busyness worker only if already active
Subsystems (2)
PATCH 1/1 i915/guc: Get runtime pm in busyness worker only if already active
Ideally the busyness worker should take a gt pm wakeref because the worker only needs to be active while gt is awake. However, the gt_park path cancels the worker synchronously and this complicates the flow if the worker is also running at the same time. The cancel waits for the worker and when the worker releases the wakeref, that would call gt_park and would lead to a deadlock.
The resolution is to take the global pm wakeref if runtime pm is already active. If not, we don't need to update the busyness stats as the stats would already be updated when the gt was parked.
Note:
- We do not requeue the worker if we cannot take a reference to runtime pm since intel_guc_busyness_unpark would requeue the worker in the resume path.
- If the gt was parked longer than time taken for GT timestamp to roll over, we ignore those rollovers since we don't care about tracking the exact GT time. We only care about roll overs when the gt is active and running workloads.
- There is a window of time between gt_park and runtime suspend, where the worker may run. This is acceptable since the worker will not find any new data to update busyness.
v2: (Daniele)
- Edit commit message and code comment
- Use runtime pm in the worker
- Put runtime pm after enabling the worker
- Use Link tag and add Fixes tag
v3: (Daniele)
- Reword commit and comments and add details
--- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +35 -3
@@ -1432,6 +1432,36 @@ static void guc_timestamp_ping(struct work_struct *wrk)unsigned long index;int srcu, ret; +/* +* Ideally the busyness worker should take a gt pm wakeref because the +* worker only needs to be active while gt is awake. However, the +* gt_park path cancels the worker synchronously and this complicates +* the flow if the worker is also running at the same time. The cancel +* waits for the worker and when the worker releases the wakeref, that +* would call gt_park and would lead to a deadlock. +* +* The resolution is to take the global pm wakeref if runtime pm is +* already active. If not, we don't need to update the busyness stats as +* the stats would already be updated when the gt was parked. +* +* Note: +* - We do not requeue the worker if we cannot take a reference to runtime +* pm since intel_guc_busyness_unpark would requeue the worker in the +* resume path. +* +* - If the gt was parked longer than time taken for GT timestamp to roll +* over, we ignore those rollovers since we don't care about tracking +* the exact GT time. We only care about roll overs when the gt is +* active and running workloads. +* +* - There is a window of time between gt_park and runtime suspend, +* where the worker may run. This is acceptable since the worker will +* not find any new data to update busyness. +*/ + wakeref =intel_runtime_pm_get_if_active (>->i915->runtime_pm); +if (!wakeref) +return ; +/* * Synchronize with gt reset to make sure the worker does not * corrupt the engine/guc stats. NB: can't actually block waiting
@@ -1440,10 +1470,9 @@ static void guc_timestamp_ping(struct work_struct *wrk)*/ ret =intel_gt_reset_trylock (gt, &srcu);if (ret) -return ; + goto err_trylock; - with_intel_runtime_pm(>->i915->runtime_pm, wakeref) -__update_guc_busyness_stats (guc); +__update_guc_busyness_stats (guc);/* adjust context stats for overflow */ xa_for_each (&guc->context_lookup, index, ce)
@@ -1452,6 +1481,9 @@ static void guc_timestamp_ping(struct work_struct *wrk)intel_gt_reset_unlock (gt, srcu);guc_enable_busyness_worker (guc); + +err_trylock: +intel_runtime_pm_put (>->i915->runtime_pm, wakeref); }static int guc_action_enable_usage_stats (struct intel_guc *guc)
Signature · 1 line
2.38.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for i915/guc: Get runtime pm in busyness worker only if already active
== Series Details ==
== Series Details ==
Series: i915/guc: Get runtime pm in busyness worker only if already active
URL : https://patchwork.freedesktop.org/series/123744/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_13635 -> Patchwork_123744v1
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_123744v1 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_123744v1, please notify your bug team ([email protected]) 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_123744v1/index.html
Participating hosts (40 -> 40)
------------------------------
Additional (1): fi-kbl-soraka
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_123744v1:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@hangcheck:
- fi-skl-guc: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13635/fi-skl-guc/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-skl-guc/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@perf:
- fi-kbl-soraka: NOTRUN -> [ABORT][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-kbl-soraka/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in Patchwork_123744v1 that come from known issues:
### CI changes ###
#### Possible fixes ####
* boot:
- fi-hsw-4770: [FAIL][4] ([i915#8293]) -> [PASS][5]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13635/fi-hsw-4770/boot.html
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-hsw-4770/boot.html
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_suspend@basic-s0@smem:
- bat-dg2-9: [PASS][6] -> [INCOMPLETE][7] ([i915#9275])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13635/bat-dg2-9/igt@gem_exec_suspend@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/bat-dg2-9/igt@gem_exec_suspend@[email protected]
* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][8] ([fdo#109271] / [i915#2190])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-kbl-soraka/igt@[email protected]
* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#4613]) +3 other tests skip
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-kbl-soraka/igt@[email protected]
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][10] ([i915#1886] / [i915#7913])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- fi-hsw-4770: NOTRUN -> [SKIP][11] ([fdo#109271]) +13 other tests skip
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-hsw-4770/igt@[email protected]
* igt@kms_dsc@dsc-basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][12] ([fdo#109271]) +9 other tests skip
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-kbl-soraka/igt@[email protected]
* igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-vga-1:
- fi-hsw-4770: NOTRUN -> [DMESG-WARN][13] ([i915#8841]) +6 other tests dmesg-warn
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-hsw-4770/igt@kms_pipe_crc_basic@[email protected]
* igt@kms_psr@sprite_plane_onoff:
- fi-hsw-4770: NOTRUN -> [SKIP][14] ([fdo#109271] / [i915#1072]) +3 other tests skip
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/fi-hsw-4770/igt@kms_psr@sprite_plane_onoff.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7952]: https://gitlab.freedesktop.org/drm/intel/issues/7952
[i915#8293]: https://gitlab.freedesktop.org/drm/intel/issues/8293
[i915#8841]: https://gitlab.freedesktop.org/drm/intel/issues/8841
[i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275
Build changes
-------------
* Linux: CI_DRM_13635 -> Patchwork_123744v1
CI-20190529: 20190529
CI_DRM_13635: c6b7f865a77a75af03c3b68baa4cf7eb66c1c6d5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7488: 099e058c5dfb7a49942edf03cae88a52a77077a3 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_123744v1: c6b7f865a77a75af03c3b68baa4cf7eb66c1c6d5 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
de17cae5a00b i915/guc: Get runtime pm in busyness worker only if already active
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/index.html
Re: [Intel-gfx] ✗ Fi.CI.BAT: failure for i915/guc: Get runtime pm in busyness worker only if already active
Quoted 36 lines · Patchwork
Patch Details
Series: i915/guc: Get runtime pm in busyness worker only if already active URL: [1]https://patchwork.freedesktop.org/series/123744/ State: failure Details: [2]https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v1/index.htmlCI Bug Log - changes from CI_DRM_13635 -> Patchwork_123744v1Summary
FAILURE
Serious unknown changes coming with
Patchwork_123744v1absolutely need to be
verified manually.If you think the reported changes have nothing to do with the changes introduced in
Patchwork_123744v1, please notify your bug team ([email protected]) 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_123744v1/index.htmlParticipating hosts (40 -> 40)
Additional (1): fi-kbl-soraka
Missing (1): fi-snb-2520mPossible new issues
Here are the unknown changes that may have been introduced in
Patchwork_123744v1:
Quoted 7 lines
IGT changes
Possible regressions * igt@i915_selftest@live@hangcheck: * fi-skl-guc: [3]PASS -> [4]DMESG-FAIL
Not related to changes in this patch. Ran the test a couple times on MTL and not seeing any failures.
Quoted 4 lines
* igt@i915_selftest@live@perf:
* fi-kbl-soraka: NOTRUN -> [5]ABORTUnrelated since this does not use GuC.
Umesh
Quoted 3 lines
Known issues
Quoted 31 lines · Umesh Nerlige Ramappa
Ideally the busyness worker should take a gt pm wakeref because the worker only needs to be active while gt is awake. However, the
gt_parkpath cancels the worker synchronously and this complicates the flow if the worker is also running at the same time. The cancel waits for the worker and when the worker releases the wakeref, that would callgt_parkand would lead to a deadlock.The resolution is to take the global pm wakeref if runtime pm is already active. If not, we don't need to update the busyness stats as the stats would already be updated when the gt was parked.
Note:
- We do not requeue the worker if we cannot take a reference to runtime pm sinceintel_guc_busyness_unparkwould requeue the worker in the resume path.- If the gt was parked longer than time taken for GT timestamp to roll over, we ignore those rollovers since we don't care about tracking the exact GT time. We only care about roll overs when the gt is active and running workloads.
- There is a window of time between
gt_parkand runtime suspend, where the worker may run. This is acceptable since the worker will not find any new data to update busyness.v2: (Daniele)
- Edit commit message and code comment
- Use runtime pm in the worker
- Put runtime pm after enabling the worker
- Use Link tag and add Fixes tag
Quoted 6 lines
v3: (Daniele)
- Reword commit and comments and add detailsFixes 77cdd054dd2c ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu")Signed-off-by Umesh Nerlige Ramappa <[email protected]>
Daniele
Quoted 68 lines
--- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +35
-3@@ -1432,6 +1432,36 @@ static void guc_timestamp_ping(struct work_struct *wrk)unsigned long index;int srcu, ret; +/* +* Ideally the busyness worker should take a gt pm wakeref because the +* worker only needs to be active while gt is awake. However, the +* gt_park path cancels the worker synchronously and this complicates +* the flow if the worker is also running at the same time. The cancel +* waits for the worker and when the worker releases the wakeref, that +* would call gt_park and would lead to a deadlock. +* +* The resolution is to take the global pm wakeref if runtime pm is +* already active. If not, we don't need to update the busyness stats as +* the stats would already be updated when the gt was parked. +* +* Note: +* - We do not requeue the worker if we cannot take a reference to runtime +* pm since intel_guc_busyness_unpark would requeue the worker in the +* resume path. +* +* - If the gt was parked longer than time taken for GT timestamp to roll +* over, we ignore those rollovers since we don't care about tracking +* the exact GT time. We only care about roll overs when the gt is +* active and running workloads. +* +* - There is a window of time between gt_park and runtime suspend, +* where the worker may run. This is acceptable since the worker will +* not find any new data to update busyness. +*/ + wakeref =intel_runtime_pm_get_if_active (>->i915->runtime_pm); +if (!wakeref) +return ; +/* * Synchronize with gt reset to make sure the worker does not * corrupt the engine/guc stats. NB: can't actually block waiting @@ -1440,10 +1470,9 @@ static void guc_timestamp_ping(struct work_struct *wrk)*/ ret =intel_gt_reset_trylock (gt, &srcu);if (ret) -return ; + goto err_trylock; - with_intel_runtime_pm(>->i915->runtime_pm, wakeref) -__update_guc_busyness_stats (guc); +__update_guc_busyness_stats (guc);/* adjust context stats for overflow */ xa_for_each (&guc->context_lookup, index, ce)@@ -1452,6 +1481,9 @@ static void guc_timestamp_ping(struct work_struct *wrk)intel_gt_reset_unlock (gt, srcu);guc_enable_busyness_worker (guc); + +err_trylock: +intel_runtime_pm_put (>->i915->runtime_pm, wakeref); }static int guc_action_enable_usage_stats (struct intel_guc *guc)
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for i915/guc: Get runtime pm in busyness worker only if already active (rev2)
In reply to Umesh Nerlige Ramappa== Series Details ==
== Series Details ==
Series: i915/guc: Get runtime pm in busyness worker only if already active (rev2)
URL : https://patchwork.freedesktop.org/series/123744/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_13651 -> Patchwork_123744v2
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_123744v2 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_123744v2, please notify your bug team ([email protected]) 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_123744v2/index.html
Participating hosts (38 -> 36)
------------------------------
Additional (1): bat-rpls-2
Missing (3): bat-adlm-1 bat-dg2-9 fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_123744v2:
### IGT changes ###
#### Possible regressions ####
* igt@i915_module_load@load:
- bat-mtlp-8: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/bat-mtlp-8/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v2/bat-mtlp-8/igt@[email protected]
* igt@runner@aborted:
- bat-rpls-2: NOTRUN -> [FAIL][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v2/bat-rpls-2/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_123744v2 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@gt_lrc:
- bat-dg2-11: [PASS][4] -> [INCOMPLETE][5] ([i915#7609] / [i915#7913])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v2/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html
* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
- bat-dg2-11: NOTRUN -> [SKIP][6] ([i915#1845]) +3 other tests skip
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v2/bat-dg2-11/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live@execlists:
- fi-bsw-n3050: [ABORT][7] ([i915#7913]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/fi-bsw-n3050/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v2/fi-bsw-n3050/igt@i915_selftest@[email protected]
* igt@kms_chamelium_edid@hdmi-edid-read:
- {bat-dg2-13}: [DMESG-WARN][9] ([i915#7952]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13651/bat-dg2-13/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v2/bat-dg2-13/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#7609]: https://gitlab.freedesktop.org/drm/intel/issues/7609
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7952]: https://gitlab.freedesktop.org/drm/intel/issues/7952
Build changes
-------------
* Linux: CI_DRM_13651 -> Patchwork_123744v2
CI-20190529: 20190529
CI_DRM_13651: 61b71c3f061a44a6ab1dcf756918886aa03a5480 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7493: 2517e42d612e0c1ca096acf8b5f6177f7ef4bce7 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_123744v2: 61b71c3f061a44a6ab1dcf756918886aa03a5480 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
60cd64d08624 i915/guc: Get runtime pm in busyness worker only if already active
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123744v2/index.html