drm/amdkfd: Add process eviction counters to sysfs

Add per-process eviction counters to sysfs to keep track of
how many eviction events have happened for each process.

v2: rename the stats dir, and track all evictions per process, per device.
v3: Simplify the stats kobject handling and cleanup.
v4: more code cleanup

Signed-off-by: Philip Cox <Philip.Cox@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Philip Cox
2020-06-30 15:51:05 -04:00
committed by Alex Deucher
parent 8a491bb31b
commit 4327bed2ff
3 changed files with 116 additions and 1 deletions

View File

@@ -631,7 +631,7 @@ enum kfd_pdd_bound {
PDD_BOUND_SUSPENDED,
};
#define MAX_SYSFS_FILENAME_LEN 11
#define MAX_SYSFS_FILENAME_LEN 15
/*
* SDMA counter runs at 100MHz frequency.
@@ -692,6 +692,13 @@ struct kfd_process_device {
uint64_t sdma_past_activity_counter;
struct attribute attr_sdma;
char sdma_filename[MAX_SYSFS_FILENAME_LEN];
/* Eviction activity tracking */
uint64_t last_evict_timestamp;
atomic64_t evict_duration_counter;
struct attribute attr_evict;
struct kobject *kobj_stats;
};
#define qpd_to_pdd(x) container_of(x, struct kfd_process_device, qpd)