From 07ecea7cb88a6c8a640086eba7bfdc33c23f5abe Mon Sep 17 00:00:00 2001 From: Lingutla Chandrasekhar Date: Fri, 1 Mar 2019 17:17:09 +0530 Subject: [PATCH] Revert "Revert "ANDROID: trace: Add trace points for tasklet entry/exit"" This reverts commit 2cadcbac1a4167978a1caa98d990025f1a46eba6, as the merge conflicts have been resolved. Bug: 168521633 Change-Id: Ib17f36be69a9112cc5ea2a5a2d940b82b480c8f0 Signed-off-by: Lingutla Chandrasekhar [elavila: Port to mainline] Signed-off-by: J. Avila Signed-off-by: Shaleen Agrawal --- include/trace/events/irq.h | 45 ++++++++++++++++++++++++++++++++++++++ kernel/softirq.c | 9 ++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h index eeceafaaea4c..bb70f46656b2 100644 --- a/include/trace/events/irq.h +++ b/include/trace/events/irq.h @@ -160,6 +160,51 @@ DEFINE_EVENT(softirq, softirq_raise, TP_ARGS(vec_nr) ); +DECLARE_EVENT_CLASS(tasklet, + + 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) +); + +DEFINE_EVENT(tasklet, tasklet_entry, + + TP_PROTO(void *func), + + TP_ARGS(func) +); + +DEFINE_EVENT(tasklet, tasklet_exit, + + TP_PROTO(void *func), + + TP_ARGS(func) +); + +DEFINE_EVENT(tasklet, tasklet_hi_entry, + + TP_PROTO(void *func), + + TP_ARGS(func) +); + +DEFINE_EVENT(tasklet, tasklet_hi_exit, + + TP_PROTO(void *func), + + TP_ARGS(func) +); + #endif /* _TRACE_IRQ_H */ /* This part must be outside protection */ diff --git a/kernel/softirq.c b/kernel/softirq.c index 0ea9f90ed011..96301bf59c50 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -789,10 +789,15 @@ static void tasklet_action_common(struct softirq_action *a, if (tasklet_trylock(t)) { if (!atomic_read(&t->count)) { if (tasklet_clear_sched(t)) { - if (t->use_callback) + if (t->use_callback) { + trace_tasklet_entry(t->callback); t->callback(t); - else + trace_tasklet_exit(t->callback); + } else { + trace_tasklet_entry(t->func); t->func(t->data); + trace_tasklet_exit(t->func); + } } tasklet_unlock(t); continue;