linux/drivers/gpu/drm/i915/gt/uc
Umesh Nerlige Ramappa 7d73c60215 drm/i915/pmu: Fix KMD and GuC race on accessing busyness
GuC updates shared memory and KMD reads it. Since this is not
synchronized, we run into a race where the value read is inconsistent.
Sometimes the inconsistency is in reading the upper MSB bytes of the
last_switch_in value. 2 types of cases are seen - upper 8 bits are zero
and upper 24 bits are zero. Since these are non-zero values, it is
not trivial to determine validity of these values. Instead we read the
values multiple times until they are consistent. In test runs, 3
attempts results in consistent values. The upper bound is set to 6
attempts and may need to be tuned as per any new occurences.

Since the duration that gt is parked can vary, the patch also updates
the gt timestamp on unpark before starting the worker.

v2:
- Initialize i
- Use READ_ONCE to access engine record

Fixes: 77cdd054dd ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu")
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220125020124.788679-2-umesh.nerlige.ramappa@intel.com
(cherry picked from commit 512712a824)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2022-02-01 08:59:25 +00:00
..
abi drm/i915/pmu: Connect engine busyness stats from GuC to pmu 2021-10-28 11:04:43 -07:00
intel_guc_ads.c drm/i915/pmu: Connect engine busyness stats from GuC to pmu 2021-10-28 11:04:43 -07:00
intel_guc_ads.h drm/i915/pmu: Connect engine busyness stats from GuC to pmu 2021-10-28 11:04:43 -07:00
intel_guc_ct.c drm/i915/guc: Kick G2H tasklet if no credits 2021-12-15 19:10:51 -08:00
intel_guc_ct.h drm/i915/guc: Update GuC debugfs to support new GuC 2021-07-22 10:07:27 -07:00
intel_guc_debugfs.c drm/i915: rename debugfs_gt files 2021-09-18 23:33:19 -07:00
intel_guc_debugfs.h drm/i915/uc: Move uC debugfs to its own folder under GT 2020-03-26 21:23:03 +00:00
intel_guc_fw.c drm/i915/guc: support bigger RSA keys 2021-12-13 11:37:49 -08:00
intel_guc_fw.h drm/i915/huc: make "support huc" reflect HW capabilities 2020-03-26 21:22:01 +00:00
intel_guc_fwif.h drm/i915/pmu: Connect engine busyness stats from GuC to pmu 2021-10-28 11:04:43 -07:00
intel_guc_log_debugfs.c drm/i915/guc: Speed up GuC log dumps 2021-12-20 15:33:16 -08:00
intel_guc_log_debugfs.h drm/i915/uc: Move uC debugfs to its own folder under GT 2020-03-26 21:23:03 +00:00
intel_guc_log.c drm/i915/guc: Update firmware to v62.0.0 2021-06-18 15:31:01 -07:00
intel_guc_log.h drm/i915/guc: Increase GuC log size for CONFIG_DEBUG_GEM 2021-12-20 15:33:17 -08:00
intel_guc_rc.c drm/i915/guc/rc: Setup and enable GuCRC feature 2021-08-03 16:05:44 -07:00
intel_guc_rc.h drm/i915/guc/rc: Setup and enable GuCRC feature 2021-08-03 16:05:44 -07:00
intel_guc_reg.h drm/i915/guc: Update to use firmware v49.0.1 2020-10-29 13:46:26 +02:00
intel_guc_slpc_types.h drm/i915/guc/slpc: Define and initialize boost frequency 2021-11-03 17:44:02 -07:00
intel_guc_slpc.c drm/i915/gt: Use to_gt() helper 2021-12-17 21:50:06 -08:00
intel_guc_slpc.h drm/i915/guc/slpc: Update boost sysfs hooks for SLPC 2021-11-03 17:44:13 -07:00
intel_guc_submission.c drm/i915/pmu: Fix KMD and GuC race on accessing busyness 2022-02-01 08:59:25 +00:00
intel_guc_submission.h drm/i915/pmu: Connect engine busyness stats from GuC to pmu 2021-10-28 11:04:43 -07:00
intel_guc.c drm/i915/guc: Implement multi-lrc submission 2021-10-15 10:37:40 -07:00
intel_guc.h drm/i915/pmu: Use PM timestamp instead of RING TIMESTAMP for reference 2022-01-31 09:35:05 +00:00
intel_huc_debugfs.c drm/i915: rename debugfs_gt files 2021-09-18 23:33:19 -07:00
intel_huc_debugfs.h drm/i915/uc: Move uC debugfs to its own folder under GT 2020-03-26 21:23:03 +00:00
intel_huc_fw.c drm/i915/huc: make "support huc" reflect HW capabilities 2020-03-26 21:22:01 +00:00
intel_huc_fw.h drm/i915/huc: make "support huc" reflect HW capabilities 2020-03-26 21:22:01 +00:00
intel_huc.c drm/i915/guc: support bigger RSA keys 2021-12-13 11:37:49 -08:00
intel_huc.h drm/i915/guc: support bigger RSA keys 2021-12-13 11:37:49 -08:00
intel_uc_debugfs.c drm/i915: rename debugfs_gt files 2021-09-18 23:33:19 -07:00
intel_uc_debugfs.h drm/i915/uc: Move uC debugfs to its own folder under GT 2020-03-26 21:23:03 +00:00
intel_uc_fw_abi.h drm/i915/guc: Update to use firmware v49.0.1 2020-10-29 13:46:26 +02:00
intel_uc_fw.c drm/i915/guc: support bigger RSA keys 2021-12-13 11:37:49 -08:00
intel_uc_fw.h drm/i915/guc: support bigger RSA keys 2021-12-13 11:37:49 -08:00
intel_uc.c Merge tag 'drm-intel-gt-next-2021-12-23' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-12-24 06:14:51 +10:00
intel_uc.h drm/i915/guc/rc: Setup and enable GuCRC feature 2021-08-03 16:05:44 -07:00
selftest_guc_multi_lrc.c drm/i915/gt: Use to_gt() helper 2021-12-17 21:50:06 -08:00
selftest_guc.c drm/i915/gt: Use to_gt() helper 2021-12-17 21:50:06 -08:00