Re: linux-next: build warnings after merge of the tip tree

From: Peter Zijlstra
Date: Mon Mar 21 2022 - 12:41:17 EST


On Mon, Mar 21, 2022 at 12:15:49PM -0400, Steven Rostedt wrote:
> On Mon, 21 Mar 2022 12:12:09 -0400
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > > > funcB:
> > > > call __fentry__
> > > push funcB on trace-stack
> > > >
> > > > [..]
> > > call __fexit__
> > > pop trace-stack until empty
> > > 'exit funcB'
> > > 'exit funcA'
> >
> > And what happens if funcC called funcA and it too was on the stack. We pop
> > that too? But it's not done yet, because calling of funcA was not a tail
> > call.

Hmm, yeah, how about we have __ftail__ mark the left function.

func_B()
{
...
}

func_A()
{
...
return func_B();
}

func_C()
{
func_A();
...
return;
}

func_B:
call __fentry__ /* push func_B */
...
call __fexit__ /* pop 1 + tails */
ret

func_A:
call __fentry__ /* push func_A */
...
call __ftail__ /* mark func_A tail */
jmp func_B

func_C:
call __fentry__ /* push func_C */
call func_A;
...
call __fexit__ /* pop 1 + tails */
ret;


Then the stack at the end of func_B looks something like:

func_C
func_A (tail)
func_B

And it will pop func_B plus all tails (func_A).

> And I just thought of another issue, where even my solution wont fix it.
> What happens if we trace funcA but not funcB? How do we get to trace the
> end of funcA?

Disallow tail calls to notrace?