mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
drm/xe/svm: Add stats for SVM page faults
Add a new entry in stats to for svm page faults. If CONFIG_DEBUG_FS is
enabled, the count can be viewed with per GT stat debugfs file.
This is similar to what is already in place for vma page faults.
Example output:
cat /sys/kernel/debug/dri/0/gt0/stats
svm_pagefault_count: 6
tlb_inval_count: 78
vma_pagefault_count: 0
vma_pagefault_kb: 0
v2: Fix build with CONFIG_DRM_GPUSVM disabled
v3: Update argument in kernel doc
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250312092749.164232-1-francois.dugast@intel.com
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
This commit is contained in:
parent
459664c98d
commit
80bcbdfc8c
|
|
@ -240,7 +240,7 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
|
|||
atomic = access_is_atomic(pf->access_type);
|
||||
|
||||
if (xe_vma_is_cpu_addr_mirror(vma))
|
||||
err = xe_svm_handle_pagefault(vm, vma, gt_to_tile(gt),
|
||||
err = xe_svm_handle_pagefault(vm, vma, gt,
|
||||
pf->page_addr, atomic);
|
||||
else
|
||||
err = handle_vma_pagefault(gt, vma, atomic);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ void xe_gt_stats_incr(struct xe_gt *gt, const enum xe_gt_stats_id id, int incr)
|
|||
}
|
||||
|
||||
static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = {
|
||||
"svm_pagefault_count",
|
||||
"tlb_inval_count",
|
||||
"vma_pagefault_count",
|
||||
"vma_pagefault_kb",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#define _XE_GT_STATS_TYPES_H_
|
||||
|
||||
enum xe_gt_stats_id {
|
||||
XE_GT_STATS_ID_SVM_PAGEFAULT_COUNT,
|
||||
XE_GT_STATS_ID_TLB_INVAL,
|
||||
XE_GT_STATS_ID_VMA_PAGEFAULT_COUNT,
|
||||
XE_GT_STATS_ID_VMA_PAGEFAULT_KB,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
#include "xe_bo.h"
|
||||
#include "xe_gt_stats.h"
|
||||
#include "xe_gt_tlb_invalidation.h"
|
||||
#include "xe_migrate.h"
|
||||
#include "xe_module.h"
|
||||
|
|
@ -713,7 +714,7 @@ static int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
|
|||
* xe_svm_handle_pagefault() - SVM handle page fault
|
||||
* @vm: The VM.
|
||||
* @vma: The CPU address mirror VMA.
|
||||
* @tile: The tile upon the fault occurred.
|
||||
* @gt: The gt upon the fault occurred.
|
||||
* @fault_addr: The GPU fault address.
|
||||
* @atomic: The fault atomic access bit.
|
||||
*
|
||||
|
|
@ -723,7 +724,7 @@ static int xe_svm_alloc_vram(struct xe_vm *vm, struct xe_tile *tile,
|
|||
* Return: 0 on success, negative error code on error.
|
||||
*/
|
||||
int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
|
||||
struct xe_tile *tile, u64 fault_addr,
|
||||
struct xe_gt *gt, u64 fault_addr,
|
||||
bool atomic)
|
||||
{
|
||||
struct drm_gpusvm_ctx ctx = {
|
||||
|
|
@ -737,12 +738,15 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
|
|||
struct drm_gpusvm_range *r;
|
||||
struct drm_exec exec;
|
||||
struct dma_fence *fence;
|
||||
struct xe_tile *tile = gt_to_tile(gt);
|
||||
ktime_t end = 0;
|
||||
int err;
|
||||
|
||||
lockdep_assert_held_write(&vm->lock);
|
||||
xe_assert(vm->xe, xe_vma_is_cpu_addr_mirror(vma));
|
||||
|
||||
xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_PAGEFAULT_COUNT, 1);
|
||||
|
||||
retry:
|
||||
/* Always process UNMAPs first so view SVM ranges is current */
|
||||
err = xe_svm_garbage_collector(vm);
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@
|
|||
#define XE_INTERCONNECT_VRAM DRM_INTERCONNECT_DRIVER
|
||||
|
||||
struct xe_bo;
|
||||
struct xe_vram_region;
|
||||
struct xe_gt;
|
||||
struct xe_tile;
|
||||
struct xe_vm;
|
||||
struct xe_vma;
|
||||
struct xe_vram_region;
|
||||
|
||||
/** struct xe_svm_range - SVM range */
|
||||
struct xe_svm_range {
|
||||
|
|
@ -64,7 +65,7 @@ void xe_svm_fini(struct xe_vm *vm);
|
|||
void xe_svm_close(struct xe_vm *vm);
|
||||
|
||||
int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
|
||||
struct xe_tile *tile, u64 fault_addr,
|
||||
struct xe_gt *gt, u64 fault_addr,
|
||||
bool atomic);
|
||||
|
||||
bool xe_svm_has_mapping(struct xe_vm *vm, u64 start, u64 end);
|
||||
|
|
@ -102,7 +103,7 @@ void xe_svm_close(struct xe_vm *vm)
|
|||
|
||||
static inline
|
||||
int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
|
||||
struct xe_tile *tile, u64 fault_addr,
|
||||
struct xe_gt *gt, u64 fault_addr,
|
||||
bool atomic)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user