From: Steven Rostedt <rostedt@goodmis.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Peter Zijlstra <peterz@infradead.org>,
x86@kernel.org
Subject: Re: [PATCH v3] ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding weak functions
Date: Thu, 26 May 2022 14:02:25 -0400 [thread overview]
Message-ID: <20220526140225.357a577e@gandalf.local.home> (raw)
In-Reply-To: <20220526100530.6ef0a17084f6abab77d8b2ba@linux-foundation.org>
On Thu, 26 May 2022 10:05:30 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Thu, 26 May 2022 10:38:10 -0400 Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > If an unused weak function was traced, it's call to fentry will still
> > exist, which gets added into the __mcount_loc table. Ftrace will use
> > kallsyms to retrieve the name for each location in __mcount_loc to display
> > it in the available_filter_functions and used to enable functions via the
> > name matching in set_ftrace_filter/notrace. Enabling these functions do
> > nothing but enable an unused call to ftrace_caller. If a traced weak
> > function is overridden, the symbol of the function would be used for it,
> > which will either created duplicate names, or if the previous function was
> > not traced, it would be incorrectly listed in available_filter_functions
> > as a function that can be traced.
>
> This might be dependent on binutils version. In some situations the
> unused __weak function might be dropped altogether. This change
> (https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1)
> tripped up recordmcount
> (https://lore.kernel.org/all/20220518181828.645877-1-naveen.n.rao@linux.vnet.ibm.com/T/#u).
>
> The kexec fix will be to just give up on using __weak.
Yes that's as separate issue with weak functions. Which reminds me, I told
Jon Corbet I would write up an article about the problems of weak functions
and ftrace ;-)
-- Steve
prev parent reply other threads:[~2022-05-26 18:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 14:38 [PATCH v3] ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding weak functions Steven Rostedt
2022-05-26 14:44 ` Steven Rostedt
2022-05-26 17:05 ` Andrew Morton
2022-05-26 18:02 ` Steven Rostedt [this message]
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=20220526140225.357a577e@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=x86@kernel.org \
--cc=yhs@fb.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