drm/amdgpu: trace allocated PASIDs
authorChristian König <christian.koenig@amd.com>
Tue, 9 Jan 2018 18:32:58 +0000 (19:32 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:17:46 +0000 (14:17 -0500)
Trace all allocated PASIDs.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h

index 842caa5..3b9d318 100644 (file)
@@ -69,6 +69,9 @@ int amdgpu_pasid_alloc(unsigned int bits)
                        break;
        }
 
+       if (pasid >= 0)
+               trace_amdgpu_pasid_allocated(pasid);
+
        return pasid;
 }
 
@@ -78,6 +81,7 @@ int amdgpu_pasid_alloc(unsigned int bits)
  */
 void amdgpu_pasid_free(unsigned int pasid)
 {
+       trace_amdgpu_pasid_freed(pasid);
        ida_simple_remove(&amdgpu_pasid_ida, pasid);
 }
 
index 251ca92..567a437 100644 (file)
@@ -378,6 +378,28 @@ TRACE_EVENT(amdgpu_vm_flush,
                      __entry->vm_hub,__entry->pd_addr)
 );
 
+DECLARE_EVENT_CLASS(amdgpu_pasid,
+           TP_PROTO(unsigned pasid),
+           TP_ARGS(pasid),
+           TP_STRUCT__entry(
+                            __field(unsigned, pasid)
+                            ),
+           TP_fast_assign(
+                          __entry->pasid = pasid;
+                          ),
+           TP_printk("pasid=%u", __entry->pasid)
+);
+
+DEFINE_EVENT(amdgpu_pasid, amdgpu_pasid_allocated,
+           TP_PROTO(unsigned pasid),
+           TP_ARGS(pasid)
+);
+
+DEFINE_EVENT(amdgpu_pasid, amdgpu_pasid_freed,
+           TP_PROTO(unsigned pasid),
+           TP_ARGS(pasid)
+);
+
 TRACE_EVENT(amdgpu_bo_list_set,
            TP_PROTO(struct amdgpu_bo_list *list, struct amdgpu_bo *bo),
            TP_ARGS(list, bo),