[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJs_Fx69jUs5jJdX6ZpP4Z4K_iFdkUAAiium6xAuBiM00Gd4SA@mail.gmail.com>
Date: Mon, 12 Oct 2020 08:14:50 -0700
From: Rob Clark <robdclark@...omium.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Rob Clark <robdclark@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Phil Auld <pauld@...hat.com>,
Valentin Schneider <valentin.schneider@....com>,
Thara Gopinath <thara.gopinath@...aro.org>,
Randy Dunlap <rdunlap@...radead.org>,
Vincent Donnefort <vincent.donnefort@....com>,
Mel Gorman <mgorman@...hsingularity.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Jens Axboe <axboe@...nel.dk>,
Marcelo Tosatti <mtosatti@...hat.com>,
Frederic Weisbecker <frederic@...nel.org>,
Ilias Stamatis <stamatis.iliass@...il.com>,
Liang Chen <cl@...k-chips.com>,
Ben Dooks <ben.dooks@...ethink.co.uk>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
"J. Bruce Fields" <bfields@...hat.com>
Subject: Re: [PATCH] kthread: Add kthread_work tracepoints
On Mon, Oct 12, 2020 at 6:59 AM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Sat, 10 Oct 2020 11:03:22 -0700
> Rob Clark <robdclark@...il.com> wrote:
>
> > /**
> > + * sched_kthread_work_execute_start - called immediately before the work callback
> > + * @work: pointer to struct kthread_work
> > + *
> > + * Allows to track kthread work execution.
> > + */
> > +TRACE_EVENT(sched_kthread_work_execute_start,
> > +
> > + TP_PROTO(struct kthread_work *work),
> > +
> > + TP_ARGS(work),
> > +
> > + TP_STRUCT__entry(
> > + __field( void *, work )
> > + __field( void *, function)
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->work = work;
> > + __entry->function = work->func;
> > + ),
> > +
> > + TP_printk("work struct %p: function %ps", __entry->work, __entry->function)
> > +);
> > +
> > +/**
> > + * sched_kthread_work_execute_end - called immediately after the work callback
> > + * @work: pointer to struct work_struct
> > + * @function: pointer to worker function
> > + *
> > + * Allows to track workqueue execution.
> > + */
> > +TRACE_EVENT(sched_kthread_work_execute_end,
> > +
> > + TP_PROTO(struct kthread_work *work, kthread_work_func_t function),
> > +
> > + TP_ARGS(work, function),
> > +
> > + TP_STRUCT__entry(
> > + __field( void *, work )
> > + __field( void *, function)
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->work = work;
> > + __entry->function = function;
> > + ),
> > +
> > + TP_printk("work struct %p: function %ps", __entry->work, __entry->function)
> > +);
> > +
>
>
> Please combine the above into:
>
> DECLARE_EVENT_CLASS(sched_kthread_work_execute_template,
>
> TP_PROTO(struct kthread_work *work),
>
> TP_ARGS(work),
>
> TP_STRUCT__entry(
> __field( void *, work )
> __field( void *, function)
> ),
>
> TP_fast_assign(
> __entry->work = work;
> __entry->function = work->func;
> ),
>
> TP_printk("work struct %p: function %ps", __entry->work, __entry->function)
> );
>
> DEFINE_EVENT(sched_kthread_work_execute_template, sched_kthread_work_execute_start,
> TP_PROTO(struct kthread_work *work),
> TP_ARGS(work));
>
> DEFINE_EVENT(sched_kthread_work_execute_template, sched_kthread_work_execute_end,
> TP_PROTO(struct kthread_work *work),
> TP_ARGS(work));
>
> As events are cheap, classes are expensive (size wise), and a TRACE_EVENT()
> is really just a CLASS and EVENT for a single instance.
I think we cannot quite do this, because we should not rely on being
able to dereference work after it finishes. Although I suppose I
could just define it to explicitly pass the fxn ptr to both
tracepoints..
BR,
-R
Powered by blists - more mailing lists