Message ID | 20241114100113.150647-4-pierre-eric.pelloux-prayer@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Improve gpu_scheduler trace events + uAPI | expand |
On Thu, 2024-11-14 at 11:01 +0100, Pierre-Eric Pelloux-Prayer wrote: > Until the switch from kthread to workqueue, Could you include the commit ID here where that happened? "Since switching the scheduler from using kthreads to workqueues in commit 1234 ("foo: bar") userspace applications cannot determine the [...] anymore" > a userspace application could > determine the source device source device of *what*? Should be mentioned. > from the pid of the thread sending the event. nit: s/pid/PID ? > > With workqueues this is not possible anymore, so the event needs to > contain > the dev_name() to identify the device. > > Signed-off-by: Pierre-Eric Pelloux-Prayer > <pierre-eric.pelloux-prayer@amd.com> > --- > drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h > b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h > index c75302ca3427..c4ec28540656 100644 > --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h > +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h > @@ -42,6 +42,7 @@ DECLARE_EVENT_CLASS(drm_sched_job, > __field(uint64_t, id) > __field(u32, job_count) > __field(int, hw_job_count) > + __string(dev, dev_name(sched_job- > >sched->dev)) > ), > > TP_fast_assign( > @@ -52,9 +53,10 @@ DECLARE_EVENT_CLASS(drm_sched_job, > __entry->job_count = > spsc_queue_count(&entity->job_queue); > __entry->hw_job_count = atomic_read( > &sched_job->sched->credit_count); > + __assign_str(dev); > ), > - TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job > count:%u, hw job count:%d", > - __entry->entity, __entry->id, > + TP_printk("dev=%s, entity=%p, id=%llu, fence=%p, > ring=%s, job count:%u, hw job count:%d", > + __get_str(dev), __entry->entity, __entry->id, > __entry->fence, __get_str(name), > __entry->job_count, __entry->hw_job_count) > );
Hi Philipp, Le 15/11/2024 à 16:03, Philipp Stanner a écrit : > On Thu, 2024-11-14 at 11:01 +0100, Pierre-Eric Pelloux-Prayer wrote: >> Until the switch from kthread to workqueue, > > Could you include the commit ID here where that happened? > > "Since switching the scheduler from using kthreads to workqueues in > commit 1234 ("foo: bar") userspace applications cannot determine the > [...] anymore" Sure. > > >> a userspace application could >> determine the source device > > source device of *what*? Should be mentioned. source device _of the event_. > >> from the pid of the thread sending the event. > > nit: s/pid/PID ? I'll update the commit message in the next version. Thanks, Pierre-Eric > >> >> With workqueues this is not possible anymore, so the event needs to >> contain >> the dev_name() to identify the device. >> >> Signed-off-by: Pierre-Eric Pelloux-Prayer >> <pierre-eric.pelloux-prayer@amd.com> >> --- >> drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h >> b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h >> index c75302ca3427..c4ec28540656 100644 >> --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h >> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h >> @@ -42,6 +42,7 @@ DECLARE_EVENT_CLASS(drm_sched_job, >> __field(uint64_t, id) >> __field(u32, job_count) >> __field(int, hw_job_count) >> + __string(dev, dev_name(sched_job- >>> sched->dev)) >> ), >> >> TP_fast_assign( >> @@ -52,9 +53,10 @@ DECLARE_EVENT_CLASS(drm_sched_job, >> __entry->job_count = >> spsc_queue_count(&entity->job_queue); >> __entry->hw_job_count = atomic_read( >> &sched_job->sched->credit_count); >> + __assign_str(dev); >> ), >> - TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job >> count:%u, hw job count:%d", >> - __entry->entity, __entry->id, >> + TP_printk("dev=%s, entity=%p, id=%llu, fence=%p, >> ring=%s, job count:%u, hw job count:%d", >> + __get_str(dev), __entry->entity, __entry->id, >> __entry->fence, __get_str(name), >> __entry->job_count, __entry->hw_job_count) >> );
diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h index c75302ca3427..c4ec28540656 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -42,6 +42,7 @@ DECLARE_EVENT_CLASS(drm_sched_job, __field(uint64_t, id) __field(u32, job_count) __field(int, hw_job_count) + __string(dev, dev_name(sched_job->sched->dev)) ), TP_fast_assign( @@ -52,9 +53,10 @@ DECLARE_EVENT_CLASS(drm_sched_job, __entry->job_count = spsc_queue_count(&entity->job_queue); __entry->hw_job_count = atomic_read( &sched_job->sched->credit_count); + __assign_str(dev); ), - TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", - __entry->entity, __entry->id, + TP_printk("dev=%s, entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", + __get_str(dev), __entry->entity, __entry->id, __entry->fence, __get_str(name), __entry->job_count, __entry->hw_job_count) );
Until the switch from kthread to workqueue, a userspace application could determine the source device from the pid of the thread sending the event. With workqueues this is not possible anymore, so the event needs to contain the dev_name() to identify the device. Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> --- drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)