From: Song Shuai <suagrfillet@gmail.com>
To: peterz@infradead.org, jpoimboe@kernel.org, tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, Song Shuai <suagrfillet@gmail.com>
Subject: [PATCH] samples: ftrace: Pick a more reasonable function to trace
Date: Tue, 17 Jan 2023 17:11:01 +0800 [thread overview]
Message-ID: <20230117091101.3669996-1-suagrfillet@gmail.com> (raw)
In ftrace-direct-multi*.c, the direct_caller - my_tramp works as
the mcount for functions with one parameter declared.
But schedule() actually has no parameter declared, so when it was
traced, the tracing function - my_direct_func will print a senseless
address.
Here replaces schedule() with kick_process() to make these samples
more reasonable and deletes the unnecessary including of mm.h.
Signed-off-by: Song Shuai <suagrfillet@gmail.com>
---
samples/ftrace/ftrace-direct-multi-modify.c | 2 +-
samples/ftrace/ftrace-direct-multi.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/samples/ftrace/ftrace-direct-multi-modify.c b/samples/ftrace/ftrace-direct-multi-modify.c
index 63f92451f38b..ea8b6fef3032 100644
--- a/samples/ftrace/ftrace-direct-multi-modify.c
+++ b/samples/ftrace/ftrace-direct-multi-modify.c
@@ -176,7 +176,7 @@ static int __init ftrace_direct_multi_init(void)
int ret;
ftrace_set_filter_ip(&direct, (unsigned long) wake_up_process, 0, 0);
- ftrace_set_filter_ip(&direct, (unsigned long) schedule, 0, 0);
+ ftrace_set_filter_ip(&direct, (unsigned long) kick_process, 0, 0);
ret = register_ftrace_direct_multi(&direct, my_tramp);
diff --git a/samples/ftrace/ftrace-direct-multi.c b/samples/ftrace/ftrace-direct-multi.c
index 08442d631b48..2b850c3593d5 100644
--- a/samples/ftrace/ftrace-direct-multi.c
+++ b/samples/ftrace/ftrace-direct-multi.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/module.h>
-#include <linux/mm.h> /* for handle_mm_fault() */
#include <linux/ftrace.h>
#include <linux/sched/stat.h>
#include <asm/asm-offsets.h>
@@ -93,7 +92,7 @@ static struct ftrace_ops direct;
static int __init ftrace_direct_multi_init(void)
{
ftrace_set_filter_ip(&direct, (unsigned long) wake_up_process, 0, 0);
- ftrace_set_filter_ip(&direct, (unsigned long) schedule, 0, 0);
+ ftrace_set_filter_ip(&direct, (unsigned long) kick_process, 0, 0);
return register_ftrace_direct_multi(&direct, (unsigned long) my_tramp);
}
--
2.20.1
reply other threads:[~2023-01-17 9:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230117091101.3669996-1-suagrfillet@gmail.com \
--to=suagrfillet@gmail.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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