Re: ftrace: Proposal for an Alternative RecordMcount framework

From: Steven Rostedt
Date: Tue Mar 06 2018 - 21:00:47 EST


On Wed, 7 Mar 2018 09:47:47 +0800
Alan Kao <alankao@xxxxxxxxxxxxx> wrote:


> > Please allow me to state the problem more clearly here. I hope this helps.
> >
> > 1. locations of mcount are recorded in a per-file basis.
> > 2. to optimize the binary, the linker turns on some aggressive
> > options, including relaxation.
> > 3. the optimizations changes the original offset.
> > 4. already recorded mcount call-sites no longer point to their
> > real positions.
> > 5. still a linked vmlinux is made.
> > 6. dynamic ftrace breaks the real logic in the kernel space,
> > panics happen.
> >
> > Thanks,
> > Alan
>
> Any comments on this?

Sorry, I've been traveling and falling behind in this. I did read this
when I was offline but forgot to reply when I was back online.

>
> BTW, the introduced framework has no effects on any other architectures that
> works fine. This feature should be configurable and turned on only when the
> arch has aggressive link-time optimizations.
>
> If you consider this appropriate, I will send the patch to this once it gets
> ready. Currently this is targeting at RISC-V and upcoming NDS32.

I see the issue you explained above and it makes sense. Perhaps make it
an option that can be enabled by anyone, and archs that require
aggressive link time optimizations would just select it.

-- Steve