[RFC] drm/amdgpu: add macro to retrieve timeline name

Christian K├Ânig deathsimple at vodafone.de
Sat Mar 11 07:11:28 UTC 2017


Am 10.03.2017 um 22:32 schrieb Andres Rodriguez:
> This helps de-duplicate a long expression and removes overly long lines.
>
> Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
> index 88e1704..f952b59 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
> @@ -4,20 +4,23 @@
>   #include <linux/stringify.h>
>   #include <linux/types.h>
>   #include <linux/tracepoint.h>
>   
>   #include <drm/drmP.h>
>   
>   #undef TRACE_SYSTEM
>   #define TRACE_SYSTEM amdgpu
>   #define TRACE_INCLUDE_FILE amdgpu_trace
>   
> +#define amdgpu_get_job_timeline_name(job) \
> +	 job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished)

Please call that AMDGPU_JOB_GET_TIMELINE_NAME and undef the macro at the 
end of the file.

Apart from that looks like a good idea to me.

Christian.

> +
>   TRACE_EVENT(amdgpu_mm_rreg,
>   	    TP_PROTO(unsigned did, uint32_t reg, uint32_t value),
>   	    TP_ARGS(did, reg, value),
>   	    TP_STRUCT__entry(
>   				__field(unsigned, did)
>   				__field(uint32_t, reg)
>   				__field(uint32_t, value)
>   			    ),
>   	    TP_fast_assign(
>   			   __entry->did = did;
> @@ -95,56 +98,56 @@ TRACE_EVENT(amdgpu_cs,
>   	    TP_printk("bo_list=%p, ring=%u, dw=%u, fences=%u",
>   		      __entry->bo_list, __entry->ring, __entry->dw,
>   		      __entry->fences)
>   );
>   
>   TRACE_EVENT(amdgpu_cs_ioctl,
>   	    TP_PROTO(struct amdgpu_job *job),
>   	    TP_ARGS(job),
>   	    TP_STRUCT__entry(
>   			     __field(uint64_t, sched_job_id)
> -			     __string(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
> +			     __string(timeline, amdgpu_get_job_timeline_name(job))
>   			     __field(unsigned int, context)
>   			     __field(unsigned int, seqno)
>   			     __field(struct dma_fence *, fence)
>   			     __field(char *, ring_name)
>   			     __field(u32, num_ibs)
>   			     ),
>   
>   	    TP_fast_assign(
>   			   __entry->sched_job_id = job->base.id;
> -			   __assign_str(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
> +			   __assign_str(timeline, amdgpu_get_job_timeline_name(job))
>   			   __entry->context = job->base.s_fence->finished.context;
>   			   __entry->seqno = job->base.s_fence->finished.seqno;
>   			   __entry->ring_name = job->ring->name;
>   			   __entry->num_ibs = job->num_ibs;
>   			   ),
>   	    TP_printk("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u",
>   		      __entry->sched_job_id, __get_str(timeline), __entry->context,
>   		      __entry->seqno, __entry->ring_name, __entry->num_ibs)
>   );
>   
>   TRACE_EVENT(amdgpu_sched_run_job,
>   	    TP_PROTO(struct amdgpu_job *job),
>   	    TP_ARGS(job),
>   	    TP_STRUCT__entry(
>   			     __field(uint64_t, sched_job_id)
> -			     __string(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
> +			     __string(timeline, amdgpu_get_job_timeline_name(job))
>   			     __field(unsigned int, context)
>   			     __field(unsigned int, seqno)
>   			     __field(char *, ring_name)
>   			     __field(u32, num_ibs)
>   			     ),
>   
>   	    TP_fast_assign(
>   			   __entry->sched_job_id = job->base.id;
> -			   __assign_str(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
> +			   __assign_str(timeline, amdgpu_get_job_timeline_name(job))
>   			   __entry->context = job->base.s_fence->finished.context;
>   			   __entry->seqno = job->base.s_fence->finished.seqno;
>   			   __entry->ring_name = job->ring->name;
>   			   __entry->num_ibs = job->num_ibs;
>   			   ),
>   	    TP_printk("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u",
>   		      __entry->sched_job_id, __get_str(timeline), __entry->context,
>   		      __entry->seqno, __entry->ring_name, __entry->num_ibs)
>   );
>   




More information about the amd-gfx mailing list