Access counter squash
Subsystems (3)
PATCH 1/1 Access counter squash
--- drivers/gpu/drm/xe/Makefile | 4 +- drivers/gpu/drm/xe/regs/xe_gtt_defs.h | 1 + drivers/gpu/drm/xe/regs/xe_lrc_layout.h | 10 + drivers/gpu/drm/xe/xe_access_counter.c | 366 +++++++++++++++++++ drivers/gpu/drm/xe/xe_access_counter.h | 17 + drivers/gpu/drm/xe/xe_access_counter_types.h | 143 ++++++++ drivers/gpu/drm/xe/xe_device.c | 30 ++ drivers/gpu/drm/xe/xe_device.h | 1 + drivers/gpu/drm/xe/xe_device_types.h | 12 + drivers/gpu/drm/xe/xe_exec_queue.c | 35 +- 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 | 74 ++++ drivers/gpu/drm/xe/xe_guc_access_counter.h | 15 + drivers/gpu/drm/xe/xe_guc_ct.c | 4 + drivers/gpu/drm/xe/xe_guc_fwif.h | 1 + drivers/gpu/drm/xe/xe_lrc.c | 35 +- drivers/gpu/drm/xe/xe_lrc.h | 5 +- drivers/gpu/drm/xe/xe_pagefault.c | 78 +--- drivers/gpu/drm/xe/xe_pt.c | 23 ++ drivers/gpu/drm/xe/xe_svm.c | 197 ++++++++-- drivers/gpu/drm/xe/xe_svm.h | 14 + drivers/gpu/drm/xe/xe_trace_bo.h | 32 +- drivers/gpu/drm/xe/xe_usm_queue.h | 127 +++++++ drivers/gpu/drm/xe/xe_vm.c | 130 ++++++- drivers/gpu/drm/xe/xe_vm.h | 6 + drivers/gpu/drm/xe/xe_vm_types.h | 11 + include/uapi/drm/xe_drm.h | 205 +++++++++++ 28 files changed, 1472 insertions(+), 115 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
drivers/gpu/drm/xe/Makefile +3 -1
@@ -32,7 +32,8 @@ $(obj)/generated/%_device_wa_oob.c $(obj)/generated/%_device_wa_oob.h: $(obj)/xe # core driver code -xe-y += xe_bb.o \ +xe-y += xe_access_counter.o \ + xe_bb.o \ xe_bo.o \ xe_bo_evict.o \ xe_dep_scheduler.o \
@@ -73,6 +74,7 @@ xe-y += xe_bb.o \ xe_guc_id_mgr.o \ xe_guc_klv_helpers.o \ xe_guc_log.o \ + xe_guc_access_counter.o \ xe_guc_pagefault.o \ xe_guc_pc.o \ xe_guc_rc.o \
drivers/gpu/drm/xe/regs/xe_gtt_defs.h +1 -0
@@ -30,6 +30,7 @@#define XE_PDE_IPS_64K BIT_ULL(11)#define XE_GGTT_PTE_DM BIT_ULL(1) +#define XE_PPGTT_PTE_NC BIT_ULL(5)#define XE_USM_PPGTT_PTE_AE BIT_ULL(10)#define XE_PPGTT_PTE_DM BIT_ULL(11)#define XE_PDE_64K BIT_ULL(6)
drivers/gpu/drm/xe/regs/xe_lrc_layout.h +10 -0
@@ -45,4 +45,14 @@#define INDIRECT_CTX_RING_START_UDW (0x08 + 1)#define INDIRECT_CTX_RING_CTL (0x0a + 1) +/* Fields for CTX_ACC_CTR_THOLD */ +#define ACC_TRIGGER_MASK REG_GENMASK(15, 0) +#define ACC_TRIGGER_VAL (x) REG_FIELD_PREP(ACC_TRIGGER_MASK, x) +#define ACC_NOTIFY_MASK REG_GENMASK(31, 16) +#define ACC_NOTIFY_VAL (x) REG_FIELD_PREP(ACC_NOTIFY_MASK, x) + +/* Fields for CTX_ASID */ +#define ACC_GRANULARITY_MASK REG_GENMASK(22, 20) +#define ACC_GRANULARITY_VAL (x) REG_FIELD_PREP(ACC_GRANULARITY_MASK, x) +#endif
drivers/gpu/drm/xe/xe_access_counter.c new file +366 -0
366 lines not on this page · raw message
drivers/gpu/drm/xe/xe_access_counter.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2026 Intel Corporation +*/ + +#ifndef _XE_ACCESS_COUNTER_H_ +#define _XE_ACCESS_COUNTER_H_ + +struct xe_device ; +struct xe_gt ; +struct xe_access_counter ; + +int xe_access_counter_init (struct xe_device *xe); + +int xe_access_counter_handler (struct xe_device *xe,struct xe_access_counter *ac); + +#endif
drivers/gpu/drm/xe/xe_access_counter_types.h new file +143 -0
143 lines not on this page · raw message
drivers/gpu/drm/xe/xe_device.c +30 -0
@@ -23,6 +23,7 @@#include "instructions/xe_gpu_commands.h" #include "regs/xe_gt_regs.h" #include "regs/xe_regs.h" +#include "xe_access_counter.h" #include "xe_bo.h" #include "xe_bo_evict.h" #include "xe_configfs.h"
@@ -997,6 +998,10 @@ int xe_device_probe(struct xe_device *xe)if (err)return err; + err =xe_access_counter_init (xe); +if (err) +return err; +if (xe->tiles->media_gt && XE_GT_WA(xe->tiles->media_gt, 15015404425_disable))XE_DEVICE_WA_DISABLE (xe,15015404425 );
@@ -1501,3 +1506,28 @@ struct xe_vm *xe_device_asid_to_vm(struct xe_device *xe, u32 asid)return vm; } + +/** +* xe_device_asid_to_fault_vm() - Find FAULT VM from ASID +* @xe: the &xe_device +* @asid: Address space ID +* +* Find a FAULTING VM from ASID and take a reference to VM which +* caller must drop. Reclaim safe. +* +* Return: VM on success, ERR_PTR on failure +*/ +struct xe_vm *xe_device_asid_to_fault_vm (struct xe_device *xe,u32 asid) +{ +struct xe_vm *vm; + +down_read (&xe->usm.lock); + vm =xa_load (&xe->usm.asid_to_vm, asid); +if (vm &&xe_vm_in_fault_mode (vm)) +xe_vm_get (vm); +else + vm =ERR_PTR (-EINVAL ); +up_read (&xe->usm.lock); + +return vm; +}
drivers/gpu/drm/xe/xe_device.h +1 -0
@@ -273,6 +273,7 @@ int xe_is_injection_active(void);bool xe_is_xe_file (const struct file *file);struct xe_vm *xe_device_asid_to_vm (struct xe_device *xe,u32 asid); +struct xe_vm *xe_device_asid_to_fault_vm (struct xe_device *xe,u32 asid);#ifdef CONFIG_PCI_IOV bool xe_device_is_admin_only (const struct xe_device *xe);
drivers/gpu/drm/xe/xe_device_types.h +12 -0
@@ -12,6 +12,7 @@#include <drm/drm_file.h> #include <drm/ttm/ttm_device.h> +#include "xe_access_counter_types.h" #include "xe_devcoredump_types.h" #include "xe_drm_ras_types.h" #include "xe_heci_gsc.h"
@@ -29,6 +30,7 @@#include "xe_survivability_mode_types.h" #include "xe_sysctrl_types.h" #include "xe_tile_types.h" +#include "xe_usm_queue.h" #include "xe_validation.h" #if IS_ENABLED (CONFIG_DRM_XE_DEBUG )
@@ -336,6 +338,16 @@ struct xe_device {struct xe_pagefault_work pf_workers[XE_PAGEFAULT_WORK_MAX ];/** @usm.pf_queue: Page fault queue */ struct xe_pagefault_queue pf_queue; +/** +* @usm.ac_workers_indx: Round-robin index selecting the +* next access-counter worker to wake. +*/ +u32 ac_workers_indx; +#define XE_ACCESS_COUNTER_WORKER_COUNT 4 +/** @usm.ac_workers: Access counter workers */ +struct xe_ac_worker ac_workers[XE_ACCESS_COUNTER_WORKER_COUNT ]; +/** @usm.ac_queue: Access counter queue */ +struct xe_usm_queue ac_queue;#if IS_ENABLED (CONFIG_DRM_XE_PAGEMAP )/** @usm.dpagemap_shrinker: Shrinker for unused pagemaps */ struct drm_pagemap_shrinker *dpagemap_shrinker;
drivers/gpu/drm/xe/xe_exec_queue.c +34 -1
@@ -436,7 +436,7 @@ static int __xe_exec_queue_init(struct xe_exec_queue *q, u32 exec_queue_flags) marker =xe_gt_sriov_vf_wait_valid_ggtt (q->gt); - lrc =xe_lrc_create (q->hwe, q->vm, q->replay_state, + lrc =xe_lrc_create (q, q->hwe, q->vm, q->replay_state,xe_lrc_ring_size (), q->msix_vec, flags);if (IS_ERR (lrc)) { err =PTR_ERR (lrc);
@@ -1153,6 +1153,38 @@ static int exec_queue_user_ext_check_final(struct xe_exec_queue *q, u64 propertireturn 0 ; } +static int exec_queue_user_ext_set_acc_param (struct xe_device *xe, +struct xe_exec_queue *q, +u64 extension,u64 *properties) +{ +u64 __user *address =u64_to_user_ptr (extension); +struct drm_xe_exec_queue_set_acc_param ext; +int err; + +if (!xe->info.has_access_counter) +return -EINVAL ; + + err =copy_from_user (&ext, address,sizeof (ext)); +if (XE_IOCTL_DBG (xe, err)) +return -EFAULT ; + +if (XE_IOCTL_DBG (xe, ext.pad1 || ext.pad2)) +return -EINVAL ; + +if (XE_IOCTL_DBG (xe, ext.granularity >DRM_XE_ACCESS_COUNTER_GRANULARITY_64M )) +return -EINVAL ; + +if (XE_IOCTL_DBG (xe, ext.notify > ext.trigger)) +return -EINVAL ; + +/* Store access counter parameters in exec queue */ + q->acc.trigger = ext.trigger; + q->acc.notify = ext.notify; + q->acc.granularity = ext.granularity; + +return 0 ; +} +static int exec_queue_user_ext_set_property (struct xe_device *xe,struct xe_exec_queue *q,u64 extension,u64 *properties)
@@ -1199,6 +1231,7 @@ typedef int (*xe_exec_queue_user_extension_fn)(struct xe_device *xe,static const xe_exec_queue_user_extension_fn exec_queue_user_extension_funcs[] = { [DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY ] = exec_queue_user_ext_set_property, + [DRM_XE_EXEC_QUEUE_EXTENSION_SET_ACC_PARAM ] = exec_queue_user_ext_set_acc_param, };#define MAX_USER_EXTENSIONS 16
drivers/gpu/drm/xe/xe_exec_queue_types.h +9 -0
@@ -265,6 +265,15 @@ struct xe_exec_queue {/** @replay_state: GPU hang replay state */ void *replay_state; +/** @acc: Access counter parameters */ +struct { +/** @acc.trigger: Access counter trigger threshold */ +u16 trigger; +/** @acc.notify: Access counter notify threshold */ +u16 notify; +/** @acc.granularity: Access counter granularity */ +u8 granularity; + } acc;/** @ops: submission backend exec queue operations */ const struct xe_exec_queue_ops *ops;
drivers/gpu/drm/xe/xe_execlist.c +1 -1
@@ -259,7 +259,7 @@ struct xe_execlist_port *xe_execlist_port_create(struct xe_device *xe, port->hwe = hwe; - port->lrc =xe_lrc_create (hwe,NULL ,NULL ,SZ_16K ,XE_IRQ_DEFAULT_MSIX ,0 ); + port->lrc =xe_lrc_create (NULL , hwe,NULL ,NULL ,SZ_16K ,XE_IRQ_DEFAULT_MSIX ,0 );if (IS_ERR (port->lrc)) { err =PTR_ERR (port->lrc); goto err;
drivers/gpu/drm/xe/xe_guc_access_counter.c new file +74 -0
74 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_access_counter.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2025 Intel Corporation +*/ + +#ifndef _XE_GUC_ACCESS_COUNTER_H_ +#define _XE_GUC_ACCESS_COUNTER_H_ + +#include <linux/types.h> + +struct xe_guc ; + +int xe_guc_access_counter_handler (struct xe_guc *guc,u32 *msg,u32 len); + +#endif
drivers/gpu/drm/xe/xe_guc_ct.c +4 -0
@@ -26,6 +26,7 @@#include "xe_gt_sriov_pf_monitor.h" #include "xe_guc.h" #include "xe_guc_log.h" +#include "xe_guc_access_counter.h" #include "xe_guc_pagefault.h" #include "xe_guc_relay.h" #include "xe_guc_submit.h"
@@ -1753,6 +1754,9 @@ static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)case XE_GUC_ACTION_REPORT_PAGE_FAULT_REQ_DESC : ret =xe_guc_pagefault_handler (guc, payload, adj_len);break ; +case XE_GUC_ACTION_ACCESS_COUNTER_NOTIFY : + ret =xe_guc_access_counter_handler (guc, payload, adj_len); +break ;case XE_GUC_ACTION_TLB_INVALIDATION_DONE : ret =xe_guc_tlb_inval_done_handler (guc, payload, adj_len);break ;
drivers/gpu/drm/xe/xe_guc_fwif.h +1 -0
@@ -299,6 +299,7 @@ struct xe_guc_acc_desc {#define ACC_TRIGGER 0#define ACC_NOTIFY 1#define ACC_SUBG_LO GENMASK(31, 1) +#define ACC_SUBG_LO_WIDTH 31u32 dw1;#define ACC_SUBG_HI BIT(0)
drivers/gpu/drm/xe/xe_lrc.c +26 -9
@@ -1516,8 +1516,10 @@ static void xe_lrc_set_gpgpu_preemption_level(struct xe_lrc *lrc, struct xe_gt *xe_lrc_write_ctx_reg (lrc,CTX_CS_CHICKEN1 , val); } -static int xe_lrc_ctx_init (struct xe_lrc *lrc,struct xe_hw_engine *hwe,struct xe_vm *vm, -void *replay_state,u16 msix_vec,u32 init_flags) +static int xe_lrc_ctx_init (struct xe_lrc *lrc,struct xe_exec_queue *q, +struct xe_hw_engine *hwe,struct xe_vm *vm, +void *replay_state, +u16 msix_vec,u32 init_flags) {struct xe_gt *gt = hwe->gt;struct xe_tile *tile =gt_to_tile (gt);
@@ -1616,8 +1618,20 @@ static int xe_lrc_ctx_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, structxe_lrc_write_ctx_reg (lrc,CTX_QUEUE_TIMESTAMP_UDW ,0 ); } -if (xe->info.has_asid && vm) -xe_lrc_write_ctx_reg (lrc,CTX_ASID , vm->usm.asid); +if (xe->info.has_asid && vm) { +u32 asid; + +if (q) + asid = vm->usm.asid |ACC_GRANULARITY_VAL (q->acc.granularity); +else + asid = vm->usm.asid; +xe_lrc_write_ctx_reg (lrc,CTX_ASID , asid); + } + +if (q && xe->info.has_access_counter && vm) +xe_lrc_write_ctx_reg (lrc,CTX_ACC_CTR_THOLD , +ACC_NOTIFY_VAL (q->acc.notify) | +ACC_TRIGGER_VAL (q->acc.trigger));if (GRAPHICS_VER (xe) >=20 && hwe->class ==XE_ENGINE_CLASS_RENDER )xe_lrc_set_gpgpu_preemption_level (lrc, gt);
@@ -1662,7 +1676,8 @@ static int xe_lrc_ctx_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, structreturn err; } -static int xe_lrc_init (struct xe_lrc *lrc,struct xe_hw_engine *hwe,struct xe_vm *vm, +static int xe_lrc_init (struct xe_lrc *lrc,struct xe_exec_queue *q, +struct xe_hw_engine *hwe,struct xe_vm *vm,void *replay_state,u32 ring_size,u16 msix_vec,u32 init_flags) {struct xe_gt *gt = hwe->gt;
@@ -1718,7 +1733,7 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, struct xe_vxe_hw_fence_ctx_init (&lrc->fence_ctx, hwe->gt, hwe->fence_irq, hwe->name); - err =xe_lrc_ctx_init (lrc, hwe, vm, replay_state, msix_vec, init_flags); + err =xe_lrc_ctx_init (lrc, q, hwe, vm, replay_state, msix_vec, init_flags);if (err) goto err_lrc_finish;
@@ -1734,6 +1749,7 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, struct xe_v/** * xe_lrc_create - Create a LRC +* @q: Exec queue (can be NULL for kernel queues) * @hwe: Hardware Engine * @vm: The VM (address space) * @replay_state: GPU hang replay state
@@ -1746,8 +1762,9 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, struct xe_v* Return pointer to created LRC upon success and an error pointer * upon failure. */ -struct xe_lrc *xe_lrc_create (struct xe_hw_engine *hwe,struct xe_vm *vm, -void *replay_state,u32 ring_size,u16 msix_vec,u32 flags) +struct xe_lrc *xe_lrc_create (struct xe_exec_queue *q,struct xe_hw_engine *hwe, +struct xe_vm *vm,void *replay_state,u32 ring_size, +u16 msix_vec,u32 flags) {struct xe_lrc *lrc;int err;
@@ -1756,7 +1773,7 @@ struct xe_lrc *xe_lrc_create(struct xe_hw_engine *hwe, struct xe_vm *vm,if (!lrc)return ERR_PTR (-ENOMEM ); - err =xe_lrc_init (lrc, hwe, vm, replay_state, ring_size, msix_vec, flags); + err =xe_lrc_init (lrc, q, hwe, vm, replay_state, ring_size, msix_vec, flags);if (err) {kfree (lrc);return ERR_PTR (err);
drivers/gpu/drm/xe/xe_lrc.h +3 -2
@@ -61,8 +61,9 @@ struct xe_lrc_snapshot {#define XE_LRC_CREATE_USER_CTX BIT(2)#define XE_LRC_DISABLE_STATE_CACHE_PERF_FIX BIT(3) -struct xe_lrc *xe_lrc_create (struct xe_hw_engine *hwe,struct xe_vm *vm, -void *replay_state,u32 ring_size,u16 msix_vec,u32 flags); +struct xe_lrc *xe_lrc_create (struct xe_exec_queue *q,struct xe_hw_engine *hwe, +struct xe_vm *vm,void *replay_state, +u32 ring_size,u16 msix_vec,u32 flags);void xe_lrc_destroy (struct kref *ref);/**
drivers/gpu/drm/xe/xe_pagefault.c +14 -64
119 lines not on this page · raw message
drivers/gpu/drm/xe/xe_pt.c +23 -0
@@ -800,6 +800,7 @@ xe_pt_stage_bind(struct xe_tile *tile, struct xe_vma *vma, .clear_pt = clear_pt, };struct xe_pt *pt = vm->pt_root[tile->id]; +struct drm_gpusvm_range_flags range_flags;int ret;bool is_purged = false;
@@ -862,6 +863,28 @@ xe_pt_stage_bind(struct xe_tile *tile, struct xe_vma *vma, XE_USM_PPGTT_PTE_AE :0 ; } +if (!xe_vma_supports_access_ctr (xe, vma, tile)) { + xe_walk.default_vram_pte |=XE_PPGTT_PTE_NC ; + xe_walk.default_system_pte |=XE_PPGTT_PTE_NC ; + } + +if (range) { +/* +* Always set NC (no-count) on VRAM PTEs for SVM ranges so +* this GPU does not generate access counter events for memory +* it is already responsible for. Today default_vram_pte +* covers only local VRAM; once UAL lands, remote-device VRAM +* pages will also flow through default_vram_pte — NC remains +* the right setting there too, as the owning device handles +* AC for its own local memory. Update this comment when UAL +* support is added and adjust if the semantics change. +*/ + xe_walk.default_vram_pte |=XE_PPGTT_PTE_NC ; + range_flags.__flags =READ_ONCE (range->base.flags.__flags); +if (!range_flags.migrate_devmem) + xe_walk.default_system_pte |=XE_PPGTT_PTE_NC ; + } + xe_walk.default_vram_pte |=XE_PPGTT_PTE_DM ; xe_walk.dma_offset = (bo && !is_purged) ?vram_region_gpu_offset (bo->ttm.resource) :0 ;if (!range)
drivers/gpu/drm/xe/xe_svm.c +165 -32
312 lines not on this page · raw message
drivers/gpu/drm/xe/xe_svm.h +14 -0
@@ -28,6 +28,14 @@ struct xe_vm;struct xe_vma ;struct xe_vram_region ; +/** struct xe_svm_range_setup_flags -flags for range setup */ +struct xe_svm_range_setup_flags { +/** @atomic: is atomic access */ +u32 atomic :1 ; +/** @acc_ctr_trigger: is called by access ctr trigger */ +u32 acc_ctr_trigger :1 ; +}; +/** struct xe_svm_range - SVM range */ struct xe_svm_range {/** @base: base drm_gpusvm_range */
@@ -109,6 +117,12 @@ void xe_svm_fini(struct xe_vm *vm);void xe_svm_close (struct xe_vm *vm); +int xe_svm_range_setup (struct xe_vm *vm,struct xe_vma *vma, +struct xe_pagefault *pf,struct xe_gt *gt, +u64 addr,struct xe_svm_range_setup_flags flags); + +struct xe_svm_range *xe_svm_range_find_first (struct xe_vm *vm,u64 start,u64 end); +int xe_svm_handle_pagefault (struct xe_vm *vm,struct xe_vma *vma,struct xe_pagefault *pf,struct xe_gt *gt,u64 fault_addr,bool atomic);
drivers/gpu/drm/xe/xe_trace_bo.h +29 -3
@@ -12,6 +12,7 @@#include <linux/tracepoint.h> #include <linux/types.h> +#include "xe_access_counter_types.h" #include "xe_bo.h" #include "xe_bo_types.h" #include "xe_vm.h"
@@ -125,9 +126,34 @@ DEFINE_EVENT(xe_vma, xe_vma_pagefault,TP_ARGS (vma) ); -DEFINE_EVENT (xe_vma, xe_vma_acc, - TP_PROTO(struct xe_vma *vma), -TP_ARGS (vma) +TRACE_EVENT (xe_vma_acc, + TP_PROTO(struct xe_vma *vma, u8 counter_type), +TP_ARGS (vma, counter_type), + +TP_STRUCT__entry ( + __string(dev, __dev_name_vma(vma)) + __field(struct xe_vma *, vma) + __field(struct xe_vm *, vm) + __field(u32, asid) + __field(u64, start) + __field(u64, end) +__field (u8, counter_type) + ), + +TP_fast_assign ( + __assign_str(dev); + __entry->vma = vma; + __entry->vm = xe_vma_vm(vma); + __entry->asid = xe_vma_vm(vma)->usm.asid; + __entry->start = xe_vma_start(vma); + __entry->end = xe_vma_end(vma) - 1; + __entry->counter_type = counter_type; + ), + +TP_printk ("dev=%s, vma=%p, vm=%p, asid=0x%05x, start=0x%012llx, end=0x%012llx, type=%s" , +__get_str (dev), __entry->vma, __entry->vm, + __entry->asid, __entry->start, __entry->end, + __entry->counter_type ==XE_ACCESS_COUNTER_TYPE_NOTIFY ?"NOTIFY" :"TRIGGER" ) ); DEFINE_EVENT(xe_vma, xe_vma_bind,
drivers/gpu/drm/xe/xe_usm_queue.h new file +127 -0
127 lines not on this page · raw message
drivers/gpu/drm/xe/xe_vm.c +128 -2
178 lines not on this page · raw message
drivers/gpu/drm/xe/xe_vm.h +6 -0
@@ -185,6 +185,9 @@ struct xe_vma *xe_vm_find_vma_by_addr(struct xe_vm *vm, u64 page_addr);int xe_vma_need_vram_for_atomic (struct xe_device *xe,struct xe_vma *vma,bool is_atomic); +bool xe_vma_supports_access_ctr (struct xe_device *xe,struct xe_vma *vma, +struct xe_tile *tile); +int xe_vm_alloc_madvise_vma (struct xe_vm *vm,uint64_t addr,uint64_t size);int xe_vm_alloc_cpu_addr_mirror_vma (struct xe_vm *vm,uint64_t addr,uint64_t size);
@@ -281,6 +284,9 @@ static inline void xe_vm_reactivate_rebind(struct xe_vm *vm)int xe_vm_lock_vma (struct drm_exec *exec,struct xe_vma *vma); +int xe_vma_lock_and_validate (struct drm_exec *exec,struct xe_vma *vma, +struct xe_vram_region *vram,bool need_vram_move); +int xe_vm_validate_rebind (struct xe_vm *vm,struct drm_exec *exec,unsigned int num_fences);
drivers/gpu/drm/xe/xe_vm_types.h +11 -0
@@ -52,6 +52,7 @@ struct xe_vm_pgtable_update_op;#define XE_VMA_DUMPABLE (DRM_GPUVA_USERBITS << 8)#define XE_VMA_SYSTEM_ALLOCATOR (DRM_GPUVA_USERBITS << 9)#define XE_VMA_MADV_AUTORESET (DRM_GPUVA_USERBITS << 10) +#define XE_VMA_MIGRATE_ON_ACC (DRM_GPUVA_USERBITS << 11)/** * struct xe_vma_mem_attr - memory attributes associated with vma
@@ -175,6 +176,16 @@ struct xe_vma {*/ struct xe_user_fence *ufence; +/** +* @ac_move_fence: Fence for an in-progress access-counter triggered +* migration/rebind. Written by the AC service and read+cleared by the +* page-fault handler, both under down_read(&vm->lock) + @fault_lock; +* any access under the read lock MUST also hold @fault_lock. The final +* put on VMA destroy (xe_vma_destroy_late()) is unlocked - safe as no +* other reference to the VMA remains. +*/ +struct dma_fence *ac_move_fence; +/** * @attr: The attributes of vma which determines the migration policy * and encoding of the PTEs for this vma.
include/uapi/drm/xe_drm.h +205 -0
229 lines not on this page · raw message
Signature · 1 line
2.43.0
Patchwork
CI✗ CI.checkpatch: warning for Access counter squash
== Series Details ==
== Series Details ==
Series: Access counter squash
URL : https://patchwork.freedesktop.org/series/173728/
State : warning
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master d875049d2b299159a272bd5151994970cdcd1e31
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 4ebb5520b3f8b22179249ce1b5bf1f020b64a84c
Author: Himal Prasad Ghimiray <[email protected]> Date: Wed Sep 9 19:36:47 2026 +0530
Access counter squash
+ /mt/dim checkpatch 5d8ee99db6673736cbd5d5d4c0d6612fe07d94ff drm-intel 4ebb5520b3f8 Access counter squash
-:8: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one
-:61: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #61:
new file mode 100644
-:1593: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #1593: FILE: drivers/gpu/drm/xe/xe_trace_bo.h:133:
+ TP_STRUCT__entry(
-:1603: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #1603: FILE: drivers/gpu/drm/xe/xe_trace_bo.h:143:
+ TP_fast_assign(
-:2232: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
total: 1 errors, 2 warnings, 2 checks, 2032 lines checked
Patchwork
CI✗ CI.KUnit: failure for Access counter squash
In reply to Himal Prasad Ghimiray== Series Details ==
== Series Details ==
Series: Access counter squash
URL : https://patchwork.freedesktop.org/series/173728/
State : failure
== Summary ==
+ trap cleanup EXIT
+ kunitconfigs=('/kernel/drivers/gpu/tests/.kunitconfig' '/kernel/drivers/gpu/drm/xe/.kunitconfig' '/kernel/drivers/gpu/drm/tests/.kunitconfig' '/kernel/drivers/gpu/drm/ttm/tests/.kunitconfig' '/kernel/drivers/dma-buf/.kunitconfig')
+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/gpu/tests/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/tests/.kunitconfig
[14:10:00] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [14:10:04] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48 [14:10:24] Starting KUnit Kernel (1/1)... [14:10:24] ============================================================ Running tests with: $ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt [14:10:24] ============= refcount_interrupt (4 subtests) ============== [14:10:24] [PASSED] test_single_irq_change [14:10:24] [PASSED] test_nested_irq_change [14:10:24] [PASSED] test_multiple_irq_change [14:10:24] [PASSED] test_irq_save [14:10:24] =============== [PASSED] refcount_interrupt ================ [14:10:24] ================= gpu_buddy (14 subtests) ================== [14:10:24] [PASSED] gpu_test_buddy_alloc_limit [14:10:24] [PASSED] gpu_test_buddy_alloc_optimistic [14:10:24] [PASSED] gpu_test_buddy_alloc_pessimistic [14:10:24] [PASSED] gpu_test_buddy_alloc_pathological [14:10:24] [PASSED] gpu_test_buddy_alloc_contiguous [14:10:24] [PASSED] gpu_test_buddy_alloc_clear [14:10:24] [PASSED] gpu_test_buddy_alloc_range [14:10:25] [PASSED] gpu_test_buddy_alloc_range_bias [14:10:25] [PASSED] gpu_test_buddy_fragmentation_performance [14:10:26] [PASSED] gpu_test_buddy_dirty_tracker_performance [14:10:26] [PASSED] gpu_test_buddy_alloc_exceeds_max_order [14:10:26] [PASSED] gpu_test_buddy_offset_aligned_allocation [14:10:26] [PASSED] gpu_test_buddy_subtree_offset_alignment_stress [14:10:26] [PASSED] gpu_test_buddy_addr_to_block [14:10:26] ==================== [PASSED] gpu_buddy ==================== [14:10:26] ============================================================ [14:10:26] Testing complete. Ran 18 tests: passed: 18 [14:10:26] Elapsed time: 26.232s total, 4.401s configuring, 19.913s building, 1.863s running
+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/gpu/drm/xe/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
ERROR:root:../drivers/gpu/drm/xe/xe_access_counter.c: In function ‘xe_access_counter_service’:../drivers/gpu/drm/xe/xe_access_counter.c:217:25: error: implicit declaration of function ‘xe_svm_range_find_first’; did you mean ‘xe_svm_range_find_or_insert’? [-Werror=implicit-function-declaration]
217 | range = xe_svm_range_find_first(vm, hint_va, min(xe_vma_end(vma), gran_end));
| ^~~~~~~~~~~~~~~~~~~~~~~
| xe_svm_range_find_or_insert../drivers/gpu/drm/xe/xe_access_counter.c:217:23: warning: assignment to ‘struct xe_svm_range *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
217 | range = xe_svm_range_find_first(vm, hint_va, min(xe_vma_end(vma), gran_end));
| ^../drivers/gpu/drm/xe/xe_access_counter.c:223:23: error: implicit declaration of function ‘xe_svm_range_setup’; did you mean ‘xe_svm_range_debug’? [-Werror=implicit-function-declaration]
223 | err = xe_svm_range_setup(vm, vma, NULL, gt, xe_svm_range_start(range),
| ^~~~~~~~~~~~~~~~~~
| xe_svm_range_debug../drivers/gpu/drm/xe/xe_access_counter.c:225:50: error: ‘struct xe_svm_range_setup_flags’ has no member named ‘atomic’
225 | .atomic = false,
| ^~~~~~../drivers/gpu/drm/xe/xe_access_counter.c:225:59: warning: excess elements in struct initializer
225 | .atomic = false,
| ^~~~~../drivers/gpu/drm/xe/xe_access_counter.c:225:59: note: (near initialization for ‘(anonymous)’) ../drivers/gpu/drm/xe/xe_access_counter.c:226:50: error: ‘struct xe_svm_range_setup_flags’ has no member named ‘acc_ctr_trigger’
226 | .acc_ctr_trigger = true,
| ^~~~~~~~~~~~~~~../drivers/gpu/drm/xe/xe_access_counter.c:226:68: warning: excess elements in struct initializer
226 | .acc_ctr_trigger = true,
| ^~~~../drivers/gpu/drm/xe/xe_access_counter.c:226:68: note: (near initialization for ‘(anonymous)’) ../drivers/gpu/drm/xe/xe_access_counter.c:224:76: error: invalid use of undefined type ‘struct xe_svm_range_setup_flags’
224 | (struct xe_svm_range_setup_flags) {
| ^
cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:290: drivers/gpu/drm/xe/xe_access_counter.o] Error 1
make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:551: drivers/gpu/drm/xe] Error 2
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [../scripts/Makefile.build:551: drivers/gpu/drm] Error 2
make[4]: *** [../scripts/Makefile.build:551: drivers/gpu] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:551: drivers] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/kernel/Makefile:2229: .] Error 2
make[1]: *** [/kernel/Makefile:248: __sub-make] Error 2
make: *** [Makefile:248: __sub-make] Error 2
[14:10:26] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [14:10:28] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48 + cleanup ++ stat -c %u:%g /kernel + chown -R 1003:1003 /kernel