Commit 24b52db6 authored by Matthew Brost's avatar Matthew Brost Committed by Rodrigo Vivi

drm/xe: Add TLB invalidation fence ftrace

This will help debug issues with TLB invalidation fences.
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent c6b0948f
......@@ -7,6 +7,7 @@
#include "xe_gt_tlb_invalidation.h"
#include "xe_guc.h"
#include "xe_guc_ct.h"
#include "xe_trace.h"
static struct xe_gt *
guc_to_gt(struct xe_guc *guc)
......@@ -82,6 +83,7 @@ static int send_tlb_invalidation(struct xe_guc *guc,
fence->seqno = seqno;
list_add_tail(&fence->link,
&gt->tlb_invalidation.pending_fences);
trace_xe_gt_tlb_invalidation_fence_send(fence);
}
action[1] = seqno;
gt->tlb_invalidation.seqno = (gt->tlb_invalidation.seqno + 1) %
......@@ -194,7 +196,10 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
fence = list_first_entry_or_null(&gt->tlb_invalidation.pending_fences,
typeof(*fence), link);
if (fence)
trace_xe_gt_tlb_invalidation_fence_recv(fence);
if (fence && tlb_invalidation_seqno_past(gt, fence->seqno)) {
trace_xe_gt_tlb_invalidation_fence_signal(fence);
list_del(&fence->link);
dma_fence_signal(&fence->base);
dma_fence_put(&fence->base);
......
......@@ -13,6 +13,7 @@
#include "xe_pt_walk.h"
#include "xe_vm.h"
#include "xe_res_cursor.h"
#include "xe_trace.h"
#include "xe_ttm_stolen_mgr.h"
struct xe_pt_dir {
......@@ -1493,6 +1494,7 @@ static void invalidation_fence_cb(struct dma_fence *fence,
struct invalidation_fence *ifence =
container_of(cb, struct invalidation_fence, cb);
trace_xe_gt_tlb_invalidation_fence_cb(&ifence->base);
queue_work(system_wq, &ifence->work);
dma_fence_put(ifence->fence);
}
......@@ -1502,6 +1504,7 @@ static void invalidation_fence_work_func(struct work_struct *w)
struct invalidation_fence *ifence =
container_of(w, struct invalidation_fence, work);
trace_xe_gt_tlb_invalidation_fence_work_func(&ifence->base);
xe_gt_tlb_invalidation(ifence->gt, &ifence->base);
}
......@@ -1511,6 +1514,8 @@ static int invalidation_fence_init(struct xe_gt *gt,
{
int ret;
trace_xe_gt_tlb_invalidation_fence_create(&ifence->base);
spin_lock_irq(&gt->tlb_invalidation.lock);
dma_fence_init(&ifence->base.base, &invalidation_fence_ops,
&gt->tlb_invalidation.lock,
......
......@@ -16,10 +16,60 @@
#include "xe_engine_types.h"
#include "xe_gpu_scheduler_types.h"
#include "xe_gt_types.h"
#include "xe_gt_tlb_invalidation_types.h"
#include "xe_guc_engine_types.h"
#include "xe_sched_job.h"
#include "xe_vm_types.h"
DECLARE_EVENT_CLASS(xe_gt_tlb_invalidation_fence,
TP_PROTO(struct xe_gt_tlb_invalidation_fence *fence),
TP_ARGS(fence),
TP_STRUCT__entry(
__field(u64, fence)
__field(int, seqno)
),
TP_fast_assign(
__entry->fence = (u64)fence;
__entry->seqno = fence->seqno;
),
TP_printk("fence=0x%016llx, seqno=%d",
__entry->fence, __entry->seqno)
);
DEFINE_EVENT(xe_gt_tlb_invalidation_fence, xe_gt_tlb_invalidation_fence_create,
TP_PROTO(struct xe_gt_tlb_invalidation_fence *fence),
TP_ARGS(fence)
);
DEFINE_EVENT(xe_gt_tlb_invalidation_fence,
xe_gt_tlb_invalidation_fence_work_func,
TP_PROTO(struct xe_gt_tlb_invalidation_fence *fence),
TP_ARGS(fence)
);
DEFINE_EVENT(xe_gt_tlb_invalidation_fence, xe_gt_tlb_invalidation_fence_cb,
TP_PROTO(struct xe_gt_tlb_invalidation_fence *fence),
TP_ARGS(fence)
);
DEFINE_EVENT(xe_gt_tlb_invalidation_fence, xe_gt_tlb_invalidation_fence_send,
TP_PROTO(struct xe_gt_tlb_invalidation_fence *fence),
TP_ARGS(fence)
);
DEFINE_EVENT(xe_gt_tlb_invalidation_fence, xe_gt_tlb_invalidation_fence_recv,
TP_PROTO(struct xe_gt_tlb_invalidation_fence *fence),
TP_ARGS(fence)
);
DEFINE_EVENT(xe_gt_tlb_invalidation_fence, xe_gt_tlb_invalidation_fence_signal,
TP_PROTO(struct xe_gt_tlb_invalidation_fence *fence),
TP_ARGS(fence)
);
DECLARE_EVENT_CLASS(xe_bo,
TP_PROTO(struct xe_bo *bo),
TP_ARGS(bo),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment