diff options
| author | Sanjay Yadav <sanjay.kumar.yadav@intel.com> | 2026-11-11 14:34:02 +0530 |
|---|---|---|
| committer | Matthew Brost <matthew.brost@intel.com> | 2026-11-18 19:52:12 -0800 |
| commit | 65ef9dec511c018bcbe5993e9749c52c26e573e2 (patch) | |
| tree | 89872afb494779fa1cd87279611903bc749d5149 /tools/perf/scripts | |
| parent | ffb03b2068bdc3bc11b61b7b3fb2c46735b0e859 (diff) | |
drm/xe/query: Use ordered clock reads for engine cycles cpu_delta
cpu_delta is meant to bound the time taken to read the engine timestamp
register, but it is measured with local_clock(), which on x86 is a plain
RDTSC that is not ordered against loads. Either end of the window can
thus be sampled while an earlier MMIO read is still in flight.
A reproducer looping on DRM_XE_DEVICE_QUERY_ENGINE_CYCLES on BMG reports
cpu_delta as low as 18 ns, while the MMIO read alone takes > 1.5 us.
Use ktime_get_raw_ns() at both ends instead. Its clocksource read is
ordered (rdtsc_ordered() on x86).
With this, the reproducer reports min/median cpu_delta of 1567/1745 ns
and no short values.
Fixes: 7793d00d1bf5 ("drm/xe: Correlate engine and cpu timestamps with better accuracy")
Cc: <stable@vger.kernel.org> # v6.8+
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Suggested-by: Aleksander Czerwionka <aleksander.czerwionka@intel.com>
Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patch.msgid.link/20261111090401.975803-2-sanjay.kumar.yadav@intel.com
(cherry picked from commit 146dec4ce1f0794fefe5ad1d549655745358b515)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Diffstat (limited to 'tools/perf/scripts')
0 files changed, 0 insertions, 0 deletions
