linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	mhiramat@kernel.org, ast@kernel.org, hjl.tools@gmail.com,
	rick.p.edgecombe@intel.com, rppt@kernel.org,
	linux-toolchains@vger.kernel.org, Andrew.Cooper3@citrix.com,
	ndesaulniers@google.com
Subject: Re: linux-next: build warnings after merge of the tip tree
Date: Tue, 22 Mar 2022 15:35:54 +0100	[thread overview]
Message-ID: <Yjneyn8o06svJkY4@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20220322091242.1ad0206b@gandalf.local.home>

On Tue, Mar 22, 2022 at 09:12:42AM -0400, Steven Rostedt wrote:

> > Suppose:
> > 
> > notrace func_B()
> > {
> > 	...
> > }
> > 
> > func_A()
> > {
> > 	...
> > 	return func_B();
> > }
> > 
> > then inhibiting tail calls would end up looking like:
> 
> If we inhibit tail calls, then we do not need to make func_B notrace.

Dude, you're arguing in circles :-( the notrace was a given.

> > func_A:
> > 	call __fentry__
> > 	...
> > 	call func_B
> > 	call __fexit__
> > 	ret
> > 
> > Then A is fully traced, B is invisible, as per spec. What is the
> > problem?
> 
> The above is fine, but then func_B is not a tail call and can also be
> traced.

Again, B is notrace as a given. This was all about how to deal with
notrace functions.

I suggested inhibiting tail-call to notrace, you said no. You now seem to
agree that solves it.

> > The problem you initially had, of doing a tail-call into a notrace, was
> > that the __fexit__ call went missing, because notrace will obviously not
> > have that. But that's avoided by inhibiting all tail-calls between
> > notrace and !notrace functions (note that notrace must also not
> > tail-call !notrace).
> 
> I'm confused by the above. Why can't a notrace tail call a !notrace?
> If we tail call to a
> 
> func_B:
> 	call __fentry__
> 	...
> 	call __fexit__
> 	ret
> 
> then the fentry and fexit show a perfectly valid trace of func_B.

Bah; I thought I had a case this morning, but now I can't seem to recall
:/

> > Your worry seems to stem about loosing visiblilty of !notrace functions,
> > but AFAICT that doesn't happen.
> 
> My worry is:
> 
> func_A:
> 	call __fentry__
> 	...
> 	jmp func_B
> 
> Where do we do the call __fexit__ ?

In B (or wherever if B again does a tail-call).

> That was the original concern, and I think the proposed solutions have
> convoluted our thoughts about what we are trying to fix. So let's go back
> to the beginning, and see how to deal with it.
> 
> That is, we have:
> 
> func_C:
> 	call __fenty__
> 	...
> 	call func_A:
> 	...
> 	call func_B:
> 	...
> 	call __fexit__
> 	ret
> 
> func_A:
> 	call __fentry__
> 	...
	call __ftail__
> 	jmp func_B
> 
> func_B:
> 	call __fentry__
> 	...
> 	call __fexit__
> 	ret
> 
> Where the above is C calling A and B as normal functions, A calling B as a
> tail call and B just being a normal function called by both A and C (and
> many other functions).

We need the __ftail__ thing to mark the trace-stack entry of func_A as
complete, then any future __fexit__ will be able to pop all completed
entries.

In recap:

	__fentry__ -- push on trace-stack
	__ftail__  -- mark top-most entry complete
	__fexit__  -- mark top-most entry complete;
	              pop all completed entries

inhibit tail-calls to notrace.

> And note, I do not want to limit function tracing (which does not rely on
> __fexit__) just because we can't figure out how to handle __fexit__.

I'm not following. Regular function tracing needs none of this.

It's function graph tracing, kretprobes and whatever else this rethook
stuff is about that needs this because return trampolines will stop
working somewhere in the not too distant future.


  reply	other threads:[~2022-03-22 14:36 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21  3:03 linux-next: build warnings after merge of the tip tree Stephen Rothwell
2022-03-21 12:55 ` Peter Zijlstra
2022-03-21 13:04   ` Peter Zijlstra
2022-03-21 13:08     ` Peter Zijlstra
2022-03-21 13:45       ` Peter Zijlstra
2022-03-21 14:19         ` Mark Rutland
2022-03-21 15:28         ` Peter Zijlstra
2022-03-21 15:45           ` Peter Zijlstra
2022-03-21 16:37             ` Linus Torvalds
2022-03-21 16:44               ` Peter Zijlstra
2022-03-21 16:52                 ` Linus Torvalds
2022-03-21 22:05                   ` Stephen Rothwell
2022-03-21 22:12                     ` Alexei Starovoitov
2022-03-21 22:46                       ` Stephen Rothwell
2022-03-21 22:50                         ` Alexei Starovoitov
2022-03-21 22:55                           ` Steven Rostedt
2022-03-22  4:51                           ` Masami Hiramatsu
2022-03-22  4:53                             ` Alexei Starovoitov
2022-03-22  7:42                       ` Peter Zijlstra
2022-03-22  4:38         ` Masami Hiramatsu
2022-03-21 15:28     ` Steven Rostedt
2022-03-21 16:04       ` Peter Zijlstra
2022-03-21 16:12         ` Steven Rostedt
2022-03-21 16:15           ` Steven Rostedt
2022-03-21 16:22             ` Steven Rostedt
2022-03-21 16:39               ` Steven Rostedt
2022-03-21 16:40             ` Peter Zijlstra
2022-03-21 16:45               ` Steven Rostedt
2022-03-21 16:50                 ` Peter Zijlstra
2022-03-21 16:54                   ` Steven Rostedt
2022-03-22  7:54                     ` Peter Zijlstra
2022-03-22 13:12                       ` Steven Rostedt
2022-03-22 14:35                         ` Peter Zijlstra [this message]
2022-03-22 15:04                           ` Steven Rostedt
2022-03-22 15:19                             ` Peter Zijlstra
2022-03-22 15:48                             ` Peter Zijlstra
2022-03-22 16:17                               ` Steven Rostedt
2022-03-23  2:23                           ` Masami Hiramatsu
2022-03-23  2:42                             ` Steven Rostedt
2022-03-23  6:28                               ` Masami Hiramatsu
2022-03-22 14:25           ` Masami Hiramatsu
2022-03-21 16:48     ` Peter Zijlstra
2022-03-22  5:31       ` Masami Hiramatsu
2022-03-22  8:08         ` Peter Zijlstra
2022-03-22  9:14           ` Masami Hiramatsu
2022-03-22 12:07             ` Peter Zijlstra
2022-03-22 12:17         ` Peter Zijlstra
2022-03-22 12:46           ` Masami Hiramatsu
2022-03-22 13:22             ` Steven Rostedt
2022-03-22 13:15         ` Mark Rutland
2022-03-22 13:51           ` Masami Hiramatsu
2022-03-22 10:46   ` Peter Zijlstra
2022-03-22 10:59     ` Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2024-02-02  3:59 Stephen Rothwell
2023-12-01  0:29 Stephen Rothwell
2023-12-01 12:09 ` Uros Bizjak
2023-12-04  4:08   ` Stephen Rothwell
2023-12-04  7:02     ` Uros Bizjak
2023-12-11  5:19       ` Stephen Rothwell
2023-12-11  7:06         ` Uros Bizjak
2023-06-02  3:12 Stephen Rothwell
2022-11-21  7:41 Stephen Rothwell
2022-05-20  7:49 Stephen Rothwell
2022-04-27  0:10 Stephen Rothwell
2022-04-27 11:31 ` Borislav Petkov
2022-04-27 13:43   ` Tom Lendacky
2022-03-22  3:51 Stephen Rothwell
2022-03-22 21:52 ` Peter Zijlstra
2022-03-22 23:11   ` Stephen Rothwell
2021-12-17  3:40 Stephen Rothwell
2022-01-21 23:58 ` Stephen Rothwell
2022-03-15  2:32   ` Stephen Rothwell
2022-04-04  3:26     ` Stephen Rothwell
2021-10-12 10:20 Stephen Rothwell
2021-10-12 13:58 ` André Almeida
2020-11-30  7:05 Stephen Rothwell
2020-11-30 10:17 ` Borislav Petkov
2020-11-30 21:56   ` Ernst, Justin
2020-11-30 22:18     ` Borislav Petkov
2020-11-23  7:19 Stephen Rothwell
2020-11-23 23:03 ` Jarkko Sakkinen
2017-11-02  2:53 Stephen Rothwell
2017-11-03 21:00 ` Masami Hiramatsu
2017-11-04  8:01   ` Ingo Molnar
2017-11-04 12:16     ` Masami Hiramatsu
2017-11-13 11:31 ` Stephen Rothwell
2017-06-23  4:19 Stephen Rothwell
2016-07-14  3:49 Stephen Rothwell
2016-07-14  3:37 Stephen Rothwell
2016-07-14  4:18 ` Stephen Rothwell
2012-10-12  5:11 Stephen Rothwell
2011-01-31  4:27 Stephen Rothwell
2011-01-31  5:08 ` Jaswinder Singh

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=Yjneyn8o06svJkY4@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=ast@kernel.org \
    --cc=hjl.tools@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=ndesaulniers@google.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --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;
as well as URLs for NNTP newsgroup(s).