linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Namhyung Kim <namhyung@kernel.org>,
	"Frank Ch. Eigler" <fche@redhat.com>
Subject: Re: [PATCH 01/16 v3] function_graph: Convert ret_stack to a series of longs
Date: Tue, 28 May 2019 13:46:35 -0400	[thread overview]
Message-ID: <20190528174635.GB252809@google.com> (raw)
In-Reply-To: <20190528085826.796157de@gandalf.local.home>

On Tue, May 28, 2019 at 08:58:26AM -0400, Steven Rostedt wrote:
> On Tue, 28 May 2019 05:50:43 -0400
> Joel Fernandes <joel@joelfernandes.org> wrote:
> 
> > On Fri, May 24, 2019 at 11:16:34PM -0400, Steven Rostedt wrote:
> > > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> > > 
> > > In order to make it possible to have multiple callbacks registered with the
> > > function_graph tracer, the retstack needs to be converted from an array of
> > > ftrace_ret_stack structures to an array of longs. This will allow to store
> > > the list of callbacks on the stack for the return side of the functions.
> > > 
> > > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > > ---
> > >  include/linux/sched.h |   2 +-
> > >  kernel/trace/fgraph.c | 124 ++++++++++++++++++++++++------------------
> > >  2 files changed, 71 insertions(+), 55 deletions(-)
> > > 
> > > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > > index 11837410690f..1850d8a3c3f0 100644
> > > --- a/include/linux/sched.h
> > > +++ b/include/linux/sched.h
> > > @@ -1113,7 +1113,7 @@ struct task_struct {
> > >  	int				curr_ret_depth;
> > >  
> > >  	/* Stack of return addresses for return function tracing: */
> > > -	struct ftrace_ret_stack		*ret_stack;
> > > +	unsigned long			*ret_stack;  
> > 
> > Can it be converted to an array of unsigned int so the shadown stack space
> > can be better used? This way stack overflow chance is lesser if there are too
> > many registered fgraph users and the function call depth is too deep.
> > AFAICS from patch 5/13, you need only 32-bits for the ftrace_ret_stack
> > offset, type and array index, so the upper 32-bit would not be used.
> > 
> 
> We can look to improve that later on. This is complex enough and I kept
> some features (like 4 byte minimum) out of this series to keep the
> complexity down. I believe there are some archs that require 64bit
> aligned access for 64 bit words and pointers. And the retstack
> structure still has longs on it. If we need to adapt to making sure we
> are aligned, I rather keep that complexity out for now.
> 
> That said, I just did a git grep HAVE_64BIT_ALIGNED_ACCESS and only
> found the kconfig where it is defined and the ring buffer code that
> deals with it. We recently removed a bunch of archs, and it could very
> well be that this requirement no longer exists.
> 
> Regardless, I've been testing this code quite heavily, and changing the
> stack from moving up to moving down already put me behind. I'd like to
> pull this code into linux-next soon. Converting to ints can be done for
> the release after we get this in.

Ok sure, I agree the conversion to ints can be done at a later time. thanks!

 - Joel


  reply	other threads:[~2019-05-28 17:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-25  3:16 [PATCH 00/16 v3] function_graph: Rewrite to allow multiple users Steven Rostedt
2019-05-25  3:16 ` [PATCH 01/16 v3] function_graph: Convert ret_stack to a series of longs Steven Rostedt
2019-05-28  9:50   ` Joel Fernandes
2019-05-28 12:58     ` Steven Rostedt
2019-05-28 17:46       ` Joel Fernandes [this message]
2019-05-25  3:16 ` [PATCH 02/16 v3] fgraph: Use BUILD_BUG_ON() to make sure we have structures divisible by long Steven Rostedt
2019-05-25  3:16 ` [PATCH 03/16 v3] fgraph: Have the current->ret_stack go down not up Steven Rostedt
2019-05-25  3:16 ` [PATCH 04/16 v3] function_graph: Add an array structure that will allow multiple callbacks Steven Rostedt
2019-05-25  3:16 ` [PATCH 05/16 v3] function_graph: Allow multiple users to attach to function graph Steven Rostedt
2019-05-25  3:16 ` [PATCH 06/16 v3] function_graph: Remove logic around ftrace_graph_entry and return Steven Rostedt
2019-05-25  3:16 ` [PATCH 07/16 v3] ftrace/function_graph: Pass fgraph_ops to function graph callbacks Steven Rostedt
2019-05-25  3:16 ` [PATCH 08/16 v3] ftrace: Allow function_graph tracer to be enabled in instances Steven Rostedt
2019-05-25  3:16 ` [PATCH 09/16 v3] ftrace: Allow ftrace startup flags exist without dynamic ftrace Steven Rostedt
2019-05-25  3:16 ` [PATCH 10/16 v3] function_graph: Have the instances use their own ftrace_ops for filtering Steven Rostedt
2019-05-25  3:16 ` [PATCH 11/16 v3] function_graph: Add "task variables" per task for fgraph_ops Steven Rostedt
2019-05-25  3:16 ` [PATCH 12/16 v3] function_graph: Move set_graph_function tests to shadow stack global var Steven Rostedt
2019-05-25  3:16 ` [PATCH 13/16 v3] function_graph: Move graph depth stored data " Steven Rostedt
2019-05-25  3:16 ` [PATCH 14/16 v3] function_graph: Move graph notrace bit " Steven Rostedt
2019-05-25  3:16 ` [PATCH 15/16 v3] function_graph: Implement fgraph_reserve_data() and fgraph_retrieve_data() Steven Rostedt
2019-05-25  3:16 ` [PATCH 16/16 v3] function_graph: Add selftest for passing local variables Steven Rostedt

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=20190528174635.GB252809@google.com \
    --to=joel@joelfernandes.org \
    --cc=akpm@linux-foundation.org \
    --cc=fche@redhat.com \
    --cc=frederic@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --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).