From: Steven Rostedt <rostedt@goodmis.org>
To: Junwen Wu <wudaemon@163.com>
Cc: mingo@redhat.com, tglx@linutronix.de, frederic@kernel.org,
tannerlove@google.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] softirq: Add tracepoint for tasklet_entry/exit
Date: Tue, 24 May 2022 21:07:09 -0400 [thread overview]
Message-ID: <20220524210709.3f0ddc3a@gandalf.local.home> (raw)
In-Reply-To: <20220508160624.48643-1-wudaemon@163.com>
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;
WARNING: multiple messages have this Message-ID
From: Junwen Wu <wudaemon@163.com>
To: rostedt@goodmis.org, Junwen Wu <wudaemon@163.com>
Cc: frederic@kernel.org, linux-kernel@vger.kernel.org,
mingo@redhat.com, tannerlove@google.com, tglx@linutronix.de
Subject: Re: [PATCH v1] softirq: Add tracepoint for tasklet_entry/exit
Date: Sat, 28 May 2022 13:54:11 +0000 [thread overview]
Message-ID: <20220524210709.3f0ddc3a@gandalf.local.home> (raw) (raw)
Message-ID: <20220528135411.rhT9_o4OOHXPsJCPXi52u-ihO8_dPxmk8NqT5a-O0OU@z> (raw)
In-Reply-To: <20220508160624.48643-1-wudaemon@163.com>
From: Steven Rostedt <rostedt@goodmis.org>
>> +
>> + 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.
I have use DECLARE_EVENT_CLASS() define use tracepoint,Steve.
Thomas, can you give me acked-by,here is patch v2.
From 68d2298372018ec90c8587d5421a0e1a3c9f879f Mon Sep 17 00:00:00 2001
From: Junwen Wu <wudaemon@163.com>
Date: Sun, 8 May 2022 15:29:56 +0000
Subject: [PATCH v2] softirq: Add tracepoint for tasklet_entry/exit
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>
---
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
next prev parent reply other threads:[~2022-05-25 1:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-08 16:06 Junwen Wu
2022-05-25 1:07 ` Steven Rostedt [this message]
2022-05-28 13:58 ` Steven Rostedt
2022-05-28 13:54 ` Junwen Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220524210709.3f0ddc3a@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tannerlove@google.com \
--cc=tglx@linutronix.de \
--cc=wudaemon@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®