blob: 0789e8d0a0e1e9db57ab493107e73ad8101d52cc [file] [log] [blame]
Alex Deucher9ce6aae2017-11-30 21:29:47 -05001/*
2 * Copyright 2017 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 */
23
Chunming Zhou353da3c2015-09-07 16:06:53 +080024#if !defined(_GPU_SCHED_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
25#define _GPU_SCHED_TRACE_H_
26
27#include <linux/stringify.h>
28#include <linux/types.h>
29#include <linux/tracepoint.h>
30
31#include <drm/drmP.h>
32
33#undef TRACE_SYSTEM
Lucas Stach1b1f42d2017-12-06 17:49:39 +010034#define TRACE_SYSTEM gpu_scheduler
35#define TRACE_INCLUDE_FILE gpu_scheduler_trace
Chunming Zhou353da3c2015-09-07 16:06:53 +080036
Lucas Stach1b1f42d2017-12-06 17:49:39 +010037TRACE_EVENT(drm_sched_job,
38 TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity),
Andrey Grodzovskya4176cb2017-10-24 13:30:16 -040039 TP_ARGS(sched_job, entity),
Chunming Zhou353da3c2015-09-07 16:06:53 +080040 TP_STRUCT__entry(
Lucas Stach1b1f42d2017-12-06 17:49:39 +010041 __field(struct drm_sched_entity *, entity)
Chris Wilsonf54d1862016-10-25 13:00:45 +010042 __field(struct dma_fence *, fence)
Christian König4f839a22015-09-08 20:22:31 +020043 __field(const char *, name)
Nicolai Hähnleeabd76c2017-06-13 22:12:38 +020044 __field(uint64_t, id)
Chunming Zhou353da3c2015-09-07 16:06:53 +080045 __field(u32, job_count)
46 __field(int, hw_job_count)
47 ),
48
49 TP_fast_assign(
Andrey Grodzovskya4176cb2017-10-24 13:30:16 -040050 __entry->entity = entity;
Nicolai Hähnleeabd76c2017-06-13 22:12:38 +020051 __entry->id = sched_job->id;
Christian König6fc13672016-05-20 12:53:52 +020052 __entry->fence = &sched_job->s_fence->finished;
Christian König4f839a22015-09-08 20:22:31 +020053 __entry->name = sched_job->sched->name;
Andrey Grodzovskya4176cb2017-10-24 13:30:16 -040054 __entry->job_count = spsc_queue_count(&entity->job_queue);
Chunming Zhou353da3c2015-09-07 16:06:53 +080055 __entry->hw_job_count = atomic_read(
56 &sched_job->sched->hw_rq_count);
57 ),
Nicolai Hähnleeabd76c2017-06-13 22:12:38 +020058 TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d",
59 __entry->entity, __entry->id,
60 __entry->fence, __entry->name,
Chunming Zhou7034dec2015-11-11 14:56:00 +080061 __entry->job_count, __entry->hw_job_count)
Chunming Zhou353da3c2015-09-07 16:06:53 +080062);
Chunming Zhou7034dec2015-11-11 14:56:00 +080063
Lucas Stach1b1f42d2017-12-06 17:49:39 +010064TRACE_EVENT(drm_sched_process_job,
65 TP_PROTO(struct drm_sched_fence *fence),
Chunming Zhou7034dec2015-11-11 14:56:00 +080066 TP_ARGS(fence),
67 TP_STRUCT__entry(
Chris Wilsonf54d1862016-10-25 13:00:45 +010068 __field(struct dma_fence *, fence)
Chunming Zhou7034dec2015-11-11 14:56:00 +080069 ),
70
71 TP_fast_assign(
Christian König6fc13672016-05-20 12:53:52 +020072 __entry->fence = &fence->finished;
Chunming Zhou7034dec2015-11-11 14:56:00 +080073 ),
74 TP_printk("fence=%p signaled", __entry->fence)
75);
76
Chunming Zhou353da3c2015-09-07 16:06:53 +080077#endif
78
79/* This part must be outside protection */
80#undef TRACE_INCLUDE_PATH
81#define TRACE_INCLUDE_PATH .
82#include <trace/define_trace.h>