* [PATCH v2] softirq: Add tracepoint for tasklet_entry/exit
@ 2022-05-28 14:42 Junwen Wu
2022-05-30 20:26 ` Davidlohr Bueso
0 siblings, 1 reply; 2+ messages in thread
From: Junwen Wu @ 2022-05-28 14:42 UTC (permalink / raw)
To: rostedt, mingo, dave, will, peterz, tglx; +Cc: linux-kernel, Junwen Wu
Usually softirq handler is pre-defined,only tasklet can be register by
driver.We expand tracepoint for tasklet_entry/exit to trace
tasklet handler.
Signed-off-by: Junwen Wu <wudaemon@163.com>
---
Changes since v1: https://lore.kernel.org/all/20220508160624.48643-1-wudaemon@163.com/
- Used DECLARE_EVENT_CLASS (Steven Rostedt)
include/trace/events/irq.h | 41 ++++++++++++++++++++++++++++++++++++++
kernel/softirq.c | 4 ++++
2 files changed, 45 insertions(+)
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index eeceafaaea4c..62b7e53121da 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -160,6 +160,47 @@ 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)
+);
+
+/**
+ * tasklet_entry - called immediately when a tasklet exec
+ * @func: the callback function when a tasklet exec
+ *
+ * When used in combination with the tasklet_entry tracepoint
+ * we can determine the callback function when a tasklet exec.
+ */
+DEFINE_EVENT(tasklet, tasklet_entry,
+
+ TP_PROTO(void *func),
+
+ TP_ARGS(func)
+);
+
+/**
+ * tasklet_exit - called immediately after the tasklet handler returns
+ * @func: the callback function when a tasklet exec
+ */
+DEFINE_EVENT(tasklet, tasklet_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 41f470929e99..79b3814ad166 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;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] softirq: Add tracepoint for tasklet_entry/exit
2022-05-28 14:42 [PATCH v2] softirq: Add tracepoint for tasklet_entry/exit Junwen Wu
@ 2022-05-30 20:26 ` Davidlohr Bueso
0 siblings, 0 replies; 2+ messages in thread
From: Davidlohr Bueso @ 2022-05-30 20:26 UTC (permalink / raw)
To: Junwen Wu; +Cc: rostedt, mingo, will, peterz, tglx, linux-kernel
On Sat, 28 May 2022, Junwen Wu wrote:
>Usually softirq handler is pre-defined,only tasklet can be register by
>driver.We expand tracepoint for tasklet_entry/exit to trace
>tasklet handler.
Tasklets are artifacts of the past, and deprecated years ago. Lets not
add to moot interfaces. Everything should be converted to run in task
context.
Thanks,
Davidlohr
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-30 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-28 14:42 [PATCH v2] softirq: Add tracepoint for tasklet_entry/exit Junwen Wu
2022-05-30 20:26 ` Davidlohr Bueso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).