History

drm/amdgpu: add an INFO query for monitoring VRAM CPU page faults

v2: bump the DRM version

Marek Olšák committed 9 years ago

Commit 68e2c5f1 parent 9156e725 files · +9 −1Browse files

Unified · Split

5 files
  1. drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 −0
  2. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 −1
  3. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 −0
  4. drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 −0
  5. include/uapi/drm/amdgpu_drm.h +2 −0
drivers/gpu/drm/amd/amdgpu/amdgpu.h+1−0
@@ -1529,6 +1529,7 @@ struct amdgpu_device { · 1528 unmodified lines
15291529 atomic64_t gtt_usage;
15301530 atomic64_t num_bytes_moved;
15311531 atomic64_t num_evictions;
1532+ atomic64_t num_vram_cpu_page_faults;
15321533 atomic_t gpu_reset_counter;
15331534 atomic_t vram_lost_counter;
15341535
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+2−1
@@ -66,9 +66,10 @@ · 65 unmodified lines
6666 * - 3.14.0 - Fix race in amdgpu_ctx_get_fence() and note new functionality
6767 * - 3.15.0 - Export more gpu info for gfx9
6868 * - 3.16.0 - Add reserved vmid support
69+ * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
6970 */
7071 #define KMS_DRIVER_MAJOR 3
71−#define KMS_DRIVER_MINOR 16
72+#define KMS_DRIVER_MINOR 17
7273 #define KMS_DRIVER_PATCHLEVEL 0
7374
7475 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+3−0
@@ -417,6 +417,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 416 unmodified lines
417417 case AMDGPU_INFO_NUM_EVICTIONS:
418418 ui64 = atomic64_read(&adev->num_evictions);
419419 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;
420423 case AMDGPU_INFO_VRAM_USAGE:
421424 ui64 = atomic64_read(&adev->vram_usage);
422425 return copy_to_user(out, &ui64, min(size, 8u)) ? -EFAULT : 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+1−0
@@ -960,6 +960,7 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo) · 959 unmodified lines
960960 return -EINVAL;
961961
962962 /* hurrah the memory is not visible ! */
963+ atomic64_inc(&adev->num_vram_cpu_page_faults);
963964 amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM);
964965 lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
965966 for (i = 0; i < abo->placement.num_placement; i++) {
include/uapi/drm/amdgpu_drm.h+2−0
@@ -603,6 +603,8 @@ struct drm_amdgpu_cs_chunk_data { · 602 unmodified lines
603603 #define AMDGPU_INFO_SENSOR_VDDNB 0x6
604604 /* Subquery id: Query graphics voltage */
605605 #define AMDGPU_INFO_SENSOR_VDDGFX 0x7
606+/* Number of VRAM page faults on CPU access. */
607+#define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E
606608
607609 #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
608610 #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t