Skip to contentSkip to conversation

Associate dma_fence and amdpgu tracepoints

PATCH Applied Andres Rodriguez 3 participants 11 messages Feb 24, 2017 – Mar 8, 2017 8 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This patch series is an meant to supersede:
drm/amdgpu: trace amdgpu_job fence details

It uses a different approach of tracking through the scheduler fence instead of the amdgpu job fence.

The difference between using these two fences account for a maximum of 1us of latency as measured by ftrace. E.g.:

<idle>-0     [002] d.h.    69.073015: dma_fence_signaled: driver=amdgpu timeline=gfx context=1 seqno=4616
<idle>-0     [002] d.h.    69.073016: dma_fence_signaled: driver=amd_sched timeline=gfx context=591 seqno=3558

In most cases the difference is 0us. I don't think this issue will be a concern on our current time scales.

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170224182058.5810-1-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/2 drm/amdgpu: make trace format uniform csv name=value

Most of the traces have uniform format except for two of them. Having all the traces match makes it simple to run awk on the ftrace output.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +2 -2
index a18ae1e..01623d1 100644
@@ -142,7 +142,7 @@ TRACE_EVENT(amdgpu_sched_run_job,
 			   __entry->ring_name = job->ring->name;
 			   __entry->num_ibs = job->num_ibs;
 			   ),
-	    TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u",
+	    TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name=%s, num_ibs=%u",
 		      __entry->adev, __entry->sched_job, __entry->ib,
 		      __entry->fence, __entry->ring_name, __entry->num_ibs)
 );
@@ -359,7 +359,7 @@ TRACE_EVENT(amdgpu_ttm_bo_move,
 			__entry->new_placement = new_placement;
 			__entry->old_placement = old_placement;
 			),
-	    TP_printk("bo=%p from:%d to %d with size = %Ld",
+	    TP_printk("bo=%p, from=%d, to=%d, size=%Ld",
 			__entry->bo, __entry->old_placement,
 			__entry->new_placement, __entry->bo_size)
 );
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170224182058.5810-2-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 1/2] drm/amdgpu: make trace format uniform csv name=value

Am 24.02.2017 um 19:20 schrieb Andres Rodriguez:

Quoted 4 lines

Most of the traces have uniform format except for two of them. Having all the traces match makes it simple to run awk on the ftrace output.

Quoted 18 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -1
index a18ae1e..01623d1 100644
@@ -142,7 +142,7 @@ TRACE_EVENT(amdgpu_sched_run_job,
  			   __entry->ring_name = job->ring->name;
  			   __entry->num_ibs = job->num_ibs;
  			   ),
-	    TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u",
+	    TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name=%s, num_ibs=%u",
  		      __entry->adev, __entry->sched_job, __entry->ib,
  		      __entry->fence, __entry->ring_name, __entry->num_ibs)
  );

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_ttm_bo_move, · line 365

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -1
@@ -359,7 +359,7 @@ TRACE_EVENT(amdgpu_ttm_bo_move,
  			__entry->new_placement = new_placement;
  			__entry->old_placement = old_placement;
  			),
-	    TP_printk("bo=%p from:%d to %d with size = %Ld",
+	    TP_printk("bo=%p, from=%d, to=%d, size=%Ld",
  			__entry->bo, __entry->old_placement,
  			__entry->new_placement, __entry->bo_size)
  );

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 08c72655-a04e-1524-33d4-178a6b76d20d-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Applied
#6 lore raw

Re: [PATCH 1/2] drm/amdgpu: make trace format uniform csv name=value

Quoted 9 lines · Christian König

Am 24.02.2017 um 19:20 schrieb Andres Rodriguez:

Quoted 5 lines

Most of the traces have uniform format except for two of them. Having all the traces match makes it simple to run awk on the ftrace output.

Applied. thanks!

Alex

Quoted 31 lines
Quoted 31 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -1
index a18ae1e..01623d1 100644
@@ -142,7 +142,7 @@ TRACE_EVENT(amdgpu_sched_run_job,
                           __entry->ring_name = job->ring->name;
                           __entry->num_ibs = job->num_ibs;
                           ),
-           TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p,
 ring name:%s, num_ibs:%u",
+           TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p,
 ring name=%s, num_ibs=%u",
                      __entry->adev, __entry->sched_job, __entry->ib,
                      __entry->fence, __entry->ring_name,

__entry->num_ibs)
);

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -1
@@ -359,7 +359,7 @@ TRACE_EVENT(amdgpu_ttm_bo_move,
                        __entry->new_placement = new_placement;
                        __entry->old_placement = old_placement;
                        ),
-           TP_printk("bo=%p from:%d to %d with size = %Ld",
+           TP_printk("bo=%p, from=%d, to=%d, size=%Ld",
                        __entry->bo, __entry->old_placement,
                        __entry->new_placement, __entry->bo_size)
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_ttm_bo_move, · line 365

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +0 -0
  );

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw

PATCH 2/2 drm/amdgpu: trace fence details in amdgpu_sched_run_job

In reply to a message not in the archive

This information is intended to provide the required data to associate amdgpu tracepoints with their corresponding dma_fence_* events.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +9 -2
index 01623d1..cc9a31d 100644
@@ -130,6 +130,9 @@ TRACE_EVENT(amdgpu_sched_run_job,
 			     __field(struct amd_sched_job *, sched_job)
 			     __field(struct amdgpu_ib *, ib)
 			     __field(struct dma_fence *, fence)
+			     __string(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+			     __field(unsigned int, context)
+			     __field(unsigned int, seqno)
 			     __field(char *, ring_name)
 			     __field(u32, num_ibs)
 			     ),
@@ -139,12 +142,16 @@ TRACE_EVENT(amdgpu_sched_run_job,
 			   __entry->sched_job = &job->base;
 			   __entry->ib = job->ibs;
 			   __entry->fence = &job->base.s_fence->finished;
+			   __assign_str(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+			   __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("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name=%s, num_ibs=%u",
+	    TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, timeline=%s, context=%u, seqno=%u, ring name=%s, num_ibs=%u",
 		      __entry->adev, __entry->sched_job, __entry->ib,
-		      __entry->fence, __entry->ring_name, __entry->num_ibs)
+		      __entry->fence, __get_str(timeline), __entry->context, __entry->seqno,
+		      __entry->ring_name, __entry->num_ibs)
 );
 
 
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170224182058.5810-3-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#9 lore raw

Re: [PATCH 2/2] drm/amdgpu: trace fence details in amdgpu_sched_run_job

Am 24.02.2017 um 19:20 schrieb Andres Rodriguez:

Quoted 23 lines

This information is intended to provide the required data to associate amdgpu tracepoints with their corresponding dma_fence_* events.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3 -0
index 01623d1..cc9a31d 100644
@@ -130,6 +130,9 @@ TRACE_EVENT(amdgpu_sched_run_job,
  			     __field(struct amd_sched_job *, sched_job)
  			     __field(struct amdgpu_ib *, ib)
  			     __field(struct dma_fence *, fence)
+			     __string(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+			     __field(unsigned int, context)
+			     __field(unsigned int, seqno)
  			     __field(char *, ring_name)
  			     __field(u32, num_ibs)
  			     ),

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_sched_run_job, · line 145

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -0
@@ -139,12 +142,16 @@ TRACE_EVENT(amdgpu_sched_run_job,
  			   __entry->sched_job = &job->base;
  			   __entry->ib = job->ibs;
  			   __entry->fence = &job->base.s_fence->finished;
+			   __assign_str(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))

Not 100% sure, but we might be able to use a char * field here instead of the extra overhead of embedding a string, the timeline names are never freed IIRC.

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_sched_run_job, · line 151

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3 -1
+			   __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("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name=%s, num_ibs=%u",
+	    TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, timeline=%s, context=%u, seqno=%u, ring name=%s, num_ibs=%u",

If you have time for another patch please drop the pinters here as well. Scheduler job, IBs and fence are all heavily reallocated (sometimes even with a slab allocator). So the pointers are completely meaningless. The adev pointer is superseded by the timeline name and context numbers.

Anyway that should be done in an extra patch, so this one is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_sched_run_job, · line 157

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +2 -1
  		      __entry->adev, __entry->sched_job, __entry->ib,
-		      __entry->fence, __entry->ring_name, __entry->num_ibs)
+		      __entry->fence, __get_str(timeline), __entry->context, __entry->seqno,
+		      __entry->ring_name, __entry->num_ibs)
  );
 
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): dbc8d447-2423-9524-4e38-e4b87022e4db-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#11 lore raw

Re: [PATCH 2/2] drm/amdgpu: trace fence details in amdgpu_sched_run_job

On Feb 25, 2017 4:40 AM, "Christian König" <[email protected]> wrote:

Am 24.02.2017 um 19:20 schrieb Andres Rodriguez:

Quoted 30 lines

This information is intended to provide the required data to associate amdgpu tracepoints with their corresponding dma_fence_* events.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -0
index 01623d1..cc9a31d 100644
@@ -130,6 +130,9 @@ TRACE_EVENT(amdgpu_sched_run_job,
                             __field(struct amd_sched_job *, sched_job)
                             __field(struct amdgpu_ib *, ib)
                             __field(struct dma_fence *, fence)
+                            __string(timeline,

job->base.s_fence->finished.ops->get_timeline_name(&job->bas e.s_fence->finished))

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3 -0
+                            __field(unsigned int, context)
+                            __field(unsigned int, seqno)
                             __field(char *, ring_name)
                             __field(u32, num_ibs)
                             ),
@@ -139,12 +142,16 @@ TRACE_EVENT(amdgpu_sched_run_job,
                           __entry->sched_job = &job->base;
                           __entry->ib = job->ibs;
                           __entry->fence = &job->base.s_fence->finished;
+                          __assign_str(timeline,
Quoted 3 lines

job->base.s_fence->finished.ops->get_timeline_name(&job->bas e.s_fence->finished))

Not 100% sure, but we might be able to use a char * field here instead of the extra overhead of embedding a string, the timeline names are never freed IIRC.

I'll give this a try.

+ __entry->context = job->base.s_fence->finished.co

Quoted 11 lines

ntext;
+ __entry->seqno = job->base.s_fence->finished.se

qno;
                           __entry->ring_name = job->ring->name;
                           __entry->num_ibs = job->num_ibs;
                           ),

- TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p,
ring name=%s, num_ibs=%u",
+ TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p,
timeline=%s, context=%u, seqno=%u, ring name=%s, num_ibs=%u",

If you have time for another patch please drop the pinters here as well. Scheduler job, IBs and fence are all heavily reallocated (sometimes even with a slab allocator). So the pointers are completely meaningless. The adev pointer is superseded by the timeline name and context numbers.

The pointers do provide some useful data. But you need to make sure you read it in between an allocation event and a fence signal event. It is extremely terrible for reading from a trace text file.

How do you feel about if we replaced the job pointer with a job id, and replaced the fence pointers with the fence data?

Anyway that should be done in an extra patch, so this one is Reviewed-by:
Christian König <[email protected]>.

Regards,
Christian.

                      __entry->adev, __entry->sched_job, __entry->ib,
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -1
-                     __entry->fence, __entry->ring_name, __entry->num_ibs)
+                     __entry->fence, __get_str(timeline),

__entry->context, __entry->seqno,
+ __entry->ring_name, __entry->num_ibs)
);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CAFQ_0eET-ydfJyFthnGOR-3-q9ZD8dev=C0eM1dfZHC8vpyXWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#13 lore raw

Re: [PATCH 2/2] drm/amdgpu: trace fence details in amdgpu_sched_run_job

Am 25.02.2017 um 18:28 schrieb Andres Rodriguez:

Quoted 65 lines · On Feb 25, 2017 4:40 AM, "Christian König"…
    Am 24.02.2017 um 19:20 schrieb Andres Rodriguez:

        This information is intended to provide the required data to
        associate
        amdgpu tracepoints with their corresponding dma_fence_* events.

        Signed-off-by: Andres Rodriguez <[email protected]
        <mailto:[email protected]>>
        ---
          drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 11 +++++++++--
          1 file changed, 9 insertions(+), 2 deletions(-)

        diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
        b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
        index 01623d1..cc9a31d 100644
        --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
        +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
        @@ -130,6 +130,9 @@ TRACE_EVENT(amdgpu_sched_run_job,
                                     __field(struct amd_sched_job *,
        sched_job)
                                     __field(struct amdgpu_ib *, ib)
                                     __field(struct dma_fence *, fence)
        +                            __string(timeline,
        job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
        +                            __field(unsigned int, context)
        +                            __field(unsigned int, seqno)
                                     __field(char *, ring_name)
                                     __field(u32, num_ibs)
                                     ),
        @@ -139,12 +142,16 @@ TRACE_EVENT(amdgpu_sched_run_job,
                                   __entry->sched_job = &job->base;
                                   __entry->ib = job->ibs;
                                   __entry->fence =
        &job->base.s_fence->finished;
        +                          __assign_str(timeline,
        job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))


    Not 100% sure, but we might be able to use a char * field here
    instead of the extra overhead of embedding a string, the timeline
    names are never freed IIRC.

I'll give this a try.

+ __entry->context =
job->base.s_fence->finished.co <http://finished.co>ntext;
+ __entry->seqno =
job->base.s_fence->finished.se <http://finished.se>qno;
__entry->ring_name = job->ring->name; __entry->num_ibs = job->num_ibs; ),
- TP_printk("adev=%p, sched_job=%p, first ib=%p,
sched fence=%p, ring name=%s, num_ibs=%u",
+ TP_printk("adev=%p, sched_job=%p, first ib=%p,
sched fence=%p, timeline=%s, context=%u, seqno=%u, ring name=%s, num_ibs=%u",

Quoted 8 lines

If you have time for another patch please drop the pinters here as well. Scheduler job, IBs and fence are all heavily reallocated (sometimes even with a slab allocator). So the pointers are completely meaningless. The adev pointer is superseded by the timeline name and context numbers.

The pointers do provide some useful data. But you need to make sure you read it in between an allocation event and a fence signal event. It is extremely terrible for reading from a trace text file.

Yeah, that's why I try to avoid them in the trace files.

Additional to that the adev pointer is 8 bytes and pretty much meaningless in the trace file, but the PCI bus number is only 4 bytes IIRC and really easy to related to other log messages.

Quoted 2 lines

How do you feel about if we replaced the job pointer with a job id, and replaced the fence pointers with the fence data?

Mostly sounds like a plan to me. I would just try to get away from trying to use the job to identify a command submission.

Instead use the scheduler fence for this. The difference is that we create the job structure early during command submission, but the scheduler fence only when the command submission is actually successfully and not interrupted by a signal.

So a job id would contain a bunch of numbers which are never submitted. Especially for the X server that is usually rather annoying in the logs.

Regards,
Christian.

Quoted 9 lines

Anyway that should be done in an extra patch, so this one is

<mailto:[email protected]>>.

Regards,
Christian.

Quoted 12 lines

__entry->adev, __entry->sched_job,
__entry->ib,
- __entry->fence, __entry->ring_name,
__entry->num_ibs)
+ __entry->fence, __get_str(timeline),
__entry->context, __entry->seqno,
+ __entry->ring_name, __entry->num_ibs)
);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 2044a656-bdd4-25b7-0710-48d4a8ed11f9-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#15 lore raw

Re: [PATCH 2/2] drm/amdgpu: trace fence details in amdgpu_sched_run_job

Is this patch ready to land or is there more work required?

Thanks,

Alex

Quoted 122 lines · Christian König

Am 25.02.2017 um 18:28 schrieb Andres Rodriguez:

On Feb 25, 2017 4:40 AM, "Christian König" <[email protected]> wrote:

Am 24.02.2017 um 19:20 schrieb Andres Rodriguez:

Quoted 26 lines

This information is intended to provide the required data to associate amdgpu tracepoints with their corresponding dma_fence_* events.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3 -0
index 01623d1..cc9a31d 100644
@@ -130,6 +130,9 @@ TRACE_EVENT(amdgpu_sched_run_job,
                             __field(struct amd_sched_job *, sched_job)
                             __field(struct amdgpu_ib *, ib)
                             __field(struct dma_fence *, fence)
+                            __string(timeline,
 job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+                            __field(unsigned int, context)
+                            __field(unsigned int, seqno)
                             __field(char *, ring_name)
                             __field(u32, num_ibs)
                             ),

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_sched_run_job, · line 146

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -0
@@ -139,12 +142,16 @@ TRACE_EVENT(amdgpu_sched_run_job,
                           __entry->sched_job = &job->base;
                           __entry->ib = job->ibs;
                           __entry->fence = &job->base.s_fence->finished;
+                          __assign_str(timeline,
 job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))

Not 100% sure, but we might be able to use a char * field here instead of the extra overhead of embedding a string, the timeline names are never freed IIRC.

I'll give this a try.

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_sched_run_job, · line 156

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3 -1
+                          __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("adev=%p, sched_job=%p, first ib=%p, sched fence=%p,
 ring name=%s, num_ibs=%u",
+           TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p,
 timeline=%s, context=%u, seqno=%u, ring name=%s, num_ibs=%u",

If you have time for another patch please drop the pinters here as well. Scheduler job, IBs and fence are all heavily reallocated (sometimes even with a slab allocator). So the pointers are completely meaningless. The adev pointer is superseded by the timeline name and context numbers.

The pointers do provide some useful data. But you need to make sure you read it in between an allocation event and a fence signal event. It is extremely terrible for reading from a trace text file.

Yeah, that's why I try to avoid them in the trace files.

Additional to that the adev pointer is 8 bytes and pretty much meaningless in the trace file, but the PCI bus number is only 4 bytes IIRC and really easy to related to other log messages.

How do you feel about if we replaced the job pointer with a job id, and replaced the fence pointers with the fence data?

Mostly sounds like a plan to me. I would just try to get away from trying to use the job to identify a command submission.

Instead use the scheduler fence for this. The difference is that we create the job structure early during command submission, but the scheduler fence only when the command submission is actually successfully and not interrupted by a signal.

So a job id would contain a bunch of numbers which are never submitted. Especially for the X server that is usually rather annoying in the logs.

Regards,
Christian.

Anyway that should be done in an extra patch, so this one is Reviewed-by:
Christian König <[email protected]>.

Regards,
Christian.

Quoted 8 lines
                      __entry->adev, __entry->sched_job, __entry->ib,

- __entry->fence, __entry->ring_name,
__entry->num_ibs)
+ __entry->fence, __get_str(timeline),
__entry->context, __entry->seqno,
+ __entry->ring_name, __entry->num_ibs)
);

Quoted 5 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_OfX=-wAkcRMh3+C-UmypR8p3JMy0hhV+-qFmqdJd+YxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Applied
#18 lore raw

Re: [PATCH 2/2] drm/amdgpu: trace fence details in amdgpu_sched_run_job

In reply to a message not in the archive
Quoted 51 lines · Christian König

Am 24.02.2017 um 19:20 schrieb Andres Rodriguez:

Quoted 26 lines

This information is intended to provide the required data to associate amdgpu tracepoints with their corresponding dma_fence_* events.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3 -0
index 01623d1..cc9a31d 100644
@@ -130,6 +130,9 @@ TRACE_EVENT(amdgpu_sched_run_job,
                             __field(struct amd_sched_job *, sched_job)
                             __field(struct amdgpu_ib *, ib)
                             __field(struct dma_fence *, fence)
+                            __string(timeline,
 job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
+                            __field(unsigned int, context)
+                            __field(unsigned int, seqno)
                             __field(char *, ring_name)
                             __field(u32, num_ibs)
                             ),

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_sched_run_job, · line 146

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +1 -0
@@ -139,12 +142,16 @@ TRACE_EVENT(amdgpu_sched_run_job,
                           __entry->sched_job = &job->base;
                           __entry->ib = job->ibs;
                           __entry->fence = &job->base.s_fence->finished;
+                          __assign_str(timeline,
 job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))

Not 100% sure, but we might be able to use a char * field here instead of the extra overhead of embedding a string, the timeline names are never freed IIRC.

drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h TRACE_EVENT(amdgpu_sched_run_job, · line 156

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3 -1
+                          __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("adev=%p, sched_job=%p, first ib=%p, sched fence=%p,
 ring name=%s, num_ibs=%u",
+           TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p,
 timeline=%s, context=%u, seqno=%u, ring name=%s, num_ibs=%u",
Quoted 7 lines

If you have time for another patch please drop the pinters here as well. Scheduler job, IBs and fence are all heavily reallocated (sometimes even with a slab allocator). So the pointers are completely meaningless. The adev pointer is superseded by the timeline name and context numbers.

Anyway that should be done in an extra patch, so this one is Reviewed-by:
Christian König <[email protected]>.

Applied. thanks!

Alex

Quoted 15 lines

Regards,
Christian.

Quoted 8 lines
                      __entry->adev, __entry->sched_job, __entry->ib,

- __entry->fence, __entry->ring_name,
__entry->num_ibs)
+ __entry->fence, __get_str(timeline),
__entry->context, __entry->seqno,
+ __entry->ring_name, __entry->num_ibs)
);

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx