aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2017-05-17 14:05:08 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-05-24 18:24:38 -0400
commit68e2c5ffeb164f069692d00659d24dbda31178bc (patch)
tree80174509a262db0c1ca1e0c58c1c578bb51800c8 /drivers/gpu
parent9156e723301c0a7a7def4cde820e018ce791b842 (diff)
drm/amdgpu: add an INFO query for monitoring VRAM CPU page faults
v2: bump the DRM version Signed-off-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c1
4 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 572e508d185f..359fb0ca8209 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1529,6 +1529,7 @@ struct amdgpu_device {
1529 atomic64_t gtt_usage; 1529 atomic64_t gtt_usage;
1530 atomic64_t num_bytes_moved; 1530 atomic64_t num_bytes_moved;
1531 atomic64_t num_evictions; 1531 atomic64_t num_evictions;
1532 atomic64_t num_vram_cpu_page_faults;
1532 atomic_t gpu_reset_counter; 1533 atomic_t gpu_reset_counter;
1533 atomic_t vram_lost_counter; 1534 atomic_t vram_lost_counter;
1534 1535
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 1bbf35f02a63..39432b0802f7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -66,9 +66,10 @@
66 * - 3.14.0 - Fix race in amdgpu_ctx_get_fence() and note new functionality 66 * - 3.14.0 - Fix race in amdgpu_ctx_get_fence() and note new functionality
67 * - 3.15.0 - Export more gpu info for gfx9 67 * - 3.15.0 - Export more gpu info for gfx9
68 * - 3.16.0 - Add reserved vmid support 68 * - 3.16.0 - Add reserved vmid support
69 * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
69 */ 70 */
70#define KMS_DRIVER_MAJOR 3 71#define KMS_DRIVER_MAJOR 3
71#define KMS_DRIVER_MINOR 16 72#define KMS_DRIVER_MINOR 17
72#define KMS_DRIVER_PATCHLEVEL 0 73#define KMS_DRIVER_PATCHLEVEL 0
73 74
74int amdgpu_vram_limit = 0; 75int amdgpu_vram_limit = 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index b324f07f137a..cda06a1bd7d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -417,6 +417,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
417 case AMDGPU_INFO_NUM_EVICTIONS: 417 case AMDGPU_INFO_NUM_EVICTIONS:
418 ui64 = atomic64_read(&adev->num_evictions); 418 ui64 = atomic64_read(&adev->num_evictions);
419 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0; 419 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0;
420 case AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS:
421 ui64 = atomic64_read(&adev->num_vram_cpu_page_faults);
422 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0;
420 case AMDGPU_INFO_VRAM_USAGE: 423 case AMDGPU_INFO_VRAM_USAGE:
421 ui64 = atomic64_read(&adev->vram_usage); 424 ui64 = atomic64_read(&adev->vram_usage);
422 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0; 425 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 365883d7948d..8ee69652be8c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -960,6 +960,7 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
960 return -EINVAL; 960 return -EINVAL;
961 961
962 /* hurrah the memory is not visible ! */ 962 /* hurrah the memory is not visible ! */
963 atomic64_inc(&adev->num_vram_cpu_page_faults);
963 amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM); 964 amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM);
964 lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT; 965 lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
965 for (i = 0; i < abo->placement.num_placement; i++) { 966 for (i = 0; i < abo->placement.num_placement; i++) {