drm/amdkfd: Track SDMA utilization per process

Track SDMA usage on a per process basis and report it through sysfs.
The value in the sysfs file indicates the amount of time SDMA has
been in-use by this process since the creation of the process.
This value is in microsecond granularity.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Mukul Joshi
2020-05-26 20:06:04 -04:00
committed by Alex Deucher
parent 2cdc9c200c
commit 32cb59f313
4 changed files with 198 additions and 14 deletions

View File

@@ -629,7 +629,14 @@ enum kfd_pdd_bound {
PDD_BOUND_SUSPENDED,
};
#define MAX_VRAM_FILENAME_LEN 11
#define MAX_SYSFS_FILENAME_LEN 11
/*
* SDMA counter runs at 100MHz frequency.
* We display SDMA activity in microsecond granularity in sysfs.
* As a result, the divisor is 100.
*/
#define SDMA_ACTIVITY_DIVISOR 100
/* Data that is per-process-per device. */
struct kfd_process_device {
@@ -677,7 +684,12 @@ struct kfd_process_device {
/* VRAM usage */
uint64_t vram_usage;
struct attribute attr_vram;
char vram_filename[MAX_VRAM_FILENAME_LEN];
char vram_filename[MAX_SYSFS_FILENAME_LEN];
/* SDMA activity tracking */
uint64_t sdma_past_activity_counter;
struct attribute attr_sdma;
char sdma_filename[MAX_SYSFS_FILENAME_LEN];
};
#define qpd_to_pdd(x) container_of(x, struct kfd_process_device, qpd)