i915/pmu: Wire GuC backend to per-client busyness
Subsystems (2)
PATCH 1/1 i915/pmu: Wire GuC backend to per-client busyness
From: John Harrison <[email protected]>
GuC provides engine_id and last_switch_in ticks for an active context in the pphwsp. The context image provides a 32 bit total ticks which is the accumulated by the context (a.k.a. context[CTX_TIMESTAMP]). This information is used to calculate the context busyness as follows:
If the engine_id is valid, then busyness is the sum of accumulated total ticks and active ticks. Active ticks is calculated with current gt time as reference.
If engine_id is invalid, busyness is equal to accumulated total ticks.
Since KMD (CPU) retrieves busyness data from 2 sources - GPU and GuC, a potential race was highlighted in an earlier review that can lead to double accounting of busyness. While the solution to this is a wip, busyness is still usable for platforms running GuC submission.
v2: (Tvrtko)
- Use COPS_RUNTIME_ACTIVE_TOTAL
- Add code comment for the race
- Undo local variables initializations
--- drivers/gpu/drm/i915/gt/intel_context.c | 12 +++- drivers/gpu/drm/i915/gt/intel_context.h | 6 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 6 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 5 ++ .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 63 ++++++++++++++++++- drivers/gpu/drm/i915/i915_drm_client.c | 6 +- 6 files changed, 87 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +10 -2
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent, child->parallel.parent = parent; } -u64 intel_context_get_total_runtime_ns (const struct intel_context *ce) +u64 intel_context_get_total_runtime_ns (struct intel_context *ce) {u64 total, active; +if (ce->ops->update_stats) + ce->ops->update_stats (ce); + total = ce->stats.runtime.total;if (ce->ops->flags &COPS_RUNTIME_CYCLES ) total *= ce->engine->gt->clock_period_ns; active =READ_ONCE (ce->stats.active); -if (active) +/* +* When COPS_RUNTIME_ACTIVE_TOTAL is set for ce->cops, the backend +* already provides the total active time of the context, so skip this +* calculation when this flag is set. +*/ +if (active && !(ce->ops->flags &COPS_RUNTIME_ACTIVE_TOTAL )) active =intel_context_clock () - active;return total + active;
drivers/gpu/drm/i915/gt/intel_context.h +3 -3
@@ -56,7 +56,7 @@ static inline bool intel_context_is_parent(struct intel_context *ce)return !!ce->parallel.number_children; } -static inline bool intel_context_is_pinned (struct intel_context *ce); +static inline bool intel_context_is_pinned (const struct intel_context *ce);static inline struct intel_context *intel_context_to_parent (struct intel_context *ce)
@@ -116,7 +116,7 @@ static inline int intel_context_lock_pinned(struct intel_context *ce)* Returns: true if the context is currently pinned for use by the GPU. */ static inline bool -intel_context_is_pinned (struct intel_context *ce) +intel_context_is_pinned (const struct intel_context *ce) {return atomic_read (&ce->pin_count); }
@@ -351,7 +351,7 @@ intel_context_clear_nopreempt(struct intel_context *ce)clear_bit (CONTEXT_NOPREEMPT , &ce->flags); } -u64 intel_context_get_total_runtime_ns (const struct intel_context *ce); +u64 intel_context_get_total_runtime_ns (struct intel_context *ce);u64 intel_context_get_avg_runtime_ns (struct intel_context *ce);static inline u64 intel_context_clock (void )
drivers/gpu/drm/i915/gt/intel_context_types.h +6 -0
@@ -38,6 +38,9 @@ struct intel_context_ops {#define COPS_RUNTIME_CYCLES_BIT 1#define COPS_RUNTIME_CYCLES BIT(COPS_RUNTIME_CYCLES_BIT) +#define COPS_RUNTIME_ACTIVE_TOTAL_BIT 2 +#define COPS_RUNTIME_ACTIVE_TOTAL BIT(COPS_RUNTIME_ACTIVE_TOTAL_BIT) +int (*alloc)(struct intel_context *ce);void (*ban)(struct intel_context *ce,struct i915_request *rq);
@@ -55,6 +58,8 @@ struct intel_context_ops {void (*sched_disable)(struct intel_context *ce); +void (*update_stats)(struct intel_context *ce); +void (*reset)(struct intel_context *ce);void (*destroy)(struct kref *kref);
@@ -146,6 +151,7 @@ struct intel_context {struct ewma_runtime avg;u64 total;u32 last; +u64 start_gt_clk; I915_SELFTEST_DECLARE(u32 num_underflow); I915_SELFTEST_DECLARE(u32 max_underflow); } runtime;
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +5 -0
@@ -196,6 +196,11 @@ static inline u8 guc_class_to_engine_class(u8 guc_class)return guc_class_engine_class_map[guc_class]; } +/* Per context engine usage stats: */ +#define PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO (0x500 / sizeof(u32)) +#define PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI (PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO + 1) +#define PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID (PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI + 1) +/* Work item for submitting workloads into work queue of GuC. */ struct guc_wq_item {u32 header;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +62 -1
112 lines not on this page · raw message
drivers/gpu/drm/i915/i915_drm_client.c +1 -5
@@ -146,11 +146,7 @@ void i915_drm_client_fdinfo(struct seq_file *m, struct file *f) PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));seq_printf (m,"drm-client-id:\t%u\n" , client->id); -/* -* Temporarily skip showing client engine information with GuC submission till -* fetching engine busyness is implemented in the GuC submission backend -*/ -if (GRAPHICS_VER (i915) <8 ||intel_uc_uses_guc_submission (&i915->gt0.uc)) +if (GRAPHICS_VER (i915) <8 )return ;for (i =0 ; i <ARRAY_SIZE (uabi_class_names); i++)
Signature · 1 line
2.25.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for i915/pmu: Wire GuC backend to per-client busyness (rev2)
== Series Details ==
== Series Details ==
Series: i915/pmu: Wire GuC backend to per-client busyness (rev2)
URL : https://patchwork.freedesktop.org/series/105085/
State : warning
== Summary ==
Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for i915/pmu: Wire GuC backend to per-client busyness (rev2)
In reply to Nerlige Ramappa, Umesh== Series Details ==
== Series Details ==
Series: i915/pmu: Wire GuC backend to per-client busyness (rev2)
URL : https://patchwork.freedesktop.org/series/105085/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_11770 -> Patchwork_105085v2
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/index.html
Participating hosts (33 -> 34)
------------------------------
Additional (2): fi-kbl-soraka fi-hsw-4770
Missing (1): fi-bdw-samus
Known issues
------------
Here are the changes found in Patchwork_105085v2 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#2190])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-kbl-soraka/igt@[email protected]
* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#4613]) +3 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-kbl-soraka/igt@[email protected]
* igt@i915_pm_backlight@basic-brightness:
- fi-hsw-4770: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#3012])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-hsw-4770/igt@[email protected]
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][4] ([i915#1886])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- fi-hsw-4770: NOTRUN -> [SKIP][5] ([fdo#109271]) +9 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-hsw-4770/igt@[email protected]
* igt@kms_chamelium@dp-crc-fast:
- fi-hsw-4770: NOTRUN -> [SKIP][6] ([fdo#109271] / [fdo#111827]) +8 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-hsw-4770/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-soraka: NOTRUN -> [SKIP][7] ([fdo#109271] / [fdo#111827]) +7 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-kbl-soraka/igt@[email protected]
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-kbl-soraka: NOTRUN -> [SKIP][8] ([fdo#109271]) +9 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-kbl-soraka/igt@[email protected]
* igt@kms_flip@basic-flip-vs-wf_vblank@a-edp1:
- fi-tgl-u2: [PASS][9] -> [DMESG-WARN][10] ([i915#402])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11770/fi-tgl-u2/igt@kms_flip@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-tgl-u2/igt@kms_flip@[email protected]
* igt@kms_force_connector_basic@force-load-detect:
- fi-kbl-guc: NOTRUN -> [SKIP][11] ([fdo#109271])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-kbl-guc/igt@[email protected]
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-kbl-soraka: NOTRUN -> [SKIP][12] ([fdo#109271] / [i915#533])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-kbl-soraka/igt@[email protected]
- fi-hsw-4770: NOTRUN -> [SKIP][13] ([fdo#109271] / [i915#533])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-hsw-4770/igt@[email protected]
* igt@kms_psr@sprite_plane_onoff:
- fi-hsw-4770: NOTRUN -> [SKIP][14] ([fdo#109271] / [i915#1072]) +3 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-hsw-4770/igt@kms_psr@sprite_plane_onoff.html
#### Possible fixes ####
* igt@i915_selftest@live@hangcheck:
- {fi-ehl-2}: [INCOMPLETE][15] ([i915#5153]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11770/fi-ehl-2/igt@i915_selftest@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/fi-ehl-2/igt@i915_selftest@[email protected]
{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
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[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#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#5153]: https://gitlab.freedesktop.org/drm/intel/issues/5153
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5903]: https://gitlab.freedesktop.org/drm/intel/issues/5903
Build changes
-------------
* Linux: CI_DRM_11770 -> Patchwork_105085v2
CI-20190529: 20190529
CI_DRM_11770: 5d213010a67287cebd7d09caf4d6b6fe0015472c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6533: 6b5107d91827962808441db6b98e478aa9e67bdb @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_105085v2: 5d213010a67287cebd7d09caf4d6b6fe0015472c @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
0bc3482984c3 i915/pmu: Wire GuC backend to per-client busyness
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v2/index.html