[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220526140225.357a577e@gandalf.local.home>
Date: Thu, 26 May 2022 14:02:25 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Jiri Olsa <jolsa@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Peter Zijlstra <peterz@...radead.org>, x86@...nel.org
Subject: Re: [PATCH v3] ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding
weak functions
On Thu, 26 May 2022 10:05:30 -0700
Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Thu, 26 May 2022 10:38:10 -0400 Steven Rostedt <rostedt@...dmis.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
Powered by blists - more mailing lists