public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
* [RFC 00/15] drm/xe: Access counter consumer layer
@ 2026-03-18  7:44 Himal Prasad Ghimiray
  2026-03-18  7:34 ` ✗ CI.checkpatch: warning for " Patchwork
                   ` (16 more replies)
  0 siblings, 17 replies; 37+ messages in thread
From: Himal Prasad Ghimiray @ 2026-03-18  7:44 UTC (permalink / raw)
  To: intel-xe
  Cc: matthew.brost, thomas.hellstrom, stuart.summers, arvind.yadav,
	tejas.upadhyay, Himal Prasad Ghimiray

This series implements the Xe access counter consumer layer for discrete
Intel GPUs. Access counters track GPU memory access patterns and emit
notifications when a threshold is exceeded; the KMD uses these as hints
to migrate BOs and SVM ranges to tile-local VRAM.

The series starts by factoring the identical circular buffer code shared
between page faults and access counters into a generic struct
xe_usm_queue, then wires both consumers to it. The access counter consumer reuses
pf_wq rather than allocating a new workqueue.

Two helpers are extracted from the page fault path for reuse:
xe_vma_lock_and_validate() and xe_device_asid_to_fault_vm(). The worker
handles both BO-backed VMAs (migrate + rebind) and SVM VMAs (via
xe_svm_range_setup()).

A new exec queue extension (DRM_XE_EXEC_QUEUE_EXTENSION_SET_ACC_PARAM)
lets userspace configure per-queue trigger/notify thresholds and
granularity, which are programmed into CTX_ACC_CTR_THOLD and CTX_ASID
during LRC init (Bspec: 59264, 59265).

Finally, xe_vma_supports_access_ctr() identifies VMAs ineligible for
access counting, and xe_pt_stage_bind() sets the NC PTE bit on them to
avoid wasting finite hardware counter slots (Bspec: 67095).

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>

Himal Prasad Ghimiray (15):
  drm/xe: Add xe_usm_queue generic USM circular buffer
  drm/xe/pagefault: Use xe_usm_queue helpers
  drm/xe: Stub out new access_counter layer
  drm/xe: Implement xe_access_counter_init
  drm/xe: Implement xe_access_counter_handler
  drm/xe: Extract xe_vma_lock_and_validate helper
  drm/xe: Move ASID to FAULT VM lookup to xe_device
  drm/xe: Implement xe_access_counter_queue_work
  drm/xe/trace: Add xe_vma_acc trace event for access counter
    notifications
  drm/xe/svm: Handle svm ranges on access ctr trigger
  drm/xe: Add xe_guc_access_counter layer
  drm/xe/uapi: Add access counter parameter extension for exec queue
  drm/xe/lrc: Pass exec_queue to xe_lrc_create for access counter params
  drm/xe/vm: Add xe_vma_supports_access_ctr() helper
  drm/xe/pt: Set NC PTE bit for VMAs ineligible for access counting

 drivers/gpu/drm/xe/Makefile                  |   4 +-
 drivers/gpu/drm/xe/regs/xe_gtt_defs.h        |   2 +-
 drivers/gpu/drm/xe/regs/xe_lrc_layout.h      |  10 +
 drivers/gpu/drm/xe/xe_access_counter.c       | 255 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_access_counter.h       |  17 ++
 drivers/gpu/drm/xe/xe_access_counter_types.h | 123 +++++++++
 drivers/gpu/drm/xe/xe_device.c               |  30 +++
 drivers/gpu/drm/xe/xe_device.h               |   1 +
 drivers/gpu/drm/xe/xe_device_types.h         |   6 +-
 drivers/gpu/drm/xe/xe_exec_queue.c           |  29 ++-
 drivers/gpu/drm/xe/xe_exec_queue_types.h     |   9 +
 drivers/gpu/drm/xe/xe_execlist.c             |   2 +-
 drivers/gpu/drm/xe/xe_guc_access_counter.c   |  62 +++++
 drivers/gpu/drm/xe/xe_guc_access_counter.h   |  15 ++
 drivers/gpu/drm/xe/xe_guc_ct.c               |   4 +
 drivers/gpu/drm/xe/xe_lrc.c                  |  35 ++-
 drivers/gpu/drm/xe/xe_lrc.h                  |   5 +-
 drivers/gpu/drm/xe/xe_pagefault.c            |  79 +-----
 drivers/gpu/drm/xe/xe_pagefault_types.h      |  27 +-
 drivers/gpu/drm/xe/xe_pt.c                   |  11 +
 drivers/gpu/drm/xe/xe_svm.c                  |  59 +++--
 drivers/gpu/drm/xe/xe_svm.h                  |   4 +
 drivers/gpu/drm/xe/xe_trace_bo.h             |  32 ++-
 drivers/gpu/drm/xe/xe_usm_queue.h            | 100 ++++++++
 drivers/gpu/drm/xe/xe_vm.c                   |  72 ++++++
 drivers/gpu/drm/xe/xe_vm.h                   |   6 +
 include/uapi/drm/xe_drm.h                    |  39 +++
 27 files changed, 910 insertions(+), 128 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_access_counter.c
 create mode 100644 drivers/gpu/drm/xe/xe_access_counter.h
 create mode 100644 drivers/gpu/drm/xe/xe_access_counter_types.h
 create mode 100644 drivers/gpu/drm/xe/xe_guc_access_counter.c
 create mode 100644 drivers/gpu/drm/xe/xe_guc_access_counter.h
 create mode 100644 drivers/gpu/drm/xe/xe_usm_queue.h

-- 
2.34.1


^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2026-04-07  6:41 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18  7:44 [RFC 00/15] drm/xe: Access counter consumer layer Himal Prasad Ghimiray
2026-03-18  7:34 ` ✗ CI.checkpatch: warning for " Patchwork
2026-03-18  7:35 ` ✗ CI.KUnit: failure " Patchwork
2026-03-18  7:44 ` [RFC 01/15] drm/xe: Add xe_usm_queue generic USM circular buffer Himal Prasad Ghimiray
2026-04-01 21:28   ` Matthew Brost
2026-04-06  4:46     ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 02/15] drm/xe/pagefault: Use xe_usm_queue helpers Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 03/15] drm/xe: Stub out new access_counter layer Himal Prasad Ghimiray
2026-04-02 21:46   ` Matthew Brost
2026-04-06  5:28     ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 04/15] drm/xe: Implement xe_access_counter_init Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 05/15] drm/xe: Implement xe_access_counter_handler Himal Prasad Ghimiray
2026-04-03  2:06   ` Matthew Brost
2026-03-18  7:44 ` [RFC 06/15] drm/xe: Extract xe_vma_lock_and_validate helper Himal Prasad Ghimiray
2026-04-01 22:03   ` Matthew Brost
2026-03-18  7:44 ` [RFC 07/15] drm/xe: Move ASID to FAULT VM lookup to xe_device Himal Prasad Ghimiray
2026-04-02 21:50   ` Matthew Brost
2026-04-07  6:41     ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 08/15] drm/xe: Implement xe_access_counter_queue_work Himal Prasad Ghimiray
2026-04-01 21:10   ` Matthew Brost
2026-04-01 22:01     ` Matthew Brost
2026-04-01 22:11   ` Matthew Brost
2026-04-02 22:06   ` Matthew Brost
2026-03-18  7:44 ` [RFC 09/15] drm/xe/trace: Add xe_vma_acc trace event for access counter notifications Himal Prasad Ghimiray
2026-04-03  1:01   ` Matthew Brost
2026-03-18  7:44 ` [RFC 10/15] drm/xe/svm: Handle svm ranges on access ctr trigger Himal Prasad Ghimiray
2026-04-03  0:25   ` Matthew Brost
2026-03-18  7:44 ` [RFC 11/15] drm/xe: Add xe_guc_access_counter layer Himal Prasad Ghimiray
2026-04-02 21:27   ` Matthew Brost
2026-03-18  7:44 ` [RFC 12/15] drm/xe/uapi: Add access counter parameter extension for exec queue Himal Prasad Ghimiray
2026-03-24 14:25   ` Francois Dugast
2026-04-01 14:46     ` Matthew Brost
2026-04-01 16:36       ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 13/15] drm/xe/lrc: Pass exec_queue to xe_lrc_create for access counter params Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 14/15] drm/xe/vm: Add xe_vma_supports_access_ctr() helper Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 15/15] drm/xe/pt: Set NC PTE bit for VMAs ineligible for access counting Himal Prasad Ghimiray
2026-04-03  0:09   ` Matthew Brost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox