Messages in this thread Patch in this message | | | Date | Tue, 24 May 2022 21:07:09 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH v1] softirq: Add tracepoint for tasklet_entry/exit |
| |
On Sun, 8 May 2022 16:06:24 +0000 Junwen Wu <wudaemon@163.com> wrote:
> --- a/include/trace/events/irq.h > +++ b/include/trace/events/irq.h > @@ -160,6 +160,38 @@ DEFINE_EVENT(softirq, softirq_raise, > TP_ARGS(vec_nr) > ); > > +TRACE_EVENT(tasklet_entry, > + > + TP_PROTO(void *func), > + > + TP_ARGS(func), > + > + TP_STRUCT__entry( > + __field( void *, func ) > + ), > + > + TP_fast_assign( > + __entry->func = func; > + ), > + > + TP_printk("function=%ps", __entry->func) > +); > +TRACE_EVENT(tasklet_exit, > + > + TP_PROTO(void *func), > + > + TP_ARGS(func), > + > + TP_STRUCT__entry( > + __field( void *, func ) > + ), > + > + TP_fast_assign( > + __entry->func = func; > + ), > + > + TP_printk("function=%ps", __entry->func)
This needs an acked-by from Thomas, but regardless, the above two trace events are identical. You need to have a DECLARE_EVENT_CLASS() followed by two DEFINE_EVENT()s, otherwise you are wasting memory.
-- Steve
> +); > #endif /* _TRACE_IRQ_H */ > > /* This part must be outside protection */ > diff --git a/kernel/softirq.c b/kernel/softirq.c > index 41f470929e99..b3bce2b3b655 100644 > --- a/kernel/softirq.c > +++ b/kernel/softirq.c > @@ -780,10 +780,14 @@ static void tasklet_action_common(struct softirq_action *a, > if (tasklet_trylock(t)) { > if (!atomic_read(&t->count)) { > if (tasklet_clear_sched(t)) { > + trace_tasklet_entry(t->use_callback ? (void *)t->callback > + : (void *)t->func); > if (t->use_callback) > t->callback(t); > else > t->func(t->data); > + trace_tasklet_exit(t->use_callback ? (void *)t->callback > + : (void *)t->func); > } > tasklet_unlock(t); > continue;
| |